/* ============================================================
   邮政票据主题:牛皮纸底 · 墨绿油墨 · 橙色邮戳 · 硬投影描边
   结果卡片 = 取件凭证(票头 + 邮戳口令瓦片 + 撕票线 + 票脚)
   ============================================================ */
:root {
  --bag: #efe8d8;            /* 牛皮纸底 */
  --paper: #fffdf6;          /* 票据纸面 */
  --ink: #26382c;            /* 油墨(正文/主色) */
  --line: #26382c;           /* 描边 */
  --muted: #6b7563;          /* 褪色墨 */
  --stamp: #d96f32;          /* 邮戳橙 */
  --stamp-dark: #b85a24;
  --ok: #3c7a52;
  --ok-soft: #eef3ec;
  --danger: #b3403a;
  --danger-soft: #f7e9e4;
  --warn: #a2661c;
  --warn-soft: #f8efdd;
  --rowbg: #f7f2e4;          /* 文件行底 */
  --track: #e6dfca;          /* 进度槽 */
  --tkhead-bg: #26382c;      /* 票头底 */
  --tkhead-fg: #f4efdd;      /* 票头字 */
  --hard: rgba(38, 56, 44, 0.9);   /* 硬投影 */
  --mask: rgba(24, 20, 12, 0.55);  /* 弹窗遮罩 */
  --hard-soft: rgba(38, 56, 44, 0.35);
  --dots: rgba(38, 56, 44, 0.05);  /* 纸面网点纹理 */
  --radius: 14px;
  --radius-sm: 9px;
  --serif: Georgia, 'Times New Roman', 'Songti SC', 'SimSun', serif;
  /* 动效节奏 */
  --t-fast: 0.15s;
  --t-med: 0.25s;
  --t-slow: 0.35s;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
[data-theme='dark'] {
  /* 墨蓝夜航:藏蓝纸面,蓝橙互补,邮戳橙夜里最跳 */
  --bag: #12161f;
  --paper: #1a2130;
  --ink: #e8e5d6;
  --line: #46516b;
  --muted: #a9b2c9;
  --stamp: #e68d4f;
  --stamp-dark: #c9702f;
  --ok: #7fc79c;
  --ok-soft: #254432;
  --danger: #e08a7c;
  --danger-soft: #462822;
  --warn: #d9ab63;
  --warn-soft: #413120;
  --rowbg: #222b44;
  --track: #151b28;
  --tkhead-bg: #33415c;
  --tkhead-fg: #f0eee0;
  --hard: rgba(0, 0, 0, 0.5);
  --hard-soft: rgba(0, 0, 0, 0.32);
  /* 深色下同透明度的遮罩几乎看不出来,加深一档保住弹窗与背景的分离感 */
  --mask: rgba(4, 7, 14, 0.72);
  --dots: rgba(232, 229, 214, 0.05);
}

* { box-sizing: border-box; }
/* [hidden] 兜底:类上的 display:flex/inline-flex 会盖过 UA 样式表的 [hidden]{display:none},
   导致 .result-placeholder/.file-list 等设了 hidden 仍可见 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto,
    'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  min-height: 100vh;
  /* 纵向 flex 骨架:main 吃掉剩余高度,页脚贴视口底 */
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(var(--dots) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bag);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--stamp); color: #fff; }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶栏 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 14px;
  width: 100%; /* body 改纵向 flex 后,auto margin 条目会收缩到内容宽,显式拉满再由 max-width 收口 */
  max-width: 720px;
  margin: 0 auto 26px;
  border-bottom: 3px double var(--line);
}
.topbar.wide { max-width: 1080px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 21px;
  border-radius: 10px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  box-shadow: 3px 3px 0 var(--hard);
}
.brand b {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  display: block;
  line-height: 1.25;
  letter-spacing: 0.05em;
}
.brand small { color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 8px; }

/* ============ 布局 ============ */
.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px 48px; }
.container.wide { max-width: 1080px; }
.container.narrow { max-width: 460px; }
.card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--hard);
  padding: 24px;
  margin-bottom: 18px;
}
.card.center { text-align: center; }
.muted { color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }

main { flex: 1 0 auto; } /* 撑满视口剩余高度,把页脚推到底 */
/* 兜底:即使 main 没撑开(异常页面)也把页脚推到底 */
.foot {
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  padding: 32px 16px 10px;
}

/* ============ 邮路三步条(柜台上方:寄件→出票→取件) ============ */
.flow-strip {
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  box-shadow: 6px 6px 0 var(--hard);
  padding: 18px 26px;
  margin-bottom: 24px;
  animation: fade-up var(--t-slow) var(--ease) both;
}
.flow-step { flex: 1; display: flex; align-items: center; gap: 13px; min-width: 0; }
.flow-dot {
  width: 46px; height: 46px; flex: none;
  border: 2.5px double var(--stamp); border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px; color: var(--stamp); font-family: var(--serif);
}
.flow-step:nth-child(1) .flow-dot { transform: rotate(-7deg); }
.flow-step:nth-child(3) .flow-dot { transform: rotate(5deg); }
.flow-step:nth-child(5) .flow-dot { transform: rotate(-4deg); }
.flow-tt b { display: block; font-size: 14px; font-family: var(--serif); letter-spacing: 0.06em; }
.flow-tt small { color: var(--muted); font-size: 12px; }
.flow-link { flex: 0 0 58px; border-top: 2px dashed var(--line); margin: 0 12px; position: relative; }
.flow-link::after {
  content: '✈'; position: absolute; right: -4px; top: -11px;
  font-size: 12px; color: var(--stamp);
}

