/*
 * OpenChatCut Pro 授权后台
 * 设计取自仓库 DESIGN.md「The Precision Editing Desk」：中性底色、Timeline Blue 只做强调、
 * Geist / Geist Mono、字重封顶 500、控件三档高度（28 / 32 / 36）、圆角刻度 4 / 6 / 8 / 12。
 * 深色为主，跟随系统切浅色，也可手动固定。
 */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --canvas: #0d0d0d;
  --panel: #141414;
  --card: #141414;
  --overlay: #181818;
  --hover: #262626;
  --active: #242424;
  --line: #292929;
  --line-strong: #292929;
  --ink: #dedede;
  --ink-strong: #f2f2f2;
  --ink-muted: #8c8c8c;
  --accent: #16a9f3;
  --accent-deep: #0284c5;
  --accent-text: hsl(200 98% 61%);
  --accent-soft: hsl(204 100% 12%);
  --on-accent: #121212;
  --danger: hsl(0 84% 60%);
  --danger-soft: rgb(240 82 82 / 0.14);
  --success: #23d160;
  --success-soft: rgb(35 209 96 / 0.12);
  --warning: #f7b23b;
  --warning-soft: rgb(247 178 59 / 0.14);
  --scrim: rgb(0 0 0 / 0.55);
  --shadow-overlay: 0 16px 48px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.04);
  --font-sans: "Geist", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --z-sticky: 20;
  --z-modal-backdrop: 200;
  --z-modal: 250;
  --z-floating: 300;
  --z-toast: 400;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --canvas: hsl(0 0% 97%);
    --panel: #ffffff;
    --card: #ffffff;
    --overlay: #ffffff;
    --hover: hsl(0 0% 96%);
    --active: hsl(0 0% 93%);
    --line: hsl(0 0% 91%);
    --line-strong: hsl(0 0% 87%);
    --ink: hsl(0 0% 11%);
    --ink-strong: hsl(0 0% 2%);
    --ink-muted: hsl(0 0% 43%);
    --accent: #16a9f3;
    --accent-deep: #0284c5;
    --accent-text: hsl(200 98% 32%);
    --accent-soft: hsl(204 100% 97%);
    --danger: hsl(0 83% 46%);
    --danger-soft: hsl(0 83% 46% / 0.08);
    --success: hsl(141 72% 30%);
    --success-soft: hsl(141 72% 30% / 0.09);
    --warning: hsl(38 92% 30%);
    --warning-soft: hsl(38 92% 45% / 0.12);
    --scrim: rgb(15 15 15 / 0.35);
    --shadow-overlay: 0 16px 48px rgb(15 15 15 / 0.16), 0 0 0 1px rgb(15 15 15 / 0.06);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --canvas: hsl(0 0% 97%);
  --panel: #ffffff;
  --card: #ffffff;
  --overlay: #ffffff;
  --hover: hsl(0 0% 96%);
  --active: hsl(0 0% 93%);
  --line: hsl(0 0% 91%);
  --line-strong: hsl(0 0% 87%);
  --ink: hsl(0 0% 11%);
  --ink-strong: hsl(0 0% 2%);
  --ink-muted: hsl(0 0% 43%);
  --accent: #16a9f3;
  --accent-deep: #0284c5;
  --accent-text: hsl(200 98% 32%);
  --accent-soft: hsl(204 100% 97%);
  --danger: hsl(0 83% 46%);
  --danger-soft: hsl(0 83% 46% / 0.08);
  --success: hsl(141 72% 30%);
  --success-soft: hsl(141 72% 30% / 0.09);
  --warning: hsl(38 92% 30%);
  --warning-soft: hsl(38 92% 45% / 0.12);
  --scrim: rgb(15 15 15 / 0.35);
  --shadow-overlay: 0 16px 48px rgb(15 15 15 / 0.16), 0 0 0 1px rgb(15 15 15 / 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5714;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  cursor: pointer;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.num,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.muted {
  color: var(--ink-muted);
}
.nowrap {
  white-space: nowrap;
}
.ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 骨架 */

.app {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  height: 100dvh;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}
.brand strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-strong);
}
.brand span {
  font-size: 12px;
  color: var(--ink-muted);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-item:hover {
  background: var(--hover);
  color: var(--ink);
}
.nav-item[aria-current="page"] {
  background: var(--active);
  color: var(--ink-strong);
}
.nav-item .label {
  flex: 1;
}
.nav-item .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}
.nav-item .count.alert {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  line-height: 18px;
  text-align: center;
}
.side-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.page-head .titles {
  flex: 1;
  min-width: 0;
}
.page-head h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-strong);
}
.page-head .sub {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.page-head .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.toolbar .grow {
  flex: 1;
}
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
  scrollbar-gutter: stable;
}
.legal {
  margin: 28px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------- 控件 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover {
  background: var(--hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.danger {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn.ghost {
  border-color: transparent;
}
.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.btn.lg {
  height: 36px;
  padding: 0 16px;
}
.btn.icon {
  width: 32px;
  padding: 0;
  border-color: transparent;
}
.btn.icon.sm {
  width: 28px;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
}
.link-btn:hover {
  text-decoration: underline;
}

.seg {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.seg button:hover {
  color: var(--ink);
}
.seg button[aria-pressed="true"] {
  background: var(--active);
  color: var(--ink-strong);
}
.seg button .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}
.field .help {
  font-size: 12px;
  color: var(--ink-muted);
}
.field .error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
}
.input,
.select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 13px;
}
.input::placeholder {
  color: var(--ink-muted);
}
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.select.sm,
.input.sm {
  height: 28px;
  font-size: 12px;
}
.select {
  padding-right: 28px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  max-width: 220px;
}
.select.on {
  border-color: var(--accent);
  color: var(--accent-text);
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
}
.search .ic {
  position: absolute;
  left: 9px;
  color: var(--ink-muted);
  pointer-events: none;
}
.search .input {
  width: 100%;
  padding-left: 30px;
}

/* ---------------------------------------------------------------- 徽标 / 标签 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--active);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.badge.success {
  background: var(--success-soft);
  color: var(--success);
}
.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 数字卡 / 面板 */

/* 换行弹性布局而不是网格：网格在 5 格排成 2+2+1、4+1 时会留出露底色的空格，
   弹性布局让最后一行的格子自己撑满 */
.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}
.tile {
  flex: 1 1 150px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 0;
  background: var(--card);
  text-align: left;
}
button.tile:hover {
  background: var(--hover);
}
.tile .value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color: var(--ink-strong);
}
.tile .label {
  font-size: 12px;
  color: var(--ink-muted);
}
.tile.tone-danger .value {
  color: var(--danger);
}
.tile.tone-warning .value {
  color: var(--warning);
}
.tile.tone-success .value {
  color: var(--success);
}
.tile.tone-accent .value {
  color: var(--accent-text);
}
.tile[aria-pressed="true"] {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  min-width: 0;
}
.panel + .panel {
  margin-top: 16px;
}
.grid-2 .panel + .panel {
  margin-top: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  flex: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-strong);
}
.panel-body {
  padding: 4px 16px 8px;
}
.rows > * + * {
  border-top: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 0;
  font-size: 13px;
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row .ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: -4px 0 20px;
  font-size: 12px;
  color: var(--ink-muted);
}
.strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.strip .tone-danger {
  color: var(--danger);
}
.strip .tone-warning {
  color: var(--warning);
}
.bar {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------------------------------------------------------------- 模型配置 */

.model-coverage {
  margin: -4px 0 16px;
  font-size: 12px;
}
.row .model-key {
  max-width: 46%;
}
.row.clickable {
  cursor: pointer;
}
.row.clickable:hover .model-key,
.row.clickable:hover .mono {
  color: var(--ink-strong);
}
.row .share {
  width: 40px;
  text-align: right;
}
.stack {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.stack > span {
  height: 100%;
}
.auth-api_key {
  background: var(--accent);
}
.auth-oauth {
  background: var(--success);
}
.auth-local_cli {
  background: var(--warning);
}
.auth-none {
  background: var(--ink-muted);
}
.model-legend {
  display: inline-flex;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-muted);
}
.model-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.model-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 360px;
  height: 28px;
  padding: 0 2px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.filter-chip .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-head {
  margin-top: 12px;
}
.change-log {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.7;
}

/* ---------------------------------------------------------------- 表格 */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.table td {
  height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.table tbody tr:hover {
  background: var(--hover);
}
.table tbody tr.selected {
  background: var(--active);
}
.table .r {
  text-align: right;
}
.table .msg {
  max-width: 0;
  width: 100%;
}
.table .msg .line1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-strong);
}
.table .msg .line2 {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-muted);
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.table-wrap .table th {
  background: var(--card);
}
.table-wrap .table tr:last-child td {
  border-bottom: 0;
}
.more {
  display: flex;
  justify-content: center;
  padding: 16px 0 0;
}

