/* 交付中心的样式。token 的含义见 delivery/center/DESIGN.md，名字一一对应。 */

:root {
  --color-canvas: oklch(0.968 0.006 275);
  --color-canvas-sunken: oklch(0.935 0.008 275);
  --color-surface: oklch(1 0 0);
  --color-surface-sunken: oklch(0.975 0.004 275);
  --color-fill: oklch(0.945 0.008 275);
  --color-shell: oklch(0.235 0.035 275);
  --color-shell-hover: oklch(0.3 0.04 275);
  --color-shell-active: oklch(0.36 0.09 275);
  --color-shell-line: oklch(0.32 0.03 275);
  --color-shell-text: oklch(0.8 0.02 275);
  --color-shell-text-strong: oklch(0.98 0.005 275);
  --color-text: oklch(0.22 0.015 275);
  --color-text-muted: oklch(0.47 0.015 275);
  --color-border: oklch(0.905 0.008 275);
  --color-border-control: oklch(0.6 0.012 275);
  --color-accent: oklch(0.47 0.17 275);
  --color-accent-hover: oklch(0.4 0.17 275);
  --color-accent-subtle: oklch(0.945 0.03 275);
  --color-on-accent: oklch(1 0 0);
  --color-success: oklch(0.47 0.11 155);
  --color-success-subtle: oklch(0.95 0.04 155);
  --color-warning: oklch(0.5 0.11 65);
  --color-warning-subtle: oklch(0.96 0.05 85);
  --color-danger: oklch(0.5 0.18 27);
  --color-danger-hover: oklch(0.43 0.17 27);
  --color-danger-subtle: oklch(0.96 0.03 27);
  --color-selection: oklch(0.88 0.06 275);

  --font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-label: 0.75rem;
  --font-data: 0.875rem;
  --font-reading: 1rem;
  --font-section: 1.125rem;
  --font-page: 1.35rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-control: 6px;
  --radius-panel: 10px;
  --radius-overlay: 12px;
  --radius-pill: 999px;
  --shadow-float: 0 0 0 1px oklch(0 0 0 / 0.06), 0 1px 2px -1px oklch(0 0 0 / 0.06), 0 4px 12px 0 oklch(0 0 0 / 0.06);
  --shadow-popover: var(--shadow-float), 0 12px 28px -8px oklch(0 0 0 / 0.14);

  --duration-instant: 120ms;
  --duration-state: 200ms;
  --duration-icon: 300ms;
  --duration-exit: 150ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-width: 216px;
  --content-width: 1120px;
  --content-gutter: 40px;

  color-scheme: light;
  scrollbar-color: var(--color-border-control) transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-data);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-canvas);
  caret-color: var(--color-accent);
}

::selection { background: var(--color-selection); }

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--color-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--color-text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.icon { width: 16px; height: 16px; flex: none; }

/* ---- 外壳：深色侧栏 + 有底色的画布 ---- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--color-shell);
  color: var(--color-shell-text);
  scrollbar-color: var(--color-shell-line) transparent;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-3) var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-size: var(--font-reading);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--color-shell-text-strong);
  padding: var(--space-1) 10px 0;
}
/* 深色底上焦点环用浅色，强调色在这上面不够 3:1。 */
.sidebar :focus-visible { outline-color: var(--color-shell-text-strong); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-shell-line); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav a, .account-actions a, .account-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-control);
  border: 0;
  background: transparent;
  color: var(--color-shell-text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-instant) var(--ease-standard);
}

.nav a:hover, .account-actions a:hover, .account-actions button:hover { background: var(--color-shell-hover); color: var(--color-shell-text-strong); text-decoration: none; }
.nav a[aria-current="page"], .account-actions a[aria-current="page"] { background: var(--color-shell-active); color: var(--color-shell-text-strong); font-weight: 600; }
.account-actions button:disabled { cursor: not-allowed; opacity: 0.55; }