/* ============ 发送页:柜台双栏(左寄件单 / 右回执常驻) ============ */
/* 内容不足一屏时柜台上/下留白均衡;超出一屏时 main 高度=内容高,自动退化为顶对齐 */
main:has(> .send-grid) { display: flex; flex-direction: column; justify-content: center; }
.send-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 26px;
  align-items: stretch; /* 两栏同高:空态时右栏占位撑到与表单卡齐底 */
}
.form-card { min-width: 0; margin-bottom: 0; align-self: stretch; display: flex; flex-direction: column; } /* 两栏齐底:表单卡同样拉伸(回执栏内容更高时不再参差) */
/* 拉伸后的多余高度交给输入区吸收:拖拽区/文本框/文件队列长高,选项和按钮不被顶得悬空 */
.form-card .panel { display: flex; flex-direction: column; flex: 1; }
.form-card .dropzone, .form-card textarea, .form-card .file-list { flex: 1; }
.form-card .dropzone { display: flex; flex-direction: column; justify-content: center; }
.card-cap, .side-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: -4px 0 16px;
  font-size: 11.5px;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-weight: 600;
}
.card-cap .cap-date {
  font-family: var(--serif);
  color: var(--stamp);
  letter-spacing: 0.08em;
  font-size: 12.5px;
}
/* 右栏随行高拉伸:sticky 在 stretch 下不再生效(两栏永远同高,无可粘滞余量),改为 flex 纵向栏 */
.send-side { display: flex; flex-direction: column; min-width: 0; }
.send-side .results { margin-top: 0; }
/* 回执空态:待出票邮戳 */
.result-placeholder {
  border: 1.5px dashed var(--line);
  border-radius: 13px;
  padding: 38px 20px;
  min-height: 340px; /* 与左栏表单卡视觉平衡 */
  flex: 1; /* 右栏被拉伸时占位随之长高,底边与表单卡对齐 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  animation: fade-up var(--t-slow) var(--ease) both;
}
.ph-postmark {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border: 2.5px double var(--stamp);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--stamp);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-indent: 0.22em; /* 补偿字距,让圆形邮戳视觉居中 */
  transform: rotate(-8deg);
  opacity: 0.8;
}
.result-placeholder p { margin: 0 0 4px; font-weight: 700; font-family: var(--serif); letter-spacing: 0.08em; }
.result-placeholder small { color: var(--muted); font-size: 12.5px; }
/* 空态内嵌「在途邮路」竖向时间线:右栏不空 */
.ph-route { margin-top: 24px; width: 100%; max-width: 300px; text-align: left; }
.ph-leg { display: flex; gap: 13px; align-items: flex-start; }
.ph-ic {
  width: 40px; height: 40px; flex: none;
  border: 1.5px solid var(--line); border-radius: 50%;
  background: var(--rowbg);
  display: grid; place-items: center; font-size: 17px;
}
.ph-leg:nth-child(1) .ph-ic { transform: rotate(-6deg); }
.ph-leg b { display: block; font-size: 13px; font-family: var(--serif); letter-spacing: 0.04em; }
.ph-leg small { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.ph-dash { width: 0; height: 22px; border-left: 2px dashed var(--line); margin: 3px 0 3px 19px; }
.ph-fine {
  margin-top: 22px; padding-top: 13px; width: 100%; max-width: 300px;
  border-top: 1.5px dashed var(--line);
  color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-align: center;
}

/* ============ 按钮:邮戳章 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--hard-soft);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast), opacity var(--t-fast);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--hard-soft); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--hard-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: 2px 2px 0 var(--hard-soft); }
.btn.primary {
  background: var(--tkhead-bg);
  border-color: var(--line);
  color: var(--tkhead-fg);
  box-shadow: 3px 3px 0 var(--stamp);
}
.btn.primary:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--stamp); }
.btn.primary:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--stamp); }
.btn.primary:disabled { box-shadow: 2px 2px 0 var(--hard-soft); } /* 禁用时不亮橙影,避免误读为可点 */
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.ghost:hover { background: var(--rowbg); transform: none; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 2px 2px 0 var(--hard-soft); }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.icon-btn {
  background: transparent;
  border: none;
  font-size: 17px;
  cursor: pointer;
  color: var(--muted);
  padding: 7px 9px;
  border-radius: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--rowbg); color: var(--ink); }
/* 语言切换:显示目标语言(用全墨色,避免深色模式下过淡) */
.lang-btn { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; padding: 7px 10px; color: var(--ink); }
.lang-float { position: fixed; top: 14px; right: 14px; z-index: 10; background: var(--paper); border: 1.5px solid var(--line); box-shadow: 3px 3px 0 var(--hard); }

/* ============ Tabs:票根 ============ */
.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 9px;
  border: 1.5px dashed var(--line);
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--ink); background: var(--rowbg); }
.tab.active { border-style: solid; background: var(--tkhead-bg); border-color: var(--line); color: var(--tkhead-fg); }

