/* ============================================================
   DRG / DIP 分组测试台 —— 「临床档案」视觉系统
   纸面底色 + 墨蓝主色 + 印章朱红点缀；衬线标题 / 等宽编码
   ============================================================ */

:root {
  --paper: #f5f3ec;
  --paper-deep: #ece8da;
  --card: #fffdf8;
  --line: #ddd6c3;
  --line-soft: #e8e3d4;
  --ink: #22313d;
  --ink-soft: #5b6a76;
  --ink-faint: #8b95a0;
  --navy: #1d4266;
  --navy-deep: #132a44;
  --navy-ink: #0f2136;
  --seal: #bf4033;
  --seal-deep: #a23326;
  --green: #1c7a4c;
  --green-deep: #0f6238;
  --amber: #96660f;
  --red: #b42318;
  --radius: 7px;
  --shadow-card: 0 1px 2px rgba(34, 49, 61, 0.05), 0 10px 28px rgba(34, 49, 61, 0.07);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SF Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(29, 66, 102, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}

::selection {
  background: rgba(191, 64, 51, 0.18);
}

button,
input,
select,
textarea {
  font: inherit;
}

h1, h2, h3 {
  font-family: var(--font-serif);
}

/* ===== 页头：墨蓝档案封 + 印章标识 ===== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 34px;
  color: #f6f2e8;
  background:
    radial-gradient(1100px 320px at 88% -70%, rgba(191, 64, 51, 0.16), transparent 62%),
    linear-gradient(180deg, #173252, var(--navy-deep));
  border-bottom: 3px solid var(--seal);
  box-shadow: 0 10px 30px rgba(19, 42, 66, 0.22);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-seal {
  display: grid;
  flex: none;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 9px;
  background: var(--seal);
  color: #fff6ee;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 246, 238, 0.38), 0 3px 8px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.app-header h1 {
  margin: 0 0 5px;
  font-size: 25px;
  letter-spacing: 1px;
}

.app-header p {
  margin: 0;
  color: rgba(244, 239, 226, 0.72);
  font-size: 13px;
  letter-spacing: 0.4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.docs-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(244, 239, 226, 0.4);
  border-radius: var(--radius);
  color: rgba(246, 242, 232, 0.92);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.docs-link:hover {
  border-color: rgba(244, 239, 226, 0.8);
  background: rgba(244, 239, 226, 0.12);
}

/* ===== 主体布局 ===== */

main {
  width: min(1480px, calc(100% - 40px));
  margin: 24px auto 34px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.status-item {
  padding: 11px 16px 12px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(34, 49, 61, 0.04);
}

.status-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.status-item strong {
  color: var(--navy-ink);
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.3px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  padding: 10px 18px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tabs button:hover {
  color: var(--navy-ink);
}

.tabs button.active {
  border-bottom-color: var(--seal);
  background: transparent;
  color: var(--navy-ink);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(390px, 43%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.tab-panel {
  display: none;
  padding: 20px;
}

.tab-panel.active {
  display: block;
}

/* ===== 表单 ===== */

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #3d4d59;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cfc9b6;
  border-radius: 5px;
  background: #fffefb;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #a9b1b9;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(29, 66, 102, 0.13);
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

/* ===== 按钮 ===== */

button {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.1s ease, box-shadow 0.15s ease;
}

button.primary {
  min-width: 112px;
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: var(--navy);
  color: #f6f2e8;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(19, 42, 66, 0.3);
}

button.primary:hover {
  background: var(--navy-ink);
}

button.primary:active {
  transform: translateY(1px);
}

button.primary:disabled {
  background: #97a6b3;
  box-shadow: none;
  cursor: wait;
}

button.ghost,
button.ghost.small {
  min-height: 36px;
  border: 1px solid #c6c0ad;
  border-radius: 5px;
  background: var(--card);
  color: #46565f;
  cursor: pointer;
}

button.ghost:hover {
  border-color: var(--navy);
  color: var(--navy);
}

button.small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

.help {
  padding: 10px 12px;
  border-left: 3px solid var(--navy);
  border-radius: 4px;
  background: var(--paper-deep);
  color: #57646e;
  font-size: 12px;
  line-height: 1.7;
}

code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--paper-deep);
  border: 1px solid var(--line-soft);
  color: var(--navy-deep);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ===== 空状态 ===== */

.empty {
  display: flex;
  min-height: 420px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--ink-soft);
  text-align: center;
}

.empty h2 {
  margin: 16px 0 8px;
  color: #33434f;
  letter-spacing: 1px;
}

.empty p {
  max-width: 420px;
  margin: 0;
  line-height: 1.7;
}

.empty-icon {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  border: 2px solid rgba(29, 66, 102, 0.3);
  border-radius: 14px;
  background: var(--paper-deep);
  color: var(--navy);
  font-family: var(--font-serif);
  font-weight: 800;
  letter-spacing: 2px;
}

.hidden {
  display: none !important;
}

/* ===== 结果面板 ===== */

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbf9f2, var(--card));
}

.result-toolbar h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.8px;
}

