/* Shared look for the admin page and the account page. Colors are tokens; dark mode redefines them.
   Palette mirrors the desktop client (IdentityV Helper, MainWindow.axaml): blue-tinted surfaces,
   navy text, a true #2869D8 accent — not the old generic indigo. */
:root {
  --bg: #f3f6fc;
  --surface: #ffffff;
  --surface-2: #edf2f9;
  --text: #202d43;
  --muted: #65758d;
  --line: #e1e6ef;
  --accent: #2869d8;
  --accent-soft: #e6eefc;
  --accent-text: #ffffff;
  --ok: #1f8a5b;
  --ok-soft: #ddf2e7;
  --warn: #a35200;
  --warn-soft: #fbf0db;
  --bad: #c9463f;
  --bad-soft: #fbe3e1;
  --shadow: 0 1px 2px rgba(32, 45, 67, .05), 0 1px 3px rgba(32, 45, 67, .07);
  --radius: 14px;
  --radius-control: 8px;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101723;
    --surface: #172231;
    --surface-2: #1f2c3e;
    --text: #edf3fe;
    --muted: #a1b0c6;
    --line: #243247;
    --accent: #7fa8f0;
    --accent-soft: #1d3049;
    --accent-text: #0e1220;
    --ok: #5ccb94;
    --ok-soft: #173528;
    --warn: #f1a10d;
    --warn-soft: #33270f;
    --bad: #f08a84;
    --bad-soft: #3a1f20;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101723; --surface: #172231; --surface-2: #1f2c3e; --text: #edf3fe; --muted: #a1b0c6; --line: #243247;
  --accent: #7fa8f0; --accent-soft: #1d3049; --accent-text: #0e1220; --ok: #5ccb94; --ok-soft: #173528;
  --warn: #f1a10d; --warn-soft: #33270f; --bad: #f08a84; --bad-soft: #3a1f20; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { flex: 1; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); padding: 6px 0; cursor: pointer; }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 7px 10px;
  min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }

button, .button {
  font: inherit;
  font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-control);
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
button:hover:not(:disabled) { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.small { padding: 3px 10px; font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 100;
}
.toast.bad { background: var(--bad); color: #fff; }

dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 0;
  background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 12, 18, .45); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 0; flex: none;
}
/* A key — the portal is the license / activation server. Icon follows the accent in both themes. */
.brand-mark::before {
  content: ""; width: 16px; height: 16px; background: var(--accent);
  -webkit-mask: var(--brand-icon) center / contain no-repeat;
          mask: var(--brand-icon) center / contain no-repeat;
}
:root {
  --brand-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='15.5' r='5.5'/%3E%3Cpath d='m21 2-9.6 9.6'/%3E%3Cpath d='m15.5 7.5 3 3L22 7l-3-3'/%3E%3C/svg%3E");
}
