:root {
  --bg: #07111b;
  --bg-soft: #0f1c2a;
  --card: rgba(14, 24, 38, 0.82);
  --card-soft: rgba(20, 34, 51, 0.9);
  --line: rgba(118, 161, 196, 0.18);
  --line-strong: rgba(142, 193, 235, 0.32);
  --text: #f2f8ff;
  --muted: #92a9bf;
  --accent: #35d3c2;
  --accent-2: #5aa7ff;
  --accent-soft: rgba(53, 211, 194, 0.12);
  --good: #31cf7a;
  --warn: #ff6e59;
  --warn-soft: rgba(255, 110, 89, 0.12);
  --pill: rgba(22, 45, 69, 0.74);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 14px 38px rgba(0, 0, 0, 0.22);
  --shell-max: 1380px;
  --content-max: 1120px;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family:
    "Avenir Next", "SF Pro Display", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  background: linear-gradient(
    180deg,
    #06101a 0%,
    #081421 28%,
    #091726 62%,
    #08131f 100%
  );
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 12% 18%,
      rgba(90, 167, 255, 0.12),
      transparent 26%
    ),
    radial-gradient(
      circle at 88% 16%,
      rgba(53, 211, 194, 0.08),
      transparent 24%
    ),
    radial-gradient(
      circle at 14% 82%,
      rgba(90, 167, 255, 0.08),
      transparent 28%
    ),
    radial-gradient(
      circle at 86% 84%,
      rgba(53, 211, 194, 0.07),
      transparent 26%
    ),
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.03) 0%,
      rgba(255, 255, 255, 0) 24%,
      rgba(255, 255, 255, 0.018) 58%,
      rgba(255, 255, 255, 0) 100%
    );
  opacity: 0.72;
}

.auth-shell {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 12, 20, 0.78);
  backdrop-filter: blur(18px);
  z-index: 40;
}

.auth-shell.show {
  display: flex;
}

.auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, #162437 0%, #122132 100%);
  border: 1px solid rgba(79, 116, 151, 0.24);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
}

.auth-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(47, 140, 255, 0.14);
  border: 1px solid rgba(47, 140, 255, 0.24);
  color: #b7d8ff;
  font-size: 12px;
}

.auth-title {
  margin: 0;
  font-size: 28px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-status {
  display: none;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(47, 140, 255, 0.12);
  border: 1px solid rgba(47, 140, 255, 0.22);
  color: #cfe6ff;
  font-size: 13px;
  line-height: 1.5;
}

.auth-status.show {
  display: block;
}

.auth-status.error {
  background: rgba(255, 107, 129, 0.14);
  border-color: rgba(255, 107, 129, 0.22);
  color: #ffd3d9;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-tab {
  min-height: 48px;
  border: 1px solid rgba(79, 116, 151, 0.18);
  border-radius: 18px;
  background: #122132;
  color: var(--text);
}

.auth-tab.active {
  background: rgba(47, 140, 255, 0.14);
  border-color: rgba(47, 140, 255, 0.34);
  color: #d7ebff;
}

.auth-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

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

.auth-link {
  border: none;
  background: transparent;
  color: #b7d8ff;
  padding: 0;
  justify-self: flex-start;
  text-align: left;
  font-size: 13px;
}

.auth-link:hover {
  color: #d7ebff;
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select,
textarea {
  outline: none;
}

.app {
  width: min(100%, var(--shell-max));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: transparent;
}

.app.auth-gated {
  display: none;
}

.topbar {
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(
    180deg,
    rgba(6, 12, 20, 0.78),
    rgba(6, 12, 20, 0.16)
  );
  backdrop-filter: blur(18px);
}

.topbar .title {
  display: none;
}

.topbar .title::before {
  content: "FLOW CONTROL";
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: rgba(191, 222, 250, 0.72);
}

.banner {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 28px));
  margin-top: 0;
  padding: 13px 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 32, 48, 0.88);
  border: 1px solid rgba(53, 211, 194, 0.22);
  color: #b9fff1;
  font-size: 13px;
  line-height: 1.2;
  z-index: 10;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  white-space: nowrap;
  text-align: center;
}

.banner-text {
  min-width: 0;
  flex: 1 1 auto;
  width: 100%;
  padding: 0 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.banner.error {
  background: rgba(48, 18, 18, 0.86);
  border-color: rgba(255, 110, 89, 0.3);
  color: #ffb9b2;
}

.offline-banner {
  display: none;
  background: rgba(240, 77, 61, 0.18);
  border: 1px solid rgba(240, 77, 61, 0.36);
  color: #ffd2cd;
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 30;
  min-width: 140px;
  max-width: calc(100vw - 64px);
  padding: 14px 24px;
  border-radius: 18px;
  background: rgba(11, 22, 34, 0.92);
  border: 1px solid rgba(47, 140, 255, 0.34);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  color: var(--text);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.estop-fab {
  position: fixed;
  left: 0;
  top: 0;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(
      circle at 34% 30%,
      rgba(206, 131, 119, 0.94),
      rgba(154, 72, 64, 0.92) 34%,
      rgba(103, 26, 24, 0.98) 100%
    ),
    linear-gradient(180deg, rgba(128, 34, 30, 0.98), rgba(73, 17, 16, 0.98));
  color: #fff3f0;
  box-shadow:
    0 20px 34px rgba(44, 10, 9, 0.3),
    inset 0 2px 8px rgba(255, 255, 255, 0.12);
  cursor: grab;
  z-index: 25;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.estop-fab:hover {
  transform: translateY(-2px);
  filter: saturate(0.92);
}

.estop-fab:active {
  cursor: grabbing;
}

.estop-fab.dragging {
  transform: scale(1.03);
  box-shadow:
    0 24px 40px rgba(44, 10, 9, 0.34),
    inset 0 2px 8px rgba(255, 255, 255, 0.14);
}

.estop-fab.armed {
  animation: estop-pulse 1s ease-in-out infinite;
}

.estop-fab-ring {
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 1px solid rgba(187, 106, 96, 0.26);
  background: radial-gradient(circle, rgba(154, 72, 64, 0.14), transparent 68%);
  pointer-events: none;
}

.estop-fab-label {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.estop-fab-label-armed {
  display: none;
  font-size: 12px;
  line-height: 1.2;
}

.estop-fab.armed .estop-fab-label-idle {
  display: none;
}

.estop-fab.armed .estop-fab-label-armed {
  display: block;
}

@keyframes estop-pulse {
  0%,
  100% {
    box-shadow:
      0 20px 34px rgba(44, 10, 9, 0.3),
      0 0 0 0 rgba(176, 83, 74, 0.14),
      inset 0 2px 8px rgba(255, 255, 255, 0.12);
  }
  50% {
    box-shadow:
      0 24px 40px rgba(44, 10, 9, 0.34),
      0 0 0 10px rgba(176, 83, 74, 0),
      inset 0 2px 8px rgba(255, 255, 255, 0.12);
  }
}

.content {
  flex: 1;
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 4px 18px 126px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.view {
  display: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.view.active {
  display: grid;
  animation: view-rise 0.28s ease;
}

.view > :first-child {
  padding: 6px 2px 0;
}

.view > :first-child .section-title {
  position: relative;
  display: inline-block;
  padding-right: 18px;
}

.view > :first-child .section-title::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: translateY(-50%);
  box-shadow: 0 0 0 8px rgba(53, 211, 194, 0.08);
}

.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(17, 30, 45, 0.9) 0%,
    rgba(14, 24, 38, 0.92) 100%
  );
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.12),
    transparent 60%
  );
  pointer-events: none;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 19px;
  letter-spacing: 0.01em;
}

.section-title {
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.06;
  margin: 0 0 10px;
}

.section-note {
  color: var(--muted);
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}

.device-card {
  padding: 22px;
  background:
    radial-gradient(
      circle at top right,
      rgba(90, 167, 255, 0.24),
      transparent 26%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(53, 211, 194, 0.14),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      rgba(17, 30, 46, 0.96) 0%,
      rgba(12, 24, 38, 0.98) 100%
    );
  border-color: rgba(113, 172, 220, 0.2);
  box-shadow: var(--shadow);
}

.device-card > .summary-grid {
  margin-top: 12px;
}

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

.device-head > :first-child {
  min-width: 0;
}

.device-name {
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(90, 167, 255, 0.12);
  border: 1px solid rgba(90, 167, 255, 0.24);
  color: #c8e2ff;
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
}

.status-chip.online {
  color: #92f6ca;
  border-color: rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.12);
}