.account { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--color-shell-line); display: flex; flex-direction: column; gap: 2px; }
.account-name { display: flex; flex-direction: column; padding: 0 10px var(--space-2); min-width: 0; }
.account-name .label { font-size: var(--font-label); color: var(--color-shell-text); }
.account-name strong { font-weight: 600; overflow-wrap: anywhere; color: var(--color-shell-text-strong); }
.account-actions { display: flex; flex-direction: column; gap: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.content {
  width: 100%;
  max-width: calc(var(--content-width) + 2 * var(--content-gutter));
  padding: var(--space-6) var(--content-gutter) var(--space-7);
  min-width: 0;
  flex: 1;
}

/* 换页时焦点移到内容区，是给读屏和键盘用的落点，不画焦点环。 */
.content:focus { outline: none; }

.footnote {
  max-width: calc(var(--content-width) + 2 * var(--content-gutter));
  padding: 0 var(--content-gutter) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-label);
}

/* ---- 页面头 ---- */

.breadcrumb { margin-bottom: var(--space-2); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); list-style: none; margin: 0; padding: 0; color: var(--color-text-muted); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb [aria-current="page"] { color: var(--color-text); overflow-wrap: anywhere; }
.breadcrumb .icon { width: 12px; height: 12px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
}

.page-head > :first-child { min-width: 0; flex: 1 1 320px; }
.page-head h1 { font-size: var(--font-page); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.page-head .title-line { display: flex; align-items: center; gap: var(--space-2) var(--space-3); flex-wrap: wrap; min-width: 0; }
.page-head .subtitle { color: var(--color-text-muted); margin-top: var(--space-1); max-width: 70ch; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); flex: none; max-width: 100%; }
.page-head .actions .spacer { width: var(--space-2); }

.situation { display: flex; align-items: flex-start; gap: var(--space-2); margin-top: var(--space-3); max-width: 70ch; }
.situation .icon { margin-top: 3px; color: var(--color-text-muted); }
.situation.success .icon { color: var(--color-success); }
.situation.warning .icon { color: var(--color-warning); }
.situation.info .icon { color: var(--color-accent); }

.section { margin-top: var(--space-6); }
.section > h2, .section-head h2 { font-size: var(--font-section); font-weight: 600; line-height: 1.35; }
.section > h2 { margin-bottom: var(--space-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.section-note { color: var(--color-text-muted); margin: calc(-1 * var(--space-1)) 0 var(--space-3); max-width: 70ch; }

/* ---- 按钮 ---- */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration-instant) var(--ease-standard), border-color var(--duration-instant) var(--ease-standard), color var(--duration-instant) var(--ease-standard), transform var(--duration-instant) var(--ease-standard);
}

/* 看得见的高度是 34，命中区上下各撑 3 到 40。 */
.button::after { content: ""; position: absolute; inset: -3px 0; }

.button.has-icon { padding-left: 12px; }
.button:hover { background: var(--color-surface-sunken); color: var(--color-text); text-decoration: none; }
.button:active:not(:disabled) { transform: scale(0.96); }
.button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.button.primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-on-accent); }
.button.danger { color: var(--color-danger); border-color: transparent; background: transparent; }
.button.danger:hover { background: var(--color-danger-subtle); color: var(--color-danger-hover); }
.button.danger-solid { background: var(--color-danger); border-color: var(--color-danger); color: var(--color-on-accent); }
.button.danger-solid:hover { background: var(--color-danger-hover); border-color: var(--color-danger-hover); color: var(--color-on-accent); }
.button.quiet { border-color: transparent; background: transparent; }
.button.quiet:hover { background: var(--color-fill); }
.button.small { min-height: 28px; padding: 0 10px; }
.button.small.has-icon { padding-left: 8px; }
.button.small::after { inset: 0; }
.button:disabled { cursor: not-allowed; opacity: 0.5; }
.button:disabled:active { transform: none; }

/* 表格行内、筛选条上的按钮只变色不缩放 */
.table .button:active, .toolbar .button:active, .pager .button:active { transform: none; }

.action-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.action-hint { color: var(--color-text-muted); font-size: var(--font-label); }

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--font-label);
  font-weight: 500;
  white-space: nowrap;
  background: var(--color-fill);
  color: var(--color-text-muted);
}

