/* BRI License Management Portal: Blue Rhine brand, light theme.
   Responsive from 320px phones to 16:9 / ultrawide monitors. */
:root {
  /* Typography: Inter for text, one size scale for the whole portal (use these, not px). */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px; --fs-lg: 16px;
  --fs-xl: 18px; --fs-2xl: 20px; --fs-3xl: 24px;
  --bg: #f3f6fb; --surface: #fff; --text: #14284f; --muted: #66748d; --border: #e3e9f2;
  --accent: #1557c0; --accent-text: #fff;
  --navy: #0d3a80; --navy-2: #0a2c63; --brand-orange: #f47b20;
  --ok: #1d8a52; --ok-bg: #e4f5eb; --warn: #9a5b00; --warn-bg: #fff2dc;
  --bad: #c22d22; --bad-bg: #fde7e5; --neutral-bg: #eef1f6;
  --gutter: clamp(16px, 2.2vw, 32px);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 42, 92, .05), 0 6px 18px rgba(16, 42, 92, .06);
  --sidebar-w: 270px; --topbar-h: 70px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--fs-md)/1.5 var(--font); background: var(--bg); color: var(--text); overflow-x: hidden; }
@media (min-width: 1800px) { body { font-size: var(--fs-lg); } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: clamp(22px, 1.9vw, 30px); font-weight: 700; color: var(--text); margin: 0 0 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin: 0 0 12px; }
.ic { width: 20px; height: 20px; flex: none; }
/* Material Symbols icon (see _icons.html): the glyph scales to the box set by each .ic size rule. */
.ic { display: inline-grid; place-items: center; container-type: size; overflow: hidden; line-height: 1; vertical-align: middle; }
.ic > ms-i { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px; font-size: 100cqh;
  line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; word-wrap: normal; direction: ltr;
  display: block; -webkit-font-smoothing: antialiased; font-feature-settings: "liga"; user-select: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }
.ic.fill > ms-i, .side-nav a.active .ic > ms-i { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---- app shell: sidebar + top bar ---------------------------------------------- */
body.app {
  background: var(--bg) url("app-bg.svg") right top / cover no-repeat fixed;
}
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 20;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #0d3f8f 0%, #0b3274 55%, #082656 100%);
}
.side-logo { height: var(--topbar-h); flex: none; display: flex; align-items: center; padding: 0 28px;
  background: #fff; border-bottom: 1px solid var(--border); }
.side-logo img { width: 197px; max-width: 100%; height: auto; display: block; }
.side-nav { display: flex; flex-direction: column; gap: 6px; padding: 24px 14px; position: relative; z-index: 1; }
.side-nav a { display: flex; align-items: center; gap: 16px; padding: 13px 16px; border-radius: 10px;
  color: #e7eefb; font-size: var(--fs-lg); font-weight: 500; }
.side-nav a .ic { width: 22px; height: 22px; opacity: .95; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.side-nav a.active { background: linear-gradient(90deg, #2468d8, #1a56bd); color: #fff;
  box-shadow: 0 6px 16px rgba(4, 22, 60, .35), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.side-waves { position: absolute; left: 0; bottom: 0; width: 100%; height: 260px; pointer-events: none; }
.sidebar-backdrop { display: none; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.top-title { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 26px; }
.menu-btn { display: none; background: none; border: 0; padding: 8px; color: var(--text); border-radius: 8px; }
.menu-btn .ic { width: 24px; height: 24px; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #a9b3c4; }
.status.on i { background: #22b35e; box-shadow: 0 0 0 3px rgba(34, 179, 94, .15); }
.status.on { color: #3b4a66; }

.user-menu { position: relative; padding-left: 26px; border-left: 1px solid var(--border); }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--text); }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; }
.avatar .ic { width: 26px; height: 26px; }
.user-menu .chev { width: 16px; height: 16px; color: var(--muted); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 12px); min-width: 220px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 42, 92, .14); padding: 8px; }
.menu-who { padding: 8px 10px 10px; font-size: var(--fs-base); color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 9px 10px;
  border-radius: 8px; color: var(--text); text-align: left; }
.menu-item:hover { background: var(--neutral-bg); }
.menu-item .ic { width: 18px; height: 18px; }

main { width: 100%; max-width: 1760px; margin: 0 auto; padding: 26px var(--gutter) 64px; }

@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(8, 24, 56, .4); }
  .shell { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
}
@media (max-width: 600px) {
  :root { --topbar-h: 60px; }
  .top-title { font-size: var(--fs-lg); }
  .top-right { gap: 14px; }
  .status .status-text, .user-name { display: none; }
  .user-menu { padding-left: 14px; }
  main { padding-top: 18px; }
}

/* ---- page header --------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-lg); }

/* ---- surfaces & grids ---------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(16px, 1.4vw, 22px); margin-bottom: 18px; min-width: 0; }
.card.narrow { max-width: 400px; margin: clamp(24px, 10vh, 100px) auto; }
.table-wrap { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.head-row h1 { margin-bottom: 8px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; min-width: 0; }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { font-size: clamp(20px, 1.8vw, 28px); }
.tile span { color: var(--muted); }
.tile.warn b { color: var(--warn); }
.tile.bad b { color: var(--bad); }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr 1fr; } .tile b { font-size: var(--fs-2xl); } }

/* ---- forms ---------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px clamp(20px, 3vw, 48px); }
.form-grid > * { min-width: 0; }
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
@media (max-width: 520px) { .pair { grid-template-columns: 1fr; } }
.form-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 760px) { .form-actions button { width: 100%; } }

.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1 1 220px; min-width: 0; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input { flex: 1 1 260px; min-width: 0; max-width: 480px; }
@media (max-width: 760px) { .filters > * { flex: 1 1 100%; max-width: none; } }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; min-width: 0; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea, button { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; max-width: 100%; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; }
label.inline input[type=date] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
textarea.key { width: 100%; word-break: break-all; }
fieldset { border: 1px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 12px 14px 14px; min-width: 0; }
legend { color: var(--muted); padding: 0 4px; }
.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }

button, .button { cursor: pointer; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); padding: 8px 16px; border-radius: 6px; font-weight: 500; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.warn { color: var(--warn); border-color: var(--warn); }
button.small { padding: 3px 9px; font-size: var(--fs-sm); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
@media (pointer: coarse) { input, select, button { min-height: 40px; } button.small { min-height: 32px; } }

/* ---- tables ------------------------------------------------------------------------ */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--neutral-bg) 50%, transparent); }
tr:last-child td { border-bottom: 0; }