.status-chip.offline {
  color: #ffb9b2;
  border-color: rgba(240, 77, 61, 0.22);
  background: rgba(240, 77, 61, 0.12);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

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

.summary-card {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(20, 34, 51, 0.76);
  border: 1px solid rgba(118, 161, 196, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  height: fit-content;
}

.tappable-card {
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.tappable-card:hover {
  transform: translateY(-3px);
  background: rgba(27, 44, 65, 0.92);
  border-color: rgba(90, 167, 255, 0.28);
  box-shadow: 0 18px 36px rgba(5, 11, 18, 0.22);
}

.tappable-card:active {
  transform: translateY(-1px);
  background: rgba(31, 51, 74, 0.96);
}

.summary-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.summary-value {
  font-size: clamp(18px, 2.3vw, 24px);
  font-weight: 700;
  line-height: 1.2;
}

.summary-sub {
  margin-top: 8px;
  color: #bfd0e2;
  font-size: 13px;
  line-height: 1.55;
}

@keyframes view-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-apex-card .summary-sub + .summary-sub {
  margin-top: 4px;
}

.home-apex-selected {
  color: #dbe8f5;
  word-break: break-word;
}

.home-detail-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.home-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.home-card-title {
  margin: 0;
}

.home-card-side {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.home-card-inline {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: #acf8d7;
}

.home-card-inline + .home-card-inline::before {
  content: "/";
  margin-right: 8px;
  color: #78dcb6;
}

.home-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.home-detail-line {
  font-size: 13px;
  line-height: 1.5;
  color: #d6e3f0;
}

.home-detail-stack {
  line-height: 1.65;
  white-space: normal;
}

.trim-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 24px;
  background: rgba(20, 34, 51, 0.72);
  border: 1px solid rgba(118, 161, 196, 0.14);
  overflow: hidden;
}

.trim-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(96px, 124px) 120px;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(118, 161, 196, 0.12);
}

.trim-row:last-child {
  border-bottom: none;
}

.trim-row-label strong {
  display: block;
  font-size: 16px;
}

.trim-row-label span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.trim-row input {
  width: 100%;
  min-width: 0;
  justify-self: start;
  margin-left: 0;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(118, 161, 196, 0.18);
  background: rgba(9, 18, 29, 0.82);
  color: var(--text);
  font-size: 17px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.trim-row .btn {
  width: 100%;
  min-width: 0;
  justify-self: end;
  margin-right: 0;
  white-space: nowrap;
  padding: 14px 10px;
  font-size: 15px;
  text-align: center;
}

.trim-row input::-webkit-outer-spin-button,
.trim-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

.quick-card {
  position: relative;
  min-height: 116px;
  padding: 18px 18px 20px;
  border-radius: 24px;
  background:
    radial-gradient(
      circle at top right,
      rgba(90, 167, 255, 0.18),
      transparent 24%
    ),
    linear-gradient(
      180deg,
      rgba(24, 40, 59, 0.92) 0%,
      rgba(16, 29, 43, 0.96) 100%
    );
  border: 1px solid rgba(118, 161, 196, 0.14);
  text-align: left;
  color: var(--text);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.quick-card:hover {
  transform: translateY(-3px);
  background:
    radial-gradient(
      circle at top right,
      rgba(90, 167, 255, 0.22),
      transparent 24%
    ),
    linear-gradient(
      180deg,
      rgba(29, 47, 68, 0.98) 0%,
      rgba(18, 32, 47, 0.98) 100%
    );
  border-color: rgba(90, 167, 255, 0.24);
  box-shadow: 0 18px 38px rgba(7, 15, 24, 0.22);
}

.quick-card:active {
  transform: translateY(0);
  background: linear-gradient(180deg, #2a3f5c 0%, #20354c 100%);
}

.quick-card:disabled,
.quick-card.disabled-card {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: linear-gradient(180deg, #172638 0%, #132232 100%);
  border-color: rgba(79, 116, 151, 0.14);
}

.quick-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.quick-card span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.danger-card {
  border-color: rgba(240, 77, 61, 0.28);
}

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

.actions.single-action {
  grid-template-columns: 1fr;
}

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

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

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

.calibration-launch-btn {
  min-height: 0;
  height: 50px;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  border-radius: 26px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.1;
  padding: 8px 10px;
  text-align: center;
}

.calibration-launch-btn span {
  display: block;
  white-space: nowrap;
}

.btn {
  border: none;
  min-height: 52px;
  border-radius: 18px;
  padding: 14px 18px;
  background: linear-gradient(
    180deg,
    rgba(38, 63, 92, 0.96) 0%,
    rgba(30, 51, 75, 0.96) 100%
  );
  color: var(--text);
  font-weight: 600;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(7, 15, 24, 0.18);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff;
}

.btn.warn {
  background: var(--warn);
  color: #fff;
}

.btn.ghost {
  background: rgba(90, 167, 255, 0.1);
  border: 1px solid rgba(90, 167, 255, 0.24);
  color: #c8defe;
}

.btn.confirm-action {
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  border: none;
  color: #fff;
}

.btn.cancel-action {
  background: var(--warn);
  border: none;
  color: #fff;
}

.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(19, 34, 50, 0.76);
  border: 1px solid rgba(118, 161, 196, 0.14);
}

.switch-meta {
  min-width: 0;
}

.switch-meta strong {
  display: block;
  font-size: 16px;
}

.switch-meta span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toggle-btn {
  min-width: 136px;
  min-height: 56px;
  padding: 10px 14px;
  border: none;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(11, 22, 35, 0.86);
  color: #c9ddf1;
  border: 1px solid rgba(90, 167, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  justify-self: end;
}

.toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 10px 24px rgba(7, 15, 24, 0.16);
}

.toggle-btn:active {
  transform: translateY(0);
}

.toggle-btn.active {
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff;
  border-color: transparent;
}

.toggle-btn.inactive {
  background: rgba(11, 22, 35, 0.86);
  color: #c9ddf1;
}

.toggle-label {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

.toggle-hint {
  font-size: 12px;
  line-height: 1.1;
  opacity: 0.9;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cloud-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.device-manager-launch {
  display: block;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(24, 40, 59, 0.92) 0%,
    rgba(16, 29, 43, 0.96) 100%
  );
  border: 1px solid rgba(118, 161, 196, 0.14);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.device-manager-launch:hover {
  transform: translateY(-2px);
  border-color: rgba(90, 167, 255, 0.24);
  box-shadow: 0 14px 30px rgba(7, 15, 24, 0.18);
}

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

.device-manager-launch-head strong {
  font-size: 17px;
}

.device-manager-launch-head span {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.device-manager-launch-value {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.device-manager-overlay-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.device-manager-overlay-actions .btn {
  min-width: 0;
  white-space: nowrap;
}

.push-service-note,
.push-service-help {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.push-service-status-box {
  border-style: solid;
}

.push-service-status-box.error {
  color: var(--danger);
  border-color: rgba(233, 91, 112, 0.32);
}

.push-service-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.push-service-actions .btn {
  min-width: 0;
  white-space: nowrap;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.device-item.selected {
  border-color: rgba(47, 140, 255, 0.34);
  box-shadow: 0 10px 24px rgba(7, 15, 24, 0.16);
}

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

.device-item-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(118, 161, 196, 0.18);
  background: rgba(9, 18, 29, 0.82);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: center;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.alarm-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

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

.cal-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.salt-page6-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.salt-page6-grid .field {
  align-items: center;
}

.salt-page6-grid .field label {
  text-align: center;
}

.salt-page6-grid .field input {
  width: 90%;
  min-width: 0;
  min-height: 10px;
  padding: 12px 18px;
  font-size: 15px;
}

.readonly {
  background: rgba(22, 39, 60, 0.86);
  color: #dbe7f3;
}

.pair,
.triple {
  display: grid;
  gap: 12px;
}

.pair {
  grid-template-columns: 1fr 1fr;
}

.calibration-confirm-field {
  width: 100%;
  align-items: center;
}

.calibration-confirm-field label {
  width: 100%;
}

.calibration-confirm-field input {
  width: 192px;
  max-width: 100%;
  min-width: 0;
  align-self: center;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.triple {
  grid-template-columns: 1fr 1fr 1fr;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(118, 161, 196, 0.12);
}

.metric-row > :first-child {
  min-width: 0;
}

.metric-row > :last-child {
  max-width: 100%;
  text-align: right;
  word-break: break-word;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row strong {
  font-size: 15px;
}

.metric-row span {
  color: var(--muted);
  font-size: 13px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(90, 167, 255, 0.12);
  border: 1px solid rgba(90, 167, 255, 0.22);
  font-size: 13px;
  color: #c9defa;
}

.chip.warn {
  background: rgba(240, 77, 61, 0.14);
  border-color: rgba(240, 77, 61, 0.28);
  color: #ffc4bd;
}

.chip.good {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.24);
  color: #a3f3c2;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(8, 18, 28, 0.88);
  border: 1px solid rgba(118, 161, 196, 0.16);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
}

.status-box {
  padding: 15px 16px;
  border-radius: 20px;
  background: rgba(12, 24, 39, 0.9);
  border: 1px dashed rgba(118, 161, 196, 0.18);
  color: #d8e5f2;
  line-height: 1.5;
}

.status-box.empty {
  color: var(--muted);
}

.cloud-session-box {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cloud-session-box .actions {
  margin-top: 14px;
}

.cloud-device-note {
  margin-top: 14px;
}

.status-main {
  font-size: 15px;
  font-weight: 600;
  color: #e8f2fb;
}

.status-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #9fb7cf;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.days label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 16px;
  background: rgba(11, 22, 35, 0.86);
  border: 1px solid rgba(90, 167, 255, 0.18);
  font-size: 13px;
  color: #bcd3ee;
}

.days input {
  display: none;
}

.days label.active {
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff;
  border-color: transparent;
}

.plan-editor-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-mode-field select {
  text-align: center;
  text-align-last: center;
  font-weight: 700;
}

.plan-volume-grid {
  align-items: end;
}

.plan-time-field {
  align-items: center;
}

.plan-time-field label {
  align-self: flex-start;
}

.plan-time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
}

.plan-time-row input {
  width: 100%;
  min-width: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.plan-time-sep {
  font-size: 28px;
  font-weight: 700;
  color: #dce9f6;
  line-height: 1;
}

.manual-change-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.makeup-editor-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.makeup-editor-grid {
  align-items: end;
}

.manual-mode-field select {
  text-align: center;
  text-align-last: center;
  font-weight: 700;
}

.manual-volume-grid {
  align-items: end;
}

.manual-split-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(118, 161, 196, 0.12);
}

.manual-split-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
}

.manual-split-copy strong {
  font-size: 15px;
  color: #e8f2fb;
  white-space: nowrap;
}

.manual-split-copy span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.manual-split-value {
  text-align: right;
  font-size: 16px;
  font-weight: 600;
  color: #dce9f6;
  white-space: nowrap;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 20px), 760px);
  padding: 10px;
  background: rgba(8, 16, 25, 0.84);
  border: 1px solid rgba(118, 161, 196, 0.16);
  border-radius: 26px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
}

.tab-btn {
  border: none;
  background: transparent;
  color: #9eb2c9;
  padding: 11px 6px;
  border-radius: 18px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.tab-btn:hover {
  transform: translateY(-1px);
  color: #dcecff;
}

.tab-btn.active {
  color: var(--accent);
  background: rgba(53, 211, 194, 0.1);
}

.tab-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.92;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 14, 0.74);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.overlay.show {
  display: flex;
}

#overlay-alarm-detail {
  z-index: 25;
}

.global-alarm-overlay {
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
  z-index: 40;
  background: rgba(5, 11, 17, 0.68);
}

.global-alarm-sheet {
  width: min(520px, calc(100vw - 32px));
  max-height: min(72vh, 540px);
}

.tap-note-overlay {
  align-items: center;
  justify-content: center;
  z-index: 45;
  background: rgba(5, 11, 17, 0.68);
}

.tap-note-sheet {
  width: min(320px, calc(100vw - 40px));
  max-height: none;
  padding: 14px;
}

.tap-note-box {
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
}

.global-alarm-card {
  gap: 14px;
}

.alarm-popup-reason-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.alarm-popup-reason {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(240, 77, 61, 0.1);
  border: 1px solid rgba(240, 77, 61, 0.22);
  color: #ffd2cd;
  font-size: 14px;
  line-height: 1.45;
}

.global-alarm-actions {
  margin-top: 4px;
}

.sheet {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(
    180deg,
    rgba(12, 22, 35, 0.96) 0%,
    rgba(15, 27, 42, 0.98) 100%
  );
  border: 1px solid rgba(118, 161, 196, 0.18);
  border-radius: 30px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: view-rise 0.22s ease;
}

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

.sheet-head h3 {
  margin: 0;
  font-size: 22px;
}

.icon-btn {
  border: none;
  min-height: 44px;
  background: rgba(26, 44, 66, 0.9);
  color: #dbe7f3;
  border-radius: 16px;
  padding: 10px 14px;
}

.trim-editor-sheet {
  padding: 18px;
}

.trim-editor-head {
  margin-bottom: 18px;
}

.trim-editor-panel {
  border-radius: 28px;
}

.trim-close-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.salt-stage {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.salt-stage.show {
  display: flex;
}

.offline-overlay {
  align-items: center;
  z-index: 40;
}

.offline-overlay .sheet {
  max-height: none;
}

.app.offline .btn,
.app.offline .toggle-btn,
.app.offline .quick-card,
.app.offline .tab-btn,
.app.offline input,
.app.offline select {
  opacity: 0.5;
}

details.debug {
  background: rgba(20, 34, 51, 0.76);
  border-radius: 20px;
  border: 1px solid rgba(118, 161, 196, 0.14);
  padding: 14px 16px;
}

details.debug summary {
  cursor: pointer;
  color: #c9ddf1;
}

pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: #bfd3e7;
}

.helper {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.helper-lines > div + div {
  margin-top: 4px;
}

.calibration-note {
  font-size: 12px;
  line-height: 1.55;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.switch-inline {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(118, 161, 196, 0.16);
  background: rgba(12, 21, 33, 0.72);
  color: var(--text);
}

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

.apex-sheet {
  gap: 12px;
}

.apex-config-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apex-chart-head {
  margin-bottom: 12px;
}

.apex-salt-sheet {
  gap: 12px;
}

.apex-salt-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apex-salt-switch-row {
  margin-top: 2px;
}

.apex-salt-range-grid {
  align-items: end;
}

.apex-slot-grid,
.apex-config-grid {
  margin-top: 0;
}

.apex-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  gap: 10px;
}

.apex-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.apex-actions .btn {
  min-width: 0;
  padding: 14px 10px;
}

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

.apex-chart-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(27, 45, 67, 0.9);
  border: 1px solid rgba(118, 161, 196, 0.14);
  overflow: hidden;
}

.apex-chart-top {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  align-items: center;
  column-gap: 0;
  min-height: 18px;
}

.apex-chart-title {
  min-width: 0;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1;
  color: #d5e3f2;
  justify-self: start;
}

.apex-chart-value {
  grid-column: 3;
  justify-self: end;
  margin-bottom: 0;
  text-align: right;
  white-space: nowrap;
  padding-left: 0;
  line-height: 1;
  align-self: center;
}

.apex-chart {
  width: 100%;
  aspect-ratio: 1.34 / 1;
  border-radius: 10px;
  background: rgba(27, 45, 67, 0.92);
  border: 0;
  overflow: hidden;
}

.apex-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

.apex-chart-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  background: #1b2d43;
}

@media (min-width: 480px) {
  .summary-grid,
  .actions,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .content {
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 136px;
  }

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

  .view > :first-child {
    grid-column: 1 / -1;
    padding-top: 10px;
  }

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

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

  #view-home.active {
    grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.92fr);
  }

  #view-home.active > :first-child {
    grid-column: 1 / -1;
  }

  #view-home.active > .device-card {
    grid-column: 1;
  }

  #view-home.active > .card:last-child {
    grid-column: 2;
    align-self: start;
    position: sticky;
    top: 128px;
  }

  #view-home .device-card .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet {
    padding: 22px;
  }
}

