/*
 * GroupDataHub light theme, adapted from the YssAtm visual language.
 * Shared by the console, monitoring screen, and Qianchuan dashboard.
 */
:root {
  color-scheme: light;
  --brand-ink: #0a1628;
  --brand-cyan: #00b4d8;
  --brand-cyan-dim: #0096b8;
  --brand-mist: #e6f6fb;
  --bg: #f7fafd;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f3f8fb;
  --panel-3: #eaf6fa;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --grid-line: #edf2f7;
  --text: #0a1628;
  --text-dim: #4a5b72;
  --muted: #6c7c90;
  --faint: #93a1b2;
  --fg: #0a1628;
  --dim: #6c7c90;
  --ln: #e2e8f0;
  --accent: #00b4d8;
  --cyan: #00b4d8;
  --info: #0096b8;
  --gold: #00b4d8;
  --ok: #15803d;
  --up: #15803d;
  --warn: #a96913;
  --danger: #d13b4c;
  --down: #d13b4c;
  --sim: #52708f;
  --ok-bg: #eaf8ef;
  --info-bg: #e8f7fb;
  --warn-bg: #fff7e8;
  --danger-bg: #fff0f2;
  --accent-bg: #e6f6fb;
  --shadow-card: 0 1px 2px rgba(10, 22, 40, 0.04), 0 10px 28px -20px rgba(10, 22, 40, 0.22);
  --shadow-lift: 0 2px 4px rgba(10, 22, 40, 0.06), 0 24px 56px -28px rgba(10, 22, 40, 0.3);
  --sans: "Public Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

html {
  background: #f7fafd;
}

body.theme-yss {
  background: #f7fafd;
  color: #0a1628;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.theme-yss * {
  letter-spacing: 0 !important;
  scrollbar-color: #cbd5e1 transparent;
}

body.theme-yss ::selection {
  background: #bdebf4;
  color: #0a1628;
}

body.theme-yss ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

body.theme-yss ::-webkit-scrollbar-thumb:hover {
  background: #a8b7c7;
}

body.theme-yss button,
body.theme-yss input,
body.theme-yss select,
body.theme-yss textarea {
  font-family: var(--sans);
}

body.theme-yss button:focus-visible,
body.theme-yss a:focus-visible,
body.theme-yss input:focus-visible,
body.theme-yss select:focus-visible,
body.theme-yss textarea:focus-visible {
  outline: 2px solid #00b4d8;
  outline-offset: 2px;
}

/* Main application */
.app-page {
  --topbar-h: 60px;
  --sidebar-w: 232px;
}

.app-page .topbar {
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: #e2e8f0;
  box-shadow: 0 1px 0 rgba(10, 22, 40, 0.02);
  backdrop-filter: blur(12px);
}

.app-page .brand {
  color: #0a1628;
  font-size: 15px;
  font-weight: 700;
}

.app-page .brand .mk,
.app-page .gate-card .g-brand .mk {
  background: #0a1628;
  color: #ffffff;
  box-shadow: none;
}

.app-page .brand .env {
  background: #f7fafd;
  border-color: #e2e8f0;
  color: #6c7c90;
}

.app-page .whoami .role {
  color: #007e99;
  background: #e6f6fb;
  border-color: #bdebf4;
}

.app-page .sidebar {
  padding: 16px 12px;
  background: #ffffff;
  border-right-color: #e2e8f0;
}

.app-page .nav-cap {
  color: #93a1b2;
  font-weight: 700;
}

.app-page .nav-item {
  color: #4a5b72;
  border-radius: 6px;
}

.app-page .nav-item:hover {
  background: #f7fafd;
  color: #0a1628;
}

.app-page .nav-item.active {
  background: #e6f6fb;
  color: #0a1628;
  font-weight: 650;
}

.app-page .nav-item.active::before {
  background: #00b4d8;
}

.app-page .nav-item .badge {
  background: #f3f8fb;
  color: #6c7c90;
}

.app-page .sidebar-foot {
  color: #93a1b2;
  border-top-color: #e2e8f0;
}

.app-page .content {
  padding: 28px 32px 64px;
}

.app-page .view-head h2 {
  color: #0a1628;
  font-size: 20px;
  font-weight: 750;
}

.app-page .btn {
  background: #ffffff;
  color: #0a1628;
  border-color: #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(10, 22, 40, 0.03);
}

.app-page .btn:hover {
  background: #f7fafd;
  border-color: #93a1b2;
}

.app-page .btn.primary {
  background: #0a1628;
  border-color: #0a1628;
  color: #ffffff;
}

.app-page .btn.primary:hover {
  background: #00a4c6;
  border-color: #00a4c6;
}

.app-page .btn.ai-btn {
  color: #007e99;
  border-color: #82d8e8;
}

.app-page .btn.ai-btn:hover {
  background: #e6f6fb;
  border-color: #00b4d8;
  color: #006b82;
}

.app-page .kpi,
.app-page .panel,
.app-page .chart-card {
  background: #ffffff;
  border-color: #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

/* The content-domain KPI also carries class="content"; isolate it from the main layout class. */
.app-page .kpi.content {
  width: auto;
  max-width: none;
  margin-left: 0;
  padding: 18px 20px;
}

.app-page .kpi .k-num,
.app-page .chart-card .c-v {
  color: #0a1628;
}

.app-page input.in,
.app-page select.in,
.app-page textarea.in {
  background: #ffffff;
  color: #0a1628;
  border-color: #cbd5e1;
  border-radius: 6px;
}

.app-page input.in:focus,
.app-page select.in:focus,
.app-page textarea.in:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.14);
}