.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border); }
.badge.success { background: var(--color-success-subtle); color: var(--color-success); }
.badge.warning { background: var(--color-warning-subtle); color: var(--color-warning); }
.badge.danger { background: var(--color-danger-subtle); color: var(--color-danger); }
.badge.info { background: var(--color-accent-subtle); color: var(--color-accent); }

.badges { display: inline-flex; gap: var(--space-1); flex-wrap: wrap; }

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

/* 一张带边框的白色面；表头有底色，圆角跟着面走（内圆角 = 外圆角 - 边框 1） */
.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-panel); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-4); vertical-align: top; }
.table th:first-child, .table td:first-child { padding-left: var(--space-5); }
.table th:last-child, .table td:last-child { padding-right: var(--space-5); }
.table th {
  font-size: var(--font-label);
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-sunken);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.table thead th:first-child { border-top-left-radius: calc(var(--radius-panel) - 1px); }
.table thead th:last-child { border-top-right-radius: calc(var(--radius-panel) - 1px); }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--radius-panel) - 1px); }
.table tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--radius-panel) - 1px); }
.table td { border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.table td.text, .table td.wrap-anywhere { white-space: normal; min-width: 14ch; max-width: 36ch; overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--duration-instant) var(--ease-standard); }
.table tbody tr:hover { background: var(--color-surface-sunken); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.end, .table th.end { text-align: right; }
.table .wrap-anywhere { overflow-wrap: anywhere; }
.table .nowrap { white-space: nowrap; }
.table .cell-main { font-weight: 500; }
.table .cell-sub { color: var(--color-text-muted); font-size: var(--font-label); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-3); padding: 0 var(--space-1); color: var(--color-text-muted); font-size: var(--font-label); }
.pager .action-bar { gap: var(--space-2); }

/* ---- 筛选条 ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-3);
  min-height: 34px;
}

.filter { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.filter > label, .filter > .label { color: var(--color-text-muted); white-space: nowrap; }
.filter .select, .filter input { width: auto; max-width: 240px; }
.filter input[type="search"] { width: 180px; }

/* 状态的分段筛选：外圈 8 = 内圈 6 + 间距 2 */
.tabs {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: calc(var(--radius-control) + 2px);
  background: var(--color-canvas-sunken);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-control);
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-instant) var(--ease-standard);
}
.tabs a:hover { color: var(--color-text); text-decoration: none; }
.tabs a[aria-current="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: 0 0 0 1px var(--color-border), 0 1px 2px -1px oklch(0 0 0 / 0.12); }

/* ---- 表单 ---- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 640px;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}
/* 独立表单页底部的操作栏：贴着面的下沿，一条分隔线加浅底 */
.form > .form-actions {
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  border-radius: 0 0 calc(var(--radius-panel) - 1px) calc(var(--radius-panel) - 1px);
}
/* 面板里、登录卡片里的表单不再套一层面 */
.panel .form, .login-card .form { padding: 0; background: transparent; border: 0; border-radius: 0; }
.panel .form > .form-actions, .login-card .form > .form-actions { margin: 0; padding: 0; border: 0; background: transparent; border-radius: 0; }
.form.wide { max-width: 800px; }
/* 表单里留给提示的空位，没有内容时不占间距。 */
.form > div:empty { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label, fieldset > legend { font-weight: 500; color: var(--color-text); }
.help { color: var(--color-text-muted); font-size: var(--font-label); }
.field .field-error { color: var(--color-danger); font-size: var(--font-label); }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }

input[type="text"], input[type="password"], input[type="search"], textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  min-height: 34px;
  padding: 5px 10px;
  width: 100%;
  transition: border-color var(--duration-instant) var(--ease-standard);
}

textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--font-mono); font-size: 0.8125rem; min-height: 160px; }
input:hover, textarea:hover { border-color: var(--color-text-muted); }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 0; border-color: var(--color-accent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--color-danger); }
input:disabled, textarea:disabled { background: var(--color-surface-sunken); color: var(--color-text-muted); cursor: not-allowed; }
::placeholder { color: var(--color-text-muted); opacity: 1; }


fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend { padding: 0; margin-bottom: var(--space-2); }
fieldset > .help { margin-top: var(--space-2); }

.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 28px; cursor: pointer; }