@media (min-width: 1100px) {
  .app {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "nav header"
      "nav main";
    column-gap: 28px;
    align-content: start;
    padding: 20px 20px 24px;
  }

  .topbar {
    grid-area: header;
    padding: 12px 8px 12px 0;
    background: transparent;
    backdrop-filter: none;
  }

  .topbar .title {
    padding-top: 62px;
  }

  .content {
    grid-area: main;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 8px 12px 0;
  }

  .tabbar {
    grid-area: nav;
    position: sticky;
    left: auto;
    top: 20px;
    bottom: auto;
    transform: none;
    width: 100%;
    align-self: start;
    grid-template-columns: 1fr;
    padding: 14px;
    border-radius: 32px;
  }

  .tab-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 54px;
    padding: 0 16px;
    font-size: 14px;
  }

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

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

  .calibration-launches {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #view-home .device-card .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #view-home .device-card .summary-grid > .summary-card:nth-child(-n + 2) {
    grid-column: span 2;
  }

  #view-home .device-card .summary-grid > .summary-card:nth-child(n + 3) {
    grid-column: span 2;
  }

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

  .sheet {
    width: min(860px, calc(100vw - 300px));
  }
}

@media (max-width: 759px) {
  .estop-fab {
    width: 64px;
    height: 64px;
  }

  .banner {
    align-items: center;
    justify-content: center;
  }

  .switch-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .device-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .toggle-btn,
  .status-chip {
    align-self: flex-start;
  }

  .device-item-head {
    flex-direction: column;
    align-items: stretch;
  }

  .trim-row {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .trim-row-label {
    grid-column: 1 / -1;
  }

  .trim-row input {
    grid-column: 1;
  }

  .trim-row .btn {
    grid-column: 2;
  }

  .cal-setting-row,
  .pair,
  .triple,
  .alarm-settings-grid,
  .page7-actions,
  .alarm-actions,
  .calibration-launches,
  .salt-page6-grid,
  .apex-chart-grid,
  .inline-pair,
  .apex-slot-grid,
  .apex-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apex-top-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  }

  .cal-setting-row .btn,
  .page7-actions .btn:last-child,
  .alarm-actions .btn:last-child {
    grid-column: 1 / -1;
  }

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

  .trim-row .btn,
  .trim-row input,
  .cal-setting-row .btn {
    justify-self: stretch;
  }

  .salt-page6-grid .field input {
    width: 100%;
  }

  .content {
    padding-bottom: 188px;
  }

  .tabbar {
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 48px));
  }

  .device-manager-launch-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .device-manager-launch-head span {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar .title {
    padding-top: 62px;
    font-size: 24px;
  }

  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .card,
  .sheet {
    padding: 16px;
    border-radius: 24px;
  }

  .tabbar {
    width: calc(100vw - 14px);
    gap: 6px;
    padding: 8px;
  }

  .tab-btn {
    font-size: 12px;
    padding-left: 2px;
    padding-right: 2px;
  }

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

  .trim-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .trim-row-label,
  .trim-row input,
  .trim-row .btn {
    grid-column: 1;
  }

  .summary-grid,
  .quick-grid,
  .actions {
    gap: 10px;
  }

  .summary-card,
  .quick-card {
    padding: 14px;
    border-radius: 20px;
  }

  .quick-card {
    min-height: 104px;
  }

  .toggle-btn {
    min-width: 120px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .switch-row {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.event-log-sheet {
  overflow: hidden;
}

.event-log-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-log-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 2px;
  background: linear-gradient(
    180deg,
    rgba(16, 29, 43, 0.98) 0%,
    rgba(16, 29, 43, 0.94) 72%,
    rgba(16, 29, 43, 0) 100%
  );
}

.event-log-toolbar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.event-log-toolbar-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-log-toolbar-copy strong {
  font-size: 18px;
  color: #edf7ff;
}

.event-log-toolbar-copy span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.event-log-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.event-log-toolbar-actions .btn {
  min-width: 88px;
}

.event-log-filter-pop {
  padding: 14px;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at top right,
      rgba(90, 167, 255, 0.14),
      transparent 28%
    ),
    rgba(14, 25, 38, 0.96);
  border: 1px solid rgba(118, 161, 196, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.event-log-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.event-log-filter-head strong,
.event-log-filter-current {
  color: #e8f3ff;
  font-size: 14px;
}

.event-log-filter-head span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.event-log-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.event-log-filter-chip {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(118, 161, 196, 0.16);
  background: rgba(12, 21, 33, 0.76);
  color: #d4e6f7;
  font-size: 14px;
  font-weight: 600;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.event-log-filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 167, 255, 0.26);
}

.event-log-filter-chip.active {
  background: rgba(53, 211, 194, 0.14);
  border-color: rgba(53, 211, 194, 0.28);
  color: #d9fff7;
}

.event-log-list-wrap {
  min-height: 280px;
  max-height: min(54vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.event-log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-log-item,
.event-log-empty {
  border-radius: 22px;
  border: 1px solid rgba(118, 161, 196, 0.14);
  background: rgba(18, 31, 47, 0.88);
}

.event-log-empty {
  padding: 24px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.event-log-item {
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.event-log-item.exchange {
  border-color: rgba(90, 167, 255, 0.22);
}

.event-log-item.makeup {
  border-color: rgba(53, 211, 194, 0.22);
}

.event-log-item.alarm {
  border-color: rgba(240, 77, 61, 0.24);
}

.event-log-item.salt {
  border-color: rgba(255, 196, 92, 0.24);
}

.event-log-item.calibration {
  border-color: rgba(156, 170, 255, 0.24);
}

.event-log-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.event-log-time {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #9ab7d5;
}

.event-log-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.event-log-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(118, 161, 196, 0.16);
}

.event-log-badge.system {
  background: rgba(90, 167, 255, 0.12);
  color: #cae4ff;
}

.event-log-badge.exchange {
  background: rgba(90, 167, 255, 0.12);
  color: #cde5ff;
}

.event-log-badge.makeup {
  background: rgba(53, 211, 194, 0.12);
  color: #d8fff7;
}

.event-log-badge.alarm {
  background: rgba(240, 77, 61, 0.12);
  color: #ffd1cc;
}

.event-log-badge.salt {
  background: rgba(255, 196, 92, 0.12);
  color: #ffe7a6;
}

.event-log-badge.calibration {
  background: rgba(156, 170, 255, 0.12);
  color: #dde2ff;
}

.event-log-badge.neutral {
  background: rgba(255, 255, 255, 0.05);
  color: #b9ccde;
}

.event-log-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #eff6ff;
}

.event-log-summary {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #c6d8ea;
}

.event-log-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.event-log-meta-line {
  font-size: 12px;
  line-height: 1.5;
  color: #96aec7;
}

.event-log-meta-line.subtle {
  color: #6fcfbf;
}

.event-log-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 820px) {
  .event-log-toolbar-main,
  .event-log-filter-head {
    flex-direction: column;
  }

  .event-log-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

@media (max-width: 560px) {
  .event-log-filter-grid {
    grid-template-columns: 1fr;
  }

  .event-log-list-wrap {
    max-height: 58vh;
  }
}
body[data-theme] {
  font-family:
    var(--theme-body-font, "Avenir Next"), var(--theme-body-font-fallback, "SF Pro Display"),
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--theme-body-bg);
  color: var(--theme-text);
  transition:
    background 0.28s ease,
    color 0.28s ease;
}

body[data-theme]::before {
  background: var(--theme-body-overlay);
  opacity: var(--theme-body-overlay-opacity, 1);
}

body[data-theme]::after {
  content: "";
  position: fixed;
  inset: auto auto -120px -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: var(--theme-body-glow);
  filter: blur(var(--theme-body-glow-blur, 20px));
  opacity: var(--theme-body-glow-opacity, 1);
  pointer-events: none;
  z-index: 0;
}

body[data-theme] .app {
  position: relative;
  z-index: 1;
}

body[data-theme] .topbar {
  min-height: 0;
  padding: 0 18px;
  background: transparent;
  backdrop-filter: none;
}

body[data-theme] .topbar-shell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 88px;
  padding: 20px 22px;
  border-radius: 30px;
  background: var(--theme-shell-bg);
  border: 1px solid var(--theme-shell-border);
  box-shadow: var(--theme-shell-shadow);
  backdrop-filter: var(--theme-shell-filter, blur(26px));
}

body[data-theme] .topbar-copy {
  min-width: 0;
}

body[data-theme] .topbar-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--theme-eyebrow);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

body[data-theme] .topbar .title {
  display: block;
  padding: 0;
  color: var(--theme-title);
  font-family: var(--theme-heading-font, inherit);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: var(--theme-heading-tracking, -0.03em);
}

body[data-theme] .topbar .title::before {
  content: none;
}

body[data-theme] .topbar-note {
  margin: 8px 0 0;
  max-width: 32rem;
  color: var(--theme-note);
  font-size: 14px;
  line-height: 1.55;
}

body[data-theme] .banner {
  top: calc(env(safe-area-inset-top, 0px) + 22px);
  background: var(--theme-banner-bg);
  border: 1px solid var(--theme-banner-border);
  color: var(--theme-banner-text);
  box-shadow: var(--theme-banner-shadow);
  backdrop-filter: var(--theme-banner-filter, blur(28px));
}

body[data-theme] .banner-text {
  padding: 0 52px;
}

body[data-theme] .banner-alert {
  background: var(--theme-banner-alert-bg);
  border-color: var(--theme-banner-alert-border);
  color: var(--theme-banner-alert-text);
}

body[data-theme] .banner.error,
body[data-theme] .offline-banner {
  background: var(--theme-warning-bg);
  border-color: var(--theme-warning-border);
  color: var(--theme-warning-text);
}

body[data-theme] .content {
  width: min(100%, 1180px);
  padding: 10px 18px 132px;
  gap: 24px;
}

body[data-theme] .view {
  gap: 20px;
}

body[data-theme] .view > :first-child {
  padding: 2px 2px 0;
}

body[data-theme] .hero-intro {
  display: block;
}

body[data-theme] .hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: min(760px, 100%);
  padding: 4px 0 10px;
}