/* ---------------------------------------------------------------- 空态 / 骨架 / 错误 */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 16px;
  text-align: center;
}
.empty strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-strong);
}
.empty p {
  max-width: 44ch;
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.skeleton {
  display: block;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--active) 0%, var(--hover) 50%, var(--active) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
}
.notice.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------------------------------------------------------- 抽屉 / 对话框 / 提示 */

.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  background: var(--scrim);
  animation: fade-in 0.15s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  width: min(640px, 100vw);
  background: var(--overlay);
  box-shadow: var(--shadow-overlay);
  animation: slide-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 16px 10px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.section + .section {
  margin-top: 24px;
}
.section h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}
.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  color: var(--ink-muted);
}
.kv dd {
  margin: 0;
  min-width: 0;
  word-break: break-all;
}
.message-block {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.code-block {
  max-height: 320px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}
.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.status-bar .grow {
  flex: 1;
  min-width: 160px;
  font-size: 12px;
  color: var(--ink-muted);
}
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}
.timeline li {
  display: grid;
  grid-template-columns: 64px 72px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li:last-child {
  border-bottom: 0;
  color: var(--ink-strong);
}
.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 24px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--overlay);
  box-shadow: var(--shadow-overlay);
  animation: pop-in 0.15s ease;
}
.dialog h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-strong);
}
.dialog p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}
.dialog .input,
.dialog .select {
  height: 36px;
  width: 100%;
  max-width: none;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog .seg {
  height: 36px;
  width: 100%;
}
.dialog .seg button {
  flex: 1;
  justify-content: center;
  height: 30px;
  font-size: 13px;
}
.gen-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
}
.gen-list .row {
  min-height: 32px;
  padding: 0;
}
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--ink-strong);
  color: var(--canvas);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-overlay);
  animation: pop-in 0.15s ease;
}
.toast.danger {
  background: var(--danger);
  color: #fff;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- 登录 */

.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 16px;
}
.login-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(380px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.login-card h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-strong);
}
.login-card .sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}
.login-card .input {
  height: 36px;
  width: 100%;
}
.login-card .legal {
  margin: 0;
}
.boot {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------- 地图 */

.map-canvas {
  width: 100%;
  height: 520px;
}

/* ---------------------------------------------------------------- 窄屏 */

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2 .panel + .panel {
    margin-top: 0;
  }
}