/* 单选的两个选项：整块可点，选中的那块有整圈强调色的边 */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px var(--space-2);
  align-items: center;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color var(--duration-instant) var(--ease-standard), background-color var(--duration-instant) var(--ease-standard);
}
.choice:hover { border-color: var(--color-border-control); }
.choice:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.choice .choice-title { font-weight: 500; }
.choice .choice-note { grid-column: 2; color: var(--color-text-muted); font-size: var(--font-label); }

.service-list { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); }
.service-item { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
.service-item:last-child { border-bottom: 0; }
.service-item .features { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: var(--space-1) 0 0 var(--space-5); }

.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ---- 自己画的控件：下拉、日期时间、文件选择、勾选和单选 ----
   原生的这几样点开后是系统自己的菜单和日历，和界面不是一套，所以收起和点开两头都在这里画。 */

.select {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 8px 5px 10px;
  font: inherit;
  color: var(--color-text);
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color var(--duration-instant) var(--ease-standard);
}
.select:hover { border-color: var(--color-text-muted); }
.select:focus-visible, .select[aria-expanded="true"] { outline: 2px solid var(--color-accent); outline-offset: 0; border-color: var(--color-accent); }
.select[aria-invalid="true"] { border-color: var(--color-danger); }
.select:disabled { background: var(--color-surface-sunken); color: var(--color-text-muted); cursor: not-allowed; }
/* 所有选项的文字叠在同一格里：控件按最长的那个定宽，选了哪个都不跳。 */
.select-value { display: grid; flex: 1; min-width: 0; }
.select-value > * { grid-area: 1 / 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-sizer { visibility: hidden; height: 0; }
.select.is-placeholder .select-text { color: var(--color-text-muted); }
.select-arrow { color: var(--color-text-muted); transition: transform var(--duration-state) var(--ease-standard); }
.select[aria-expanded="true"] .select-arrow { transform: rotate(180deg); }

/* 弹出层：外圆角 10 = 选项的圆角 6 + 内边距 4 */
.popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  background: var(--color-surface);
  border-radius: calc(var(--radius-control) + var(--space-1));
  box-shadow: var(--shadow-popover);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  animation: popover-in var(--duration-exit) var(--ease-enter);
}
.popover[data-side="top"] { animation-name: popover-in-up; }
@keyframes popover-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes popover-in-up { from { opacity: 0; transform: translateY(4px); } }

.menu { padding: var(--space-1); max-height: 320px; max-width: min(480px, calc(100vw - 16px)); }
.menu-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 32px;
  padding: 5px 8px 5px 10px;
  border-radius: var(--radius-control);
  cursor: default;
}
.menu-option.is-active { background: var(--color-fill); }
.menu-option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.menu-option-check { visibility: hidden; color: var(--color-accent); }
.menu-option[aria-selected="true"] { font-weight: 500; }
.menu-option[aria-selected="true"] .menu-option-check { visibility: visible; }
.menu-empty { padding: var(--space-2) 10px; color: var(--color-text-muted); }

.datetime {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  transition: border-color var(--duration-instant) var(--ease-standard);
}
.datetime:hover { border-color: var(--color-text-muted); }
.datetime:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 0; border-color: var(--color-accent); }
.datetime.is-invalid { border-color: var(--color-danger); }
.datetime input[type="text"] {
  width: auto;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.datetime input[type="text"]:focus-visible { outline: none; }
.datetime input[aria-invalid="true"] { color: var(--color-danger); }
.datetime .datetime-date { flex: 1; min-width: 0; }
.datetime .datetime-time { flex: none; width: 68px; }
.datetime-divider { align-self: stretch; width: 1px; margin: 7px 0; background: var(--color-border); }
.datetime-open, .calendar-nav {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-instant) var(--ease-standard);
}
.datetime-open { margin-right: 2px; }
.datetime-open:hover, .datetime-open[aria-expanded="true"], .calendar-nav:hover { background: var(--color-fill); color: var(--color-text); }
.datetime-open:focus-visible { outline-offset: -2px; }

