/* ═══════════════════════════════════════════════════════════════
   古迹说 · 激活码核销台
   主张：这是一张券码核对台 —— 暖纸底、墨绿、等宽数字、朱砂作废戳。
   数字一律等宽，表格是主角，装饰只用来交代"这是一批码"。
   ═══════════════════════════════════════════════════════════════ */

:root {
  --paper: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #16211e;
  --ink-2: #55605c;
  --ink-3: #6e7a76;
  --line: #e2ded4;
  --line-soft: #efebe2;
  --brand: #10322b;
  --brand-2: #1b4a40;
  --brand-soft: #e7eee9;
  --gold: #c8a94e;
  --accent: #b2420c;
  --ok: #1b6b4a;
  --ok-soft: #e5f0e9;

  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;

  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul {
  margin: 0;
}

button {
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.eyebrow--light {
  color: rgba(233, 240, 236, 0.55);
}

.eyebrow--danger {
  color: var(--accent);
}

.mono {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* 必须带上 .table 前缀，否则被 .table th 的 left 覆盖 */
.table th.ta-r,
.table td.ta-r {
  text-align: right;
}

/* ─────────────────────────── 控件 ─────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-2);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: #cfc9bc;
  color: var(--ink);
}

.btn--danger {
  background: var(--accent);
  color: #fff;
}

.btn--danger:hover {
  background: #963707;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
}

.btn--rail {
  padding: 7px 12px;
  font-size: 13px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(233, 240, 236, 0.8);
}

.btn--rail:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn--void {
  padding: 5px 11px;
  font-size: 13px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid #e6cfc4;
  color: var(--accent);
}

.btn--void:hover {
  background: #fbf1ec;
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.is-busy svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: #a9a49a;
}

.input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(27, 74, 64, 0.12);
}

.input--bare {
  border: 0;
  padding-left: 4px;
  background: transparent;
}

.input--bare:focus {
  outline: none;
  box-shadow: none;
}

.input--date {
  width: auto;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--mono);
}

.field {
  display: block;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

/* ─────────────────────────── 登录 ─────────────────────────── */

.login {
  display: grid;
  grid-template-columns: minmax(340px, 45%) 1fr;
  min-height: 100vh;
  background: var(--paper);
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px 48px 32px;
  background: var(--brand);
  color: #e9f0ec;
  overflow: hidden;
}

/* 细密斜纹，像票据底纹，不是渐变光斑 */
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.035) 0 1px,
    transparent 1px 7px
  );
  pointer-events: none;
}

.login-brand__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.wordmark {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.wordmark__sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(233, 240, 236, 0.45);
}

.wordmark--sm {
  font-size: 16px;
  color: #fff;
}

.login-brand__mid {
  position: relative;
  z-index: 1;
}

.login-brand__mid h1 {
  margin: 14px 0 20px;
  font-size: clamp(38px, 4.6vw, 58px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: #fff;
}

.login-brand__desc {
  font-size: 14px;
  line-height: 1.9;
  color: rgba(233, 240, 236, 0.6);
}

.login-brand__foot {
  position: relative;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(233, 240, 236, 0.35);
}

/* 券码底纹：一排排 8 位码，交代"这是一批码" */
.code-grid {
  position: absolute;
  right: 12px;
  bottom: 56px;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(233, 240, 236, 0.13);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px 32px;
}

.login-form {
  width: min(360px, 100%);
}

.login-form h2 {
  margin: 8px 0 28px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.login-form .field + .field {
  margin-top: 16px;
}

.login-form .btn {
  margin-top: 24px;
  padding: 12px 16px;
}

.login-form .btn.is-busy {
  opacity: 0.7;
}

.form-msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-1);
  font-size: 13px;
  background: #fbf1ec;
  border: 1px solid #e8cfc3;
  color: var(--accent);
}

/* ─────────────────────────── 应用外壳 ─────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 14px 18px;
  background: var(--brand);
}

.rail__brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 10px;
}

.rail__brand-sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(233, 240, 236, 0.42);
}

.rail__nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-1);
  background: transparent;
  color: rgba(233, 240, 236, 0.62);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--gold);
}

.rail__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.rail__user-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail__user-role {
  font-size: 11px;
  color: rgba(233, 240, 236, 0.4);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
  padding: 0 32px;
  background: rgba(246, 243, 236, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.crumb {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.view {
  padding: 30px 32px 64px;
  max-width: 1200px;
  width: 100%;
}

/* 同步失败驻留提示：只闪一下的 toast 不足以说明"现在没数据" */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 18px 32px 0;
  padding: 13px 16px;
  background: #fdf6ee;
  border: 1px solid #e8d5c2;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-1);
}

