/* ==========================================================================
   共享设计系统：三端（登录 / 工作台 / 后台）共用
   只放基础令牌与通用组件，页面级布局写在各自的 <style> 里
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0a0e14;
  --bg-soft: #0d1219;
  --surface: #11161f;
  --surface-2: #161d28;
  --surface-3: #1d2634;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #e8eef6;
  --muted: #8b97a8;
  --dim: #6f7d8f;

  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --ok: #2ee6a8;
  --ok-soft: rgba(46, 230, 168, 0.12);
  --warn: #ffb020;
  --warn-soft: rgba(255, 176, 32, 0.12);
  --danger: #ff5d5d;
  --danger-soft: rgba(255, 93, 93, 0.12);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; opacity: .85; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

::selection { background: rgba(79, 140, 255, .3); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .18); background-clip: content-box; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, transform .06s, opacity .16s;
  background: linear-gradient(180deg, #5a95ff, #3d7bf0);
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 123, 240, .28);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; box-shadow: none; }

.btn.ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}
.btn.ghost:hover { background: var(--surface-3); border-color: var(--line-strong); }

.btn.danger {
  background: transparent;
  border-color: rgba(255, 93, 93, .3);
  color: var(--danger);
  box-shadow: none;
  font-weight: 500;
}
.btn.danger:hover { background: var(--danger-soft); border-color: rgba(255, 93, 93, .5); }

.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .02em;
}

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, .2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .16);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b97a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  vertical-align: -2px;
  cursor: pointer;
}

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

/* ---------------- 卡片 / 面板 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.panel.tight { padding: 0; overflow: hidden; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 46px 24px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent);
}
.empty svg { opacity: .5; margin-bottom: 12px; }
.empty strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 6px; font-weight: 600; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
.tag.ok { color: var(--ok); border-color: rgba(46, 230, 168, .32); background: var(--ok-soft); }
.tag.warn { color: var(--warn); border-color: rgba(255, 176, 32, .32); background: var(--warn-soft); }
.tag.danger { color: var(--danger); border-color: rgba(255, 93, 93, .32); background: var(--danger-soft); }
.tag.info { color: #8fb6ff; border-color: rgba(79, 140, 255, .32); background: var(--accent-soft); }
.tag.plain::before { display: none; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: rgba(255, 255, 255, .025); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.wrap { white-space: normal; max-width: 320px; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 12, .68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .16s ease-out;
}
.modal.on { display: flex; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

.dialog {
  width: 460px;
  max-width: 100%;
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
.dialog-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-hd h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.dialog-hd .x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.dialog-hd .x:hover { background: var(--surface-3); color: var(--text); }
.dialog-bd { padding: 20px; }
.dialog-ft {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .12);
}

/* ---------------- 提示 ---------------- */
.msg { min-height: 18px; font-size: 12.5px; margin-top: 8px; color: var(--danger); }
.msg.ok { color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 120;
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 品牌标 ---------------- */
.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #4f8cff, #7c5cff 70%);
  box-shadow: 0 6px 18px rgba(79, 140, 255, .35);
  flex: none;
}
.logo-mark svg { width: 18px; height: 18px; }