.app-page input.in::placeholder,
.app-page textarea.in::placeholder {
  color: #93a1b2;
}

.app-page pre.out,
.app-page .chart-empty {
  background: #f7fafd;
  border-color: #e2e8f0;
  color: #4a5b72;
}

.app-page .callout.ok { color: #126b35; }
.app-page .callout.info { color: #006f86; }
.app-page .callout.warn { color: #81520f; }
.app-page .callout.danger { color: #a82937; }

.app-page .tbl-wrap {
  background: #ffffff;
  border-color: #e2e8f0;
  border-radius: 8px;
}

.app-page table.tbl th {
  background: #f7fafd;
  color: #6c7c90;
  border-bottom-color: #e2e8f0;
}

.app-page table.tbl td {
  color: #4a5b72;
  border-bottom-color: #edf2f7;
}

.app-page table.tbl tr:hover td {
  background: #f3f8fb;
}

.app-page .gate {
  background: rgba(247, 250, 253, 0.94);
  backdrop-filter: blur(10px);
}

.app-page .gate-card {
  background: #ffffff;
  border-color: #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
}

.app-page .gate-card h1 {
  color: #0a1628;
  font-weight: 750;
}

.app-page .gate-foot code {
  background: #f3f8fb;
  color: #4a5b72;
}

/* Monitoring screen */
.screen-page {
  background: #f7fafd !important;
}

.screen-page .hdr {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: #e2e8f0;
  box-shadow: 0 1px 0 rgba(10, 22, 40, 0.03);
  backdrop-filter: blur(12px);
}

.screen-page .hdr .mk {
  background: #0a1628;
  color: #ffffff;
  box-shadow: none;
}

.screen-page .hdr .ttl,
.screen-page .clock {
  color: #0a1628;
  text-shadow: none;
}

.screen-page .hdr .ttl small {
  color: #007e99;
}

.screen-page .loginbar {
  background: #fff0f2;
  border-bottom-color: #f3c7cd;
}

.screen-page .loginbar input {
  background: #ffffff;
  color: #0a1628;
  border-color: #cbd5e1;
}

.screen-page .loginbar input:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.14);
}

.screen-page .loginbar button {
  background: #0a1628;
  border-color: #0a1628;
  color: #ffffff;
}

.screen-page .loginbar button:hover {
  background: #00a4c6;
  border-color: #00a4c6;
}

.screen-page .kpi,
.screen-page .cell {
  background: #ffffff;
  border-color: #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.screen-page .kpi::after {
  display: none;
}

.screen-page .kpi:hover {
  border-color: #cbd5e1;
  transform: none;
}

.screen-page .kpi .num {
  color: #0a1628;
}

.screen-page .kpi .yoy,
.screen-page .arow .aact {
  background: #f3f8fb;
  color: #6c7c90;
}

.screen-page .tk {
  background: #f7fafd;
  border-color: #e2e8f0;
  border-radius: 6px;
}

.screen-page .mbar {
  background: #edf2f7;
}

.screen-page .mbar > i {
  background: linear-gradient(90deg, #82d8e8, #00b4d8);
}

.screen-page .mbar.wait {
  background: repeating-linear-gradient(45deg, #f7fafd, #f7fafd 6px, #edf2f7 6px, #edf2f7 12px);
}

.screen-page .lamp {
  background: #f3f8fb;
  border-color: #e2e8f0;
}

.screen-page .lamp.ok,
.screen-page .lamp.bad {
  box-shadow: none;
}

.screen-page .fbar {
  background: linear-gradient(90deg, #00b4d8, #0096b8);
  color: #ffffff;
}

.screen-page .fbar.empty {
  background: #edf2f7;
  color: #6c7c90;
}

.screen-page .tbl-wrap {
  background: #ffffff;
  border-color: #e2e8f0;
}

.screen-page table.tbl th {
  background: #f7fafd;
  border-bottom-color: #e2e8f0;
}

.screen-page table.tbl td,
.screen-page .arow {
  border-bottom-color: #edf2f7;
}

.screen-page table.tbl tr:hover td,
.screen-page .arow:hover {
  background: #f3f8fb;
}

/* Qianchuan dashboard */
.qianchuan-page {
  background: #f7fafd;
  color: #0a1628;
}

.qianchuan-page .wrap {
  max-width: 1280px;
  padding: 28px;
}

.qianchuan-page h1 {
  color: #0a1628;
  font-size: 20px;
  font-weight: 750;
}

.qianchuan-page .bar {
  min-height: 48px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}

.qianchuan-page .tag {
  background: #f3f8fb;
  border-color: #e2e8f0;
  color: #6c7c90;
}

.qianchuan-page .tag.sim {
  background: #eef3f8;
  color: #52708f;
  border-color: #cbd5e1;
}

.qianchuan-page .card {
  background: #ffffff;
  border-color: #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.qianchuan-page .kpi .v {
  color: #0a1628;
}

.qianchuan-page th {
  background: #f7fafd;
  color: #6c7c90;
  border-bottom-color: #e2e8f0;
}

.qianchuan-page td {
  color: #4a5b72;
  border-bottom-color: #edf2f7;
}

.qianchuan-page .chart .b {
  background: linear-gradient(180deg, #00b4d8, #0096b8);
}

.qianchuan-page .chart .b:hover::after {
  background: #0a1628;
  color: #ffffff;
}

.qianchuan-page button {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0a1628;
  border-radius: 6px;
}

.qianchuan-page button:hover {
  background: #f7fafd;
  border-color: #00b4d8;
}

.qianchuan-page button.pri {
  background: #0a1628;
  border: 1px solid #0a1628;
  color: #ffffff;
}

.qianchuan-page button.pri:hover {
  background: #00a4c6;
  border-color: #00a4c6;
}

.qianchuan-page button.ok {
  background: #15803d;
}

.qianchuan-page button.no {
  color: #d13b4c;
  border-color: #e8a7b0;
}

.qianchuan-page .advice {
  background: #f7fafd;
  border-left-color: #00b4d8;
  border-radius: 0 6px 6px 0;
}

.qianchuan-page .advice.risk-high {
  border-left-color: #d13b4c;
}

.qianchuan-page .advice.risk-mid {
  border-left-color: #a96913;
}

.qianchuan-page #login {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 28px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
}

.qianchuan-page #login input {
  background: #ffffff;
  color: #0a1628;
  border-color: #cbd5e1;
  border-radius: 6px;
}

.qianchuan-page #login input:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.14);
  outline: none;
}

@media (max-width: 820px) {
  .app-page {
    --topbar-h: 56px;
    --sidebar-w: 0px;
  }

  .app-page .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .app-page .brand .env,
  .app-page .health,
  .app-page .whoami .role,
  .app-page .whoami .name {
    display: none;
  }

  .app-page .layout {
    padding-top: calc(var(--topbar-h) + 48px);
  }

  .app-page .sidebar {
    top: var(--topbar-h);
    right: 0;
    bottom: auto;
    width: 100%;
    height: 48px;
    z-index: 25;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .app-page .nav-cap,
  .app-page .sidebar-foot {
    display: none;
  }

  .app-page .nav-item {
    flex: none;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .app-page .nav-item.active::before {
    top: auto;
    right: 8px;
    bottom: 0;
    left: 8px;
    width: auto;
    height: 2px;
  }

  .app-page .content {
    width: 100%;
    margin-left: 0;
    padding: 20px 14px 48px;
  }

  .app-page .view-head {
    align-items: flex-start;
  }

  .screen-page .hdr {
    padding: 0 14px;
    gap: 10px;
  }

  .screen-page .hdr .env,
  .screen-page .refresh {
    display: none;
  }

  .screen-page .screen {
    padding: 12px;
  }

  .qianchuan-page .wrap {
    padding: 18px 14px 32px;
  }
}

@media (max-width: 520px) {
  .app-page .brand {
    font-size: 13px;
  }

  .app-page .brand .mk {
    width: 20px;
    height: 20px;
  }

  .app-page .gate-card {
    padding: 24px 20px;
  }

  .screen-page .hdr .ttl small,
  .screen-page .health {
    display: none;
  }

  .screen-page .clock {
    font-size: 15px;
  }

  .qianchuan-page .bar {
    align-items: flex-start;
  }
}

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