.result-toolbar > div {
  display: flex;
  gap: 8px;
}

#result-body {
  padding: 18px 20px 24px;
}

.group-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.group-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-top: 2px solid rgba(29, 66, 102, 0.45);
  border-radius: var(--radius);
  background: #f8f6ee;
}

.group-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.group-card strong {
  display: block;
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1.25;
}

.group-card em {
  display: block;
  min-height: 34px;
  margin-top: 4px;
  color: #4b5a65;
  font-style: normal;
  font-size: 13px;
  line-height: 1.4;
}

.result-section {
  margin-bottom: 18px;
}

.result-section > h3 {
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--paper-deep);
  color: #4d5b66;
  font-weight: 700;
  white-space: nowrap;
}

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

.code {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e6ecf2;
  border: 1px solid #ccd8e4;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  background: #fdf3dd;
  border-color: #ecd9a8;
  color: var(--amber);
}

.badge.error {
  background: #fbe9e7;
  border-color: #eec4bd;
  color: var(--red);
}

/* ===== 规则路径：档案时间线 ===== */

.path {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.path li {
  position: relative;
  padding: 10px 0 12px 26px;
  border-left: 2px solid #d3cdba;
  margin-left: 10px;
}

.path li::before {
  position: absolute;
  top: 15px;
  left: -7px;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--navy);
  transform: rotate(45deg);
  content: "";
}

.path li:last-child {
  border-left-color: transparent;
}

.path li:last-child::before {
  background: var(--seal);
}

.path-stage {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--navy);
  font-weight: 700;
}

.path-code {
  margin-left: auto;
  color: #3d4d59;
  font-family: var(--font-mono);
}

.path-name {
  margin: 3px 0;
  color: #4b5a65;
}