body[data-theme] .hero-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--theme-kicker-bg);
  border: 1px solid var(--theme-kicker-border);
  color: var(--theme-kicker-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-theme] .hero-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 28px;
  background: var(--theme-hero-panel-bg);
  border: 1px solid var(--theme-hero-panel-border);
  box-shadow: var(--theme-hero-panel-shadow);
  backdrop-filter: var(--theme-hero-panel-filter, blur(24px));
}

body[data-theme] .hero-stat {
  padding: 14px 16px;
  border-radius: 22px;
  background: var(--theme-hero-stat-bg);
  border: 1px solid var(--theme-hero-stat-border);
}

body[data-theme] .hero-stat span {
  display: block;
  margin-bottom: 6px;
  color: var(--theme-note);
  font-size: 12px;
  letter-spacing: 0.04em;
}

body[data-theme] .hero-stat strong {
  display: block;
  color: var(--theme-title);
  font-size: 15px;
  line-height: 1.45;
}

body[data-theme] .section-title,
body[data-theme] .card h2,
body[data-theme] .sheet-head h3,
body[data-theme] .device-name,
body[data-theme] .summary-value,
body[data-theme] .quick-card strong,
body[data-theme] .metric-row strong,
body[data-theme] .theme-toolbar-copy strong,
body[data-theme] .theme-option strong {
  color: var(--theme-title);
  font-family: var(--theme-heading-font, inherit);
}

body[data-theme] .section-title {
  letter-spacing: var(--theme-heading-tracking, -0.03em);
}

body[data-theme] .view > :first-child .section-title::after {
  width: 11px;
  height: 11px;
  background: linear-gradient(
    135deg,
    var(--theme-accent-2),
    var(--theme-accent)
  );
  box-shadow: 0 0 0 10px var(--theme-accent-soft);
}

body[data-theme] .section-note,
body[data-theme] .helper,
body[data-theme] .summary-label,
body[data-theme] .switch-meta span,
body[data-theme] .field label,
body[data-theme] .quick-card span,
body[data-theme] .summary-sub,
body[data-theme] .home-detail-line,
body[data-theme] .home-card-inline + .home-card-inline::before,
body[data-theme] .metric-row span,
body[data-theme] .event-log-time,
body[data-theme] .event-log-meta-line,
body[data-theme] pre,
body[data-theme] .theme-option-desc,
body[data-theme] .theme-toolbar-copy span {
  color: var(--theme-muted);
}

body[data-theme] .card,
body[data-theme] .sheet,
body[data-theme] .summary-card,
body[data-theme] .quick-card,
body[data-theme] .switch-row,
body[data-theme] .trim-panel,
body[data-theme] .event-log-filter-pop,
body[data-theme] .event-log-item,
body[data-theme] .event-log-empty,
body[data-theme] details.debug,
body[data-theme] .status-box {
  background: var(--theme-panel-bg);
  border: 1px solid var(--theme-panel-border);
  box-shadow: var(--theme-panel-shadow);
  backdrop-filter: var(--theme-panel-filter, blur(22px));
}

body[data-theme] .card,
body[data-theme] .sheet {
  border-radius: 30px;
}

body[data-theme] .card::before,
body[data-theme] .sheet::before {
  background: linear-gradient(
    90deg,
    var(--theme-panel-highlight),
    transparent 72%
  );
}

body[data-theme] .device-card {
  background: var(--theme-device-bg);
  border-color: var(--theme-device-border);
  box-shadow: var(--theme-device-shadow);
}

body[data-theme] .device-manager-launch {
  background: var(--theme-device-bg);
  border: 1px solid var(--theme-device-border);
  color: var(--theme-title);
  box-shadow: var(--theme-device-shadow);
}

body[data-theme] .device-manager-launch-head strong,
body[data-theme] .device-manager-launch-value {
  color: var(--theme-title);
  font-family: var(--theme-heading-font, inherit);
}

body[data-theme] .device-manager-launch-head span {
  color: var(--theme-muted);
}

body[data-theme] .summary-card,
body[data-theme] .quick-card {
  border-radius: 24px;
}

body[data-theme] .summary-value {
  letter-spacing: -0.02em;
}

body[data-theme] .home-card-inline {
  color: var(--theme-accent);
}