@media (max-width: 767px) {
  body {
    overflow: auto;
  }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100dvh;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
  }
  .brand {
    display: none;
  }
  /* 手机上侧栏变成横向滚动条，底部的刷新、主题、改密、退出跟在导航后面，不能藏 */
  .side-foot {
    flex-direction: row;
    padding-top: 0;
    padding-left: 8px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .nav {
    flex-direction: row;
  }
  .nav-item {
    height: 44px;
    white-space: nowrap;
  }
  .main {
    height: auto;
  }
  .page-head,
  .toolbar,
  .page-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .page-body {
    overflow: visible;
  }
  .search {
    min-width: 0;
    flex: 1 1 100%;
  }
  .table thead {
    display: none;
  }
  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }
  .table tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }
  .table td {
    height: auto;
    padding: 2px 0;
    border: 0;
  }
  .table td[data-label]::before {
    content: attr(data-label) "  ";
    color: var(--ink-muted);
    font-size: 12px;
  }
  .table .msg {
    max-width: none;
  }
  .table .r {
    text-align: left;
  }
  .kv {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  .map-canvas {
    height: 380px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------------------------------------------------------------- 购买分析 */

.pc-chart {
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 150px;
}
.pc-col {
  flex: 1 1 0;
  min-width: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.pc-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  opacity: 0.7;
}
.pc-col:hover .pc-bar {
  opacity: 1;
}
.pc-day {
  font-size: 10px;
  line-height: 1;
  height: 10px;
  color: var(--ink-muted);
  white-space: nowrap;
}
