/* Foregon Licensing design system.
   Brand: navy #1d232f, blue #0763ab, lock blue #1a7fc1. Light is the default theme; Dark is the only alternative.
   Spacing on a 4px scale; cards have soft 10px corners, tags are square-ish 4px. */

:root, [data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f3f6fa;
  --border: #e3e8ef;
  --border-strong: #cdd5e0;
  --text: #121826;
  --text-2: #4a5466;
  --text-3: #6b7485;
  --accent: #0763ab;
  --accent-hover: #05508a;
  --accent-soft: #eaf3fb;
  --accent-text: #0763ab;
  --on-accent: #ffffff;
  --focus-ring: 0 0 0 3px rgba(26, 127, 193, .3);
  --success: #12753f; --success-soft: #e8f6ee; --success-border: #bde3cc;
  --warning: #8a5300; --warning-soft: #fff6e3; --warning-border: #f1d7a0;
  --orange: #a3420b; --orange-soft: #fdede2; --orange-border: #f4c8a6;
  --danger: #b42318; --danger-soft: #fdeeec; --danger-border: #f3c4be;
  --danger-strong: #b42318; --danger-strong-hover: #8f1c13;
  --neutral: #5d6676; --neutral-soft: #eff2f6; --neutral-border: #dde2ea;
  --sidebar: #1d232f;
  --sidebar-raised: #283041;
  --sidebar-text: #b8c3d4;
  --sidebar-line: rgba(255, 255, 255, .08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .22);
  --overlay: rgba(14, 19, 28, .55);
  --skeleton: #e9edf2;
  --skeleton-shine: #f5f7fa;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1218;
  --surface: #161b24;
  --surface-2: #1a202b;
  --surface-hover: #1e2532;
  --border: #262e3c;
  --border-strong: #354052;
  --text: #e7ebf1;
  --text-2: #a9b2c0;
  --text-3: #8892a2;
  --accent: #2b80c4;
  --accent-hover: #3a91d6;
  --accent-soft: rgba(58, 151, 224, .14);
  --accent-text: #74baf0;
  --on-accent: #ffffff;
  --focus-ring: 0 0 0 3px rgba(84, 166, 232, .35);
  --success: #5ccf96; --success-soft: rgba(76, 195, 138, .12); --success-border: rgba(76, 195, 138, .32);
  --warning: #eab55a; --warning-soft: rgba(234, 181, 90, .12); --warning-border: rgba(234, 181, 90, .32);
  --orange: #f29a62; --orange-soft: rgba(242, 154, 98, .12); --orange-border: rgba(242, 154, 98, .32);
  --danger: #f2837a; --danger-soft: rgba(242, 131, 122, .12); --danger-border: rgba(242, 131, 122, .34);
  --danger-strong: #c8392d; --danger-strong-hover: #a92e24;
  --neutral: #a3acba; --neutral-soft: rgba(255, 255, 255, .06); --neutral-border: rgba(255, 255, 255, .12);
  --sidebar: #11151c;
  --sidebar-raised: #1c2330;
  --sidebar-text: #a9b4c5;
  --sidebar-line: rgba(255, 255, 255, .06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .6);
  --skeleton: #1f2632;
  --skeleton-shine: #262e3c;
  color-scheme: dark;
}