/* Phones: rows become cards; labels come from the header (data-label set by base.html) */
@media (max-width: 760px) {
  table.stackable thead { display: none; }
  table.stackable, table.stackable tbody, table.stackable tr, table.stackable td { display: block; width: 100%; }
  table.stackable tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  table.stackable tr:last-child { border-bottom: 0; }
  table.stackable td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 110px 1fr; gap: 8px; word-break: break-word; }
  table.stackable td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .03em; }
  table.stackable td[data-label=""] { grid-template-columns: 1fr; }
  table.stackable td[data-label=""]::before { display: none; }
  table.stackable td.empty-cell { display: none; }
}

/* ---- details list, text, badges -------------------------------------------------- */
dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { dl { grid-template-columns: 1fr; gap: 2px; } dd { margin-bottom: 8px; } }
details > summary { cursor: pointer; }
.mono { font-family: var(--font-mono); font-size: var(--fs-base); overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
code { background: var(--neutral-bg); padding: 1px 5px; border-radius: 4px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: var(--fs-sm); font-weight: 500; background: var(--neutral-bg); white-space: nowrap; }
.s-active, .c-active { background: var(--ok-bg); color: var(--ok); }
.s-expiring, .s-warning, .s-today, .s-suspended, .c-unknown, .c-suspended { background: var(--warn-bg); color: var(--warn); }
.s-expired, .s-revoked, .c-revoked, .c-rejected { background: var(--bad-bg); color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px var(--ok-bg); } }
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

