:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-soft: #5b6675;
  --line: #e3e8ef;
  --brand: #1f6feb;
  --brand-dark: #1858c4;
  --danger: #c62828;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* ---------- 登录页 ---------- */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #eef3fb 0%, #f7f9fc 55%, #eef1f6 100%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 24px 22px;
  box-shadow: 0 10px 30px rgba(24, 42, 74, .07);
}

.auth-head { text-align: center; margin-bottom: 22px; }

.brand-mark {
  width: 46px; height: 46px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark.small {
  width: 26px; height: 26px; margin: 0; border-radius: 7px; font-size: 14px;
}

.auth-head h1 { margin: 0; font-size: 21px; letter-spacing: .5px; }
.auth-head .sub { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  font-size: 16px; /* 避免 iOS 聚焦缩放 */
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
  background: #fff;
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 58px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 34px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.pw-toggle:hover { background: #eef2f8; }

.primary {
  width: 100%;
  height: 46px;
  margin-top: 4px;
  font-size: 15.5px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.primary:hover:not(:disabled) { background: var(--brand-dark); }
.primary:disabled { opacity: .62; cursor: default; }

.error {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--danger);
  background: #fdeceb;
  border: 1px solid #f8d5d2;
  border-radius: 9px;
}

.hint {
  margin: 18px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: #8a94a3;
  text-align: center;
}

/* ---------- 应用页 ---------- */
.app-body { min-height: 100vh; min-height: 100dvh; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .3px; }

.ghost {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.ghost:hover { background: #f4f6fa; color: var(--ink); }

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14.5px; }
.card.muted { background: #fbfcfe; }

.kv { margin: 0; display: grid; gap: 10px; }
.kv > div {
  display: flex;
  gap: 12px;
  font-size: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { width: 76px; flex: none; color: var(--ink-soft); }
.kv dd { margin: 0; word-break: break-all; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12.5px;
  color: var(--brand-dark);
  background: #eaf1fe;
  border-radius: 999px;
}

.todo {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-soft);
}

.fineprint { margin: 0; font-size: 11.5px; color: #8a94a3; line-height: 1.6; }
.fineprint.center { text-align: center; }

.signed-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.signed-in-line { margin: 0; font-size: 15px; }

/* 票据管理页 */
.app-body { background: linear-gradient(155deg, #eef3fb 0%, #f7f9fc 40%, #f2f5fa 100%); }
.workspace-header { background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
.workspace-header-inner { max-width: 1280px; min-height: 68px; margin: 0 auto; padding: 12px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 20px; }
.workspace-header .brand { font-size: 16px; gap: 10px; }
.workspace-header .brand-mark.small { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; }
.brand-divider { height: 19px; width: 1px; background: var(--line); margin: 0 3px; }
.brand-caption { font-size: 13px; color: var(--ink-soft); font-weight: 400; }
.workspace-user { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; margin-left: auto; }
.workspace-user > * { flex-shrink: 0; }
.user-copy { display: grid; gap: 3px; text-align: right; font-size: 13px; }
.user-copy span { color: #8994a4; font-size: 12px; }
.app-body .page { max-width: 1280px; padding: 34px 28px 60px; gap: 18px; }
.page-heading { margin-bottom: 3px; }
.eyebrow { color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; margin-bottom: 7px; }
.page-heading h1 { margin: 0; font-size: 26px; letter-spacing: .3px; }
.page-heading p, .section-heading p { color: #7a8799; font-size: 13px; margin: 7px 0 0; line-height: 1.5; }
.app-body .card { border-radius: 15px; box-shadow: 0 8px 26px rgba(24,42,74,.035); }
.upload-card, .ledger-card { padding: 22px 24px; min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.section-heading h2 { font-size: 16px; margin: 0; }
.format-tag, .count-tag { flex: none; border-radius: 7px; padding: 5px 9px; color: #667995; background: #f1f5fb; font-size: 11px; font-weight: 600; }
.upload-form { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 16px; align-items: end; }
.upload-form.has-visibility { grid-template-columns: minmax(0, 1fr) 140px auto; }
.upload-field { display: grid; gap: 7px; color: #56657a; font-size: 12px; font-weight: 600; min-width: 0; }
.upload-field select, .upload-field input[type=file] { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; color: var(--ink); font: inherit; font-size: 13px; }
.upload-field select { padding: 0 12px; }
.upload-field input[type=file] { padding: 6px; font-weight: 400; }
.upload-field input[type=file]::file-selector-button { border: 0; border-radius: 6px; padding: 6px 10px; margin-right: 10px; color: #315c9f; background: #eaf1fe; cursor: pointer; }
.upload-submit { height: 44px; border: 0; padding: 0 19px; border-radius: 9px; background: var(--brand); color: white; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.upload-submit:hover { background: var(--brand-dark); }
.upload-submit:disabled { opacity: .65; cursor: wait; }
.upload-submit span { padding-left: 8px; }
.upload-progress { display: flex; align-items: center; gap: 9px; margin: 13px 0 0; font-size: 13px; color: #315c9f; }
.upload-progress[hidden] { display: none; }
.upload-spinner { width: 15px; height: 15px; border: 2px solid #cbdcf6; border-top-color: var(--brand); border-radius: 50%; animation: upload-spin .8s linear infinite; }
@keyframes upload-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .upload-spinner { animation: none; } }
.duplicate-page { max-width: 560px !important; padding-top: 70px !important; }
.duplicate-card { padding: 32px !important; text-align: center; }
.duplicate-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff4df; color: #a77722; font-size: 24px; font-weight: 700; }
.duplicate-card h1 { margin: 16px 0 8px; font-size: 20px; }
.duplicate-card p, .duplicate-detail { color: var(--ink-soft); font-size: 13px; line-height: 1.8; }
.duplicate-detail:empty { display: none; }
.duplicate-detail { margin: 16px 0; padding: 12px; border-radius: 9px; background: #f7f9fc; }
.duplicate-back { display: inline-block; margin-top: 16px; padding: 10px 16px; border-radius: 9px; background: var(--brand); color: white; text-decoration: none; font-size: 13px; font-weight: 600; }
.upload-hint { margin: 13px 0 0; color: #98a3b2; font-size: 12px; }
.table-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.ledger-table { border-collapse: collapse; width: 100%; min-width: 1120px; table-layout: fixed; text-align: left; }
.ledger-table .col-select { width: 4%; }
.ledger-table .col-kind { width: 6%; }
.ledger-table .col-number { width: 15%; }
.ledger-table .col-seller { width: 14%; }
.ledger-table .col-date { width: 9%; }
.ledger-table .col-amount { width: 8%; }
.ledger-table .col-state { width: 8%; }
.ledger-table .col-person { width: 10%; }
.ledger-table .col-note { width: 8%; }
.ledger-table .col-file { width: 100px; }
.ledger-table .col-actions { width: 18%; }
.ledger-table th { white-space: nowrap; }
.batch-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: #718096; font-size: 12px; }
.batch-bar button { border: 1px solid #dbe6f4; border-radius: 7px; background: #f8fbff; color: #426a9c; padding: 6px 12px; cursor: pointer; }
.batch-bar .icon-action { padding: 0; }
.batch-bar button:disabled { opacity: .5; cursor: not-allowed; }
.batch-bar .batch-void { color: #ae4343; border-color: #f2d9d7; background: #fff6f5; }
.ledger-table input[type=checkbox] { accent-color: #1f6feb; width: 15px; height: 15px; }
.ledger-table th:first-child, .ledger-table td:first-child { text-align: center; padding-left: 0; padding-right: 0; }
.ledger-table th:first-child input, .ledger-table td:first-child input { display: block; margin: 0 auto; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 16px; color: #718096; font-size: 12px; }
.pagination select, .pagination button { border: 1px solid #dbe6f4; border-radius: 7px; background: white; color: #526987; padding: 6px 9px; }
.pagination button { cursor: pointer; }.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.ledger-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: -3px 0 17px; }
.ledger-filters label { display: grid; gap: 6px; color: #718096; font-size: 12px; font-weight: 600; }
.ledger-filters select, .ledger-filters input { width: 150px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; padding: 0 10px; font-size: 13px; color: var(--ink); }
.ledger-filters input { width: 185px; }
.filter-empty { color: #98a3b2; text-align: center; font-size: 13px; padding: 18px 0 0; }
.filter-empty[hidden], .ledger-table tr[hidden] { display: none; }
.ledger-table .withdraw-button { color: #ae4343 !important; background: #fff6f5 !important; border-color: #f2d9d7 !important; }
.ledger-table th { position: relative; padding: 12px 12px; background: #f7f9fc; color: #8793a3; font-size: 12px; font-weight: 600; white-space: nowrap; }
.column-resize { position: absolute; right: -4px; top: 0; bottom: 0; width: 9px; z-index: 2; cursor: col-resize; touch-action: none; }
.column-resize:hover::after, .column-resize:focus-visible::after { content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: #7ca7e7; border-radius: 2px; }
.cell-ellipsis { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-table th:first-child { border-radius: 8px 0 0 8px; }
.ledger-table th:last-child { border-radius: 0 8px 8px 0; }
.ledger-table td { padding: 16px 8px; border-bottom: 1px solid #eef1f5; font-size: 13px; vertical-align: middle; color: #425169; line-height: 1.6; overflow-wrap: anywhere; }
.ledger-table tbody tr:last-child td { border-bottom: 0; }
.ledger-table td:first-child { font-variant-numeric: tabular-nums; color: #243650; white-space: nowrap; }
.ledger-table td:nth-last-child(2) { white-space: normal; }
.ledger-table td:last-child { min-width: 0; }
.ledger-table td[colspan] { text-align: center; padding: 35px 12px; color: #a1acb9; }
.ledger-table a { color: var(--brand); text-decoration: none; font-weight: 600; }
.ledger-table a:hover { text-decoration: underline; }
.status-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; background: #edf3fd; color: #426eae; font-size: 12px; white-space: nowrap; }
.status-picked { background: #fff4df; color: #a77722; }
.status-written_off { background: #e8f7ee; color: #278053; }
.status-not_writeoff { background: #f4f1f1; color: #846e70; }
.status-void { background: #f1f2f5; color: #7e8795; }
.history-item { display: flex; gap: 8px; margin: 0 0 8px; font-size: 12px; color: #7f8a9b; }
.history-dot { width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: #aabbd3; flex: none; }
.history-item div { display: grid; gap: 1px; }
.history-item strong { color: #4d5e76; font-weight: 600; }
.history-item span:empty { display: none; }
.action-icons { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ledger-table .action-icons .inline { margin: 0; }
.icon-action, .ledger-table .inline .icon-action { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid #dbe6f4; border-radius: 7px; background: #f8fbff; color: #426a9c; font-size: 18px; cursor: pointer; }
.icon-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.status-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; cursor: pointer; font: inherit; font-size: 12px; line-height: 1.4; }
.status-chevron { flex: none; display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.status-trigger:hover { filter: brightness(.96); }
.status-trigger:focus-visible, .status-menu button:focus-visible { outline: 2px solid #729fed; outline-offset: 2px; }
.status-menu { position: fixed; z-index: 30; min-width: 112px; padding: 5px; border: 1px solid #e1e8f2; border-radius: 9px; background: white; box-shadow: 0 8px 26px #1c355022; }
.status-menu button { display: block; width: 100%; border: 0; border-radius: 6px; padding: 8px 10px; background: transparent; color: #43546d; font-size: 13px; text-align: left; cursor: pointer; }
.status-menu button:hover, .status-menu button.selected { background: #eef4fe; color: #2864bd; }
.submitter-edit { border: 0; padding: 0; background: transparent; color: #315c9f; cursor: pointer; }
.note-edit { border: 0; padding: 0; text-align: left; background: transparent; color: #315c9f; cursor: pointer; overflow-wrap: anywhere; }
.note-attachment { display: table; margin-bottom: 4px; padding: 2px 7px; border-radius: 6px; background: #e9f7f1; color: #25715a; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.note-attachment[hidden] { display: none; }
.invoice-number { border: 0; padding: 0; text-align: left; background: transparent; color: #315c9f; font: inherit; cursor: pointer; }
.invoice-number:hover { color: #1768df; text-decoration: underline; }
.invoice-number:focus-visible { outline: 2px solid #729fed; outline-offset: 2px; border-radius: 3px; }
.copy-link-toast { position: fixed; z-index: 100; padding: 6px 10px; border-radius: 6px; background: #273953; color: white; font-size: 12px; box-shadow: 0 4px 14px #1c355033; pointer-events: none; }
.global-search { display: flex; align-items: center; gap: 12px; color: #56657a; font-size: 13px; font-weight: 600; }
.global-search input { width: min(320px, 70%); height: 38px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 0 12px; }
.note-input { height: 110px; padding: 10px 12px; resize: vertical; font: inherit; }
.transfer-item { border-bottom: 1px solid #e8eef6; padding: 8px 0 14px; }.transfer-item p { color: #43546d; font-size: 13px; }.transfer-item button { margin-right: 8px; }
.document-dialog { width: min(720px, 94vw); max-height: 90vh; border: 0; border-radius: 14px; padding: 24px; box-shadow: 0 20px 80px #19355b40; }
.document-dialog::backdrop { background: #17263d88; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-header h2 { margin: 0; font-size: 18px; }.dialog-header button { border: 0; background: none; font-size: 24px; cursor: pointer; color: #70839b; }
.document-dialog.preview-dialog { width: min(1000px, 96vw); }
.preview-pages { max-height: 75vh; overflow: auto; background: #f1f4f8; padding: 16px; text-align: center; border-radius: 8px; }
.preview-pages img { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto 16px; background: white; box-shadow: 0 2px 12px #24364f18; }
.preview-pages img:last-child { margin-bottom: 0; }
.preview-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.attachment-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-height: 72px; overflow-y: auto; margin: 0 0 12px; color: #718096; font-size: 12px; }
.attachment-link { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #dbe6f4; border-radius: 7px; padding: 5px 9px; background: #f8fbff; color: #315c9f; cursor: pointer; }
.attachment-heading { color: #526987; font-size: 15px; margin: 25px 0 12px; text-align: left; }
.attachment-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #718096; font-size: 13px; margin: 10px 0; text-align: left; overflow-wrap: anywhere; }
.attachment-remove { flex: none; border: 1px solid #f2d9d7; border-radius: 7px; padding: 5px 10px; color: #ae4343; background: #fff6f5; cursor: pointer; }
.dialog-history { border-bottom: 1px solid #e8eef6; padding: 12px 0; color: #43546d; font-size: 13px; }.dialog-history p { margin: 5px 0 0; color: #7e8da0; }
.dialog-input { display: block; width: 100%; margin: 12px 0; height: 42px; padding: 0 12px; border: 1px solid #dbe6f4; border-radius: 8px; background: white; }.dialog-message { color: #718096; font-size: 13px; }.dialog-save { border: 0; border-radius: 8px; background: var(--brand); color: white; padding: 10px 18px; cursor: pointer; }
.buyer-subline { display: block; margin-top: 5px; color: #7f8a9b; font-size: 12px; }
.admin-link { display: inline-flex; align-items: center; justify-content: center; color: #285ea9; text-decoration: none; }
.notification-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #45658f; cursor: pointer; }
.notification-bell:hover { background: #eef4fc; }
.notification-bell:focus-visible { outline: 2px solid #729fed; outline-offset: 2px; }
.notification-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border: 1px solid white; border-radius: 50%; background: #e84d54; }
.notification-dot[hidden] { display: none; }
.notification-item { padding: 12px 0; border-bottom: 1px solid #e8eef6; }
.notification-item p { margin: 0 0 4px; color: #354a68; font-size: 14px; line-height: 1.5; }
.notification-time { display: block; margin-bottom: 8px; color: #8a98aa; font-size: 12px; }
.notification-item button { margin-right: 8px; }
.notification-item a { color: #1768df; font-size: 13px; text-decoration: none; }
.admin-page { max-width: 1120px !important; }
.settings-card { padding: 24px; margin-bottom: 18px; }
.settings-card h2 { margin: 0 0 8px; font-size: 17px; }
.settings-card p { color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.settings-list { padding: 0; margin: 16px 0; list-style: none; }
.settings-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.settings-list small { color: #7f8a9b; }
.settings-add { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.settings-add input, .settings-add select { min-width: 200px; flex: 1; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.seller-mapping-row { flex-wrap: wrap; }
.seller-source { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.seller-mapping-edit { display: flex; flex: 1; gap: 8px; min-width: 220px; }
.seller-mapping-edit input { flex: 1; min-width: 100px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.settings-card button { border: 0; border-radius: 8px; background: var(--brand); color: white; padding: 10px 16px; cursor: pointer; }
.settings-card .settings-remove { background: #f2f6fc; color: #456996; }
.admin-page .settings-add label { display: grid; flex: 1; min-width: 180px; gap: 7px; color: #56657a; font-size: 13px; }
.admin-page .settings-add label input, .admin-page .settings-add label select { min-width: 0; width: 100%; }
.admin-page .settings-add { align-items: end; }
.admin-page .settings-list li { flex-wrap: wrap; }
.admin-page .settings-list li > span { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.admin-page .settings-list form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-page .settings-list input[type=password] { min-width: 0; width: 180px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; font: inherit; font-size: 13px; }
.document-manage-link { display: inline-flex; margin-top: 7px; color: #315c9f; font-size: 12px; text-decoration: none; }
.document-manage-link:hover { text-decoration: underline; }
.document-settings-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0; }
.document-settings-form label { display: grid; gap: 7px; color: #56657a; font-size: 13px; }
.document-settings-form select { min-width: 180px; max-width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fbfcfe; font: inherit; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.role-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fbfcfe; }
.role-card h3 { margin: 0 0 12px; font-size: 15px; }
.permission-grid { display: grid; gap: 10px; margin-bottom: 16px; }
.permission-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4d5e76; }
.ledger-table .inline { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.ledger-table .inline input { height: 32px; width: 125px; min-width: 0; padding: 0 9px; border-radius: 7px; font-size: 12px; }
.ledger-table .inline button { border: 1px solid #d6e4fa; border-radius: 7px; color: #245dad; background: #f4f8ff; padding: 7px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.ledger-table .inline button:hover { background: #e8f1ff; }
.empty-state { color: #98a3b2; font-size: 13px; text-align: center; padding: 24px 0; }
.confirm-page { max-width: 900px !important; }
.upload-queue { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.upload-queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #50627e; font-size: 13px; }
.upload-queue ul { margin: 10px 0 0; padding: 0; list-style: none; }
.upload-queue-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf1f7; font-size: 13px; }
.upload-queue-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #243650; }
.upload-queue-state { flex: none; color: #536f99; }
.upload-queue-detail { color: #ad5662; }
.upload-queue-row a { flex: none; color: #1768df; text-decoration: none; font-weight: 600; }
@media (max-width: 720px) { .upload-queue-row { flex-wrap: wrap; } .upload-queue-detail { width: 100%; } }
.confirm-page .card { padding: 26px; }
.confirm-page .card > p { color: var(--ink-soft); line-height: 1.6; font-size: 13px; }
.confirm-page form:not(.classification-form) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 22px 0; }
.confirm-page form label { display: grid; gap: 7px; color: #56657a; font-size: 13px; font-weight: 600; }
.confirm-page input:not([type=hidden]), .confirm-page select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; color: var(--ink); font-size: 14px; }
.confirm-page button { height: 42px; border: 0; padding: 0 18px; border-radius: 9px; background: var(--brand); color: white; font-size: 13px; font-weight: 600; cursor: pointer; }
.confirm-page form:not(.classification-form) > button { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }
.classification-form { display: flex; align-items: end; gap: 12px; padding: 16px; border-radius: 10px; background: #f4f7fc; }
.classification-form label { flex: 1; }
.classification-form button { background: #e7effe; color: #245dad; }
.confirm-page a { color: var(--brand); text-decoration: none; }
@media (max-width: 720px) {
  .workspace-header-inner { padding: 0 16px; min-height: 60px; }
  .workspace-header-inner { padding-top: 12px; padding-bottom: 12px; }
  .workspace-user { width: 100%; margin-left: 0; gap: 8px; }
  .workspace-user .user-copy { margin-right: auto; text-align: left; }
  .workspace-user .test-switch { order: 1; }
  .ledger-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-filters label { min-width: 0; }
  .ledger-filters input, .ledger-filters select { min-width: 0; width: 100%; }
  .app-body .page { padding: 25px 16px 44px; }
  .page-heading h1 { font-size: 23px; }
  .upload-card, .ledger-card { padding: 18px 16px; }
  .upload-form, .upload-form.has-visibility { grid-template-columns: 1fr; gap: 13px; }
  .upload-submit { width: 100%; }
  .brand-caption, .brand-divider { display: none; }
  .confirm-page form:not(.classification-form) { grid-template-columns: 1fr; }
  .classification-form { flex-wrap: wrap; }
  .classification-form label { min-width: 100%; }
}

@media (max-width: 420px) {
  .auth-card { padding: 26px 18px 18px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .kv dt { width: 64px; }
}

.visibility-badge {
  display: inline-block;
  margin-inline-start: .4rem;
  padding: .1rem .45rem;
  border-radius: .6rem;
  background: #e8f1fa;
  color: #21476a;
  font-size: .78rem;
}
.visibility-badge.private {
  background: #f0e6fb;
  color: #57328a;
}

.auth-test-switch { position: fixed; top: 1rem; right: 1rem; }
.test-switch { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.test-switch { padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #f5f8fd; }
.test-switch span { padding: 0 5px; font-size: 11px; color: #7a8799; white-space: nowrap; }
.test-switch button { height: 28px; padding: 0 9px; border: 0; border-radius: 6px; background: white; color: #315c9f; font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }
.test-switch button:hover, .test-switch button:focus-visible { background: #e8f0ff; color: var(--brand-dark); }
