:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --text: #16171a;
  --text-2: #55575c;
  --muted: #8b8d94;
  --faint: #b9bbc0;
  --line: #ececf0;
  --line-2: #f4f4f6;
  --accent: #2563eb;
  --accent-soft: #f0f5ff;
  --danger: #c4322b;
  --warn: #9a6100;
  --ok: #17693f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 20, 24, 0.04), 0 4px 16px rgba(18, 20, 24, 0.04);
  --shadow-lg: 0 8px 24px rgba(18, 20, 24, 0.08), 0 32px 64px rgba(18, 20, 24, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d0f;
    --surface: #151619;
    --text: #f0f1f3;
    --text-2: #a8aab0;
    --muted: #7c7e85;
    --faint: #55575d;
    --line: #232529;
    --line-2: #1b1d21;
    --accent: #6396ff;
    --accent-soft: #16203a;
    --danger: #f2645a;
    --warn: #e0a02a;
    --ok: #43b880;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 32px 64px rgba(0, 0, 0, 0.5);
  }
}

/* 线性图标 */
.i {
  width: 16px; height: 16px; flex: none; display: inline-block;
  vertical-align: -3px; stroke: currentColor; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.i-lg { width: 22px; height: 22px; stroke-width: 1.35; }
.i-file { color: var(--faint); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

/* 顶栏 */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 8px; height: 54px; }
.brand {
  font-weight: 600; font-size: 15px; letter-spacing: -0.02em;
  margin-right: 20px; color: var(--text);
}
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-links a {
  padding: 5px 11px; border-radius: 7px; color: var(--muted);
  font-size: 13.5px; transition: color .15s, background .15s;
}
.nav-links a:hover { background: var(--line-2); color: var(--text); text-decoration: none; }
.nav-links a.on { color: var(--text); font-weight: 500; background: var(--line-2); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  font-size: 13.5px; font-family: inherit; font-weight: 500; letter-spacing: -0.006em;
  background: var(--text); color: var(--bg);
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:active { opacity: .75; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); color: var(--text); opacity: 1; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); opacity: 1; }
.btn.plain {
  background: transparent; color: var(--muted); border-color: transparent; padding: 5px 9px;
}
.btn.plain:hover { background: var(--line-2); color: var(--text); opacity: 1; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }

/* 输入 */
input[type=text], input[type=password], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
label {
  display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px;
  font-weight: 500; letter-spacing: 0;
}

/* 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 9px;
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s cubic-bezier(.32,.72,0,1); z-index: 200; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }

/* 表格：去行线，靠留白分隔 */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px;
  letter-spacing: 0.02em; padding: 0 12px 9px; border-bottom: 1px solid var(--line);
  white-space: nowrap; user-select: none;
}
th.sortable { cursor: pointer; transition: color .15s; }
th.sortable:hover { color: var(--text-2); }
th .sortmark { opacity: .55; margin-left: 2px; font-size: 9px; }
td { padding: 9px 12px; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
tbody tr { transition: background .12s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--line-2); }
tbody tr.sel { background: var(--accent-soft); }

/* 状态：小圆点 + 灰字，只有过期用红 */
.dot {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 12.5px; white-space: nowrap;
}
.dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--faint); flex: none;
}
.dot.expired { color: var(--danger); }
.dot.expired::before { background: var(--danger); }
.dot.expiring { color: var(--warn); }
.dot.expiring::before { background: var(--warn); }
.dot.plain::before { display: none; }

.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grow { flex: 1; }
.hide { display: none !important; }
.center { text-align: center; }

/* 空状态 */
.empty { padding: 56px 24px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* 弹层 */
.mask {
  position: fixed; inset: 0; background: rgba(12,13,15,.32); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } }
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 430px; max-height: 86vh; overflow: auto; padding: 22px;
  animation: pop .18s cubic-bezier(.32,.72,0,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99) } }
.modal h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 600; letter-spacing: -.012em; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; cursor: pointer; inset: 0; background: var(--line);
  border-radius: 980px; transition: background .2s;
}
.switch span::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%;
  transition: transform .2s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }

/* 进度条 */
.bar { height: 3px; background: var(--line); border-radius: 980px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .hide-sm { display: none !important; }
  .card { padding: 18px; border-radius: 12px; }
  th, td { padding-left: 8px; padding-right: 8px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 10px; }
  .btn.sm { padding: 4px 7px; }
}

/* 表格文字截断：避免窄屏下溢出重叠 */
td.name { max-width: 0; overflow: hidden; }
.fname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fname .txt {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
