:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --bg: #101112;
  --panel: #17191b;
  --panel-2: #1c1f22;
  --line: #2b2f33;
  --text: #f2f4f5;
  --muted: #8e969e;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { min-width: 320px; font-size: 13px; }
button, input, select { font: inherit; letter-spacing: 0; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #111315; }
.login-panel { width: min(380px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 22px 70px rgba(0,0,0,.32); }
.brand-lockup, .sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-lockup img { width: 30px; height: 30px; }
.brand-lockup strong, .sidebar-brand strong { font-size: 13px; }
h1 { margin: 24px 0 20px; font-size: 18px; }
.field-label { display: block; margin: 13px 0 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field, .select { width: 100%; height: 40px; padding: 0 12px; color: var(--text); border: 1px solid var(--line); border-radius: 7px; outline: none; background: #121416; }
.field:focus, .select:focus { border-color: rgba(59,130,246,.75); }
.password-field { position: relative; }
.password-field .field { padding-right: 44px; }
.password-field .icon-button { position: absolute; top: 4px; right: 4px; }
.icon-button { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-button:hover { color: #fff; background: rgba(255,255,255,.055); }
.icon-button svg { width: 16px; height: 16px; }
.primary-button, .secondary-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 7px; color: #fff; font-weight: 700; }
.primary-button { background: var(--blue-2); }
.primary-button:hover { background: var(--blue); }
.secondary-button { color: #d8dde1; border: 1px solid var(--line); background: var(--panel-2); }
.secondary-button:hover { color: #fff; background: #25292d; }
.primary-button svg, .secondary-button svg { width: 15px; height: 15px; }
#login-submit { width: 100%; margin-top: 20px; }
.form-state { min-height: 18px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.form-state.error { color: var(--red); }
.app-view { width: 100%; min-height: 100vh; display: grid; grid-template-columns: 212px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #151719; }
.sidebar-brand { height: 60px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.sidebar-brand img { width: 26px; height: 26px; }
.nav-list { display: flex; flex-direction: column; gap: 3px; padding: 14px 10px; }
.nav-button { position: relative; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 7px; color: #9aa1a8; background: transparent; text-align: left; }
.nav-button:hover { color: #fff; background: rgba(255,255,255,.045); }
.nav-button.is-active { color: #fff; background: rgba(59,130,246,.16); }
.nav-button svg { width: 16px; height: 16px; }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: #fff; background: #dc2626; font-size: 10px; }
.sidebar-footer { margin-top: auto; height: 44px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: #626a72; border-top: 1px solid var(--line); font-size: 10px; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: #6b7280; }
.health-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(52,211,153,.48); }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(16,17,18,.96); backdrop-filter: blur(12px); }
.topbar h2 { margin: 0; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.admin-name { padding: 0 8px; color: var(--muted); font-size: 11px; }
.content { padding: 24px; }
.page { display: none; }
.page.is-active { display: block; }
.metric-band { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-band > div { min-width: 0; padding: 18px 16px; }
.metric-band > div + div { border-left: 1px solid var(--line); }
.metric-band span { display: block; color: var(--muted); font-size: 11px; }
.metric-band strong { display: block; margin-top: 7px; font-size: 22px; font-weight: 650; }
.section-block { margin-top: 28px; }
.section-title { height: 40px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.section-title h3 { margin: 0; font-size: 12px; }
.daily-chart { min-height: 248px; display: grid; grid-template-columns: repeat(14, minmax(18px, 1fr)); gap: 10px; align-items: end; padding: 24px 6px 0; }
.chart-column { min-width: 0; height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.chart-count { color: #aab1b7; font-size: 10px; }
.chart-bar { width: min(26px, 70%); min-height: 2px; border-radius: 3px 3px 0 0; background: var(--blue); }
.chart-label { color: #626a72; font-size: 9px; white-space: nowrap; }
.toolbar { min-height: 52px; display: flex; align-items: center; justify-content: flex-start; gap: 9px; border-bottom: 1px solid var(--line); }
.search-box { width: min(360px, 100%); position: relative; }
.search-box svg { position: absolute; top: 12px; left: 12px; width: 15px; height: 15px; color: var(--muted); }
.search-box input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 7px; outline: none; color: var(--text); background: #121416; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 40px; color: #747d85; font-size: 10px; text-align: left; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { height: 58px; padding-right: 16px; color: #cbd0d4; font-size: 11px; border-bottom: 1px solid rgba(43,47,51,.8); vertical-align: middle; }
td:last-child, th:last-child { padding-right: 0; }
.user-cell { min-width: 180px; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: center; }
.avatar, .generation-thumb { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #202326; border: 1px solid var(--line); }
.generation-thumb { border-radius: 5px; cursor: zoom-in; }
.primary-line { max-width: 260px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.secondary-line { max-width: 260px; margin-top: 3px; overflow: hidden; color: #717981; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 5px; background: #24282b; color: #b8bec3; font-size: 10px; }
.status.active, .status.approved { color: var(--green); background: rgba(52,211,153,.1); }
.status.disabled, .status.rejected { color: var(--red); background: rgba(251,113,133,.1); }
.status.pending { color: var(--amber); background: rgba(251,191,36,.1); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.pagination { min-height: 48px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 11px; }
.service-list { border-top: 1px solid var(--line); }
.service-list > div { min-height: 58px; display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 16px; align-items: center; border-bottom: 1px solid var(--line); }
.service-list span { color: var(--muted); }
.service-list strong, .service-list code { overflow-wrap: anywhere; color: var(--text); font-size: 11px; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.68); backdrop-filter: blur(7px); }
.dialog { width: min(560px, 100%); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.dialog header, .dialog footer { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); }
.dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.dialog h3 { margin: 0; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; padding: 20px; }
.form-grid label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.image-modal img { max-width: min(920px,90vw); max-height: 86vh; object-fit: contain; }
.image-close { position: fixed; top: 18px; right: 18px; color: #fff; background: rgba(0,0,0,.35); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; max-width: min(420px,calc(100vw - 40px)); padding: 10px 14px; border: 1px solid var(--line); border-radius: 7px; background: #202326; color: #fff; font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%,8px); transition: opacity .16s ease, transform .16s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.empty-row { height: 120px; color: #636b72; text-align: center; }
@media (max-width: 860px) {
  .app-view { grid-template-columns: 60px minmax(0,1fr); }
  .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-brand strong, .nav-button span, .nav-badge, .sidebar-footer span:first-child { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .sidebar-footer { justify-content: center; padding: 0; }
  .metric-band { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-band > div { border-bottom: 1px solid var(--line); }
  .metric-band > div + div { border-left: 0; }
  .metric-band > div:nth-child(even) { border-left: 1px solid var(--line); }
  .daily-chart { gap: 5px; }
}
@media (max-width: 560px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .admin-name { display: none; }
  .toolbar { align-items: stretch; padding: 8px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .service-list > div { grid-template-columns: 92px minmax(0,1fr); }
}