:root {
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 24px; font-weight: 680; letter-spacing: -.01em; }
h2 { font-size: 15.5px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.numeric { font-variant-numeric: tabular-nums; }
.icon { flex-shrink: 0; display: block; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.boot-screen { min-height: 100vh; display: grid; place-items: center; background: #1d232f; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 18px 12px 12px; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { height: 26px; width: auto; display: block; }
.sidebar-brand span { font-size: 13px; font-weight: 600; color: var(--sidebar-text); border-left: 1px solid rgba(255, 255, 255, .22); padding-left: 10px; }
.nav-section-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgba(184, 195, 212, .55); padding: 14px 12px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--radius); color: var(--sidebar-text); font-weight: 520; font-size: 14px; position: relative; }
.nav-item:hover { background: var(--sidebar-raised); color: #fff; text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--sidebar-raised); color: #fff; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #3a97e0; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .1); color: #fff; }
.nav-count.attention { background: #b86e00; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--sidebar-line); display: flex; flex-direction: column; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 8px; border-radius: var(--radius); }
.user-chip-text { min-width: 0; flex: 1; line-height: 1.3; }
.user-chip-name { color: #fff; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 12px; color: rgba(184, 195, 212, .75); }
.sidebar-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); border: 0; background: transparent; color: var(--sidebar-text); cursor: pointer; flex-shrink: 0; }
.sidebar-icon-button:hover { background: var(--sidebar-raised); color: #fff; }
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: rgba(255, 255, 255, .05); margin: 0 4px; }
.theme-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--sidebar-text); background: transparent; border: 0; border-radius: 6px; min-height: 28px; cursor: pointer; }
.theme-switch button:hover { color: #fff; }
.theme-switch button[aria-pressed="true"] { background: var(--sidebar-raised); color: #fff; }

.mobile-bar { display: none; }
.content { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px; }

/* avatars (initials) */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-text); }
.avatar.large { width: 52px; height: 52px; font-size: 18px; border-radius: 12px; }
.avatar.square { border-radius: 8px; }
.sidebar .avatar { background: #2f6fa3; color: #fff; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-subtitle { color: var(--text-2); margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 10px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-hint { color: var(--text-3); font-size: 13px; font-weight: 400; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.columns > div { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.sticky { position: sticky; top: 24px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; gap: 12px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); text-decoration: none; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-chip { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.tone-active { color: var(--success); background: var(--success-soft); }
.tone-renew_soon { color: var(--warning); background: var(--warning-soft); }
.tone-in_grace { color: var(--orange); background: var(--orange-soft); }
.tone-upcoming, .tone-accent { color: var(--accent-text); background: var(--accent-soft); }
.tone-ended { color: var(--neutral); background: var(--neutral-soft); }
.tone-revoked, .tone-danger { color: var(--danger); background: var(--danger-soft); }
.tone-warning { color: var(--warning); background: var(--warning-soft); }

/* ---------- tags (4px) ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--radius-sm); padding: 0 7px; font-size: 12px; font-weight: 600; line-height: 21px; white-space: nowrap; border: 1px solid transparent; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag.plain::before { display: none; }
.tag-active { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.tag-renew_soon { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.tag-in_grace { background: var(--orange-soft); color: var(--orange); border-color: var(--orange-border); }
.tag-upcoming, .tag-accent { background: var(--accent-soft); color: var(--accent-text); }
.tag-ended, .tag-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: var(--neutral-border); }
.tag-revoked { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

/* ---------- buttons ---------- */
.btn { font: inherit; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease); }
.btn:hover { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-danger { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-danger:hover { background: var(--danger-strong-hover); border-color: var(--danger-strong-hover); color: #fff; }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-border); }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-link { border: 0; background: none; box-shadow: none; padding: 0; min-height: 0; color: var(--accent-text); font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--accent-text); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-lg { min-height: 42px; padding: 9px 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
form { margin: 0; }
.field { margin-bottom: 18px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.field-hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.optional-tag { font-weight: 500; font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 5px; line-height: 17px; }
.input { width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 11px; min-height: 38px; transition: border-color .12s var(--ease), box-shadow .12s var(--ease); }
.input::placeholder { color: var(--text-3); opacity: .8; }
.input:hover { border-color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input[readonly] { background: var(--surface-2); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.input.mono, .input.mono { font-family: var(--mono); font-size: 12.5px; }
.input-with-button { position: relative; }
.input-with-button .input { padding-right: 42px; }
.input-with-button .reveal { position: absolute; right: 3px; top: 3px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-3); border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.input-with-button .reveal:hover { color: var(--text); background: var(--surface-hover); }
.input-with-icon { position: relative; }
.input-with-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-with-icon .input { padding-left: 36px; }
.input.code-input { font-family: var(--mono); font-size: 24px; letter-spacing: .35em; text-align: center; padding: 10px; min-height: 52px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; font-size: 14px; }
.check-row input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.form-section-title { font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 8px 0 14px; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.drop-zone { display: block; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 22px; text-align: center; background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s; font-size: 13.5px; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone .icon { margin: 0 auto 8px; color: var(--accent-text); }
.drop-zone strong { color: var(--text); }
.drop-zone.loaded { border-style: solid; border-color: var(--success-border); background: var(--success-soft); color: var(--success); }
.drop-zone.loaded .icon { color: var(--success); }

/* segmented control */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; background: var(--neutral-soft); border: 1px solid var(--border); max-width: 100%; }
.segmented button { font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); min-height: 30px; padding: 4px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.segmented .count { font-size: 11.5px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }
.segmented button[aria-pressed="true"] .count { color: var(--accent-text); }
.segmented.full { display: flex; }
.segmented.full button { flex: 1 1 auto; justify-content: center; }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); font-size: 13.5px; }
.banner > .icon { margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-weight: 650; font-size: 14px; margin-bottom: 2px; }
.banner-body p { margin: 0; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.banner.info { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.banner.info > .icon { color: var(--accent-text); }
.banner.success { background: var(--success-soft); border-color: var(--success-border); box-shadow: none; }
.banner.success > .icon { color: var(--success); }
.banner.warning { background: var(--warning-soft); border-color: var(--warning-border); box-shadow: none; }
.banner.warning > .icon { color: var(--warning); }
.banner.danger { background: var(--danger-soft); border-color: var(--danger-border); box-shadow: none; }
.banner.danger > .icon { color: var(--danger); }
.form-error { display: flex; gap: 10px; align-items: flex-start; background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; }

/* ---------- tables ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input-with-icon { flex: 1 1 220px; max-width: 340px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover td { background: var(--surface-hover); }
.data-table td.chevron { color: var(--text-3); width: 40px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title { font-weight: 600; color: var(--text); }
a.cell-title:hover { color: var(--accent-text); }
.cell-sub { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.data-table td.primary-cell { overflow-wrap: normal; min-width: 210px; }
.data-table td.primary-cell .cell-title { white-space: nowrap; }
.table-footer { padding: 10px 20px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); }

/* term progress */
.term { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.term-bar { height: 5px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.term-fill { height: 100%; border-radius: 3px; background: var(--success); width: 0; }
.term-fill.renew_soon { background: var(--warning); }
.term-fill.in_grace { background: var(--orange); }
.term-fill.ended { background: var(--neutral); }
.term-fill.revoked { background: var(--danger); }
.term-fill.upcoming { background: var(--accent); }
.term-text { font-size: 12.5px; color: var(--text-3); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
a.list-row { color: var(--text); }
a.list-row:hover { background: var(--surface-hover); text-decoration: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 12.5px; color: var(--text-3); }
.details { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); margin: 0; font-size: 14px; }
.details dt { color: var(--text-3); padding: 9px 0; border-bottom: 1px solid var(--border); }
.details dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }
.contact-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; color: var(--text); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.contact-line .icon { color: var(--text-3); }

/* ---------- empty and loading states ---------- */
.empty-state { text-align: center; padding: 40px 24px; color: var(--text-2); }
.empty-icon { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; background: var(--neutral-soft); color: var(--text-3); }
.empty-state h3 { margin-bottom: 4px; }
.empty-state p { max-width: 380px; margin: 0 auto 16px; font-size: 13.5px; }
.empty-state.compact { padding: 26px 20px; }
.empty-state.compact p { margin-bottom: 0; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-shine) 50%, var(--skeleton) 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-title { height: 26px; width: 240px; margin-bottom: 10px; }
.skeleton-line { height: 14px; width: 360px; max-width: 80%; margin-bottom: 26px; }
.skeleton-block { height: 220px; border-radius: var(--radius-lg); }

/* ---------- overview ---------- */
.setup-step { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.setup-step:last-child { border-bottom: 0; }
.setup-mark { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; border: 1.5px solid var(--border-strong); color: var(--text-3); }
.setup-step.done .setup-mark { background: var(--success); border-color: var(--success); color: #fff; }
.setup-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-3); }
.setup-text strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.setup-step.done .setup-text strong { color: var(--text-3); }
.progress-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed-item { display: flex; gap: 12px; padding: 9px 20px; align-items: flex-start; }
.feed-dot { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.feed-text { min-width: 0; flex: 1; font-size: 13.5px; line-height: 1.4; }
.feed-text strong { font-weight: 600; }
.feed-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.status-line { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.status-line:last-child { border-bottom: 0; }
.status-text { flex: 1; min-width: 0; }
.status-text strong { display: block; font-size: 13.5px; color: var(--text); font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--neutral); margin: 0 3px; }
.status-dot.good { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- license page ---------- */
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.key-preview { flex: 1 1 260px; min-width: 0; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-full { margin-top: 12px; }
.key-full textarea { word-break: break-all; }
.lifecycle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lifecycle.ended-early { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.milestone.revoked .milestone-dot { background: var(--danger); border-color: var(--danger); }
.milestone.revoked .milestone-label { color: var(--danger); }
.milestone { min-width: 0; padding-right: 12px; }
.milestone-track { display: flex; align-items: center; margin-bottom: 10px; }
.milestone-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); flex-shrink: 0; }
.milestone-line { flex: 1; height: 2px; background: var(--border); margin-left: 4px; }
.milestone:last-child .milestone-line { visibility: hidden; }
.milestone.passed .milestone-dot { background: var(--accent); border-color: var(--accent); }
.milestone.passed .milestone-line { background: var(--accent); }
.milestone.current .milestone-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.milestone-label { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.milestone-date { font-weight: 650; font-size: 14px; margin-top: 2px; }
.milestone-note { font-size: 12.5px; color: var(--text-3); }
.term-summary { display: flex; align-items: center; gap: 14px; margin-top: 20px; font-size: 13px; color: var(--text-2); }
.term-summary .term-bar { flex: 1; height: 8px; border-radius: 4px; }
.timeline { list-style: none; margin: 0; padding: 6px 0; }
.timeline-item { display: flex; gap: 12px; padding: 9px 20px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 33px; top: 40px; bottom: -6px; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }

/* issue form preview */
.big-date { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.preview-range { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.preview-range .subtle { font-size: 12.5px; }

/* ---------- audit log ---------- */
.day-heading { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 9px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); }
.day-heading:first-child { border-top: 0; }
.audit-entry { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.audit-entry:last-child { border-bottom: 0; }
.audit-entry-main { flex: 1; min-width: 0; }
.audit-entry-title { font-weight: 600; font-size: 13.5px; }
.audit-entry-detail { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.audit-entry-meta { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; line-height: 1.5; }

/* ---------- dialogs and toasts ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface); }
dialog[open] { animation: dialog-in .16s var(--ease); }
dialog::backdrop { background: var(--overlay); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 4px; }
.dialog-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dialog-head h2 { font-size: 17px; margin-bottom: 4px; }
.dialog-head p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.dialog-body { padding: 16px 22px 22px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: center; gap: 10px; background: #1d232f; color: #fff; padding: 11px 16px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in .2s var(--ease); }
[data-theme="dark"] .toast { background: #2a3242; }
.toast .icon { color: #5ccf96; }
.toast.error .icon { color: #f2837a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- sign-in pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside { background: #1d232f; color: #c9d3e1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 440px; height: 440px; border-radius: 50%; border: 64px solid rgba(26, 127, 193, .12); pointer-events: none; }
.auth-aside img { height: 34px; width: auto; display: block; align-self: flex-start; position: relative; z-index: 1; }
.auth-pitch { position: relative; z-index: 1; max-width: 430px; }
.auth-eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #5aaaea; margin-bottom: 12px; }
.auth-pitch h2 { color: #fff; font-size: 30px; font-weight: 700; letter-spacing: -.015em; margin-bottom: 14px; line-height: 1.2; }
.auth-pitch p { color: #b8c3d4; font-size: 15px; }
.auth-points { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #dfe6f0; font-size: 14px; }
.auth-points .icon { color: #5aaaea; }
.auth-legal { font-size: 12.5px; color: #7f8ba0; position: relative; z-index: 1; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 26px; }
.auth-mobile-brand { display: none; }
.auth-switch { margin-top: 22px; font-size: 13.5px; color: var(--text-2); text-align: center; }
.setup-key { font-family: var(--mono); font-size: 17px; letter-spacing: .06em; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; text-align: center; margin-bottom: 8px; overflow-wrap: anywhere; color: var(--text); }
.steps { list-style: none; counter-reset: steps; margin: 0 0 20px; padding: 0; }
.steps li { counter-increment: steps; display: flex; gap: 12px; margin-bottom: 14px; font-size: 13.5px; color: var(--text-2); }
.steps li::before { content: counter(steps); width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.steps li > div { min-width: 0; flex: 1; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-family: var(--mono); font-size: 14.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }

/* ---------- two-step setup and roles ---------- */
.qr-frame { display: block; width: fit-content; padding: 10px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 0 8px; line-height: 0; }
.qr-frame svg { display: block; }
.setup-key-details { margin-top: 4px; }
.setup-key-details summary { cursor: pointer; color: var(--accent-text); font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.setup-key-details .row-wrap { margin-top: 10px; }
.choice-cards { display: grid; gap: 8px; }
.choice-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; cursor: pointer; background: var(--surface); transition: border-color .12s var(--ease), background .12s var(--ease); }
.choice-card:hover { border-color: var(--text-3); }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice-card input { accent-color: var(--accent); margin: 3px 0 0; width: 16px; height: 16px; flex-shrink: 0; }
.choice-card strong { display: block; font-size: 14px; }
.choice-card span { display: block; font-size: 13px; color: var(--text-2); }
.permission-matrix td, .permission-matrix th { text-align: center; }
.permission-matrix td:first-child, .permission-matrix th:first-child { text-align: left; }
.permission-matrix .yes { color: var(--success); display: inline-flex; }
.permission-matrix .no { color: var(--text-3); }
.method-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.method-row:last-child { border-bottom: 0; }
.method-icon { width: 36px; height: 36px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.method-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-3); }
.method-text strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.permission-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.permission-list li { display: flex; gap: 8px; align-items: flex-start; }
.permission-list .icon { margin-top: 2px; color: var(--success); }
.permission-list li.denied { color: var(--text-3); }
.permission-list li.denied .icon { color: var(--text-3); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); }
  .shell.drawer-open .sidebar { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: var(--overlay); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: #1d232f; padding: 10px 14px; }
  .mobile-bar img { height: 24px; width: auto; display: block; }
  .page { padding: 20px 16px 48px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; justify-content: center; margin: 0 0 28px; }
  .auth-mobile-brand .brand-plate { background: #1d232f; border-radius: 10px; padding: 10px 16px; }
  .auth-mobile-brand img { height: 26px; width: auto; display: block; }
  .auth-main { align-items: flex-start; padding-top: 40px; }
}
@media (max-width: 720px) {
  h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .lifecycle, .lifecycle.ended-early { grid-template-columns: minmax(0, 1fr); }
  .milestone { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 12px; padding: 0; }
  .milestone-track { grid-row: 1 / span 3; flex-direction: column; margin: 3px 0 0; }
  .milestone-line { width: 2px; height: auto; flex: 1; min-height: 26px; margin: 4px 0 0; }
  .milestone-note { padding-bottom: 14px; }
  .details { grid-template-columns: minmax(0, 1fr); }
  .details dt { border-bottom: 0; padding-bottom: 0; font-size: 12.5px; }
  .details dd { padding-top: 2px; }
  .card-head, .card-body, .toolbar, .card-foot, .preview-range { padding-left: 16px; padding-right: 16px; }
  .list-row, .feed-item, .setup-step, .status-line, .audit-entry, .timeline-item, .day-heading { padding-left: 16px; padding-right: 16px; }
  .timeline-item::before { left: 29px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 12px 44px 12px 16px; border-bottom: 1px solid var(--border); position: relative; }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td, .data-table td:first-child, .data-table td:last-child { border: 0; padding: 3px 0; }
  .data-table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
  .data-table td.primary-cell::before { display: none !important; }
  .data-table td.primary-cell { padding-bottom: 6px; min-width: 0; }
  .data-table td.primary-cell .cell-title { white-space: normal; }
  .data-table td.chevron { position: absolute; right: 12px; top: 16px; width: auto; }
  .method-row { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
  .permission-matrix { font-size: 13px; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1 1 auto; }
  .audit-entry { flex-wrap: wrap; }
  .audit-entry-meta { width: 100%; text-align: left; padding-left: 40px; }
  .recovery-codes { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .segmented.wrap-on-phone { display: flex; }
  .segmented.wrap-on-phone button { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Printing is turned off: license keys and contact details stay on screen. */
@media print {
  body > * { display: none !important; }
  body::after { content: "Printing is turned off in Foregon Licensing."; display: block; padding: 40px; font: 16px var(--font); color: #000; }
}
