:root {
  --bg: #05060a;
  --bg-2: #080b11;
  --panel: #0a0e15;
  --panel-2: #0d121b;
  --line: rgba(120, 160, 190, 0.13);
  --line-2: rgba(120, 160, 190, 0.24);
  --text: #e6eef7;
  --muted: #93a2b8;
  --dim: #5f6e85;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --violet: #a78bfa;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, Menlo, monospace;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --sidebar-w: 244px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 460px at 8% -10%, rgba(56, 189, 248, 0.1), transparent 62%),
    radial-gradient(700px 500px at 100% 0%, rgba(139, 92, 246, 0.09), transparent 60%),
    radial-gradient(900px 600px at 60% 110%, rgba(94, 234, 212, 0.05), transparent 70%);
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ---------- login ---------- */
.login-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 36px 34px;
  background:
    radial-gradient(500px circle at 90% 0%, rgba(94, 234, 212, 0.09), transparent 58%),
    rgba(9, 12, 18, 0.94);
  box-shadow: 0 40px 100px -50px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 34px; }
.mark { width: 38px; height: 38px; color: var(--accent); flex: none; filter: drop-shadow(0 0 14px rgba(94, 234, 212, 0.4)); }
.mark svg { width: 100%; height: 100%; display: block; }
.login-brand strong { display: block; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; color: var(--muted); }
.login-brand small { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-top: 5px; letter-spacing: 0.03em; }