.live { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 10px; }
.live.on { background: var(--ok-bg); color: var(--ok); }
.live.off { background: var(--neutral-bg); color: var(--muted); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.pair { align-items: end; }
label small { font-weight: 400; font-size: var(--fs-sm); }
.filters select, .filters button { width: auto; flex: 0 0 auto; }
.filters input { width: auto; }
@media (max-width: 760px) { .filters select, .filters input, .filters button { width: 100%; flex: 1 1 100%; } }
@media (max-width: 760px) {
  table.stackable td { display: block; position: relative; padding: 3px 0 3px 118px; min-height: 26px; }
  table.stackable td::before { position: absolute; left: 0; top: 5px; width: 110px; }
  table.stackable td[data-label=""] { padding-left: 0; }
}
@media (max-width: 480px) { .tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
/* device health + commands */
.h-ok, .k-done { background: var(--ok-bg); color: var(--ok); }
.h-warning, .h-stale, .k-pending, .k-sent, .k-accepted { background: var(--warn-bg); color: var(--warn); }
.h-critical, .k-failed { background: var(--bad-bg); color: var(--bad); }
.h-none, .k-expired { background: var(--neutral-bg); color: var(--muted); }
.issues { margin: 0 0 8px; padding-left: 18px; color: var(--warn); }
.issues:empty { display: none; }

/* ---- login page (fixed light brand design, independent of dark mode) ---------------- */
.login-page {
  --brand-navy: #0f3a7d; --brand-navy-2: #0a2c63; --brand-orange: #f47b20;
  --ink: #12306b; --field-border: #cfd7e3; --field-icon: #4a5a78;
  min-height: 100vh; margin: 0; color: var(--ink);
  font-family: var(--font);
  background: #eef2f9 url("login-bg.svg") center / cover no-repeat fixed;
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  position: relative; width: min(560px, 100%);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border-radius: 24px; padding: clamp(28px, 4vw, 44px) clamp(22px, 4vw, 46px) clamp(32px, 4vw, 46px);
  box-shadow: 0 24px 60px rgba(16, 42, 92, .16), 0 2px 6px rgba(16, 42, 92, .06);
  border-bottom: 6px solid var(--brand-orange);
  text-align: center;
}
.login-logo { width: min(360px, 85%); height: auto; display: block; margin: 0 auto; }
.login-rule { height: 1px; margin: 24px auto 26px; width: 70%;
  background: linear-gradient(90deg, transparent, #dfe4ec 20%, #dfe4ec 80%, transparent); position: relative; }
.login-rule span { position: absolute; left: 50%; top: -1px; width: 96px; height: 3px; margin-left: -48px;
  background: var(--brand-orange); border-radius: 2px; }
.login-title { display: block; font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; color: var(--ink);
  margin: 0 0 26px; letter-spacing: -.01em; }
.login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.login-field { position: relative; display: block; }
.login-field input {
  width: 100%; height: 58px; padding: 0 52px 0 56px; font-size: var(--fs-xl); color: var(--ink);
  background: #fff; border: 1.5px solid var(--field-border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input::placeholder { color: #7d889c; }
.login-field input:focus { outline: none; border-color: var(--brand-navy); box-shadow: 0 0 0 4px rgba(15, 58, 125, .12); }
.login-icon, .login-eye .ic { width: 24px; height: 24px; color: var(--field-icon); }
.login-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.login-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0;
  padding: 6px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; min-height: 0; }
.login-eye:hover { background: #f1f4f9; }
.login-eye .eye-on { display: none; }
.login-eye.showing .eye-on { display: block; }
.login-eye.showing .eye-off { display: none; }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.login-check { display: inline-flex; flex-direction: row; align-items: center; gap: 12px; font-weight: 400; font-size: var(--fs-lg); color: var(--ink); cursor: pointer; }
.login-check input { width: 24px; height: 24px; margin: 0; accent-color: var(--brand-navy); cursor: pointer; }
.login-link { background: none; border: 0; padding: 0; color: #1665c0; font-size: var(--fs-lg); cursor: pointer; min-height: 0; }
.login-link:hover { text-decoration: underline; }
.login-help { background: #f3f6fb; border: 1px solid #dfe5ef; border-radius: 8px; padding: 10px 14px; font-size: var(--fs-md); color: #3c4a66; }
.login-help code { background: #e6ecf6; color: var(--ink); }
.login-submit {
  margin-top: 8px; height: 62px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  font-size: var(--fs-2xl); font-weight: 600; color: #fff; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, #164a99, var(--brand-navy-2));
  box-shadow: 0 8px 20px rgba(10, 44, 99, .25); transition: filter .15s, transform .05s;
}
.login-submit:hover { filter: brightness(1.08); border: 0; }
.login-submit:active { transform: translateY(1px); }
.login-submit .ic { width: 28px; height: 28px; color: #fff; }
.login-alert { text-align: left; padding: 11px 14px; border-radius: 8px; margin: -8px 0 18px; font-size: var(--fs-lg);
  background: #e6f4ec; color: #1e6b45; border: 1px solid #c4e5d2; }
.login-alert.error { background: #fdecea; color: #a12a20; border-color: #f6c9c4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 480px) {
  .login-page { background-attachment: scroll; }
  .login-card { border-radius: 18px; }
  .login-field input { height: 52px; font-size: var(--fs-lg); }
  .login-submit { height: 56px; font-size: var(--fs-2xl); }
}
.login-check input { padding: 0; min-height: 0; border-radius: 4px; }

/* login: compact size (card ~400px wide, centred) */
.login-card { width: min(400px, 100%); border-radius: 18px; border-bottom-width: 5px;
  padding: 30px 30px 32px; box-shadow: 0 18px 44px rgba(16, 42, 92, .15), 0 2px 5px rgba(16, 42, 92, .06); }
.login-logo { width: 197px; max-width: 70%; }
.login-rule { margin: 16px auto 18px; width: 60%; }
.login-rule span { width: 64px; margin-left: -32px; }
.login-title { font-size: var(--fs-2xl); margin-bottom: 20px; }
.login-form { gap: 12px; }
.login-field input { height: 44px; font-size: var(--fs-lg); padding: 0 42px 0 42px; border-radius: 8px; border-width: 1px; }
.login-icon, .login-eye .ic { width: 19px; height: 19px; }
.login-icon { left: 14px; }
.login-eye { right: 6px; padding: 5px; }
.login-check { gap: 8px; font-size: var(--fs-md); }
.login-check input { width: 17px; height: 17px; }
.login-link { font-size: var(--fs-md); }
.login-help { font-size: var(--fs-base); padding: 8px 12px; }
.login-submit { margin-top: 4px; height: 46px; font-size: var(--fs-lg); gap: 10px; border-radius: 8px;
  box-shadow: 0 6px 14px rgba(10, 44, 99, .22); }
.login-submit .ic { width: 21px; height: 21px; }
.login-alert { font-size: var(--fs-md); padding: 9px 12px; margin: -4px 0 14px; }
@media (max-width: 480px) {
  .login-card { padding: 26px 20px 28px; }
  .login-field input { height: 44px; font-size: var(--fs-lg); }   /* 16px stops phones zooming in */
  .login-submit { height: 46px; font-size: var(--fs-lg); }
}

/* ---- brand buttons ------------------------------------------------------------------ */
button.primary, .button.primary { display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #1a5cc4, var(--navy)); border: 0; color: #fff;
  padding: 9px 16px; border-radius: 9px; box-shadow: 0 4px 12px rgba(13, 58, 128, .22); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
.button.primary .ic { width: 18px; height: 18px; }
.button.outline { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 20px;
  border: 1.5px solid #c9d6ea; color: var(--navy); font-weight: 600; background: #fff; }
.button.outline:hover { border-color: var(--accent); }
.button.outline .ic { width: 17px; height: 17px; }

/* ---- dashboard: stat cards ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
@media (max-width: 1500px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.stat {
  --tone: #1d63d6; --tone-bg: #e3edfc;
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px;
  min-height: 170px; padding: 18px 20px 20px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 42, 92, .1); }
.stat::after { /* soft decorative leaf on the right */
  content: ""; position: absolute; right: -28px; top: 22px; width: 84px; height: 110px; border-radius: 60% 40% 60% 40%;
  background: linear-gradient(160deg, var(--tone-bg), transparent 75%); transform: rotate(28deg); opacity: .8;
}
.stat-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--tone-bg); position: relative; z-index: 1; }
.stat-ic::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--tone); }
.stat-ic .ic { position: relative; color: #fff; width: 22px; height: 22px; }
.stat-label { font-size: var(--fs-md); color: #34466b; position: relative; z-index: 1; }
.stat-val { font-size: clamp(24px, 1.9vw, 30px); font-weight: 700; line-height: 1.15; color: var(--text); position: relative; z-index: 1; }
.stat-bar { margin-top: auto; width: 40px; height: 3px; border-radius: 2px; background: var(--tone); position: relative; z-index: 1; top: 8px; }
.tone-blue   { --tone: #1d63d6; --tone-bg: #e2ecfc; }
.tone-green  { --tone: #22a35a; --tone-bg: #e1f5e8; }
.tone-orange { --tone: #f39a12; --tone-bg: #fff0d8; }
.tone-red    { --tone: #e5352b; --tone-bg: #fde4e2; }
.tone-teal   { --tone: #13a3a8; --tone-bg: #dcf4f4; }
.tone-purple { --tone: #8a4fe0; --tone-bg: #efe5fd; }
@media (max-width: 480px) { .stat { min-height: 140px; padding: 14px; } .stat-ic { width: 44px; height: 44px; margin-bottom: 10px; } }

/* ---- dashboard: needs attention ------------------------------------------------------------ */
.attention { position: relative; overflow: hidden; padding: 0; }
.attention::before { content: ""; position: absolute; right: 4%; top: -40px; width: 340px; height: 150px; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(29, 99, 214, .06) 45%, transparent 60%, rgba(29, 99, 214, .05) 75%, transparent 90%); }
.attention-head { display: flex; align-items: center; gap: 18px; padding: 22px 26px; color: var(--text); position: relative; }
.attention-head:hover { text-decoration: none; background: rgba(29, 99, 214, .025); }
.attention-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, #1d63d6, var(--navy)); color: #fff; box-shadow: 0 4px 10px rgba(13, 58, 128, .25); }
.attention-ic .ic { width: 22px; height: 22px; }
.attention-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.attention-text b { font-size: var(--fs-lg); color: var(--navy); }
.attention-text span { color: #4a5a78; }
.attention-chev { color: #4a5a78; width: 22px; height: 22px; }
.attention.has-items .attention-ic { background: linear-gradient(180deg, #f39a12, #e07a00); }
.attention .table-soft { margin: 0 26px 22px; width: calc(100% - 52px); }

/* ---- soft tables, card header, empty state ------------------------------------------------ */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xl); }
.live-note { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-base); font-weight: 400; color: var(--muted); }
.live-note .dot { margin: 0; background: #22b35e; }
.table-soft { border: 1px solid var(--border); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.table-soft thead th { background: #f3f6fb; color: #4a5a78; font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-soft td { padding: 11px 14px; }
.table-soft tr.empty:hover { background: none; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 12px 30px; color: #4a5a78; }
.empty-state svg { width: 130px; height: 98px; }
.empty-state p { margin: 0; }
@media (max-width: 760px) {
  .table-soft { border: 0; }
  .attention .table-soft { margin: 0 16px 16px; width: calc(100% - 32px); }
  .attention-head { padding: 18px; }
}

/* ---- headings & small fixes for the other pages in the new frame --------------------- */
.head-row h1 { margin-bottom: 8px; }
.flash { border-radius: 10px; }
.toast { background: var(--navy-2); color: #fff; border-radius: 10px; }

/* ==== dashboard v2 (tinted stat cards, activity chart, attention, striped checks) ==== */
.stats { gap: 14px; margin-bottom: 18px; }
.stat {
  min-height: 0; padding: 16px 18px 14px; gap: 2px; border: 0; border-radius: 12px;
  border-bottom: 3px solid var(--tone);
  background: linear-gradient(140deg, var(--tone-bg) 0%, color-mix(in srgb, var(--tone-bg) 45%, #fff) 100%);
  box-shadow: 0 1px 2px rgba(16, 42, 92, .05), 0 4px 14px rgba(16, 42, 92, .05);
}
.stat::after { display: none; }
.stat .stat-ic { width: 28px; height: 28px; color: var(--tone); margin-bottom: 8px; stroke-width: 2; background: none; }
.stat .stat-ic::before { display: none; }
.stat-val { color: var(--tone); font-size: clamp(24px, 1.9vw, 30px); }
.stat-val small { font-size: .62em; color: var(--tone); font-weight: 700; }
.stat-label { font-size: var(--fs-md); font-weight: 600; color: #2b3b5c; }
.tone-blue   { --tone: #1f63d6; --tone-bg: #e6eefc; }
.tone-green  { --tone: #1f9a52; --tone-bg: #e3f5e9; }
.tone-orange { --tone: #ef8a10; --tone-bg: #fff0dc; }
.tone-red    { --tone: #e0332a; --tone-bg: #fde6e4; }
.tone-purple { --tone: #7c4ddb; --tone-bg: #efe8fc; }
.tone-slate  { --tone: #3b4a63; --tone-bg: #eceff4; }
.tone-navy   { --tone: #1652b8; --tone-bg: #e4ecfa; }

.dash-row { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.dash-row > .card { margin-bottom: 0; }
@media (max-width: 1150px) { .dash-row { grid-template-columns: 1fr; } }

.card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-title h2 { margin: 0; font-size: var(--fs-xl); color: var(--navy); }
.card-head .card-title { margin-bottom: 0; }
.title-ic { width: 24px; height: 24px; color: var(--navy); stroke-width: 2; }
.card-sub { margin: 2px 0 0; font-size: var(--fs-base); color: var(--muted); }
.title-badge { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, #f6a53a, #ec7b10); color: #fff; box-shadow: 0 3px 8px rgba(236, 123, 16, .3); }
.title-badge .ic { width: 17px; height: 17px; stroke-width: 2.2; }

/* activity chart */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: #e7ecf4; stroke-width: 1; }
.chart .tick, .chart .xlab { font-size: var(--fs-sm); fill: #5b6984; font-family: inherit; }
.chart .line { fill: none; stroke: #1f6ee0; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: #fff; stroke: #1f6ee0; stroke-width: 2.2; }
.chart .pt.last { fill: #1f6ee0; stroke: #fff; stroke-width: 2.5; }
.chart .bubble rect { fill: #e8effb; stroke: #cfdcf3; }
.chart .bubble text { font-size: var(--fs-sm); font-weight: 600; fill: #1b3a6e; font-family: inherit; }
.chart .bubble.last rect { fill: #1f6ee0; stroke: none; }
.chart .bubble.last text { fill: #fff; }

/* needs attention card */
.attention-card { background: linear-gradient(150deg, #fff6ef 0%, #fffaf6 45%, #fff 100%); }
.attention-card .card-title { margin-bottom: 16px; }
.all-good { display: flex; align-items: center; gap: 10px; padding: 18px; border-radius: 10px;
  background: rgba(255, 255, 255, .7); border: 1px dashed #e6d7c8; color: #4a5a78; }
.all-good .ic { color: var(--ok); }

/* tables in the new style */
.table-soft { background: #fff; }
.table-soft thead th { background: #eaf0fa; color: #22385f; font-size: var(--fs-sm); font-weight: 700; letter-spacing: .04em; }
.table-soft thead th .ic { width: 15px; height: 15px; margin-right: 8px; vertical-align: -3px; color: #22385f; stroke-width: 2; }
.table-soft td { border-bottom: 1px solid #edf1f7; }
.table-striped tbody tr:nth-child(even) td { background: #f6f9fd; }
.table-striped tbody tr:hover td { background: #eef4fd; }
.strong-link { font-weight: 600; color: #1557c0; }
.result-note { color: #3b4a63; }
.card-head { margin-bottom: 14px; }
.card-head h2 { font-size: var(--fs-xl); color: var(--navy); }
.live-note { font-size: var(--fs-base); font-weight: 400; color: var(--muted); }

/* pill badges */
.badge { padding: 2px 11px; border-radius: 999px; font-weight: 600; font-size: var(--fs-sm); }
.s-active, .c-active { background: #d8f2e1; color: #17703f; }
.s-expiring, .s-warning, .s-today, .s-suspended, .c-unknown, .c-suspended { background: #fde9b0; color: #7a5200; }
.s-expired, .s-revoked, .c-revoked, .c-rejected { background: #fbdcd9; color: #a3241b; }
.stat .stat-ic { border-radius: 0; }

/* ==== compact sizing (smaller text and components, more on screen) ==================== */
:root { --sidebar-w: 220px; --topbar-h: 56px; --radius: 12px; }
body { font-size: var(--fs-base); }
@media (min-width: 1800px) { body { font-size: var(--fs-md); } }
h1 { font-size: clamp(18px, 1.4vw, 22px); margin-bottom: 12px; }
h2 { font-size: var(--fs-md); }
.ic { width: 17px; height: 17px; }
main { max-width: 1600px; padding: 18px var(--gutter) 40px; }

/* sidebar + top bar */
.side-logo { padding: 0 20px; }
.side-logo img { width: 158px; }
.side-nav { padding: 16px 10px; gap: 3px; }
.side-nav a { padding: 9px 12px; gap: 12px; font-size: var(--fs-md); border-radius: 8px; }
.side-nav a .ic { width: 18px; height: 18px; }
.side-waves { height: 200px; }
.topbar { gap: 12px; }
.top-title { font-size: var(--fs-lg); }
.top-right { gap: 18px; }
.status { font-size: var(--fs-base); }
.user-menu { padding-left: 18px; }
.user-menu summary { font-size: var(--fs-base); gap: 8px; }
.avatar { width: 28px; height: 28px; }
.avatar .ic { width: 21px; height: 21px; }
.menu-btn .ic { width: 21px; height: 21px; }

/* page header + buttons */
.page-head { margin-bottom: 14px; }
.page-sub { font-size: var(--fs-base); margin-top: 2px; }
button.primary, .button.primary { padding: 7px 13px; font-size: var(--fs-base); border-radius: 8px; }
.button.primary .ic { width: 15px; height: 15px; }
.button.outline { padding: 5px 12px; font-size: var(--fs-base); }
.button.outline .ic { width: 14px; height: 14px; }
input, select, textarea, button { padding: 6px 9px; }

/* cards */
.card { padding: 14px 16px; margin-bottom: 14px; }
.card-title { gap: 10px; margin-bottom: 6px; }
.card-title h2, .card-head h2 { font-size: var(--fs-lg); }
.title-ic { width: 19px; height: 19px; }
.title-badge { width: 24px; height: 24px; }
.title-badge .ic { width: 14px; height: 14px; }
.card-sub { font-size: var(--fs-sm); }
.card-head { margin-bottom: 10px; }
.live-note { font-size: var(--fs-sm); }

/* stat cards */
.stats { gap: 10px; margin-bottom: 14px; }
.stat { padding: 11px 13px 10px; border-radius: 10px; border-bottom-width: 3px; }
.stat .stat-ic { width: 21px; height: 21px; margin-bottom: 4px; }
.stat-val { font-size: clamp(19px, 1.4vw, 23px); }
.stat-label { font-size: var(--fs-sm); }
.dash-row { gap: 14px; margin-bottom: 14px; }

/* tables */
th, td { padding: 6px 9px; }
.table-soft thead th { padding: 8px 10px; font-size: var(--fs-xs); }
.table-soft thead th .ic { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; }
.table-soft td { padding: 7px 10px; }
.badge { padding: 1px 9px; font-size: var(--fs-xs); }
.mono { font-size: var(--fs-sm); }
.empty-state { padding: 22px 10px 18px; }
.empty-state svg { width: 96px; height: 72px; }
.all-good { padding: 12px 14px; }

/* chart text */
.chart .tick, .chart .xlab { font-size: var(--fs-xs); }
.chart .bubble text { font-size: var(--fs-xs); }

/* other pages */
.tiles { gap: 10px; }
.tile { padding: 11px 13px; }
.tile b { font-size: clamp(17px, 1.4vw, 22px); }
dl { gap: 6px 14px; }
.flash { padding: 8px 12px; margin-bottom: 12px; }

/* ---- Sign-in second step (MFA) ---- */
.mfa-text { margin: 0 0 14px; font-size: var(--fs-md); line-height: 1.55; color: #22385f; text-align: left; }
.mfa-small { margin: -6px 0 14px; font-size: var(--fs-sm); color: #5b6b86; text-align: left; }
.mfa-secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px;
  padding: 10px 12px; border-radius: 8px; background: #eef3fb; border: 1px dashed #b9cdf0; }
.mfa-secret .mono { font-size: var(--fs-md); letter-spacing: .04em; color: #14284f; word-break: break-all; }
.mfa-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 12px; }
.mfa-back { display: flex; justify-content: center; text-decoration: none; }

/* Inter everywhere (form controls don't inherit fonts by default) */
html { -webkit-text-size-adjust: 100%; }
body, button, input, select, textarea { font-family: var(--font); }
h1, h2, h3, h4 { font-family: var(--font); letter-spacing: -0.01em; }
code, kbd, pre, samp { font-family: var(--font-mono); }
