/* Login, account and user-admin pages, plus the signed-in user menu on the report page.
   Builds on the report's style.css tokens (--bg, --surface, --ink, --accent ...). */
:root {
  --btn-bg: #1f64b8; --btn-ink: #ffffff; --btn-hover: #184f95;
  --brand-a: #0f2f57; --brand-b: #1d5aa8;
  --err-bg: #fdecea; --err-ink: #8f2412; --ok-bg: #e7f3e7; --ok-ink: #145214;
  --focus: rgba(42, 120, 214, .28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --btn-bg: #9ec5f4; --btn-ink: #0b1f3a; --btn-hover: #c3dbf8;
    --brand-a: #07182d; --brand-b: #123d73;
    --err-bg: #3a1c17; --err-ink: #f6b4a6; --ok-bg: #16301a; --ok-ink: #9fdc9f;
    --focus: rgba(158, 197, 244, .30);
  }
}
:root[data-theme="dark"] {
  --btn-bg: #9ec5f4; --btn-ink: #0b1f3a; --btn-hover: #c3dbf8;
  --brand-a: #07182d; --brand-b: #123d73;
  --err-bg: #3a1c17; --err-ink: #f6b4a6; --ok-bg: #16301a; --ok-ink: #9fdc9f;
  --focus: rgba(158, 197, 244, .30);
}

/* ---------------------------------------------------------------- login: split screen */
body.auth-login { min-height: 100vh; }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }
.brand {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .10), transparent 55%),
              linear-gradient(155deg, var(--brand-a), var(--brand-b));
  display: flex; align-items: center;
}
.brand::after {      /* faint grid lines, like the report's chart grid */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
}
.brand-in { position: relative; z-index: 1; padding: 56px clamp(28px, 6vw, 88px); max-width: 640px; }
.brand .eyebrow { color: rgba(255, 255, 255, .78); }
.brand-title { font-size: clamp(34px, 4.4vw, 52px); line-height: 1.05; margin: 10px 0 12px; letter-spacing: -.01em; }
.brand-title span { color: #9ec5f4; }
.brand-lede { margin: 0 0 30px; font-size: 16.5px; color: rgba(255, 255, 255, .88); line-height: 1.6; }
.mosaic { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-width: 380px; margin-bottom: 30px; }
.mosaic i { display: block; aspect-ratio: 1; border-radius: 5px; background: rgba(158, 197, 244, var(--o, 40%)); }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; color: rgba(255, 255, 255, .85); }
.brand-points li { padding-left: 18px; position: relative; }
.brand-points li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: #9ec5f4; }

.formside { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; margin: 0 0 4px; }
.theme.corner { position: fixed; top: 16px; right: 16px; z-index: 10; }

/* ---------------------------------------------------------------- shared form pieces */
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 14px; padding: 26px 28px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 17px; }
.card .sub { margin: 0 0 20px; }
.fld { display: grid; gap: 6px; margin: 0 0 16px; }
.fld > span:first-child { font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.fld input, .fld select {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--axis); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.fld input:focus, .fld select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.pwbox { position: relative; display: block; }
.pwbox input { padding-right: 48px; }
.eye {
  position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.eye:hover { color: var(--ink); background: var(--panel); }
.eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eye .i-off { display: none; }
.eye.on { color: var(--accent); }
.eye.on .i-eye { display: none; }
.eye.on .i-off { display: block; }
.caps { color: var(--err-ink); font-size: 12.5px; }
.hint, .fine { color: var(--muted); font-size: 12.5px; }
.fine { margin: 16px 0 0; text-align: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink2); margin: 0 0 16px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 600; border-radius: 10px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--grid); background: var(--surface); color: var(--ink);
}
.btn:hover { text-decoration: none; background: var(--panel); }
.btn.primary { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.btn.primary:hover { background: var(--btn-hover); }
.btn:disabled { opacity: .65; cursor: progress; }
.btn.wide { width: 100%; height: 46px; margin-top: 4px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13.5px; font-weight: 500; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err-ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.flash { border-radius: 10px; padding: 11px 14px; margin: 0 0 16px; font-size: 14px; line-height: 1.5; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.err { background: var(--err-bg); color: var(--err-ink); }
.flash.secret { background: var(--fact); color: var(--ink); }
.flash .fine { text-align: left; margin: 6px 0 0; }
.pwshow { font-size: 16px; padding: 3px 8px; letter-spacing: .04em; user-select: all; }

.meter { height: 4px; border-radius: 2px; background: var(--grid); margin: -8px 0 16px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--b-l3); transition: width .2s, background-color .2s; }
.meter.ok i { background: var(--accent); }
.meter.strong i { background: var(--good); }
.match { display: block; min-height: 18px; margin: -8px 0 12px; font-size: 12.5px; }
.match.yes { color: var(--good); }
.match.no { color: var(--muted); }

/* ---------------------------------------------------------------- account + users pages */
body.auth-page { min-height: 100vh; }
.auth-page .top h1 { font-size: 22px; }
.home { color: var(--ink); }
.home:hover { text-decoration: none; color: var(--accent); }
.narrow { max-width: 560px; padding-top: 32px; padding-bottom: 48px; }
.pagetitle { margin: 28px 0 16px; }
.admin-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.auth-page main.wrap > .card { margin-bottom: 40px; }
.tablewrap { overflow-x: auto; }
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 8px 8px; border-bottom: 1px solid var(--grid); }
.utable td { padding: 10px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.utable tr:last-child td { border-bottom: 0; }
.utable.log tr.bad td { color: var(--err-ink); }
.acts { text-align: right; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 9px; background: var(--panel); color: var(--ink2); }
.tag.admin { background: var(--btn-bg); color: var(--btn-ink); }
.tag.warn { background: var(--warn-bg); color: var(--ink2); }

details.menu { position: relative; display: inline-block; text-align: left; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: 38px; z-index: 20; width: 300px; display: grid; gap: 12px;
  background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
  white-space: normal;
}
.menu-pop form + form { border-top: 1px solid var(--grid); padding-top: 12px; }
.menu-pop .fld { margin-bottom: 10px; }
.menu-pop .check { margin-bottom: 10px; font-size: 13px; }

/* ---------------------------------------------------------------- signed-in menu (report page + admin pages) */
.top-side { flex-wrap: wrap; justify-content: flex-end; }
.userbar { display: flex; align-items: center; gap: 12px; font-size: 13.5px; flex-wrap: wrap; }
.userbar .who { font-weight: 600; color: var(--ink); }
.userbar .who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
.userbar a { color: var(--ink2); }
.userbar a:hover { color: var(--accent); }
.userbar form { margin: 0; display: inline; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--ink2); cursor: pointer; }
.linkbtn:hover { color: var(--accent); text-decoration: underline; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; min-height: 0; }
  .brand-in { padding: 64px 22px 30px; }
  .brand-title { font-size: 34px; margin-bottom: 6px; }
  .brand-lede { margin-bottom: 0; font-size: 15px; }
  .mosaic, .brand-points { display: none; }
  .formside { padding: 28px 16px 48px; align-items: flex-start; }
  .card { padding: 22px 18px; }
  .admin-grid { grid-template-columns: 1fr; }
  .menu-pop { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .acts { white-space: normal; }
  .userbar { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