body[data-theme] .tappable-card:hover,
body[data-theme] .quick-card:hover,
body[data-theme] .theme-option:hover {
  transform: translateY(-4px);
  background: var(--theme-panel-hover-bg);
  border-color: var(--theme-border-strong);
  box-shadow: var(--theme-hover-shadow);
}

body[data-theme] .tappable-card:active,
body[data-theme] .quick-card:active,
body[data-theme] .theme-option:active {
  transform: translateY(-1px);
}

body[data-theme] .status-chip {
  background: var(--theme-chip-bg);
  border: 1px solid var(--theme-chip-border);
  color: var(--theme-chip-text);
  box-shadow: inset 0 1px 0 var(--theme-panel-highlight);
}

body[data-theme] .status-chip.online {
  color: var(--theme-good);
  background: var(--theme-good-soft);
  border-color: var(--theme-good-border);
}

body[data-theme] .status-chip.offline {
  color: var(--theme-warn);
  background: var(--theme-warn-soft);
  border-color: var(--theme-warning-border);
}

body[data-theme] .btn,
body[data-theme] .icon-btn,
body[data-theme] .toggle-btn {
  min-height: 54px;
  border: 1px solid var(--theme-button-border);
  background: var(--theme-button-bg);
  color: var(--theme-button-text);
  box-shadow: var(--theme-button-shadow);
}

body[data-theme] .btn:hover,
body[data-theme] .icon-btn:hover,
body[data-theme] .toggle-btn:hover {
  box-shadow: var(--theme-button-hover-shadow);
}

body[data-theme] .btn.primary,
body[data-theme] .btn.confirm-action,
body[data-theme] .toggle-btn.active {
  background: var(--theme-primary-bg);
  border-color: var(--theme-primary-border);
  color: var(--theme-primary-text);
}

body[data-theme] .btn.ghost {
  background: var(--theme-ghost-bg);
  border-color: var(--theme-ghost-border);
  color: var(--theme-ghost-text);
}

body[data-theme] .btn.warn,
body[data-theme] .btn.cancel-action {
  background: var(--theme-warn-bg);
  border-color: var(--theme-warn-border);
  color: var(--theme-primary-text);
}

body[data-theme] .toggle-btn.inactive {
  background: var(--theme-button-bg);
  color: var(--theme-button-text);
  border-color: var(--theme-button-border);
}

body[data-theme] .field input,
body[data-theme] .field select,
body[data-theme] .trim-row input {
  background: var(--theme-input-bg);
  border: 1px solid var(--theme-input-border);
  color: var(--theme-input-text);
  box-shadow: inset 0 1px 2px var(--theme-input-shadow);
}

body[data-theme] .readonly {
  background: var(--theme-readonly-bg);
  color: var(--theme-readonly-text);
}

body[data-theme] button:focus-visible,
body[data-theme] input:focus-visible,
body[data-theme] select:focus-visible,
body[data-theme] textarea:focus-visible {
  box-shadow:
    0 0 0 3px var(--theme-accent-soft),
    0 12px 28px rgba(10, 132, 255, 0.12);
  border-color: var(--theme-accent);
}

body[data-theme] .event-log-toolbar {
  background: var(--theme-toolbar-bg);
}

body[data-theme] .event-log-filter-chip {
  background: var(--theme-filter-chip-bg);
  border-color: var(--theme-filter-chip-border);
  color: var(--theme-button-text);
}

body[data-theme] .event-log-filter-chip.active {
  background: var(--theme-filter-chip-active-bg);
  border-color: var(--theme-filter-chip-active-border);
  color: var(--theme-filter-chip-active-text);
}

body[data-theme] .event-log-title,
body[data-theme] .status-main {
  color: var(--theme-title);
}

body[data-theme] .event-log-summary,
body[data-theme] .status-sub {
  color: var(--theme-subtle-strong);
}

body[data-theme] .event-log-meta-line.subtle {
  color: var(--theme-accent);
}

body[data-theme] .event-log-badge {
  border-color: var(--theme-filter-chip-border);
}

body[data-theme] .event-log-badge.system,
body[data-theme] .event-log-badge.exchange {
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}

body[data-theme] .event-log-badge.makeup,
body[data-theme] .chip.good {
  background: var(--theme-good-soft);
  border-color: var(--theme-good-border);
  color: var(--theme-good);
}

body[data-theme] .event-log-badge.alarm,
body[data-theme] .chip.warn,
body[data-theme] .alarm-popup-reason {
  background: var(--theme-warn-soft);
  border-color: var(--theme-warning-border);
  color: var(--theme-warn);
}

body[data-theme] .event-log-badge.salt {
  background: var(--theme-salt-soft);
  color: var(--theme-salt-text);
}

body[data-theme] .event-log-badge.calibration {
  background: var(--theme-cal-soft);
  color: var(--theme-cal-text);
}

body[data-theme] .event-log-badge.neutral,
body[data-theme] .chip {
  background: var(--theme-chip-bg);
  border-color: var(--theme-chip-border);
  color: var(--theme-chip-text);
}

body[data-theme] .tabbar {
  background: var(--theme-tabbar-bg);
  border: 1px solid var(--theme-tabbar-border);
  box-shadow: var(--theme-tabbar-shadow);
  backdrop-filter: var(--theme-tabbar-filter, blur(28px));
}

body[data-theme] .tab-btn {
  color: var(--theme-tab-text);
  border-radius: 18px;
}

body[data-theme] .tab-btn:hover {
  color: var(--theme-title);
}

body[data-theme] .tab-btn.active {
  color: var(--theme-tab-active-text);
  background: var(--theme-tab-active-bg);
  box-shadow: inset 0 1px 0 var(--theme-panel-highlight);
}

body[data-theme] .tab-icon {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 6px var(--theme-accent-soft);
}

body[data-theme] .overlay {
  background: var(--theme-overlay-bg);
  backdrop-filter: blur(18px);
}

body[data-theme] .global-alarm-overlay,
body[data-theme] .tap-note-overlay {
  background: var(--theme-overlay-strong-bg);
}

body[data-theme] .icon-btn,
body[data-theme] details.debug summary,
body[data-theme] .manual-split-value,
body[data-theme] .metric-row > :last-child {
  color: var(--theme-button-text);
}

body[data-theme] .progress-track {
  background: var(--theme-progress-track);
  border-color: var(--theme-input-border);
}

body[data-theme] .apex-chart,
body[data-theme] .apex-chart-empty {
  background: var(--theme-chart-bg);
  box-shadow: inset 0 0 0 1px var(--theme-input-border);
}

body[data-theme] .theme-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

body[data-theme] .theme-toolbar-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body[data-theme] .theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body[data-theme] .theme-option {
  width: 100%;
  min-height: 176px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--theme-panel-border);
  background: var(--theme-option-bg);
  color: var(--theme-title);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--theme-panel-shadow);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

body[data-theme] .theme-option.active {
  background: var(--theme-option-active-bg);
  border-color: var(--theme-accent);
  box-shadow:
    0 0 0 1px var(--theme-accent),
    var(--theme-hover-shadow);
}

body[data-theme] .theme-option-tag {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--theme-kicker-bg);
  border: 1px solid var(--theme-kicker-border);
  color: var(--theme-kicker-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-theme] .theme-option strong {
  font-size: 20px;
  line-height: 1.15;
}

body[data-theme] .theme-option-desc {
  line-height: 1.55;
}