/* ============ 拖拽区:包裹单 ============ */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  transition: background var(--t-fast);
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover { background: var(--rowbg); }
.dz-icon { font-size: 34px; margin-bottom: 8px; transition: transform var(--t-med) ease; }
.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { transform: scale(1.1) translateY(-2px); }
.dropzone p { margin: 0 0 6px; font-size: 14px; }
.dropzone p b { font-weight: 700; }
.dropzone small { color: var(--muted); font-size: 13px; }

/* ============ 文件队列(多选批量) ============ */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--rowbg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  overflow: hidden;
  animation: fade-up var(--t-slow) var(--ease) both;
}
.file-row.uploading { background: var(--warn-soft); }
.file-row.done { background: var(--ok-soft); }
.file-row.fail { background: var(--danger-soft); }
.fr-icon { font-size: 20px; flex: none; }
.fr-meta { flex: 1; min-width: 0; }
.fr-meta b { display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-meta small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-status { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--serif); }
.file-row.done .fr-status { color: var(--ok); font-weight: 700; }
.file-row.fail .fr-status { color: var(--danger); font-weight: 700; }
.fr-remove { padding: 5px 7px; font-size: 13px; flex: none; }
/* 迷你进度条:贴行底缘(蜡封条) */
.fr-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  border-radius: 999px;
  background: var(--stamp);
  transition: width var(--t-med) ease;
}
.file-row.done .fr-bar { width: 100%; background: var(--ok); }
.file-row.fail .fr-bar { width: 100%; background: var(--danger); }

/* ============ 文本输入 ============ */
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.65;
  resize: vertical;
  transition: box-shadow var(--t-fast);
}
textarea:focus { outline: none; box-shadow: 3px 3px 0 var(--hard-soft); }

/* ============ 选项 segmented:邮资标签 ============ */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; margin: 22px 0 6px; }
.opt-group label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.18em;
  margin-bottom: 7px;
}
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  padding: 6px 13px;
  border: 1.5px solid var(--line);
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.seg button:hover { color: var(--ink); background: var(--rowbg); }
.seg button.active { background: var(--stamp); border-color: var(--stamp); color: #fff; }

/* ============ 进度条 ============ */
.progress { margin-top: 18px; }
.bar {
  height: 12px;
  background: var(--track);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--stamp-dark), var(--stamp));
  border-radius: 999px;
  transition: width var(--t-med) ease;
}
.progress small { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============ 结果:取件凭证(票据) ============ */
.results { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.result {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  box-shadow: 6px 6px 0 var(--hard);
  overflow: hidden;
}
/* 批量头部 */
.result-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-radius: 13px;
  background: var(--ok-soft);
  border: 1.5px solid var(--line);
  box-shadow: 4px 4px 0 var(--hard);
}
.result-batch-head .result-title { margin: 0; }
.result-batch-head .btn-row { margin: 0; flex-wrap: nowrap; }
.result-title { margin: 0; font-weight: 700; font-size: 14.5px; }
.result-title.batch { font-family: var(--serif); letter-spacing: 0.04em; }
/* 票头 */
.tk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--tkhead-bg);
  color: var(--tkhead-fg);
  padding: 9px 16px;
  font-size: 12px;
  letter-spacing: 0.3em;
  font-weight: 600;
}
.tk-head .tk-no { letter-spacing: 0.08em; color: var(--stamp); font-family: var(--serif); }
/* 票身 */
.tk-body { padding: 18px 16px 14px; text-align: center; }
.result-main { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.result-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.result-file-name { font-size: 13px; color: var(--muted); word-break: break-all; margin-bottom: 2px; }
/* 口令瓦片:邮戳 */
.code { display: flex; justify-content: center; gap: 8px; margin: 8px 0 10px; }
.code span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 58px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 7px;
  box-shadow: 2px 2px 0 var(--hard-soft);
  user-select: all;
}
.code span:nth-child(odd) { transform: rotate(-1.6deg); }
.code span:nth-child(even) { transform: rotate(1.4deg); }
.result-link { color: var(--muted); font-size: 12px; word-break: break-all; }
.result-meta { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
/* 二维码:白底保证深色模式可扫描 */
.qr-wrap {
  flex: none;
  background: #fff;
  padding: 8px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--hard-soft);
}
.qr-wrap svg { display: block; width: 110px; height: 110px; }
.qr-hint { text-align: center; font-size: 10.5px; color: #6b7280; margin-top: 5px; letter-spacing: 0.18em; }
/* 撕票线(带缺口) */
.tk-tear { border-top: 2px dashed var(--line); position: relative; margin: 0 14px; }
.tk-tear::before, .tk-tear::after {
  content: '';
  position: absolute;
  top: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bag);
  border: 1.5px solid var(--line);
}
.tk-tear::before { left: -24px; }
.tk-tear::after { right: -24px; }
/* 票脚 */
.tk-foot { display: flex; gap: 10px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.result .btn-row { justify-content: center; }

/* ============ 特性带(柜台下方:一排业务公告章) ============ */
.feat-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 28px; }
.feat {
  background: var(--paper);
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  box-shadow: 3px 3px 0 var(--hard-soft);
  padding: 14px 16px;
  display: flex; gap: 12px; align-items: center;
  animation: fade-up var(--t-slow) var(--ease) both;
}
.feat:nth-child(2) { transform: rotate(0.4deg); }
.feat:nth-child(3) { transform: rotate(-0.3deg); }
.feat-ic {
  width: 40px; height: 40px; flex: none;
  border: 2px double var(--stamp); border-radius: 50%;
  display: grid; place-items: center; font-size: 17px;
}
.feat b { display: block; font-size: 13.5px; font-family: var(--serif); letter-spacing: 0.04em; }
.feat small { color: var(--muted); font-size: 12px; }