/* 日历：7 列 32 的格子，间距 2 */
.calendar { padding: var(--space-3); }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.calendar-title { font-weight: 500; font-variant-numeric: tabular-nums; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 2px; }
.calendar-week span { height: 24px; line-height: 24px; text-align: center; color: var(--color-text-muted); font-size: var(--font-label); }
.calendar-day {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.calendar-day:hover { background: var(--color-fill); }
.calendar-day[data-outside] { color: var(--color-text-muted); }
.calendar-day[aria-current="date"] { font-weight: 600; box-shadow: inset 0 0 0 1px var(--color-border-control); }
.calendar-day[aria-selected="true"] { background: var(--color-accent); color: var(--color-on-accent); box-shadow: none; }
.calendar-day:focus-visible { outline-offset: 1px; }
.calendar-foot { display: flex; justify-content: flex-end; margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border); }

.file-picker { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.file-input:focus-visible + label { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-control);
  cursor: pointer;
  transition: background-color var(--duration-instant) var(--ease-standard), border-color var(--duration-instant) var(--ease-standard);
}
input[type="checkbox"] { border-radius: 4px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before, input[type="radio"]::before {
  content: "";
  background: var(--color-on-accent);
  transform: scale(0);
  transition: transform var(--duration-instant) var(--ease-standard);
}
input[type="checkbox"]::before { width: 10px; height: 10px; clip-path: polygon(13% 47%, 2% 60%, 40% 94%, 98% 22%, 86% 11%, 39% 68%); }
input[type="radio"]::before { width: 6px; height: 6px; border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--color-accent); border-color: var(--color-accent); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:checked:hover:not(:disabled), input[type="radio"]:checked:hover:not(:disabled) { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { background: var(--color-surface-sunken); border-color: var(--color-border); cursor: not-allowed; }
input[type="checkbox"]:disabled:checked, input[type="radio"]:disabled:checked { background: var(--color-border-control); border-color: var(--color-border-control); }
.check:has(input:disabled) { color: var(--color-text-muted); cursor: not-allowed; }

/* ---- 面板（行内表单） ---- */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  padding: var(--space-5);
}

.panel + .panel { margin-top: var(--space-4); }
.panel > h3 { font-size: var(--font-reading); font-weight: 600; margin-bottom: var(--space-2); }
.panel > h3:has(+ form) { margin-bottom: var(--space-4); }
.panel > .section-note { margin-top: 0; margin-bottom: var(--space-4); }

.inline-panel {
  margin: 0 0 var(--space-5);
  animation: panel-in var(--duration-state) var(--ease-standard);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-panel);
  background: var(--color-accent-subtle);
  color: var(--color-text);
}
.notice .icon { margin-top: 3px; color: var(--color-accent); }
.notice.warning { background: var(--color-warning-subtle); }
.notice.warning .icon { color: var(--color-warning); }
.notice.danger { background: var(--color-danger-subtle); }
.notice.danger .icon { color: var(--color-danger); }
.notice.success { background: var(--color-success-subtle); }
.notice.success .icon { color: var(--color-success); }
.notice .notice-body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.notice .notice-title { font-weight: 600; }
.notice ul { margin: var(--space-1) 0 0; padding-left: 1.25em; }
.notice .code-ref { color: var(--color-text-muted); font-size: var(--font-label); }

/* ---- 许可的概要：期限、服务 ---- */

.summary {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}
.summary > div { padding: var(--space-4) var(--space-5); min-width: 0; }
.summary > div + div { border-left: 1px solid var(--color-border); }
.summary h2 { font-size: var(--font-label); font-weight: 500; color: var(--color-text-muted); margin-bottom: var(--space-2); }

.term { display: flex; flex-direction: column; gap: var(--space-3); }
.term-now { font-size: var(--font-section); font-weight: 600; line-height: 1.35; font-variant-numeric: tabular-nums; }
.term.warning .term-now { color: var(--color-warning); }
.term.off .term-now { color: var(--color-text-muted); }
.term-track { position: relative; height: 6px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.term-fill { position: absolute; inset: 0 auto 0 0; width: var(--elapsed, 0%); min-width: 2px; background: var(--color-success); }
.term.warning .term-fill { background: var(--color-warning); }
.term.off .term-fill { background: var(--color-border-control); }
.term-ends { display: flex; justify-content: space-between; gap: var(--space-3); color: var(--color-text-muted); font-size: var(--font-label); font-variant-numeric: tabular-nums; }
.term-ends span:last-child { text-align: right; }

.entitlements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.entitlements li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--space-2); min-width: 0; }
.entitlements .name { font-weight: 500; }