body[data-theme] .theme-swatch {
  margin-top: auto;
  display: block;
  height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.theme-swatch-classic {
  background:
    radial-gradient(circle at 18% 20%, rgba(90, 167, 255, 0.26), transparent 22%),
    linear-gradient(135deg, #08131f 0%, #102338 54%, #17324a 100%);
}

.theme-swatch-apple {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.8), transparent 20%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f8 56%, #dde6f5 100%);
}

.theme-swatch-retro {
  background:
    radial-gradient(circle at 20% 22%, rgba(134, 239, 172, 0.2), transparent 22%),
    linear-gradient(135deg, #07100b 0%, #0b1811 54%, #102319 100%);
}

.theme-swatch-editorial {
  background:
    linear-gradient(135deg, #f7f1e7 0%, #efe5d6 52%, #e3d5c3 100%);
}

body[data-theme="classic"] {
  --theme-text: #f2f8ff;
  --theme-title: #f2f8ff;
  --theme-muted: #92a9bf;
  --theme-note: #9bb0c5;
  --theme-eyebrow: #9bb5cf;
  --theme-accent: #35d3c2;
  --theme-accent-2: #5aa7ff;
  --theme-accent-soft: rgba(53, 211, 194, 0.12);
  --theme-good: #31cf7a;
  --theme-good-soft: rgba(49, 207, 122, 0.12);
  --theme-good-border: rgba(49, 207, 122, 0.2);
  --theme-warn: #ff6e59;
  --theme-warn-soft: rgba(255, 110, 89, 0.12);
  --theme-warning-bg: rgba(48, 18, 18, 0.86);
  --theme-warning-border: rgba(255, 110, 89, 0.28);
  --theme-warning-text: #ffb9b2;
  --theme-salt-soft: rgba(255, 196, 92, 0.12);
  --theme-salt-text: #ffe7a6;
  --theme-cal-soft: rgba(156, 170, 255, 0.12);
  --theme-cal-text: #dde2ff;
  --theme-body-bg: linear-gradient(
    180deg,
    #06101a 0%,
    #081421 28%,
    #091726 62%,
    #08131f 100%
  );
  --theme-body-overlay:
    radial-gradient(circle at 12% 18%, rgba(90, 167, 255, 0.12), transparent 26%),
    radial-gradient(circle at 88% 16%, rgba(53, 211, 194, 0.08), transparent 24%),
    radial-gradient(circle at 14% 82%, rgba(90, 167, 255, 0.08), transparent 28%),
    radial-gradient(circle at 86% 84%, rgba(53, 211, 194, 0.07), transparent 26%);
  --theme-body-glow: radial-gradient(circle, rgba(90, 167, 255, 0.12), transparent 70%);
  --theme-topbar-bg: linear-gradient(
    180deg,
    rgba(6, 12, 20, 0.78),
    rgba(6, 12, 20, 0.16)
  );
  --theme-shell-bg: rgba(8, 18, 30, 0.72);
  --theme-shell-border: rgba(118, 161, 196, 0.16);
  --theme-shell-shadow: 0 20px 55px rgba(0, 0, 0, 0.26);
  --theme-shell-filter: blur(24px);
  --theme-banner-bg: rgba(16, 32, 48, 0.88);
  --theme-banner-border: rgba(53, 211, 194, 0.22);
  --theme-banner-text: #b9fff1;
  --theme-banner-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  --theme-banner-alert-bg: rgba(240, 77, 61, 0.18);
  --theme-banner-alert-border: rgba(255, 110, 89, 0.32);
  --theme-banner-alert-text: #ffd0ca;
  --theme-kicker-bg: rgba(22, 45, 69, 0.74);
  --theme-kicker-border: rgba(118, 161, 196, 0.16);
  --theme-kicker-text: #cae2f6;
  --theme-hero-panel-bg: rgba(15, 30, 45, 0.76);
  --theme-hero-panel-border: rgba(118, 161, 196, 0.16);
  --theme-hero-panel-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  --theme-hero-stat-bg: rgba(20, 34, 51, 0.72);
  --theme-hero-stat-border: rgba(118, 161, 196, 0.14);
  --theme-panel-bg: linear-gradient(
    180deg,
    rgba(17, 30, 45, 0.9),
    rgba(14, 24, 38, 0.92)
  );
  --theme-panel-border: rgba(118, 161, 196, 0.18);
  --theme-border-strong: rgba(90, 167, 255, 0.28);
  --theme-panel-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
  --theme-panel-highlight: rgba(255, 255, 255, 0.12);
  --theme-panel-hover-bg: linear-gradient(
    180deg,
    rgba(29, 47, 68, 0.98),
    rgba(18, 32, 47, 0.98)
  );
  --theme-hover-shadow: 0 18px 36px rgba(5, 11, 18, 0.22);
  --theme-device-bg:
    radial-gradient(circle at top right, rgba(90, 167, 255, 0.24), transparent 26%),
    radial-gradient(circle at bottom left, rgba(53, 211, 194, 0.14), transparent 30%),
    linear-gradient(
      180deg,
      rgba(17, 30, 46, 0.96) 0%,
      rgba(12, 24, 38, 0.98) 100%
    );
  --theme-device-border: rgba(113, 172, 220, 0.2);
  --theme-device-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  --theme-chip-bg: rgba(90, 167, 255, 0.12);
  --theme-chip-border: rgba(90, 167, 255, 0.24);
  --theme-chip-text: #c8e2ff;
  --theme-button-bg: linear-gradient(
    180deg,
    rgba(38, 63, 92, 0.96) 0%,
    rgba(30, 51, 75, 0.96) 100%
  );
  --theme-button-border: rgba(90, 167, 255, 0.18);
  --theme-button-text: #f2f8ff;
  --theme-button-shadow: 0 10px 24px rgba(7, 15, 24, 0.16);
  --theme-button-hover-shadow: 0 14px 30px rgba(7, 15, 24, 0.18);
  --theme-primary-bg: linear-gradient(90deg, #5aa7ff 0%, #35d3c2 100%);
  --theme-primary-border: transparent;
  --theme-primary-text: #ffffff;
  --theme-ghost-bg: rgba(90, 167, 255, 0.1);
  --theme-ghost-border: rgba(90, 167, 255, 0.24);
  --theme-ghost-text: #c8defe;
  --theme-warn-bg: linear-gradient(135deg, #ff8369 0%, #ff6e59 100%);
  --theme-warn-border: rgba(255, 110, 89, 0.18);
  --theme-input-bg: rgba(9, 18, 29, 0.82);
  --theme-input-border: rgba(118, 161, 196, 0.18);
  --theme-input-text: #f2f8ff;
  --theme-input-shadow: rgba(0, 0, 0, 0.18);
  --theme-readonly-bg: rgba(22, 39, 60, 0.86);
  --theme-readonly-text: #dbe7f3;
  --theme-toolbar-bg: linear-gradient(
    180deg,
    rgba(16, 29, 43, 0.98) 0%,
    rgba(16, 29, 43, 0.94) 72%,
    rgba(16, 29, 43, 0) 100%
  );
  --theme-filter-chip-bg: rgba(12, 21, 33, 0.76);
  --theme-filter-chip-border: rgba(118, 161, 196, 0.16);
  --theme-filter-chip-active-bg: rgba(53, 211, 194, 0.14);
  --theme-filter-chip-active-border: rgba(53, 211, 194, 0.28);
  --theme-filter-chip-active-text: #d9fff7;
  --theme-tabbar-bg: rgba(8, 16, 25, 0.84);
  --theme-tabbar-border: rgba(118, 161, 196, 0.16);
  --theme-tabbar-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
  --theme-tab-text: #9eb2c9;
  --theme-tab-active-bg: rgba(53, 211, 194, 0.1);
  --theme-tab-active-text: #35d3c2;
  --theme-overlay-bg: rgba(4, 9, 14, 0.74);
  --theme-overlay-strong-bg: rgba(5, 11, 17, 0.68);
  --theme-progress-track: rgba(8, 18, 28, 0.88);
  --theme-chart-bg: rgba(27, 45, 67, 0.92);
  --theme-subtle-strong: #bfd3e7;
  --theme-option-bg: rgba(15, 29, 42, 0.78);
  --theme-option-active-bg: rgba(20, 38, 56, 0.92);
}

body[data-theme="apple"] {
  --theme-text: #0f172a;
  --theme-title: #111827;
  --theme-muted: #64748b;
  --theme-note: #6b7280;
  --theme-eyebrow: #5b6b81;
  --theme-accent: #0a84ff;
  --theme-accent-2: #68b6ff;
  --theme-accent-soft: rgba(10, 132, 255, 0.12);
  --theme-good: #34c759;
  --theme-good-soft: rgba(52, 199, 89, 0.12);
  --theme-good-border: rgba(52, 199, 89, 0.16);
  --theme-warn: #ff453a;
  --theme-warn-soft: rgba(255, 69, 58, 0.12);
  --theme-warning-bg: rgba(255, 239, 237, 0.84);
  --theme-warning-border: rgba(255, 69, 58, 0.2);
  --theme-warning-text: #b42318;
  --theme-salt-soft: rgba(245, 158, 11, 0.14);
  --theme-salt-text: #b45309;
  --theme-cal-soft: rgba(99, 102, 241, 0.1);
  --theme-cal-text: #4f46e5;
  --theme-body-bg:
    radial-gradient(circle at top left, rgba(134, 196, 255, 0.34), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.92), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f8 46%, #e8edf5 100%);
  --theme-body-overlay:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.9), transparent 18%),
    radial-gradient(circle at 84% 10%, rgba(10, 132, 255, 0.12), transparent 22%),
    radial-gradient(circle at 16% 82%, rgba(103, 232, 249, 0.16), transparent 22%),
    radial-gradient(circle at 88% 78%, rgba(59, 130, 246, 0.14), transparent 24%);
  --theme-body-glow: radial-gradient(circle, rgba(10, 132, 255, 0.1), transparent 70%);
  --theme-topbar-bg: linear-gradient(
    180deg,
    rgba(248, 250, 252, 0.88) 0%,
    rgba(248, 250, 252, 0.64) 64%,
    rgba(248, 250, 252, 0) 100%
  );
  --theme-shell-bg: rgba(255, 255, 255, 0.6);
  --theme-shell-border: rgba(255, 255, 255, 0.66);
  --theme-shell-shadow: 0 20px 55px rgba(148, 163, 184, 0.18);
  --theme-shell-filter: blur(30px) saturate(150%);
  --theme-banner-bg: rgba(255, 255, 255, 0.72);
  --theme-banner-border: rgba(255, 255, 255, 0.82);
  --theme-banner-text: #1d4f91;
  --theme-banner-shadow: 0 18px 50px rgba(148, 163, 184, 0.22);
  --theme-banner-alert-bg: rgba(255, 69, 58, 0.12);
  --theme-banner-alert-border: rgba(255, 69, 58, 0.18);
  --theme-banner-alert-text: #b42318;
  --theme-kicker-bg: rgba(255, 255, 255, 0.66);
  --theme-kicker-border: rgba(255, 255, 255, 0.78);
  --theme-kicker-text: #4b6788;
  --theme-hero-panel-bg:
    linear-gradient(140deg, rgba(255, 255, 255, 0.86), rgba(238, 244, 255, 0.7));
  --theme-hero-panel-border: rgba(255, 255, 255, 0.74);
  --theme-hero-panel-shadow: 0 18px 48px rgba(148, 163, 184, 0.18);
  --theme-hero-stat-bg: rgba(255, 255, 255, 0.7);
  --theme-hero-stat-border: rgba(148, 163, 184, 0.12);
  --theme-panel-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.84),
    rgba(245, 247, 252, 0.78)
  );
  --theme-panel-border: rgba(255, 255, 255, 0.74);
  --theme-border-strong: rgba(190, 220, 255, 0.96);
  --theme-panel-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 18px 44px rgba(148, 163, 184, 0.16);
  --theme-panel-highlight: rgba(255, 255, 255, 0.86);
  --theme-panel-hover-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92),
    rgba(240, 245, 255, 0.86)
  );
  --theme-hover-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 24px 54px rgba(148, 163, 184, 0.18);
  --theme-device-bg:
    radial-gradient(circle at top right, rgba(104, 182, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(125, 211, 252, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 247, 255, 0.8));
  --theme-device-border: rgba(255, 255, 255, 0.82);
  --theme-device-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 28px 70px rgba(148, 163, 184, 0.2);
  --theme-chip-bg: rgba(255, 255, 255, 0.72);
  --theme-chip-border: rgba(10, 132, 255, 0.12);
  --theme-chip-text: #0a84ff;
  --theme-button-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94),
    rgba(240, 244, 250, 0.88)
  );
  --theme-button-border: rgba(255, 255, 255, 0.84);
  --theme-button-text: #0f172a;
  --theme-button-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 10px 24px rgba(148, 163, 184, 0.12);
  --theme-button-hover-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 16px 34px rgba(148, 163, 184, 0.16);
  --theme-primary-bg: linear-gradient(135deg, #1990ff 0%, #66bbff 100%);
  --theme-primary-border: rgba(10, 132, 255, 0.12);
  --theme-primary-text: #ffffff;
  --theme-ghost-bg: rgba(255, 255, 255, 0.64);
  --theme-ghost-border: rgba(148, 163, 184, 0.16);
  --theme-ghost-text: #1d4f91;
  --theme-warn-bg: linear-gradient(135deg, #ff6a5d 0%, #ff453a 100%);
  --theme-warn-border: rgba(255, 69, 58, 0.16);
  --theme-input-bg: rgba(255, 255, 255, 0.72);
  --theme-input-border: rgba(148, 163, 184, 0.18);
  --theme-input-text: #0f172a;
  --theme-input-shadow: rgba(148, 163, 184, 0.08);
  --theme-readonly-bg: rgba(239, 244, 251, 0.86);
  --theme-readonly-text: #334155;
  --theme-toolbar-bg: linear-gradient(
    180deg,
    rgba(247, 249, 252, 0.96) 0%,
    rgba(247, 249, 252, 0.78) 72%,
    rgba(247, 249, 252, 0) 100%
  );
  --theme-filter-chip-bg: rgba(255, 255, 255, 0.72);
  --theme-filter-chip-border: rgba(148, 163, 184, 0.16);
  --theme-filter-chip-active-bg: rgba(10, 132, 255, 0.1);
  --theme-filter-chip-active-border: rgba(10, 132, 255, 0.18);
  --theme-filter-chip-active-text: #0a84ff;
  --theme-tabbar-bg: rgba(255, 255, 255, 0.62);
  --theme-tabbar-border: rgba(255, 255, 255, 0.8);
  --theme-tabbar-shadow: 0 20px 50px rgba(148, 163, 184, 0.22);
  --theme-tab-text: #64748b;
  --theme-tab-active-bg: rgba(10, 132, 255, 0.1);
  --theme-tab-active-text: #0a84ff;
  --theme-overlay-bg: rgba(226, 232, 240, 0.44);
  --theme-overlay-strong-bg: rgba(226, 232, 240, 0.54);
  --theme-progress-track: rgba(226, 232, 240, 0.8);
  --theme-chart-bg: rgba(255, 255, 255, 0.72);
  --theme-subtle-strong: #5f6f86;
  --theme-option-bg: rgba(255, 255, 255, 0.78);
  --theme-option-active-bg: rgba(239, 246, 255, 0.92);
}

body[data-theme="editorial"] {
  --theme-body-font: "Avenir Next";
  --theme-heading-font: Georgia, "Times New Roman", "Songti SC", serif;
  --theme-heading-tracking: -0.02em;
  --theme-text: #2b2119;
  --theme-title: #231912;
  --theme-muted: #7d6a5d;
  --theme-note: #866f60;
  --theme-eyebrow: #7b2435;
  --theme-accent: #7b2435;
  --theme-accent-2: #b45309;
  --theme-accent-soft: rgba(123, 36, 53, 0.1);
  --theme-good: #3f6b48;
  --theme-good-soft: rgba(63, 107, 72, 0.1);
  --theme-good-border: rgba(63, 107, 72, 0.14);
  --theme-warn: #b42318;
  --theme-warn-soft: rgba(180, 35, 24, 0.08);
  --theme-warning-bg: rgba(255, 241, 238, 0.86);
  --theme-warning-border: rgba(180, 35, 24, 0.12);
  --theme-warning-text: #9f1b12;
  --theme-salt-soft: rgba(180, 83, 9, 0.12);
  --theme-salt-text: #9a5310;
  --theme-cal-soft: rgba(123, 36, 53, 0.08);
  --theme-cal-text: #7b2435;
  --theme-body-bg: linear-gradient(180deg, #f7f1e7 0%, #efe4d4 54%, #e5d7c5 100%);
  --theme-body-overlay:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.3), transparent 20%);
  --theme-body-glow: radial-gradient(circle, rgba(123, 36, 53, 0.06), transparent 70%);
  --theme-topbar-bg: linear-gradient(
    180deg,
    rgba(247, 241, 231, 0.9) 0%,
    rgba(247, 241, 231, 0.66) 68%,
    rgba(247, 241, 231, 0) 100%
  );
  --theme-shell-bg: rgba(255, 250, 243, 0.7);
  --theme-shell-border: rgba(35, 25, 18, 0.08);
  --theme-shell-shadow: 0 16px 36px rgba(92, 67, 50, 0.08);
  --theme-shell-filter: blur(18px);
  --theme-banner-bg: rgba(255, 250, 243, 0.88);
  --theme-banner-border: rgba(35, 25, 18, 0.08);
  --theme-banner-text: #6b1f2f;
  --theme-banner-shadow: 0 14px 30px rgba(92, 67, 50, 0.08);
  --theme-banner-alert-bg: rgba(123, 36, 53, 0.08);
  --theme-banner-alert-border: rgba(123, 36, 53, 0.12);
  --theme-banner-alert-text: #7b2435;
  --theme-kicker-bg: rgba(123, 36, 53, 0.06);
  --theme-kicker-border: rgba(123, 36, 53, 0.12);
  --theme-kicker-text: #7b2435;
  --theme-hero-panel-bg: rgba(255, 249, 240, 0.78);
  --theme-hero-panel-border: rgba(35, 25, 18, 0.08);
  --theme-hero-panel-shadow: 0 16px 32px rgba(92, 67, 50, 0.08);
  --theme-hero-stat-bg: rgba(255, 252, 247, 0.92);
  --theme-hero-stat-border: rgba(35, 25, 18, 0.06);
  --theme-panel-bg: linear-gradient(180deg, rgba(255, 250, 243, 0.82), rgba(248, 240, 228, 0.86));
  --theme-panel-border: rgba(35, 25, 18, 0.08);
  --theme-border-strong: rgba(123, 36, 53, 0.18);
  --theme-panel-shadow: 0 12px 26px rgba(92, 67, 50, 0.08);
  --theme-panel-highlight: rgba(255, 255, 255, 0.8);
  --theme-panel-hover-bg: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(247, 239, 227, 0.92));
  --theme-hover-shadow: 0 16px 32px rgba(92, 67, 50, 0.1);
  --theme-device-bg:
    radial-gradient(circle at top right, rgba(123, 36, 53, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(247, 239, 227, 0.9));
  --theme-device-border: rgba(35, 25, 18, 0.08);
  --theme-device-shadow: 0 18px 40px rgba(92, 67, 50, 0.1);
  --theme-chip-bg: rgba(123, 36, 53, 0.06);
  --theme-chip-border: rgba(123, 36, 53, 0.1);
  --theme-chip-text: #7b2435;
  --theme-button-bg: linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(246, 238, 226, 0.94));
  --theme-button-border: rgba(35, 25, 18, 0.08);
  --theme-button-text: #2b2119;
  --theme-button-shadow: 0 8px 18px rgba(92, 67, 50, 0.06);
  --theme-button-hover-shadow: 0 12px 22px rgba(92, 67, 50, 0.08);
  --theme-primary-bg: linear-gradient(135deg, #7b2435 0%, #b45309 100%);
  --theme-primary-border: rgba(123, 36, 53, 0.14);
  --theme-primary-text: #ffffff;
  --theme-ghost-bg: rgba(123, 36, 53, 0.04);
  --theme-ghost-border: rgba(123, 36, 53, 0.08);
  --theme-ghost-text: #7b2435;
  --theme-warn-bg: linear-gradient(135deg, #c13f35 0%, #b42318 100%);
  --theme-warn-border: rgba(180, 35, 24, 0.12);
  --theme-input-bg: rgba(255, 253, 249, 0.94);
  --theme-input-border: rgba(35, 25, 18, 0.08);
  --theme-input-text: #2b2119;
  --theme-input-shadow: rgba(92, 67, 50, 0.04);
  --theme-readonly-bg: rgba(244, 234, 220, 0.92);
  --theme-readonly-text: #5a4638;
  --theme-toolbar-bg: linear-gradient(
    180deg,
    rgba(250, 245, 238, 0.96) 0%,
    rgba(250, 245, 238, 0.82) 72%,
    rgba(250, 245, 238, 0) 100%
  );
  --theme-filter-chip-bg: rgba(255, 252, 247, 0.94);
  --theme-filter-chip-border: rgba(35, 25, 18, 0.08);
  --theme-filter-chip-active-bg: rgba(123, 36, 53, 0.08);
  --theme-filter-chip-active-border: rgba(123, 36, 53, 0.14);
  --theme-filter-chip-active-text: #7b2435;
  --theme-tabbar-bg: rgba(255, 248, 240, 0.84);
  --theme-tabbar-border: rgba(35, 25, 18, 0.08);
  --theme-tabbar-shadow: 0 16px 32px rgba(92, 67, 50, 0.12);
  --theme-tab-text: #866f60;
  --theme-tab-active-bg: rgba(123, 36, 53, 0.08);
  --theme-tab-active-text: #7b2435;
  --theme-overlay-bg: rgba(230, 220, 207, 0.56);
  --theme-overlay-strong-bg: rgba(230, 220, 207, 0.72);
  --theme-progress-track: rgba(230, 220, 207, 0.9);
  --theme-chart-bg: rgba(255, 252, 247, 0.9);
  --theme-subtle-strong: #6c594d;
  --theme-option-bg: rgba(255, 250, 243, 0.9);
  --theme-option-active-bg: rgba(255, 245, 236, 0.98);
}

body[data-theme="retro"] {
  --theme-body-font: "SF Mono", "Menlo", "Consolas", monospace;
  --theme-heading-font: "SF Mono", "Menlo", "Consolas", monospace;
  --theme-heading-tracking: -0.01em;
  --theme-text: #c9ffd8;
  --theme-title: #e8ffe9;
  --theme-muted: #7ab58a;
  --theme-note: #88c999;
  --theme-eyebrow: #8fff93;
  --theme-accent: #7dff6c;
  --theme-accent-2: #d6ff5c;
  --theme-accent-soft: rgba(125, 255, 108, 0.12);
  --theme-good: #8fff93;
  --theme-good-soft: rgba(143, 255, 147, 0.1);
  --theme-good-border: rgba(143, 255, 147, 0.16);
  --theme-warn: #ffb347;
  --theme-warn-soft: rgba(255, 179, 71, 0.1);
  --theme-warning-bg: rgba(46, 28, 8, 0.9);
  --theme-warning-border: rgba(255, 179, 71, 0.18);
  --theme-warning-text: #ffd48a;
  --theme-salt-soft: rgba(255, 179, 71, 0.12);
  --theme-salt-text: #ffd48a;
  --theme-cal-soft: rgba(125, 255, 108, 0.08);
  --theme-cal-text: #aaff97;
  --theme-body-bg:
    radial-gradient(circle at 15% 18%, rgba(125, 255, 108, 0.08), transparent 18%),
    linear-gradient(180deg, #07100b 0%, #0a140d 46%, #0b120d 100%);
  --theme-body-overlay:
    linear-gradient(90deg, rgba(125, 255, 108, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(125, 255, 108, 0.03) 1px, transparent 1px);
  --theme-body-overlay-opacity: 0.26;
  --theme-body-glow: radial-gradient(circle, rgba(125, 255, 108, 0.12), transparent 70%);
  --theme-topbar-bg: linear-gradient(
    180deg,
    rgba(5, 10, 7, 0.9) 0%,
    rgba(5, 10, 7, 0.42) 68%,
    rgba(5, 10, 7, 0) 100%
  );
  --theme-shell-bg: rgba(8, 16, 11, 0.78);
  --theme-shell-border: rgba(125, 255, 108, 0.1);
  --theme-shell-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --theme-shell-filter: blur(18px);
  --theme-banner-bg: rgba(9, 19, 12, 0.9);
  --theme-banner-border: rgba(125, 255, 108, 0.12);
  --theme-banner-text: #b8ffb0;
  --theme-banner-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  --theme-banner-alert-bg: rgba(255, 179, 71, 0.14);
  --theme-banner-alert-border: rgba(255, 179, 71, 0.18);
  --theme-banner-alert-text: #ffd48a;
  --theme-kicker-bg: rgba(125, 255, 108, 0.06);
  --theme-kicker-border: rgba(125, 255, 108, 0.12);
  --theme-kicker-text: #8fff93;
  --theme-hero-panel-bg: rgba(9, 18, 12, 0.84);
  --theme-hero-panel-border: rgba(125, 255, 108, 0.1);
  --theme-hero-panel-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
  --theme-hero-stat-bg: rgba(10, 22, 14, 0.88);
  --theme-hero-stat-border: rgba(125, 255, 108, 0.08);
  --theme-panel-bg: linear-gradient(180deg, rgba(10, 18, 12, 0.9), rgba(8, 14, 10, 0.94));
  --theme-panel-border: rgba(125, 255, 108, 0.1);
  --theme-border-strong: rgba(125, 255, 108, 0.2);
  --theme-panel-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  --theme-panel-highlight: rgba(125, 255, 108, 0.1);
  --theme-panel-hover-bg: linear-gradient(180deg, rgba(12, 24, 15, 0.96), rgba(9, 16, 12, 0.96));
  --theme-hover-shadow:
    0 0 0 1px rgba(125, 255, 108, 0.1),
    0 16px 30px rgba(0, 0, 0, 0.28);
  --theme-device-bg:
    radial-gradient(circle at top right, rgba(125, 255, 108, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(12, 24, 15, 0.94), rgba(8, 14, 10, 0.98));
  --theme-device-border: rgba(125, 255, 108, 0.12);
  --theme-device-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  --theme-chip-bg: rgba(125, 255, 108, 0.08);
  --theme-chip-border: rgba(125, 255, 108, 0.12);
  --theme-chip-text: #aaff97;
  --theme-button-bg: linear-gradient(180deg, rgba(12, 24, 15, 0.96), rgba(9, 18, 12, 0.96));
  --theme-button-border: rgba(125, 255, 108, 0.12);
  --theme-button-text: #d7ffd0;
  --theme-button-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  --theme-button-hover-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
  --theme-primary-bg: linear-gradient(135deg, #5fd152 0%, #bfff6c 100%);
  --theme-primary-border: rgba(125, 255, 108, 0.14);
  --theme-primary-text: #08110b;
  --theme-ghost-bg: rgba(125, 255, 108, 0.05);
  --theme-ghost-border: rgba(125, 255, 108, 0.1);
  --theme-ghost-text: #aaff97;
  --theme-warn-bg: linear-gradient(135deg, #f5a548 0%, #ffb347 100%);
  --theme-warn-border: rgba(255, 179, 71, 0.16);
  --theme-input-bg: rgba(7, 15, 9, 0.92);
  --theme-input-border: rgba(125, 255, 108, 0.1);
  --theme-input-text: #e8ffe9;
  --theme-input-shadow: rgba(0, 0, 0, 0.2);
  --theme-readonly-bg: rgba(13, 24, 16, 0.92);
  --theme-readonly-text: #a7d2a4;
  --theme-toolbar-bg: linear-gradient(
    180deg,
    rgba(9, 18, 12, 0.96) 0%,
    rgba(9, 18, 12, 0.82) 72%,
    rgba(9, 18, 12, 0) 100%
  );
  --theme-filter-chip-bg: rgba(10, 19, 12, 0.92);
  --theme-filter-chip-border: rgba(125, 255, 108, 0.1);
  --theme-filter-chip-active-bg: rgba(125, 255, 108, 0.1);
  --theme-filter-chip-active-border: rgba(125, 255, 108, 0.16);
  --theme-filter-chip-active-text: #caffbc;
  --theme-tabbar-bg: rgba(8, 14, 10, 0.9);
  --theme-tabbar-border: rgba(125, 255, 108, 0.1);
  --theme-tabbar-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
  --theme-tab-text: #7ab58a;
  --theme-tab-active-bg: rgba(125, 255, 108, 0.1);
  --theme-tab-active-text: #caffbc;
  --theme-overlay-bg: rgba(4, 8, 5, 0.72);
  --theme-overlay-strong-bg: rgba(4, 8, 5, 0.82);
  --theme-progress-track: rgba(10, 19, 12, 0.96);
  --theme-chart-bg: rgba(11, 20, 13, 0.94);
  --theme-subtle-strong: #9bc59c;
  --theme-option-bg: rgba(9, 18, 11, 0.9);
  --theme-option-active-bg: rgba(12, 24, 15, 0.98);
}

@media (min-width: 1100px) {
  body[data-theme] .app {
    grid-template-columns: 236px minmax(0, 1fr);
    column-gap: 30px;
    padding: 22px 22px 28px;
  }

  body[data-theme] .topbar {
    padding: 0;
    background: transparent;
    backdrop-filter: none;
  }

  body[data-theme] .topbar-shell {
    min-height: 104px;
  }

  body[data-theme] .content {
    padding: 0 8px 12px 0;
  }

  body[data-theme] .tabbar {
    top: 22px;
    padding: 16px;
    border-radius: 34px;
  }

  body[data-theme] .tab-btn {
    min-height: 56px;
    justify-content: flex-start;
    padding: 0 16px;
  }

  body[data-theme] .theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-theme] .sheet {
    width: min(900px, calc(100vw - 320px));
  }
}

@media (max-width: 759px) {
  body[data-theme] .topbar {
    padding: 0;
  }

  body[data-theme] .topbar-shell {
    min-height: auto;
    padding: 18px;
    border-radius: 26px;
  }

  body[data-theme] .banner {
    top: calc(env(safe-area-inset-top, 0px) + 18px);
  }

  body[data-theme] .banner-text {
    padding: 0 48px;
  }

  body[data-theme] .theme-toolbar {
    flex-direction: column;
  }

  body[data-theme] .theme-grid {
    grid-template-columns: 1fr 1fr;
  }

  body[data-theme] .content {
    padding-bottom: 194px;
  }

  body[data-theme] .tabbar {
    width: min(calc(100vw - 24px), 760px);
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 18px));
  }
}

@media (max-width: 420px) {
  body[data-theme] .topbar-shell {
    padding: 16px;
  }

  body[data-theme] .topbar .title {
    font-size: 28px;
  }

  body[data-theme] .topbar-note {
    font-size: 13px;
  }

  body[data-theme] .banner-text {
    padding: 0 42px;
  }

  body[data-theme] .hero-panel {
    padding: 14px;
  }

  body[data-theme] .hero-stat {
    padding: 13px 14px;
  }

  body[data-theme] .theme-grid {
    grid-template-columns: 1fr;
  }
}
