:root {
  --surface: #f3f5f4;
  --panel: #fff;
  --ink: #0a0d0c;
  --muted: #68736e;
  --line: #d9dfdc;
  --accent: #16e477;
  --accent-soft: #dffff0;
  --danger: #d92d20;
  --warning: #f59e0b;
  --warning-soft: #fff7e6;
  --font-heading: Geist, Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-data: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font-body); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--accent); color: var(--ink); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 13px; font-weight: 750; letter-spacing: .04em; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-data); }
.danger { color: var(--danger); }
.success { color: #087a43; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.btn { min-height: 42px; border: 1px solid var(--line); border-radius: 0; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--panel); color: var(--ink); font-weight: 650; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary .icon { color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.icon-btn { width: 42px; height: 42px; padding: 0; }
.input, .select, .textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 0 13px; outline: none; }
.textarea { min-height: 82px; padding-top: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.select-compact { max-width: 150px; }
.notice-top { margin-top: 14px; }
.notice-bottom { margin-bottom: 18px; }
.btn-block-top { width: 100%; margin-top: 12px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 12px; font-weight: 650; }
.form-stack { display: grid; gap: 18px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.notice { display: flex; gap: 10px; padding: 13px; border: 1px solid var(--line); background: #f7f8f7; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice-success { border-color: transparent; background: var(--accent-soft); color: #17633f; }
.notice-warning { border-color: #f0c977; background: var(--warning-soft); color: #7a5208; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; background: #eef1ef; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge-success { background: var(--accent-soft); color: #087a43; }
.badge-warning { background: #fff4d8; color: #9a6200; }
.badge-danger { background: #fdecec; color: var(--danger); }

.public-page { min-height: 100vh; display: grid; grid-template-columns: minmax(520px, 55%) 1fr; background: var(--panel); }
.public-hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 56px 64px; background: var(--ink); color: #fff; }
.hero-copy { max-width: 590px; }
.secure-label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; background: #173525; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.secure-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero-copy h1 { margin: 20px 0 18px; font-family: var(--font-heading); font-size: clamp(42px, 4.3vw, 62px); line-height: 1.06; letter-spacing: -.035em; }
.hero-copy > p { max-width: 530px; color: #aeb8b3; font-size: 15px; line-height: 1.7; }
.ip-box { margin-top: 26px; max-width: 520px; display: flex; justify-content: space-between; align-items: center; padding: 17px 19px; border: 1px solid #3a4540; }
.ip-box span { display: block; color: #8d9a94; font-size: 11px; margin-bottom: 5px; }
.ip-box strong { font-family: var(--font-data); font-size: 18px; }
.ip-box .icon { color: var(--accent); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step { display: grid; gap: 6px; }
.step b { color: var(--accent); font-size: 11px; }
.step span { color: #d5dbd8; font-size: 12px; }
.public-panel { display: grid; place-items: center; padding: 70px 80px; }
.public-form { width: min(100%, 480px); display: grid; gap: 24px; }
.public-form h2 { margin: -6px 0 0; font-family: var(--font-heading); font-size: 36px; letter-spacing: -.02em; }
.public-form > p { margin: -10px 0 0; color: var(--muted); line-height: 1.6; }
.code-input { min-height: 54px; border-color: var(--ink); font-family: var(--font-data); letter-spacing: .04em; }
.submit-wide { width: 100%; min-height: 52px; justify-content: space-between; }
.success-mark { width: 58px; height: 58px; display: grid; place-items: center; background: var(--accent); }
.success-mark .icon { width: 29px; height: 29px; }
.result-list { border: 1px solid var(--line); background: #f7f8f7; }
.result-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.result-row:last-child { border-bottom: 0; }
.result-row span { color: var(--muted); }
.result-row strong { font-family: var(--font-data); font-size: 12px; }

.login-page .public-hero { flex-basis: 43%; }
.login-page { grid-template-columns: 43% 57%; }
.login-security { border-top: 1px solid #303a35; }
.security-row { display: flex; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid #303a35; }
.security-row .icon { color: var(--accent); }
.security-row span { display: block; color: #8d9a94; font-size: 11px; margin-bottom: 3px; }
.security-row strong { font-size: 12px; }

.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 28px 18px; background: var(--ink); color: #fff; }
.sidebar-top { display: grid; gap: 34px; }
.side-nav { display: grid; gap: 5px; }
.nav-link { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; background: transparent; color: #cdd4d0; font-size: 13px; text-align: left; }
.nav-link .icon { color: #849089; }
.nav-link.active { background: var(--accent); color: var(--ink); font-weight: 700; }
.nav-link.active .icon { color: var(--ink); }
.account { display: grid; grid-template-columns: 32px 1fr 18px; gap: 10px; align-items: center; padding: 16px 8px 0; border-top: 1px solid #303a35; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; background: #25302b; color: var(--accent); font-weight: 750; }
.account strong, .account small { display: block; }
.account small { margin-top: 3px; color: #85918b; font-size: 10px; }
.mobile-logout { display: none; }
.admin-content { min-width: 0; }
.topbar { min-height: 76px; display: flex; justify-content: space-between; align-items: center; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar small, .topbar strong { display: block; }
.topbar small { color: var(--muted); margin-bottom: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.logout-action { min-height: 36px; padding: 0 12px; }
.health { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.health::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.page { padding: 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font: 650 30px/1.15 var(--font-heading); letter-spacing: -.025em; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 13px; top: 13px; color: var(--muted); }
.search .input { padding-left: 40px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.metric { min-height: 126px; display: grid; gap: 11px; padding: 18px; border: 1px solid var(--line); background: var(--panel); }
.metric-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric strong { font: 650 30px/1 var(--font-data); }
.metric small { color: #0b7b47; font-weight: 650; }
.metric-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.metric-dark .metric-head { color: #aeb8b3; }
.status-bar { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; background: var(--ink); color: #fff; }
.status-bar > div { display: flex; align-items: center; gap: 12px; }
.status-box { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: var(--ink); }
.status-bar strong, .status-bar small { display: block; }
.status-bar small { color: #9aa59f; margin-top: 3px; }
.status-bar > b { color: var(--accent); font: 600 12px var(--font-data); }
.panel { border: 1px solid var(--line); background: var(--panel); }
.panel-head { min-height: 56px; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 15px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
.list-row { display: flex; justify-content: space-between; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row strong, .list-row small { display: block; }
.list-row small { margin-top: 4px; color: var(--muted); }

.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
.data-table th { height: 44px; padding: 0 12px; background: #f8faf9; color: var(--muted); font-size: 11px; text-align: left; white-space: nowrap; }
.data-table td { min-height: 60px; padding: 14px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; vertical-align: middle; }
.data-table td strong { color: var(--ink); }
.table-actions { display: flex; align-items: center; gap: 12px; }
.pagination { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 12px; border: 1px solid var(--line); border-top: 0; background: var(--panel); color: var(--muted); font-size: 11px; }
.pagination-actions { display: flex; align-items: center; gap: 10px; }
.pagination-actions label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.pagination-actions .select { width: 68px; min-height: 34px; padding: 0 24px 0 9px; }
.pagination-actions .btn { min-height: 34px; padding: 0 11px; }
.pagination-actions .btn:disabled { cursor: not-allowed; opacity: .4; }
.pagination-actions strong { min-width: 52px; color: var(--ink); text-align: center; }
.text-btn { padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 11px; font-weight: 650; }
.text-btn.danger { color: var(--danger); }
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; }
.drawer { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer-head h2 { margin: 0; font-size: 17px; }
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 20px; background: var(--line); }
.stat { display: flex; gap: 12px; align-items: center; padding: 17px 18px; background: var(--panel); }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; background: #eff2f0; }
.stat small, .stat strong { display: block; }
.stat small { color: var(--muted); }
.stat strong { margin-top: 4px; }
.current-access { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: var(--ink); color: #fff; }
.current-access > div { display: flex; align-items: center; gap: 12px; }
.current-access .status-box { width: 36px; height: 36px; }
.current-access small { display: block; color: #9aa59f; margin-top: 3px; }
.settings-tabs { display: flex; gap: 24px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.settings-tabs button { padding: 0 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12px; }
.settings-tabs button.active { border-color: var(--accent); color: var(--ink); font-weight: 650; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; }
.settings-column { display: grid; align-content: start; gap: 18px; }
.settings-card { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.settings-card h2 { margin: 0 0 6px; font-size: 16px; }
.settings-card > p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.setting-row { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { font-size: 12px; }
.setting-row small { margin-top: 4px; color: var(--muted); }
.setting-row .select, .setting-row .input { width: 170px; min-height: 38px; }
.settings-card { scroll-margin-top: 18px; }
.admin-user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.current-user-label { display: inline-block; margin-left: 6px; padding: 2px 5px; background: var(--accent-soft); color: #087a43; font-size: 9px; font-weight: 650; }
.toggle { width: 40px; height: 22px; padding: 3px; border: 0; background: #cbd2ce; display: flex; align-items: center; }
.toggle::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.toggle.on { justify-content: flex-end; background: var(--ink); }
.toggle.on::after { background: var(--accent); }
.component-status { padding: 20px; background: var(--ink); color: #fff; }
.component-status h2 { margin: 0 0 15px; font-size: 15px; }
.component-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 11px; }
.component-row span:first-child::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); }
.component-row small { color: #9aa59f; }

.bottom-nav { display: none; }
.mobile-cards { display: none; }
.mobile-shortcuts { display: none; }
.card-list { gap: 10px; }
.entity-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); background: var(--panel); }
.entity-card-head, .entity-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.entity-card p { margin: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.entity-card small { color: var(--muted); }

.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 16px; background: var(--ink); color: #fff; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 0; background: var(--panel); }
.modal::backdrop { background: #0a0d0c99; }
.modal-inner { padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.code-output { padding: 13px; border: 1px solid var(--line); background: #f7f8f7; font: 600 13px/1.8 var(--font-data); overflow-wrap: anywhere; }
.empty { padding: 42px 20px; color: var(--muted); text-align: center; }
.loading { padding: 50px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .split-layout { grid-template-columns: 1fr; }
  .drawer { display: none; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  body { padding-bottom: 68px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .mobile-cards { display: grid !important; }
  .mobile-shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
  .public-page, .login-page { min-height: calc(100vh - 68px); display: block; }
  .public-hero { min-height: auto; padding: 28px 20px 34px; gap: 28px; }
  .hero-copy h1 { margin: 14px 0 12px; font-size: 36px; }
  .hero-copy > p { font-size: 13px; }
  .ip-box { margin-top: 20px; padding: 14px 15px; }
  .steps, .login-security { display: none; }
  .public-panel { display: block; padding: 28px 20px 34px; }
  .public-form { width: 100%; gap: 20px; }
  .public-form h2 { font-size: 28px; }
  .success-mark { width: 52px; height: 52px; }
  .admin-layout { display: block; min-height: calc(100vh - 68px); }
  .sidebar { position: static; width: 100%; height: 64px; padding: 0 18px; display: flex; flex-direction: row; align-items: center; }
  .sidebar-top { display: block; }
  .sidebar .brand-mark { width: 28px; height: 28px; }
  .side-nav, .account { display: none; }
  .mobile-logout { display: flex; align-items: center; gap: 6px; color: #fff; }
  .topbar { display: none; }
  .page { padding: 24px 18px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 26px; }
  .page-head .btn:not(.icon-btn) span { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar .select { flex: 1; }
  .metrics { gap: 10px; margin-bottom: 16px; }
  .metric { min-height: 104px; padding: 14px; }
  .metric strong { font-size: 24px; }
  .status-bar { padding: 14px; }
  .dashboard-grid { display: block; }
  .dashboard-grid > :last-child { display: none; }
  .panel-head { min-height: 50px; padding: 0 14px; }
  .list-row { padding: 13px 14px; }
  .data-table-wrap { display: none; }
  .mobile-cards { margin-top: 10px; }
  .pagination { margin-top: 10px; padding: 12px; border-top: 1px solid var(--line); flex-direction: column; align-items: stretch; }
  .pagination-actions { justify-content: space-between; }
  .pagination-actions label { display: none; }
  .stats-strip { margin-bottom: 16px; }
  .stat { padding: 14px; }
  .stat-icon { display: none; }
  .current-access { padding: 14px; }
  .current-access .badge { display: none; }
  .settings-tabs { gap: 8px; overflow-x: auto; border: 0; }
  .settings-tabs button { flex: 1 0 auto; padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); }
  .settings-tabs button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
  .settings-card { padding: 16px; }
  .setting-row { min-height: 68px; }
  .setting-row .select, .setting-row .input { width: 125px; }
  .admin-user-row { align-items: flex-start; padding: 12px 0; }
  .admin-user-actions { flex-wrap: wrap; gap: 8px; }
  .bottom-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: 68px; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 10px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: #fffffff2; backdrop-filter: blur(12px); }
  .bottom-link { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 9px; }
  .bottom-link .icon { width: 18px; height: 18px; }
  .bottom-link.active { background: var(--accent-soft); color: #087a43; font-weight: 650; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .toast { left: 16px; right: 16px; bottom: 82px; max-width: none; }
}
.clipboard-helper {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}