.notice__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.notice__title {
  font-size: 13.5px;
  font-weight: 600;
  color: #8a3208;
}

.notice__text {
  font-size: 13px;
  line-height: 1.6;
  color: #7a4a2a;
  word-break: break-word;
}

/* ─────────────────────────── 查询 ─────────────────────────── */

.query-hero {
  max-width: 740px;
  margin: 40px auto 0;
  text-align: center;
}

.query-hero__title {
  margin: 12px 0 26px;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.query-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: 0 1px 2px rgba(22, 33, 30, 0.04), 0 18px 36px -26px rgba(16, 50, 43, 0.55);
}

.query-box:focus-within {
  border-color: #b9c9c1;
  box-shadow: 0 1px 2px rgba(22, 33, 30, 0.05), 0 0 0 4px rgba(27, 74, 64, 0.09);
}

.query-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: clamp(18px, 2.4vw, 25px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  outline: none;
}

.query-input::placeholder {
  color: #c6c0b3;
}

.query-box .btn {
  padding: 13px 24px;
  font-size: 15px;
}

.query-hero__hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
}

.query-result {
  max-width: 940px;
  margin: 34px auto 0;
}

.empty-note {
  padding: 28px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-2);
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.9;
}

/* 查无此码：码与状态徽章同一行，别复用纵向堆叠的 .ticket__lead */
.notfound-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

/* 单条结果：一张横向票据 */
.ticket {
  position: relative;
  display: grid;
  grid-template-columns: minmax(184px, 0.8fr) minmax(0, 2.4fr) auto;
  align-items: center;
  gap: 28px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: 0 1px 2px rgba(22, 33, 30, 0.04);
}

/* 票据撕口 */
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  transform: translateX(-50%);
}

.ticket::before {
  top: -7px;
}

.ticket::after {
  bottom: -7px;
}