/* ============ 取件页 ============ */
h2.title { margin: 8px 0 6px; font-size: 22px; font-weight: 700; line-height: 1.3; font-family: var(--serif); letter-spacing: 0.04em; }
.pk-sub { margin: 0 0 16px; font-size: 13.5px; }
.error-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1.5px solid var(--danger);
  color: var(--danger);
  font-size: 14px;
}
.share-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--rowbg);
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
}
.sc-icon { font-size: 32px; }
.sc-meta { flex: 1; min-width: 0; text-align: left; }
.sc-meta b { display: block; font-size: 15px; font-weight: 700; word-break: break-all; }
.sc-meta small { color: var(--muted); }
.meta-line { color: var(--muted); font-size: 13px; margin: 12px 2px 0; text-align: left; }
pre.text-body {
  background: var(--rowbg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
  line-height: 1.7;
  max-height: 340px;
  overflow: auto;
  margin: 0 0 4px;
  text-align: left;
}

/* ============ 管理页 ============ */
.stats-row { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; margin-bottom: 20px; }
.stats-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stats-counts .stat-card { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.stat-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 3px 3px 0 var(--hard-soft);
}
.stat-card b { display: block; font-size: 24px; font-weight: 700; font-family: var(--serif); font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-card small { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px dashed var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: 0.1em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--rowbg); }
td.wrap { white-space: normal; min-width: 140px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 12px;
  font-weight: 600;
}
.badge.active { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.badge.expired { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge.exhausted { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.badge.kind-file { background: transparent; color: var(--stamp); border-color: var(--stamp); }
.badge.kind-text { background: transparent; color: var(--muted); border-color: var(--line); }
.token-input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  margin: 12px 0 4px;
  transition: box-shadow var(--t-fast);
}
.token-input:focus { outline: none; box-shadow: 3px 3px 0 var(--hard-soft); }
.admin-foot { margin-top: 18px; display: flex; justify-content: flex-end; }
.pager-btns { display: flex; gap: 8px; }

/* ============ 作废确认弹窗(管理页):票据卡 + 硬偏移投影 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--mask);
}
.modal-mask[hidden] { display: none; }
.modal-card {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--hard);
  padding: 22px 22px 18px;
  width: min(430px, 100%);
  animation: pop-in 0.18s ease-out;
}
.modal-title { margin: 0 0 14px; font-family: var(--serif); font-size: 19px; letter-spacing: 0.04em; }
.del-target {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--rowbg);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: grid;
  gap: 6px;
}
.del-line { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.del-line > :first-child { flex: 0 0 4em; font-size: 12px; letter-spacing: 0.08em; }
.del-line > :last-child { min-width: 0; overflow-wrap: anywhere; }
.del-warn { margin: 0 0 16px; color: var(--danger); font-size: 13px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes pop-in { from { transform: translateY(8px); opacity: 0; } }

/* ============ toast:墨条 ============ */
#toast-host {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 99;
  pointer-events: none;
}
.toast {
  background: var(--tkhead-bg);
  color: var(--tkhead-fg);
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 3px 3px 0 var(--hard);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.toast.error { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ============ 移动端 ============ */
/* 双栏并回单栏:右栏回到表单下方,空态占位隐藏 */
@media (max-width: 880px) {
  .send-grid { grid-template-columns: 1fr; gap: 18px; }
  .send-side .side-cap, .result-placeholder { display: none; }
  /* 邮路条竖排,连线转为向下虚线;特性带两列 */
  .flow-strip { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 18px; }
  .flow-link { flex: 0 0 0; width: 0; height: 26px; border-top: none; border-left: 2px dashed var(--line); margin: 0 0 0 22px; }
  .flow-link::after { right: -6px; top: 12px; }
  .feat-band { grid-template-columns: repeat(2, 1fr); margin-top: 20px; gap: 12px; }
}
@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .topbar { padding: 14px 16px 8px; }
  .code { gap: 6px; }
  .code span { width: 42px; height: 52px; font-size: 27px; }
  .otp-row { gap: 6px; }
  .otp-box { width: 42px; height: 54px; font-size: 24px; }
  .btn-row .btn { flex: 1; }
  th, td { padding: 8px 6px; }
  .row-between { flex-wrap: wrap; }
  .stat-card b { font-size: 21px; }
  .result-main { gap: 14px; }
  .qr-wrap svg { width: 92px; height: 92px; }
  .tk-tear::before, .tk-tear::after { width: 13px; height: 13px; top: -7.5px; }
  .tk-tear::before { left: -20px; }
  .tk-tear::after { right: -20px; }
}

/* ============ 动效 ============ */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.card { animation: fade-up var(--t-slow) var(--ease) both; }
.result:not([hidden]) { animation: pop var(--t-slow) var(--ease) both; }

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
.shake { animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

/* 键盘焦点可见性 */
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible,
.seg button:focus-visible, a:focus-visible, .otp-box:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
}

/* 取件页:6 格口令输入(邮戳格) */
.otp-row { display: flex; gap: 8px; justify-content: center; margin: 4px 0 8px; }
.otp-box {
  width: 46px;
  height: 58px;
  padding: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  caret-color: var(--stamp);
  box-shadow: 2px 2px 0 var(--hard-soft);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.otp-box:focus { outline: none; border-color: var(--stamp); box-shadow: 3px 3px 0 var(--stamp); }

/* 进度条:等待态流光 */
@keyframes pending-slide { from { background-position: 0 0; } to { background-position: 34px 0; } }
.bar > div.pending {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) 12px,
    rgba(255, 255, 255, 0.3) 12px,
    rgba(255, 255, 255, 0.3) 24px
  );
  background-size: 34px 34px;
  animation: pending-slide 0.8s linear infinite;
}

.mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace; font-variant-numeric: tabular-nums; }

/* 动画敏感用户 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.storage-card { padding: 14px 18px; text-align: left; min-width: 0; }
.storage-card small { letter-spacing: 0; }
.storage-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.storage-value b { font-size: 24px; white-space: nowrap; }
.storage-total { font-size: 14px; color: var(--muted); white-space: nowrap; }
.storage-meter { display: block; width: 100%; height: 6px; border: 0; background: var(--track); border-radius: 4px; overflow: hidden; }
.storage-meter::-webkit-meter-bar { background: var(--track); border: 0; border-radius: 4px; height: 6px; }
.storage-meter::-webkit-meter-optimum-value { background: var(--stamp); border-radius: 4px; }
.storage-meter::-moz-meter-bar { background: var(--stamp); border-radius: 4px; }
.storage-caption { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
@media (max-width: 1000px) {
  .stats-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stats-counts .stat-card { min-height: 90px; }
}
@media (max-width: 540px) {
  .stats-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-counts .stat-card:last-child { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; min-height: 60px; }
}

/* Upload source labels and private admin details. */
.source-cell { min-width: 150px; max-width: 210px; white-space: normal; }
.source-cell small { display: block; font-size: 11px; overflow-wrap: anywhere; }
.source-link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.source-link:hover { color: var(--stamp); }
.source-dialog { width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); box-shadow: 0 20px 64px var(--mask); }
.source-dialog[open] { display: flex; flex-direction: column; }
.source-dialog::backdrop { background: var(--mask); }
.source-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.source-heading h3 { margin: 0; font-size: 16px; }
.source-heading h3:focus { outline: none; }
.source-body { padding: 8px 12px; overflow: auto; min-height: 0; }
#source-detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 13px; }
#source-detail:not(:has(.source-field)) { display: block; overflow-wrap: anywhere; }
.source-field { min-width: 0; display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: baseline; gap: 10px; }
.source-field-wide { grid-column: 1 / -1; }
.source-field small { font-family: inherit; font-size: 12px; font-weight: 400; }
.source-field span { overflow-wrap: anywhere; }
.source-field.mono span { font-size: 12px; line-height: 1.6; }
#source-form { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; gap: 4px 8px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
#source-form label { font-size: 12px; color: var(--muted); }
#source-note { width: 100%; min-width: 0; padding: 5px 8px; background: var(--bag); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 16px; }
#source-note:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
#source-error { grid-column: 1 / -1; margin: 4px 0 0; }
.source-footer { flex-shrink: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 12px; background: var(--paper); border-top: 1px solid var(--line); }
.source-footer .btn { min-height: 36px; padding: 5px 12px; }
@media (max-width: 420px) {
  .source-heading { padding: 8px 12px; }
  .source-body { padding: 8px 12px; }
  .source-field, #source-form { grid-template-columns: 84px minmax(0, 1fr); column-gap: 8px; }
  .source-footer { padding: 8px 12px; }
  .source-footer .btn { flex: 1; min-height: 40px; }
}