.login-form h1 { font-size: 23px; margin-bottom: 8px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-error { min-height: 20px; color: var(--danger); font-size: 12.5px; margin: 4px 0 14px; }
.login-back { display: block; text-align: center; margin-top: 20px; font-size: 12px; color: var(--dim); }
.login-back:hover { color: var(--accent); }

/* ---------- app shell ---------- */
.app {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(6, 8, 13, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.sidebar-brand .mark { width: 30px; height: 30px; }
.sidebar-brand strong { display: block; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; color: var(--muted); }
.sidebar-brand small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--dim); margin-top: 4px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.side-link i { font-family: var(--mono); font-size: 9.5px; font-style: normal; color: var(--dim); letter-spacing: 0.08em; }
.side-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.side-link.active {
  color: #d8fff9;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.13), rgba(94, 234, 212, 0.02));
  border-color: rgba(94, 234, 212, 0.22);
}
.side-link.active i { color: var(--accent); }
.side-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 18px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.operator { display: flex; align-items: center; gap: 10px; padding: 0 4px 12px; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(94, 234, 212, 0.12);
  border: 1px solid rgba(94, 234, 212, 0.25);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  flex: none;
}
.operator strong { display: block; font-size: 12.5px; font-weight: 500; }
.operator small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; }
.side-actions { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px; }
.mini-link {
  background: none;
  border: 0;
  padding: 4px 0;
  font-size: 11.5px;
  color: var(--dim);
  cursor: pointer;
}
.mini-link:hover { color: var(--accent); }
.mini-link.danger:hover { color: var(--danger); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 11, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.sidebar-toggle {
  display: none;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.crumbs { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--dim); }
.crumbs b { color: var(--line-2); }
.crumbs strong { color: var(--muted); font-weight: 500; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 18px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--dim); }
.live { display: inline-flex; align-items: center; gap: 7px; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: livePulse 2.2s infinite; }
@keyframes livePulse { 50% { opacity: 0.35; } }
.clock { color: var(--muted); }

.view-wrap { padding: 30px; flex: 1; }
.view { animation: viewIn 0.26s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.view-head h2 { font-size: 21px; }
.view-head p { color: var(--dim); font-size: 12.5px; margin-top: 6px; }

/* ---------- buttons / fields ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(100deg, var(--accent), #34d3c0);
  color: #03201d;
  box-shadow: 0 8px 22px -14px rgba(94, 234, 212, 0.8);
}
.btn-primary:hover { box-shadow: 0 12px 26px -12px rgba(94, 234, 212, 0.85); }
.btn-ghost { color: var(--muted); border-color: var(--line); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-outline { color: var(--text); border-color: var(--line-2); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.28); background: rgba(248, 113, 113, 0.07); }
.btn-danger:hover { border-color: var(--danger); color: #fff; background: rgba(248, 113, 113, 0.16); }
.btn-block { width: 100%; height: 42px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-xs { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 6px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }
.field input, .field textarea, .field select {
  width: 100%;
  background: rgba(4, 6, 10, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { resize: vertical; line-height: 1.7; min-height: 72px; }
.field input::placeholder, .field textarea::placeholder { color: #46536a; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08);
}
.field input[disabled] { opacity: 0.45; }
.field.invalid input, .field.invalid textarea { border-color: rgba(248, 113, 113, 0.6); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.field-wide { grid-column: 1 / -1; }
.form-card { padding: 26px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 6px; }
.save-hint { font-size: 12px; color: var(--accent); margin-right: auto; }
.form-hint { font-size: 12px; color: var(--dim); min-height: 18px; margin-top: 10px; }
.form-hint.error, .form-hint.ok { display: block; }
.form-hint.error { color: var(--danger); }
.form-hint.ok { color: var(--ok); }

/* ---------- cards / metrics ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.metric {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 20px 18px;
  background: linear-gradient(160deg, rgba(12, 17, 25, 0.9), rgba(7, 9, 14, 0.95));
  overflow: hidden;
}
.metric::after {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.12), transparent 70%);
}
.metric span { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; color: var(--dim); text-transform: uppercase; }
.metric strong { display: block; font-family: var(--mono); font-size: 28px; font-weight: 500; margin-top: 10px; color: #f1fffd; letter-spacing: -0.02em; }
.metric small { display: block; font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.metric.highlight { border-color: rgba(94, 234, 212, 0.3); box-shadow: inset 0 0 40px rgba(94, 234, 212, 0.06); }
.metric.highlight strong { color: var(--accent); }

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 14, 20, 0.86);
  padding: 22px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.card-head h3 { font-size: 14.5px; font-weight: 500; }
.card-hint { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--dim); }
.link-btn { background: none; border: 0; padding: 0; font-size: 12px; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.muted-text { color: var(--muted); font-size: 13px; line-height: 1.8; margin-bottom: 18px; }

.split-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; margin-bottom: 20px; }

.list-block { display: grid; gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; }
.list-row { background: rgba(7, 10, 15, 0.9); padding: 14px 16px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.list-row strong { display: block; font-size: 13px; font-weight: 500; }
.list-row p { font-size: 12px; color: var(--dim); margin-top: 3px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-row .when { font-family: var(--mono); font-size: 10px; color: var(--dim); white-space: nowrap; }

.activity-list { display: flex; flex-direction: column; gap: 12px; max-height: 296px; overflow: auto; }
.activity-item { display: flex; gap: 12px; font-size: 12.5px; }
.activity-item i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex: none;
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
}
.activity-item span { color: var(--muted); }
.activity-item small { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--dim); margin-top: 2px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 12, 18, 0.8);
  padding: 18px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.quick-card:hover { border-color: rgba(94, 234, 212, 0.32); background: rgba(13, 18, 26, 0.9); transform: translateY(-2px); }
.quick-card span { font-family: var(--mono); font-size: 9.5px; color: var(--accent); letter-spacing: 0.16em; }
.quick-card strong { display: block; font-size: 13px; font-weight: 500; margin-top: 8px; }
.quick-card small { display: block; font-size: 11.5px; color: var(--dim); margin-top: 3px; }

/* ---------- nav categories ---------- */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.category-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 12, 18, 0.8);
  padding: 18px 20px;
  margin-bottom: 26px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; }
.panel-head span { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.1em; }
.category-list { display: flex; flex-direction: column; gap: 8px; }
.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(6, 9, 14, 0.6);
}
.category-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.category-main strong { font-size: 13px; font-weight: 500; }
.category-main .cell-sub { display: block; }