.ticket__lead {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket__code {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.ticket__facts {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) minmax(146px, 1fr) minmax(64px, auto);
  gap: 18px;
  padding-left: 28px;
  border-left: 1px dashed var(--line);
}

.ticket__facts dt {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 5px;
}

.ticket__facts dd {
  font-size: 15px;
  color: var(--ink);
}

/* 日期必须一行读完，折行会让票据读起来像断句 */
.ticket__facts dd.mono {
  white-space: nowrap;
}

.ticket__act {
  display: flex;
  justify-content: flex-end;
}

.ticket--void {
  background: #fcfaf6;
}

/* ─────────────────────────── 列表 ─────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 380px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.toolbar__search:focus-within {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(27, 74, 64, 0.1);
}

.toolbar__search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.6;
  stroke-linecap: round;
  flex: none;
}

.toolbar__meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 11px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fbfaf5;
}

.table .cell-code {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.table .cell-name {
  color: var(--ink);
}

.table .cell-name--empty {
  color: var(--ink-3);
}

.table .cell-date {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-size: 13px;
}

.table .empty-row td {
  padding: 44px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.status--used {
  color: var(--ok);
}

.status--used::before {
  background: var(--ok);
}

.status--unused {
  color: var(--ink-3);
}

.status--unused::before {
  background: #b9b4a7;
}

.status--void {
  color: var(--accent);
}

.status--void::before {
  background: var(--accent);
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-3);
}

.pager__spacer {
  flex: 1;
}

.pager__info {
  font-variant-numeric: tabular-nums;
}

.pager .btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* ─────────────────────────── 统计 ─────────────────────────── */

.metric-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.metric__value {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.range-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* 时间选择：标签 + 两个日期框，没有「应用」按钮，改完即算 */
.range-pick {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-pick__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.range-pick__sep {
  font-size: 13px;
  color: var(--ink-3);
}

/* 区间汇总：紧跟日期框，用一条竖线和左边的选择器分开 */
.range-sum {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-left: auto;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.range-sum__value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.range-sum__label {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* 查询命中多条时的说明行 */
.result-caption {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.daily-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
}

.daily-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.daily-block__head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* 区块标题右侧的辅助数字，统计与账号操作记录共用 */
.daily-block__sum {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.daily-list {
  max-height: 520px;
  overflow-y: auto;
}

.daily-row {
  display: grid;
  grid-template-columns: 104px 1fr 64px;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.daily-row:last-child {
  border-bottom: 0;
}

.daily-row:hover {
  background: #fbfaf5;
}

.daily-row__date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.daily-row__track {
  height: 8px;
  background: #f1eee6;
  border-radius: 4px;
  overflow: hidden;
}

.daily-row__bar {
  height: 100%;
  min-width: 2px;
  background: var(--brand-2);
  border-radius: 4px;
  transition: width 0.35s ease;
}

.daily-row.is-zero .daily-row__bar {
  background: #d9d4c8;
}

.daily-row__count {
  font-family: var(--mono);
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.daily-row.is-zero .daily-row__count {
  color: var(--ink-3);
}

.daily-empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}

.daily-note {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-3);
  max-width: 760px;
}

/* ─────────────────────────── 账号管理 ─────────────────────────── */

.toolbar__hint {
  max-width: 640px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-3);
}

/* 说明文字旁边的操作按钮贴右，别悬在文案后面 */
.toolbar > .btn {
  margin-left: auto;
}

/* 账号列：账号名 + 角色标签 + 备注，两行读完 */
.acct-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.acct-name__user {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.acct-note {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.chip--owner {
  background: #f5eed8;
  border: 1px solid #e4d4a9;
  color: #7a5c12;
}

.chip--admin {
  background: var(--brand-soft);
  border: 1px solid #cddbd4;
  color: var(--brand-2);
}

.chip--self {
  background: #f0efe9;
  border: 1px solid var(--line);
  color: var(--ink-3);
}

/* 停用的账号整行降调，一眼能区分 */
.table tr.is-disabled .acct-name__user,
.table tr.is-disabled .acct-note {
  color: var(--ink-3);
}

.acct-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.link-btn {
  padding: 4px 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  color: var(--brand-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.link-btn:hover {
  background: var(--brand-soft);
}

.link-btn--danger {
  color: var(--accent);
}

.link-btn--danger:hover {
  background: #fbf1ec;
}

.audit-block {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
}

.audit-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row:hover {
  background: #fbfaf5;
}

.audit-row__time {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.audit-row__main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  min-width: 0;
}

.audit-row__by {
  font-size: 13px;
  color: var(--ink-2);
}

.audit-row__act {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.audit-row__target {
  font-size: 13px;
  color: var(--brand-2);
}

.audit-row__detail {
  flex: 1 1 100%;
  font-size: 12.5px;
  color: var(--ink-3);
  word-break: break-word;
}

.audit-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

/* ─────────────────────────── 弹窗 ─────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(14, 32, 27, 0.52);
}

.modal__box {
  position: relative;
  width: min(460px, 100%);
  padding: 28px;
  background: var(--surface);
  border-radius: var(--r-3);
  box-shadow: 0 30px 70px -24px rgba(12, 30, 25, 0.6);
}

.modal__box h2 {
  margin: 8px 0 12px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal__body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
}

.modal__body strong {
  color: var(--accent);
  font-weight: 600;
}

.modal__facts {
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  display: grid;
  gap: 10px;
}

.modal__facts > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.modal__facts dt {
  font-size: 13px;
  color: var(--ink-3);
  flex: none;
}

.modal__facts dd {
  font-size: 14px;
  color: var(--ink);
  text-align: right;
  word-break: break-all;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal__form .field + .field {
  margin-top: 16px;
}

.modal__form .modal__actions,
#pwd-form-area .modal__actions,
#pwd-done .modal__actions {
  margin-top: 24px;
}

.field__hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.input-row .input {
  flex: 1;
  min-width: 0;
}

.input-row .btn {
  padding: 0 14px;
  font-size: 13px;
}

/* 新密码只显示这一次，做成可整段选中的暗格 */
.secret-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px dashed #cfc9bc;
  border-radius: var(--r-1);
}

.secret-box code {
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}

#pwd-done .field__hint {
  margin-top: 10px;
}

/* ─────────────────────────── Toast ─────────────────────────── */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}

.toast {
  padding: 12px 16px;
  background: var(--brand);
  color: #eef4f0;
  border-radius: var(--r-1);
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: 0 16px 36px -18px rgba(12, 30, 25, 0.7);
  animation: toast-in 0.22s ease-out;
}

.toast--error {
  background: #7a2a07;
}

.toast--warn {
  background: #6d4a0c;
}

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

/* ─────────────────────────── 响应式 ─────────────────────────── */

@media (max-width: 900px) {
  .login {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 42vh;
    padding: 28px 26px;
  }

  .login-brand__mid h1 {
    font-size: 36px;
    margin: 10px 0 14px;
  }

  .code-grid {
    display: none;
  }

  .login-panel {
    padding: 34px 24px 56px;
  }

  /* minmax(0,1fr)：默认的 1fr 最小值是内容宽度，四个导航项会把整页顶宽
     grid-template-rows：默认两行会按比例瓜分 100vh，把顶部横条拉到 240px 高（大片空绿）；
     改成「横条按内容高度、剩余全给内容区」 */
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
  }

  .rail__brand {
    display: none;
  }

  .rail__nav {
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 手机上省掉图标，让三个导航和"退出"都留在首屏内 */
  .rail__nav svg {
    display: none;
  }

  .rail__nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: auto;
    padding: 8px 9px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .nav-item.is-active {
    box-shadow: none;
  }

  .rail__foot {
    margin-top: 0;
    padding: 0;
    border-top: 0;
    flex: none;
  }

  .rail__user {
    display: none;
  }

  .topbar {
    padding: 0 16px;
    height: 52px;
  }

  .view {
    padding: 22px 16px 56px;
  }

  .notice {
    margin: 14px 16px 0;
    gap: 10px;
  }

  .query-hero {
    margin-top: 16px;
  }

  .query-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .query-box .btn {
    padding: 12px 20px;
  }

  .query-input {
    text-align: center;
    padding: 10px 8px;
  }

  .ticket {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 20px;
  }

  .ticket__facts {
    padding-left: 0;
    border-left: 0;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
  }

  .ticket__act {
    justify-content: flex-start;
  }

  .metric-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric {
    padding: 16px 16px;
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(1),
  .metric:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .metric__value {
    font-size: 28px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .table {
    min-width: 640px;
  }

  .daily-row {
    grid-template-columns: 88px 1fr 48px;
    gap: 12px;
    padding: 9px 14px;
  }

  /* 窄屏：标签独占一行，两个日期框并排撑满，「至」夹在中间不换行 */
  .range-bar {
    gap: 10px;
  }

  .range-pick {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  .range-pick__label {
    flex: 0 0 100%;
    font-size: 12px;
  }

  .range-pick .input--date {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 6px;
    font-size: 12.5px;
  }

  /* 汇总与导出按钮同一行，不再各占一行 */
  .range-sum {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    flex: 1 1 auto;
  }

  .range-sum__value {
    font-size: 24px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar__meta {
    margin-left: 0;
    width: 100%;
  }
}

/* 窄屏：表格改成卡片行，避免横向滚动把日期和作废按钮推到屏幕外 */
@media (max-width: 700px) {
  .table-wrap {
    overflow-x: visible;
  }

  .table {
    min-width: 0;
    display: block;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: block;
  }

  .table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 5px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
  }

  .table tbody tr:last-child {
    border-bottom: 0;
  }

  .table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    font-weight: 500;
  }

  .table td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .table td:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
    margin-top: 2px;
  }

  .table td:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
    text-align: right;
    margin-top: 2px;
  }

  .table td:nth-child(5) {
    grid-column: 2;
    grid-row: 1 / span 2;
    text-align: right;
    align-self: start;
  }

  .table .empty-row {
    display: block;
    padding: 0;
  }

  .table .empty-row td {
    padding: 40px 16px;
    text-align: center;
  }

  /* 账号表是 4 列，单独排版：账号 + 状态在首行，最近登录次行，操作独占一行 */
  .table--accounts tbody tr {
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
  }

  .table--accounts td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .table--accounts td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .table--accounts td:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }

  .table--accounts td:nth-child(4) {
    grid-column: 1 / span 2;
    grid-row: 3;
    text-align: left;
    margin-top: 4px;
  }

  .table--accounts .acct-actions {
    justify-content: flex-start;
    margin-left: -7px;
  }

  .audit-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 16px;
  }
}

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