/* Keep the type visible above the filename baseline, outside its ellipsis. */
.share-filename-line { display: flex; align-items: baseline; gap: 5px; width: clamp(150px, 18vw, 220px); }
.share-filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-kind.badge { flex: none; position: relative; top: -0.45em; padding: 0 4px; font-size: 10px; line-height: 1.4; }

/* Phone layouts keep the primary action close to the input. */
@media (max-width: 640px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; margin-bottom: 12px; }
  .brand { min-width: 0; gap: 8px; }
  .brand .logo { width: 34px; height: 34px; font-size: 18px; flex: none; }
  .brand b { font-size: 16px; letter-spacing: 0; }
  .brand small { display: block; font-size: 11px; }
  .actions { gap: 2px; }
  .actions .btn, .actions .icon-btn { min-height: 40px; min-width: 40px; padding: 7px 8px; }
  .container { padding: 4px 12px 24px; }
  .card { padding: 14px; box-shadow: 3px 3px 0 var(--hard); }
  main:has(> .send-grid) { justify-content: flex-start; }
  .send-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .flow-strip { flex-direction: row; gap: 6px; padding: 10px; margin-bottom: 12px; box-shadow: 3px 3px 0 var(--hard); }
  .flow-step { flex-direction: column; gap: 3px; text-align: center; }
  .flow-dot { width: 28px; height: 28px; font-size: 15px; }
  .flow-tt b { font-size: 12px; letter-spacing: 0; }
  .flow-tt small, .flow-link { display: none; }
  .card-cap { margin: 0 0 10px; letter-spacing: 0.1em; }
  .tabs { gap: 8px; margin-bottom: 12px; }
  .tab { min-height: 42px; }
  .dropzone { padding: 20px 12px; }
  .dz-icon { font-size: 28px; margin-bottom: 4px; }
  .options { gap: 12px; margin: 14px 0 0; }
  .opt-group label { margin-bottom: 5px; letter-spacing: 0.04em; }
  .seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 5px; }
  .seg button { min-height: 40px; padding: 6px 4px; font-size: 12px; }
  .btn.block { min-height: 44px; margin-top: 12px; }
  textarea, .token-input { font-size: 16px; }
  .file-row { gap: 8px; padding: 8px; }
  .fr-remove { min-width: 40px; min-height: 40px; }
  .fr-status { max-width: 5em; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
  .feat-band { gap: 8px; margin-top: 14px; }
  .feat { gap: 8px; padding: 10px; align-items: flex-start; }
  .feat-ic { width: 28px; height: 28px; font-size: 14px; }
  .feat > div { min-width: 0; overflow-wrap: anywhere; }
  .feat b { font-size: 12px; letter-spacing: 0; }
  .feat small { font-size: 11px; }
  .foot { padding: 18px 12px 12px; letter-spacing: 0.06em; }
  .otp-row, .code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 320px; margin-inline: auto; }
  .otp-box, .code span { width: 100%; min-width: 0; height: 48px; font-size: 24px; }
  .code { padding-inline: 2px; } /* Leave room for the tilted digit borders. */
  .result-col { width: 100%; }
  .result-batch-head { padding: 12px; gap: 8px; }
  .result-batch-head .btn-row { width: 100%; flex-wrap: wrap; }
  .result-batch-head .btn { min-width: 0; padding: 8px; }
  .tk-head { gap: 8px; letter-spacing: 0.1em; }
  .tk-body { padding: 14px 12px; }
  .tk-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 8px; }
  .tk-foot .btn { min-height: 42px; padding: 8px 6px; }
  .sc-meta small { overflow-wrap: anywhere; }
  .modal-mask { padding: 12px; }
  .modal-card { padding: 16px; max-height: calc(100dvh - 24px); overflow: auto; }
  .modal-actions .btn { flex: 1; min-height: 42px; padding: 8px; }
  .stats-counts { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .stats-counts .stat-card { grid-column: span 2; min-height: 66px; padding: 10px 6px; gap: 3px; }
  .stats-counts .stat-card:nth-last-child(-n+2) { grid-column: span 3; }
  .stats-counts .stat-card:last-child { flex-direction: column; }
  .stat-card small { letter-spacing: 0; font-size: 11px; }
  .storage-card { padding: 12px 14px; }
  #admin-panel .table-wrap { overscroll-behavior-x: contain; }
  #admin-panel td .btn { min-height: 40px; }
  .admin-pager { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; }
  .admin-pager .pager-btns { display: flex; gap: 6px; }
  .admin-pager .btn { min-height: 40px; padding-inline: 8px; }
  .admin-pager #page-info { grid-column: 1 / -1; grid-row: 2; text-align: center; }
}
@media (max-width: 360px) {
  .topbar .brand .logo { display: none; }
  .feat { gap: 6px; padding: 8px; }
}