/* ---- 字段网格 ---- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4) var(--space-5);
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

.facts > div { min-width: 0; }
.facts dt { font-size: var(--font-label); color: var(--color-text-muted); margin-bottom: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts .span-all { grid-column: 1 / -1; }
.facts .span-2 { grid-column: span 2; }
.panel .facts, .notice + .section-gap .facts { border: 0; padding: 0; background: transparent; border-radius: 0; }

/* ---- 可复制的值 ---- */

.copyable { display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.copyable .value {
  flex: 1;
  min-width: 0;
  padding: 6px var(--space-3);
  background: var(--color-fill);
  border-radius: var(--radius-control);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.copy-button { flex: none; min-width: 72px; }
.copy-button .icon-swap { position: relative; width: 16px; height: 16px; display: inline-block; }
.copy-button .icon-swap .icon { position: absolute; inset: 0; transition: opacity var(--duration-icon) var(--ease-standard), transform var(--duration-icon) var(--ease-standard), filter var(--duration-icon) var(--ease-standard); }
.copy-button .icon-swap .icon-done { opacity: 0; transform: scale(0.25); filter: blur(4px); color: var(--color-success); }
.copy-button.copied .icon-swap .icon-copy { opacity: 0; transform: scale(0.25); filter: blur(4px); }
.copy-button.copied .icon-swap .icon-done { opacity: 1; transform: none; filter: none; }

.secret-once {
  border: 1px solid var(--color-warning);
  background: var(--color-warning-subtle);
  border-radius: var(--radius-panel);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.secret-once .notice-title { font-weight: 600; }
.secret-once .copyable .value { background: var(--color-surface); font-size: var(--font-reading); padding: var(--space-2) var(--space-3); }
.flash { margin-bottom: var(--space-5); }

/* ---- 帮助：阅读类的页面。一栏正文（每行 40 字以内），右边是本页目录 ---- */

.doc-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(160px, 220px); gap: var(--space-7); align-items: start; }
.doc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  padding: var(--space-6) var(--space-7) var(--space-7);
  font-size: var(--font-reading);
  line-height: 1.75;
  min-width: 0;
}
.doc section + section { margin-top: var(--space-7); padding-top: var(--space-6); border-top: 1px solid var(--color-border); }
.doc h2 { font-size: var(--font-section); font-weight: 600; line-height: 1.4; margin-bottom: var(--space-4); }
.doc section { scroll-margin-top: var(--space-5); }
.doc h3 { font-size: var(--font-reading); font-weight: 600; line-height: 1.5; margin: var(--space-5) 0 var(--space-2); }
.doc p { text-wrap: pretty; }
.doc p + p, .doc ul + p, .doc ol + p, .doc .table-wrap + p, .doc p + ul, .doc p + ol { margin-top: var(--space-3); }
.doc ul, .doc ol { margin: 0; padding-left: 1.4em; }
.doc li + li { margin-top: var(--space-2); }
.doc li::marker { color: var(--color-text-muted); }
.doc-steps > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-accent); }
.doc-steps > li { padding-left: var(--space-1); }
.doc code { font-family: var(--font-mono); font-size: 0.875em; padding: 1px 6px; border-radius: 4px; background: var(--color-fill); overflow-wrap: anywhere; }
.doc .table-wrap { margin: var(--space-4) 0; font-size: var(--font-data); line-height: 1.6; }
.doc .table th, .doc .table td { white-space: normal; padding-left: var(--space-4); padding-right: var(--space-4); }
.doc .table tbody th { font-weight: 600; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--color-border); background: transparent; color: var(--color-text); font-size: inherit; padding-top: var(--space-3); padding-bottom: var(--space-3); }
.doc .table tbody tr:last-child th { border-bottom: 0; }
.doc .table tbody th code { font-weight: 400; }
.doc .table tbody tr:hover { background: transparent; }
.doc .notice { margin-bottom: var(--space-4); font-size: var(--font-data); line-height: 1.6; }
.doc-faq { margin: 0; }
.doc-faq dt { font-weight: 600; }
.doc-faq dd { margin: var(--space-1) 0 0; color: var(--color-text); }
.doc-faq dd + dt { margin-top: var(--space-5); }