.path-rule {
  margin: 0;
  color: #7d8894;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.warning-list,
.empty-list {
  margin: 0;
  padding-left: 18px;
  color: #4b5a65;
  line-height: 1.7;
}

.warning-list li {
  color: var(--amber);
}

.batch-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 34px 24px;
  color: #7d8894;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 16px;
  border-left: 4px solid var(--navy);
  border-radius: 6px;
  background: #16283c;
  color: #f3efe5;
  box-shadow: 0 14px 34px rgba(15, 33, 54, 0.35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-left-color: #d9534f;
}

/* DIP result readability: keep long codes, names and JSON inside the panel. */
.result-panel,
#result-body,
#dip-result-body {
  min-width: 0;
  padding: 5px 10px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.cell-wrap {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dip-result-hero {
  display: grid;
  grid-template-columns: minmax(180px, 0.38fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 2px solid rgba(29, 66, 102, 0.45);
  border-radius: 9px;
  background: linear-gradient(120deg, #f4f1e6, #fbf9f3);
}

.dip-result-hero.unmatched {
  border-top-color: #dca658;
  background: linear-gradient(120deg, #faf1de, #fdfaf2);
}

.dip-hero-item {
  min-width: 0;
}

.dip-hero-item > span,
.dip-hero-item > em {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
}

.dip-hero-item > em {
  margin-top: 6px;
}

.dip-hero-item > strong {
  display: block;
  margin-top: 5px;
  color: #14532d;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dip-result-hero.unmatched .dip-hero-item > strong {
  color: var(--amber);
}

.dip-group-code {
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.dip-group-meta .group-card strong {
  font-size: 18px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-value {
  color: var(--navy);
}

.stage-legend {
  margin-bottom: 10px;
  padding: 9px 11px;
  border-left: 3px solid var(--navy);
  border-radius: 4px;
  background: var(--paper-deep);
  color: #57646e;
  font-size: 12px;
  line-height: 1.7;
}

.stage-name {
  display: block;
  color: var(--navy);
  font-weight: 700;
}

.stage-code {
  display: block;
  margin-top: 2px;
  color: #7d8894;
  font-family: var(--font-mono);
  font-size: 11px;
}

.dip-path-table,
.dip-batch-table {
  table-layout: fixed;
}

.dip-path-table {
  width: 100%;
  min-width: 0;
}

.dip-path-table th:nth-child(1) { width: 17%; }
.dip-path-table th:nth-child(2) { width: 17%; }
.dip-path-table th:nth-child(3) { width: 21%; }
.dip-path-table th:nth-child(4) { width: 10%; }
.dip-path-table th:nth-child(5) { width: 35%; }

.dip-batch-table {
  width: 100%;
  min-width: 0;
}

.tooltip-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  white-space: normal;
  line-height: 1.4;
}

.field-syntax {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.hint-icon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.dip-batch-table th:nth-child(1) { width: 4%; }
.dip-batch-table th:nth-child(2) { width: 11%; }
.dip-batch-table th:nth-child(3) { width: 27%; }
.dip-batch-table th:nth-child(4) { width: 21%; }
.dip-batch-table th:nth-child(5) { width: 14%; }
.dip-batch-table th:nth-child(6) { width: 8%; }
.dip-batch-table th:nth-child(7) { width: 9%; }
.dip-batch-table th:nth-child(8) { width: 6%; }
.dip-path-table .code,
.dip-batch-table .code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.json-detail {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.55;
}

.batch-summary .badge {
  max-width: 100%;
  white-space: normal;
  line-height: 1.5;
}

#dip-result-body details {
  margin-bottom: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf9f2;
}

#dip-result-body summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

  .status-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .app-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  main {
    width: calc(100% - 20px);
  }

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

  .grid.two,
  .grid.four,
  .group-summary,
  .dip-result-hero {
    grid-template-columns: 1fr;
  }

  .tab-panel,
  #result-body {
    padding: 15px;
  }
}

/* ===== 批量任务：Excel 导入 + 进度条 ===== */
.batch-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #f8f6ee 0%, #f1eee2 100%);
}

.excel-btn {
  display: inline-flex;
  flex-direction: row; /* 覆盖全局 label { flex-direction: column } */
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.excel-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.excel-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.excel-btn:active {
  transform: translateY(1px);
}

/* 下载模板：浅绿描边按钮 */
.excel-btn-download {
  color: var(--green-deep);
  background: #ebf5ee;
  border-color: #c3ddcc;
}

.excel-btn-download:hover {
  background: #ddf0e4;
  border-color: #9ccfae;
  box-shadow: 0 2px 6px rgba(16, 124, 65, 0.14);
}

/* 导入 Excel：实心绿主按钮；选中文件后切换为描边绿「已选择」状态 */
.excel-btn-import {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(180deg, #1b8756 0%, #147044 100%);
  border-color: #0e5c37;
  box-shadow: 0 1px 3px rgba(16, 98, 60, 0.3);
}

.excel-btn-import:hover {
  background: linear-gradient(180deg, #167749 0%, #0f6039 100%);
  box-shadow: 0 2px 8px rgba(16, 98, 60, 0.35);
}

.excel-btn-import .icon-check,
.excel-btn-import .label-done {
  display: none;
}

.batch-file-row.has-file .excel-btn-import {
  color: var(--green-deep);
  background: #ebf5ee;
  border-color: #9ccfae;
  box-shadow: none;
}

.batch-file-row.has-file .excel-btn-import:hover {
  background: #ddf0e4;
}

.batch-file-row.has-file .excel-btn-import .icon-upload,
.batch-file-row.has-file .excel-btn-import .label-idle {
  display: none;
}

.batch-file-row.has-file .excel-btn-import .icon-check,
.batch-file-row.has-file .excel-btn-import .label-done {
  display: inline;
}

.file-name {
  font-size: 13px;
  color: #5b6b7c;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-file-row.has-file .file-name {
  color: var(--green-deep);
  font-weight: 600;
}

.batch-file-row .file-clear {
  color: var(--red);
}

.batch-file-row .file-clear:hover {
  color: #8f1a11;
  background: #fbeae8;
  border-color: #e3b3ac;
}

.batch-file-row .file-clear svg {
  width: 13px;
  height: 13px;
  margin-right: 4px;
}

.batch-progress {
  margin: 14px 0 4px;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #3c4a56;
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  border-radius: 5px;
  background: #e2ddcd;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), #2e6390);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-bar.done .progress-fill {
  background: var(--green);
}

.progress-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: #8b95a0;
}

.fail-reason {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--red);
}

/* ===== 访问控制：登录页 / 头部用户信息 / 用户管理页 ===== */
.user-info {
  color: rgba(244, 239, 226, 0.85);
  font-size: 13px;
  white-space: nowrap;
}

.login-body {
  background-color: var(--navy-deep);
  background-image:
    radial-gradient(rgba(244, 239, 226, 0.07) 1px, transparent 1px),
    radial-gradient(900px 480px at 50% -10%, rgba(191, 64, 51, 0.2), transparent 65%);
  background-size: 22px 22px, 100% 100%;
}

.login-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px 16px;
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  padding: 38px 34px 24px;
  border: 1px solid rgba(244, 239, 226, 0.16);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 30px 70px rgba(6, 16, 28, 0.45);
  text-align: center;
}

.login-card::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, var(--seal) 0%, var(--seal) 34%, var(--navy) 66%, var(--navy) 100%);
  content: "";
}

.login-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.login-mark .brand-seal {
  width: 56px;
  height: 56px;
  font-size: 29px;
  border-radius: 11px;
}

.login-card h1 {
  margin: 0 0 6px;
  color: var(--navy-ink);
  font-size: 22px;
  letter-spacing: 1.5px;
}

.login-sub {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.login-card form {
  gap: 14px;
  text-align: left;
}

.login-card .actions {
  margin-top: 6px;
}

.login-card .primary {
  width: 100%;
}

.login-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
}

.login-foot {
  margin: 22px -34px -24px;
  padding: 12px 34px;
  border-top: 1px dashed var(--line);
  border-radius: 0 0 12px 12px;
  background: #faf7ee;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.create-form {
  padding: 18px 20px 20px;
}

.create-help {
  flex: 1;
  min-width: 220px;
  margin: 0;
}

.expiry-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-inline {
  display: inline-flex;
  flex-direction: row; /* 覆盖全局 label { flex-direction: column } */
  align-items: center;
  gap: 6px;
  color: #3d4d59;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.checkbox-inline input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--navy);
}

.admin-users-body {
  padding: 16px 20px 20px;
  overflow-x: auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
}

button.ghost.danger {
  color: var(--red);
  border-color: #e3b3ac;
}

button.ghost.danger:hover {
  color: #8f1a11;
  background: #fbeae8;
  border-color: #d98d85;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 26, 38, 0.5);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(460px, calc(100vw - 40px));
  padding: 22px 24px;
  border-top: 3px solid var(--seal);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 24px 60px rgba(15, 33, 54, 0.4);
}

.modal-card h3 {
  margin: 0 0 6px;
  letter-spacing: 0.8px;
}

.modal-note {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.modal-expiry {
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.pwd-display {
  padding: 12px 14px;
  border: 1px dashed #c9c2ae;
  border-radius: 6px;
  background: var(--paper-deep);
  color: var(--navy-deep);
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  user-select: all;
  word-break: break-all;
}

/* ===== 入场动效 ===== */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.app-header,
.status-bar,
.tabs,
.layout > .panel,
.admin-main > .panel,
.login-card {
  animation: rise 0.45s ease both;
}

.status-bar {
  animation-delay: 0.05s;
}

.tabs {
  animation-delay: 0.1s;
}

.layout > .panel,
.admin-main > .panel {
  animation-delay: 0.15s;
}

.login-card {
  animation-duration: 0.5s;
}

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