.file-detail-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.file-detail-link:hover { color: var(--stamp); }
.guest-settings { margin: 0 0 12px; font-size: 13px; }
.guest-settings summary { cursor: pointer; padding: 4px 0; }
.login-guard-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.login-guard-heading .btn, .login-guard-row .btn { flex-shrink: 0; }
.login-guard-bans { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.login-guard-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.login-guard-info { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 540px) { #login-protection .btn { min-height: 40px; } }
#guest-policy-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 10px 0; }
#guest-policy-form label { display: grid; gap: 4px; }
#guest-policy-form input { width: 110px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
#guest-policy-form input:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
#upload-policy-hint { display: block; margin: 0 0 8px; font-size: 12px; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.file-detail-link:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.file-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.file-wide { grid-column: 1 / -1; }
.file-identity { display: grid; gap: 2px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.file-identity strong { font-size: 14px; font-weight: 600; line-height: 1.5; }
.file-field { display: grid; align-content: start; gap: 1px; min-width: 0; }
.file-field-value { min-width: 0; font-variant-numeric: tabular-nums; }
.file-field .badge { white-space: normal; }
.file-source-link { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
#file-dialog .source-body { padding-top: 8px; padding-bottom: 8px; }
.retention-settings { padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px dashed var(--line); }
#retention-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
#retention-days { width: 80px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
#retention-days:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
#retention-error { margin: 8px 0; }
@media (max-width: 640px) {
  #retention-form .btn, #retention-days { min-height: 40px; }
}

/* Admin audit keeps the existing theme while separating logs from file management. */
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
#admin-settings-btn svg { display: block; }
.audit-card { padding: 20px; }
.audit-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.audit-heading h2 { margin: 0 0 4px; font-size: 19px; }
.audit-actions { display: flex; gap: 8px; align-items: center; }
.audit-categories { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.audit-categories button { padding: 9px 12px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.audit-categories button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--stamp); font-weight: bold; }
.audit-categories button:focus-visible { outline: 2px solid var(--stamp); outline-offset: -2px; }
.audit-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.audit-filter label { display: grid; gap: 5px; font-size: 12px; min-width: 0; }
.audit-filter input, .audit-filter select { min-width: 0; max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; height: 36px; box-sizing: border-box; }
.audit-filter input:focus-visible, .audit-filter select:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.audit-search { flex: 1; min-width: 140px !important; }
.audit-table { width: 100%; font-size: 12px; }
.audit-table td { padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.audit-table td small { display: block; margin-top: 3px; }
.audit-table td .audit-mobile-label { display: none; }
.audit-table td.audit-source, .audit-table td.audit-target { white-space: normal; min-width: 125px; max-width: 220px; overflow-wrap: anywhere; }
.audit-result { display: inline-block; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.audit-success { color: #25814c; background: #53b77c22; }
.audit-failed { color: #c34b3d; background: #d45e5022; }
.audit-blocked { color: #bd791f; background: #dd9e3522; }
[data-theme="dark"] .audit-success { color: #8cd2a9; }
[data-theme="dark"] .audit-failed { color: #f09a8f; }
[data-theme="dark"] .audit-blocked { color: #ebbd72; }
.audit-pager { gap: 10px; margin-top: 14px; }
#audit-detail .file-field { min-width: 0; overflow-wrap: anywhere; }
#audit-detail .file-field:nth-child(10), #audit-detail .file-field:nth-child(11) { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .audit-card { padding: 12px; }
  .audit-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .audit-heading .audit-actions { width: 100%; }
  .audit-heading .audit-actions .btn { flex: 1; }
  .audit-categories { gap: 0; }
  .audit-categories button { flex: 1; padding: 9px 5px; font-size: 12px; }
  .audit-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filter .audit-search { min-width: 0 !important; }
  .audit-filter .audit-actions { grid-column: 1 / -1; }
  .audit-filter .audit-actions .btn { flex: 1; }
  .audit-filter input, .audit-filter select { width: 100%; font-size: 16px; height: 40px; }
  #admin-audit-view .btn, .admin-nav .btn { min-height: 40px; }
  .audit-table-wrap { overflow: visible; }
  .audit-table, .audit-table tbody { display: block; min-width: 0; }
  .audit-table thead { display: none; }
  .audit-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); }
  .audit-table tbody tr:hover { background: var(--rowbg); }
  .audit-table tbody tr:hover td { background: transparent; }
  .audit-table td { padding: 2px 0; border: 0; min-width: 0; white-space: normal; }
  .audit-table td:nth-child(1) { grid-row: 2; grid-column: 1; color: var(--muted); }
  .audit-table td:nth-child(2) { grid-row: 1; grid-column: 1; }
  .audit-table td:nth-child(2) small { display: none; }
  .audit-table td:nth-child(3) { grid-row: 1; grid-column: 2; text-align: right; }
  .audit-table td:nth-child(4) { grid-row: 4; grid-column: 1; }
  .audit-table td:nth-child(5) { grid-row: 3; grid-column: 1; }
  .audit-table td:nth-child(6) { grid-row: 5; grid-column: 1 / -1; }
  .audit-table td:nth-child(7) { grid-row: 2 / 5; grid-column: 2; align-self: center; }
  .audit-table td.audit-source, .audit-table td.audit-target { min-width: 0; max-width: none; }
  .audit-table td .audit-mobile-label { display: inline; margin-right: 8px; }
}
/* Shared controls and compact upload context. */
button, input, select, textarea { font: inherit; }
.btn, .icon-btn, .seg button, .tab { min-height: 36px; }
button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.source-link, .file-detail-link { min-height: 24px; }
[data-theme='dark'] .btn.danger { color: #241713; }
.upload-context { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; font-size: 13px; }
.upload-context summary, .source-history summary, .source-agent summary { cursor: pointer; min-height: 32px; padding-block: 5px; }
.context-fields { display: grid; gap: 10px; padding: 10px 0 2px; }
.context-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: start; gap: 10px; }
.context-row > label, .context-label { padding-top: 8px; }
.context-label { display: flex; flex-direction: column; gap: 4px; }
.context-fields label { display: block; font-weight: 500; }
.context-fields input, .context-fields textarea { display: block; width: 100%; min-width: 0; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-size: 16px; }
.context-fields textarea { min-height: 76px; resize: vertical; }
#upload-description-field { min-width: 0; }
#description-count { font-size: 11px; font-variant-numeric: tabular-nums; }
.context-fields > small { padding-left: 120px; }
@media (max-width: 600px) {
  .context-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .context-row > label, .context-label { padding-top: 0; }
  .context-label { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 8px; }
  .context-fields > small { padding-left: 0; }
}
.admin-settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.settings-section { min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.settings-section:last-child { border-bottom: 0; }
.admin-settings .retention-settings, .admin-settings .guest-settings { margin: 0; }
.settings-section form { margin-block: 8px; }
.settings-section .btn, .settings-section input { min-height: 36px; }
.admin-list-card { padding: 14px; }
.source-heading { flex-shrink: 0; }
.source-ip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.source-ip .btn { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.source-agent { margin-top: 4px; }
.source-agent p { margin: 4px 0; font-size: 12px; overflow-wrap: anywhere; }
.source-history { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; font-size: 13px; }
#source-history-list { display: grid; }
.source-activity { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.source-activity:last-child { border-bottom: 0; }
.source-activity small { overflow-wrap: anywhere; }
.activity-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.activity-head > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.activity-head .badge { flex-shrink: 0; }
#source-back { margin-right: auto; }
.file-description { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.file-description p { margin: 4px 0 0; white-space: pre-wrap; }
.delete-dialog { width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 0; border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.delete-dialog::backdrop { background: var(--mask); }
.delete-dialog .modal-card { width: 100%; box-shadow: none; }
@media (max-width: 760px) {
  .admin-settings { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px), (pointer: coarse) {
  .btn, .btn.small, .icon-btn, .seg button, .tab, .source-footer .btn,
  .settings-section .btn, .settings-section input, .source-ip .btn, .audit-filter input, .audit-filter select,
  .actions .btn, .actions .icon-btn, #admin-panel td .btn, .admin-pager .btn,
  #login-protection .btn, #retention-form .btn, #retention-days, #admin-audit-view .btn, .admin-nav .btn { min-height: 44px; }
  .source-link, .file-detail-link { min-height: 32px; }
  .source-heading h3 { font-size: 16px; }
  #source-form { grid-template-columns: 84px minmax(0, 1fr); gap: 4px 8px; }
  .source-footer { gap: 6px; }
  .source-footer .btn { padding-inline: 8px; font-size: 13px; }
  .upload-context summary, .source-history summary { min-height: 40px; padding-block: 8px; }
}
/* Primary navigation belongs in the header; paging stays with its list. */
.admin-topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; padding-block: 12px; margin-bottom: 12px; background: var(--paper); }
.admin-topbar .brand { min-width: 0; }
.admin-topbar .brand b { white-space: nowrap; }
.admin-topbar .actions { grid-column: 3; }
#admin-navigation { min-width: 0; justify-self: center; margin: 0; }
.list-toolbar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 10px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 3px 8px var(--hard-soft); }
.page-summary { color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-toolbar .pager-btns { flex-wrap: wrap; gap: 6px; }
.admin-list-card .table-wrap, .audit-table-wrap { scroll-margin-top: 84px; }
.file-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); }
.file-summary .badge { font-size: 12px; }
#file-detail .file-field { grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 8px; }
#file-detail .file-field > small:last-child:not(:first-child) { grid-column: 2; }
.settings-dialog { width: min(540px, calc(100vw - 24px)); }
.settings-dialog h4 { margin: 0 0 8px; font-size: 13px; }
.settings-saved { display: block; color: var(--ok); margin-top: 4px; }
.settings-dialog #btn-logout { margin-right: auto; }
.display-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.preference-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px; align-items: center; gap: 8px; margin-bottom: 6px; }
.preference-row select { width: 100%; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); }
#retention-form, #guest-policy-form { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; align-items: center; gap: 8px; margin: 0; }
.setting-value { display: flex; align-items: center; gap: 6px; min-width: 0; }
#retention-form .setting-value input, #guest-policy-form input { width: 80px; min-width: 0; }
#guest-policy-form { margin-top: 8px; }
.settings-section > .muted { display: block; margin-top: 6px; line-height: 1.5; }
.settings-dialog .login-guard-heading { margin: 0; }
.settings-dialog .login-guard-heading h4 { margin: 0; }
@media (max-width: 900px) {
  .admin-topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .admin-topbar .actions { grid-column: 2; }
  #admin-navigation { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .list-toolbar { justify-content: space-between; }
}
@media (max-width: 600px) {
  .admin-topbar { padding: 8px 12px; }
  .admin-topbar .actions { gap: 2px; }
  .admin-topbar .actions .icon-btn { width: 36px; padding-inline: 4px; }
  .admin-topbar .actions .btn { padding-inline: 8px; }
  .admin-topbar .brand b { font-size: 16px; white-space: normal; }
  .list-toolbar { top: 4px; padding: 8px; gap: 6px; }
  .list-toolbar .page-summary { width: 100%; }
  .list-toolbar .pager-btns { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .list-toolbar .btn { padding-inline: 5px; }
  .admin-nav { gap: 6px; }
  .admin-nav .btn { padding-inline: 8px; }
  .preference-row select { min-height: 44px; font-size: 16px; }
  .display-options { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .preference-row { grid-template-columns: minmax(0, 1fr) 110px; }
  #retention-form, #guest-policy-form { grid-template-columns: minmax(0, 1fr) 90px auto; gap: 6px; }
  #retention-form .setting-value input, #guest-policy-form input { width: 64px; }
  .settings-dialog .source-body { padding: 0 12px; }
  #file-detail .file-field { grid-column: 1 / -1; grid-template-columns: 88px minmax(0, 1fr); }
}
