/* Shared styles for the sign-in, account and admin pages. Palette from the desktop RheoVision:
   navy #144272, hover blue #2C74B3, window gradient #081F3B-#185088, green #7DC242, yellow #FFC40C. */
:root {
  --navy: #144272; --navy-hi: #2c74b3; --navy-deep: #0a2647; --navy-night: #081f3b; --navy-mid: #185088; --navy-press: #0e3259;
  --green: #7dc242; --yellow: #ffc40c;
  --bg: #edf2f7; --surface: #ffffff; --surface-2: #e8eef5; --line: #d1dce8;
  --fg: #10233a; --muted: #55687d; --ink: #144272;
  --ok: #2f7a12; --ok-soft: #e4f2d6; --bad: #b42318; --bad-soft: #fde8e6; --warn: #8a5a00; --warn-soft: #fff4cc;
  --grid: rgba(16, 35, 58, .09);
  --f-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081f3b; --surface: #0c2a4d; --surface-2: #12355e; --line: #1f4a78;
    --fg: #e6eef7; --muted: #a3b8cf; --ink: #8cc0f0;
    --ok: #9ad45c; --ok-soft: #1d3a1f; --bad: #ff8a80; --bad-soft: #3d1a1a; --warn: #ffc40c; --warn-soft: #3a2f0e;
    --grid: rgba(230, 238, 247, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #081f3b; --surface: #0c2a4d; --surface-2: #12355e; --line: #1f4a78;
  --fg: #e6eef7; --muted: #a3b8cf; --ink: #8cc0f0;
  --ok: #9ad45c; --ok-soft: #1d3a1f; --bad: #ff8a80; --bad-soft: #3d1a1a; --warn: #ffc40c; --warn-soft: #3a2f0e;
  --grid: rgba(230, 238, 247, .1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 600; }
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--navy-hi); outline-offset: 2px; }

/* Top band */
.top { background: linear-gradient(90deg, var(--navy-night), var(--navy-deep) 45%, var(--navy-mid)); color: #fff; border-bottom: 3px solid var(--green); }
.top-in { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); max-width: 2400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 16px; color: #fff; text-decoration: none; }
.brand img { height: 34px; display: block; }
.brand .rule { width: 1px; height: 34px; background: rgba(255,255,255,.35); }
.brand b { font-size: 21px; font-weight: 500; display: block; line-height: 1.1; }
.brand small { display: block; font-size: 12px; color: rgba(255,255,255,.72); }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 13.5px; }
.top-nav a, .top-nav button { color: rgba(255,255,255,.88); text-decoration: none; background: none; border: 1px solid transparent; border-radius: 5px; padding: 6px 10px; cursor: pointer; }
.top-nav a:hover, .top-nav button:hover { background: rgba(44,116,179,.4); color: #fff; }
.top-nav .who { color: rgba(255,255,255,.75); }
.top-nav .who b { color: #fff; font-weight: 600; }

.wrap { max-width: 1400px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.card-h h2 { padding-left: 10px; border-left: 3px solid var(--navy-hi); line-height: 1.25; }
.hint { color: var(--muted); font-size: 13px; margin: 0; max-width: 72ch; }

/* Controls */
.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type="text"], input[type="password"], input[type="email"], input[type="search"], select { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus { border-color: var(--navy-hi); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 5px; padding: 8px 14px; cursor: pointer; font-weight: 500; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--navy-hi); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-hi); border-color: var(--navy-hi); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.msg { border-radius: 5px; padding: 10px 12px; font-size: 13.5px; }
.msg.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.msg.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }

/* Tables */
.scroll { overflow-x: auto; min-width: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12.5px; color: #fff; background: var(--navy); padding: 9px 10px; white-space: nowrap; }
.tbl th.n, .tbl td.n { text-align: right; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--navy-hi) 8%, transparent); }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl td.actions .btn + .btn { margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.admin { background: color-mix(in srgb, var(--navy-hi) 16%, transparent); color: var(--ink); }
.pill.plain { background: var(--surface-2); color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--navy-hi); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; }
.tile b { font-size: 26px; font-weight: 600; line-height: 1.15; }
.tile span { font-size: 12.5px; color: var(--muted); }
.tile.alert { border-top-color: var(--bad); }
.tile.good { border-top-color: var(--green); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); }

/* Dialogs */
dialog.dlg { border: 0; padding: 0; border-radius: 8px; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgba(8,31,59,.45); }
dialog.dlg::backdrop { background: rgba(8, 31, 59, .62); }
.dlg-h { background: linear-gradient(90deg, var(--navy-deep), var(--navy)); color: #fff; padding: 14px 18px; border-bottom: 3px solid var(--green); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-h h2 { font-size: 16px; color: #fff; }
.dlg-x { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 5px; width: 30px; height: 30px; cursor: pointer; }
.dlg-b { padding: 18px; display: grid; gap: 14px; }
.dlg-f { padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.secret { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 5px; padding: 10px 12px; }
.secret code { font-size: 18px; font-weight: 600; letter-spacing: .04em; flex: 1; word-break: break-all; font-family: "IBM Plex Mono", Consolas, monospace; }
.radio { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.radio input { accent-color: var(--navy-hi); width: 16px; height: 16px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--navy-deep); color: #fff; border-left: 4px solid var(--green); padding: 10px 16px; border-radius: 6px; font-size: 13.5px; z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { border-left-color: var(--bad); }
.chart-box { position: relative; height: 300px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