/* ---------- shortcuts ---------- */
.shortcut-board { display: flex; flex-direction: column; gap: 22px; }
.shortcut-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.shortcut-group-head h3 { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; }
.shortcut-group-head span { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.14em; text-transform: uppercase; }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 12px; }
.shortcut-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 12, 18, 0.82);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.shortcut-card:hover { border-color: rgba(94, 234, 212, 0.3); transform: translateY(-2px); }
.shortcut-main { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; min-width: 0; }
.shortcut-icon {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.22);
  background: rgba(94, 234, 212, 0.07);
  color: var(--accent);
}
.shortcut-icon svg { width: 17px; height: 17px; }
.shortcut-main strong { display: block; font-size: 13.5px; font-weight: 500; }
.shortcut-main small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.shortcut-main code {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 6px;
  word-break: break-all;
}
.shortcut-actions { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.cell-mono { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; }

/* ---------- table ---------- */
.table-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(9, 12, 18, 0.8); }
@media (max-width: 960px) {
  .table-card { overflow-x: auto; }
  .data-table { min-width: 720px; }
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 13px 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid rgba(120, 160, 190, 0.07); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.cell-title { font-weight: 500; }
.cell-sub { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { display: flex; gap: 6px; }
.icon-badge {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: rgba(94, 234, 212, 0.07);
  border: 1px solid rgba(94, 234, 212, 0.18);
  color: var(--accent);
}
.icon-badge svg { width: 16px; height: 16px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.pill.on { color: #6ee7b7; background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.24); }
.pill.off { color: var(--dim); background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
.pill.new { color: #7dd3fc; background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.24); }
.pill.contacted { color: #fcd34d; background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.24); }
.pill.closed { color: var(--dim); background: rgba(255, 255, 255, 0.03); border-color: var(--line); }

.table-empty { padding: 46px 20px; text-align: center; color: var(--dim); font-size: 13px; }

/* ---------- messages ---------- */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 29px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: rgba(94, 234, 212, 0.11); border-color: rgba(94, 234, 212, 0.34); color: var(--accent); }

.message-list { display: grid; gap: 14px; }
.message-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 14, 20, 0.86);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.message-card.unread { border-color: rgba(56, 189, 248, 0.26); }
.message-card.unread::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}
.msg-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.msg-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-who strong { font-size: 14px; font-weight: 500; }
.msg-who span { font-size: 12px; color: var(--dim); }
.msg-body { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.85; white-space: pre-wrap; }
.msg-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; padding-top: 15px; border-top: 1px solid rgba(120, 160, 190, 0.08); flex-wrap: wrap; }
.msg-foot .when { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.08em; }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- stats editor / users ---------- */
.stats-editor { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 20px; }
.stats-rows { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; align-items: center; }
.stat-row input {
  background: rgba(4, 6, 10, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
}
.stat-row input:focus { border-color: rgba(94, 234, 212, 0.55); }
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.icon-btn:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }

.users-list { display: grid; gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: rgba(7, 10, 15, 0.9); padding: 13px 16px; flex-wrap: wrap; }
.user-row strong { font-size: 13px; font-weight: 500; }
.user-row small { display: block; font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 2px; }
.inline-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 14px; align-items: end; border-top: 1px solid var(--line); padding-top: 20px; }
.inline-form .field { margin-bottom: 0; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 3, 6, 0.76); backdrop-filter: blur(5px); }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 660px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: linear-gradient(170deg, #0c1119, #070a10);
  box-shadow: 0 50px 110px -40px rgba(0, 0, 0, 0.95);
  animation: modalIn 0.24s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.99); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 24px; border-top: 1px solid var(--line); }
.modal-foot .form-hint { margin: 0; flex: 1; }
.modal-actions { display: flex; gap: 10px; }
.modal-body .form-grid { gap: 0 18px; }
.checkbox-field { flex-direction: row; align-items: center; gap: 10px; margin-top: 6px; }
.checkbox-field input { width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-field span { font-size: 12.5px; color: var(--muted); }

/* ---------- toast ---------- */
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid rgba(94, 234, 212, 0.3);
  background: rgba(9, 15, 20, 0.97);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.9);
  animation: toastIn 0.24s ease;
}
.toast.error { border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.26s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
  }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: grid; place-items: center; }
  .split-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-rows { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .view-wrap { padding: 22px 18px 40px; }
  .topbar { padding: 0 18px; }
  .topbar-meta .clock { display: none; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 620px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 30px 22px 26px; }
  .inline-form { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-panel { max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-foot { flex-wrap: wrap; }
}

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

/* ---------- certificate ---------- */
.metric-grid-3 { grid-template-columns: repeat(3, 1fr); }
.info-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 9px; overflow: hidden; }
.info-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 14px;
  background: rgba(7, 10, 15, 0.9);
  padding: 11px 14px;
  font-size: 12.5px;
}
.info-row dt { color: var(--dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding-top: 2px; }
.info-row dd { color: var(--muted); word-break: break-all; overflow: hidden; text-overflow: ellipsis; }
.cert-output {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  background: rgba(4, 6, 10, 0.75);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 16px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 900px) {
  .metric-grid-3 { grid-template-columns: 1fr; }
  .info-row { grid-template-columns: 1fr; gap: 4px; }
}
