:root {
  --bg: #eef6fb;
  --panel: #ffffffeb;
  --text: #173042;
  --muted: #5d7587;
  --brand: #1d6585;
  --temp: #f08a3e;
  --humi: #1da7bf;
  --pm: #4067db;
  --mq4: #16965d;
  --warn: #d4543f;
  --ok: #238a57;
  --line: #e8f0f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #d9eef822, transparent 28%),
    linear-gradient(180deg, #edf7fb, #f8fbfd);
}

button,
input {
  font: inherit;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 20%, #fff4ce 0, #fff4ce33 18%, transparent 40%),
    radial-gradient(circle at 80% 12%, #a8d8ff 0, #a8d8ff33 18%, transparent 42%),
    linear-gradient(135deg, #eaf6ff, #fef5e8 48%, #eefbf4);
}

.auth-screen[hidden],
.modal-mask[hidden],
#appRoot[hidden] {
  display: none;
}

.auth-notice[hidden] {
  display: none;
}

.auth-panel {
  position: relative;
  width: min(100%, 1040px);
  min-height: min(720px, 90vh);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(380px, 0.88fr);
  background: #ffffffea;
  border: 1px solid #fff;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 28px 80px #14384f24;
}

.auth-art {
  position: relative;
  padding: 36px 36px 30px;
  background: linear-gradient(180deg, #1d4f74, #173a57 52%, #10293d);
  overflow: hidden;
}

.auth-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #f7fbff;
  font-size: 48px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.auth-stage {
  position: relative;
  z-index: 1;
  height: 520px;
  margin-top: 20px;
}

.bubble {
  position: absolute;
  border-radius: 999px;
  opacity: 0.95;
  filter: blur(2px);
  animation: floatBob 5.5s ease-in-out infinite;
}

.bubble.one {
  width: 140px;
  height: 140px;
  left: 18px;
  top: 18px;
  background: #ffffff1d;
}

.bubble.two {
  width: 56px;
  height: 56px;
  right: 50px;
  top: 92px;
  background: #ffe59a3d;
  animation-delay: -1.5s;
}

.bubble.three {
  width: 86px;
  height: 86px;
  right: 18px;
  bottom: 62px;
  background: #87d6ff24;
  animation-delay: -2.4s;
}

.character {
  --body: #6f5ef6;
  position: absolute;
  border-radius: 45% 55% 50% 50% / 48% 52% 46% 54%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--body) 88%, #fff 12%), color-mix(in srgb, var(--body) 76%, #000 24%));
  box-shadow: inset 0 -14px 22px #0000001f, 0 18px 30px #06142135;
  transform-origin: center bottom;
  animation: floatBob 4.8s ease-in-out infinite;
}

.character::after {
  content: "";
  position: absolute;
  inset: auto 18% 14% 18%;
  height: 24%;
  border-radius: 999px;
  background: #ffffff12;
  filter: blur(10px);
}

.character.purple {
  --body: #7b61ff;
  width: 190px;
  height: 232px;
  left: 80px;
  bottom: 44px;
}

.character.dark {
  --body: #1f2a37;
  width: 210px;
  height: 250px;
  right: 84px;
  bottom: 30px;
  animation-delay: -1.6s;
}

.character.yellow {
  --body: #ffcb54;
  width: 124px;
  height: 146px;
  left: 286px;
  bottom: 214px;
  animation-delay: -0.8s;
}

.character.orange {
  --body: #ff9557;
  width: 102px;
  height: 122px;
  left: 224px;
  bottom: 178px;
  animation-delay: -2.1s;
}

.character.small .face {
  top: 28%;
}

.character.small .eye {
  width: 22px;
  height: 22px;
}

.character.small .pupil {
  width: 9px;
  height: 9px;
}

.face {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
}

.eye {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  transition: height 0.18s ease, transform 0.18s ease, background 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pupil {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0f1720;
  transform: translate(0, 0);
  transition: transform 0.12s ease-out, opacity 0.18s ease;
}

.mouth {
  position: absolute;
  left: 50%;
  bottom: 28%;
  width: 46px;
  height: 18px;
  transform: translateX(-50%);
  border-bottom: 4px solid #172331;
  border-radius: 0 0 40px 40px;
  opacity: 0.26;
}

.hand {
  position: absolute;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--body) 92%, #fff 8%);
  box-shadow: 0 8px 18px #00000018;
  top: 34%;
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.hand.left {
  left: 16%;
  transform: translate(-12px, 18px) rotate(18deg);
}

.hand.right {
  right: 16%;
  transform: translate(12px, 18px) rotate(-18deg);
}

.character.cover .hand {
  opacity: 1;
}

.character.cover .hand.left {
  transform: translate(0, 0) rotate(8deg);
}

.character.cover .hand.right {
  transform: translate(0, 0) rotate(-8deg);
}

.character.cover .eye {
  background: #f5f5f7;
}

.character.blink .eye {
  height: 5px;
  background: #172331;
  transform: translateY(11px);
}

.character.blink .pupil {
  opacity: 0;
}

.auth-form {
  padding: 42px 36px;
  display: grid;
  align-content: center;
  gap: 18px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.auth-tabs {
  display: inline-flex;
  padding: 5px;
  gap: 6px;
  border-radius: 999px;
  background: #e9f1f6;
  width: fit-content;
}

.auth-tab {
  border: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px #12344716;
}

.auth-pane {
  display: none;
}

.auth-pane.active {
  display: block;
}

.auth-pane h2 {
  margin: 4px 0 0;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-notice {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.7;
}

.auth-notice.error {
  color: #b64040;
  background: #fff1f1;
  border: 1px solid #ffd6d6;
}

.auth-notice.ok {
  color: #237a49;
  background: #eff9f2;
  border: 1px solid #d6eedf;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field label {
  font-size: 14px;
  font-weight: 700;
  color: #315167;
}

.login-field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #d6e5ee;
  background: #fbfdff;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.login-field input:focus {
  border-color: #2c7da0;
  box-shadow: 0 0 0 4px #2c7da018;
  transform: translateY(-1px);
}

.password-row {
  position: relative;
}

.password-row input {
  padding-right: 78px;
}

.toggle-pass {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  min-width: 56px;
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  border: 0;
  background: #eef5f9;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.auth-submit {
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 0;
  background: linear-gradient(135deg, #1d6585, #163f5d);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 26px #174f7126;
}

.auth-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.auth-error {
  min-height: 22px;
  color: #c23d3d;
  font-size: 13px;
  line-height: 1.6;
}

.app {
  max-width: 1240px;
  margin: 18px auto;
  padding: 0 14px;
}

.hero,
.panel {
  background: var(--panel);
  border-radius: 24px;
  box-shadow: 0 18px 40px #14384f14;
  border: 1px solid #fff;
}

.hero {
  padding: 22px 24px;
  background: linear-gradient(135deg, #166b88, #174f71);
  color: #f3fbff;
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.title {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
}

.sub {
  margin: 8px 0 0;
  color: #d5edf7;
  font-size: 14px;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tag {
  padding: 7px 12px;
  border-radius: 999px;
  background: #ffffff17;
  border: 1px solid #ffffff22;
  font-size: 12px;
}

.status {
  min-width: 300px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #ffffff14;
}

.sline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
  font-size: 14px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #93a7b6;
  margin-right: 8px;
}

.dot.on {
  background: #6af0ae;
}

.dot.wait {
  background: #e7c05f;
}

.toolbar,
.main {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.main {
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.92fr);
}

.left-column,
.right-column {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 18px 18px 20px;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.head h2 {
  margin: 0;
  font-size: 20px;
}

.toolbar-head {
  margin: 0;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.profile-entry {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: 16px;
  border: 1px solid #dce8ef;
  background: #f7fbfe;
  color: var(--text);
  min-height: 52px;
}

.profile-entry-text {
  display: grid;
  text-align: left;
  gap: 2px;
}

.profile-entry-text strong {
  font-size: 14px;
}

.profile-entry-text span {
  font-size: 12px;
  color: var(--muted);
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1b748f, #1a5771);
  color: #fff;
  font-weight: 800;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.profile-avatar.small {
  width: 42px;
  height: 42px;
}

.profile-avatar.large {
  width: 88px;
  height: 88px;
  font-size: 28px;
}

.profile-avatar.has-image {
  color: transparent;
}

.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: #e6eef3;
  gap: 4px;
}

.seg button,
.btn,
.ctl,
.modal-close {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.seg button {
  padding: 10px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.seg button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px #12344716;
}

.btn {
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1b748f, #1a5771);
  color: #fff;
  font-weight: 800;
}

.btn.small {
  padding: 9px 12px;
  font-size: 14px;
  justify-self: start;
}

.btn.ghost {
  background: #eef5f9;
  color: var(--text);
  border: 1px solid #dde8ef;
}

.btn.secondary {
  background: linear-gradient(135deg, #708da0, #536d7f);
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.card {
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #edf4f7;
  box-shadow: 0 12px 28px #14384f0f;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.value {
  margin: 8px 0 4px;
  font-size: 34px;
  font-weight: 800;
}

.unit {
  font-size: 13px;
  color: var(--muted);
}

.note {
  font-size: 12px;
  color: var(--muted);
}

.icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.temp {
  background: linear-gradient(135deg, var(--temp), #ff6d4d);
}

.humi {
  background: linear-gradient(135deg, var(--humi), #246fd1);
}

.pm {
  background: linear-gradient(135deg, var(--pm), #5f82ff);
}

.mq4 {
  background: linear-gradient(135deg, var(--mq4), #22be75);
}

.mode {
  background: linear-gradient(135deg, #7a57ff, #3487ff);
}

.cardtop {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.split .full {
  grid-column: 1 / -1;
}

.warns {
  display: grid;
  gap: 10px;
}

.warn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #edf4f7;
}

.state {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.state.ok {
  background: #238a5718;
  color: var(--ok);
}

.state.bad {
  background: #d4543f18;
  color: var(--warn);
}

.state.wait {
  background: #dfeaf218;
  color: #6b8597;
}

.ctlbox {
  display: grid;
  gap: 12px;
}

.ctlrow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ctl {
  padding: 13px 14px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
}

.on {
  background: linear-gradient(135deg, #1cab62, #0f7d45);
}

.off {
  background: linear-gradient(135deg, #db7a27, #b44f15);
}

.raw {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: #102634;
  color: #d9f2ff;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-all;
  font: 12px/1.7 Consolas, monospace;
}

.meta2 {
  font-size: 12px;
  color: var(--muted);
}

.threshold-action {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6fbff, #eef6fb);
  border: 1px dashed #cfe0ea;
  display: grid;
  gap: 10px;
}

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.charts .full {
  grid-column: 1 / -1;
}

canvas {
  width: 100% !important;
  height: 250px !important;
}

.foot {
  text-align: center;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: #1026347a;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(100%, 560px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 24px 60px #10263433;
  padding: 20px;
  border: 1px solid #f0f5f8;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.modal-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #edf5f9;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdfe;
}

.field span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.field input {
  width: 100%;
  border: 1px solid #d8e5ed;
  background: #fff;
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: #2c7da0;
  box-shadow: 0 0 0 3px #2c7da018;
}

.current-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f2f7fb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.modal-tip {
  margin-top: 12px;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.profile-modal {
  width: min(100%, 860px);
}

.profile-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-card {
  padding: 18px;
  border-radius: 20px;
  background: #fbfdfe;
  border: 1px solid #e8f0f5;
}

.profile-card h4 {
  margin: 0 0 14px;
  font-size: 18px;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-summary-text {
  display: grid;
  gap: 6px;
}

.profile-summary-text strong {
  font-size: 18px;
}

.profile-summary-text span {
  font-size: 13px;
  color: var(--muted);
}

.upload-box {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed #bcd1df;
  background: linear-gradient(180deg, #f8fcff, #f0f7fb);
  cursor: pointer;
}

.upload-box span {
  font-weight: 800;
}

.upload-box small {
  color: var(--muted);
  line-height: 1.6;
}

.hidden-input {
  display: none;
}

.field-stack {
  display: grid;
  gap: 12px;
}

.left-actions {
  justify-content: flex-start;
}

.modal-tip.error {
  color: var(--warn);
}

.modal-tip.ok {
  color: var(--ok);
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes floatBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (max-width: 1080px) {
  .main {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-art {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .cards,
  .split,
  .charts,
  .ctlrow,
  .field-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .title,
  .auth-title {
    font-size: 32px;
  }

  .auth-form,
  .auth-art {
    padding: 28px 22px;
  }

  .auth-stage {
    height: 360px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .profile-entry {
    width: 100%;
    justify-content: flex-start;
  }
}