.doc-toc { position: sticky; top: var(--space-5); font-size: var(--font-data); }
.doc-toc-title { font-size: var(--font-label); font-weight: 600; color: var(--color-text-muted); margin-bottom: var(--space-2); padding: 0 var(--space-2); }
.doc-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-toc a { display: block; padding: 5px var(--space-2); border-radius: var(--radius-control); color: var(--color-text-muted); line-height: 1.45; transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-instant) var(--ease-standard); }
.doc-toc a:hover { background: var(--color-fill); color: var(--color-text); text-decoration: none; }
.doc-toc a[aria-current="true"] { background: var(--color-fill); color: var(--color-text); font-weight: 600; }

/* ---- 加载、空、出错 ---- */

.skeleton { display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton .bar { height: 14px; border-radius: var(--radius-control); background: var(--color-canvas-sunken); }
.skeleton .bar.head { height: 28px; width: 30%; margin-bottom: var(--space-3); }
.skeleton .bar.w60 { width: 60%; }
.skeleton .bar.w80 { width: 80%; }
.skeleton .block { height: 120px; border-radius: var(--radius-panel); background: var(--color-canvas-sunken); }
.skeleton .line { height: 44px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: var(--space-5); }
.skeleton .line::before, .skeleton .line::after { content: ""; height: 12px; border-radius: var(--radius-control); background: var(--color-canvas-sunken); }
.skeleton .line::before { width: 22%; }
.skeleton .line::after { width: 38%; }

.empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border-control);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.empty .empty-title { color: var(--color-text); font-weight: 600; font-size: var(--font-reading); }
.empty .action-bar, .empty > .button, .empty > a { margin-top: var(--space-3); }

.toast {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-overlay);
  box-shadow: var(--shadow-float);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 420px;
  animation: toast-in 240ms var(--ease-enter);
  z-index: 10;
}
.toast .icon { color: var(--color-success); }
.toast.leaving { opacity: 0; transition: opacity var(--duration-exit) var(--ease-standard); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: var(--color-shell);
}
.login-page :focus-visible { outline-offset: 2px; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius-overlay);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  box-shadow: 0 24px 48px -16px oklch(0 0 0 / 0.4);
}

.login-card h1 { font-size: var(--font-page); font-weight: 600; line-height: 1.3; }
.login-card .form { gap: var(--space-4); }
.login-card .button.primary { width: 100%; min-height: 40px; }
.login-card .button.primary::after { inset: 0; }
.login-card input { min-height: 40px; font-size: var(--font-reading); }

/* ---- 窄一些的桌面 ---- */

@media (max-width: 1100px) {
  :root { --sidebar-width: 176px; --content-gutter: var(--space-5); }
  .content { padding-top: var(--space-5); padding-bottom: var(--space-6); }
  .row, .summary { grid-template-columns: minmax(0, 1fr); }
  .doc-layout { grid-template-columns: minmax(0, 760px); gap: var(--space-4); }
  .doc-toc { position: static; order: -1; }
  .doc-toc ol { flex-direction: row; flex-wrap: wrap; }
  .doc { padding: var(--space-5); }
  .summary > div + div { border-left: 0; border-top: 1px solid var(--color-border); }
}

@media (prefers-reduced-motion: reduce) {
  .inline-panel { animation: none; }
  .toast { animation: none; }
  .popover { animation: none; }
  .select-arrow { transition: none; }
  input[type="checkbox"]::before, input[type="radio"]::before { transition: none; }
  .button:active:not(:disabled) { transform: none; }
  .copy-button .icon-swap .icon { transform: none !important; filter: none !important; }
}

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.section-gap { margin-top: var(--space-3); }
.form-error:empty { display: none; }
.toolbar-slot { display: contents; }
