/* ==========================================================================
   Theme layer — "2027": aurora background, glass surfaces, soft depth, glow accents.
   Loaded after app.css; only restyles, never changes layout contracts.
   ========================================================================== */
:root {
  --ink: #0f172a;
  --muted: #5f6b7d;
  --line: rgba(15, 23, 42, .08);
  --bg: #f3f6fb;
  --radius: 16px;
  --brand-2: #6d5dfc;                       /* secondary accent for gradients */
  --brand-grad: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 55%, var(--brand-2)) 100%);
  --glass: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .7);
  --shadow: 0 1px 1px rgba(15, 23, 42, .03), 0 2px 6px -2px rgba(15, 23, 42, .06), 0 14px 32px -18px rgba(15, 23, 42, .18);
  --shadow-hover: 0 1px 2px rgba(15, 23, 42, .05), 0 22px 44px -20px rgba(15, 23, 42, .32);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
  --ok: #047857; --ok-bg: #e3f8ee;
  --warn: #a35a00; --warn-bg: #fff3df;
  --bad: #be123c; --bad-bg: #ffe8ec;
  --info: #1d4ed8; --info-bg: #e7efff;
  --grey-bg: #eef2f7;
}

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 110% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, .08), transparent 60%),
    radial-gradient(700px 400px at 50% 120%, rgba(109, 93, 252, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
* { scrollbar-width: thin; scrollbar-color: #c3ccda transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c9d2df; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: #aab6c8; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
a { transition: color .15s; }

/* faint engineering grid behind the content */
.main { position: relative; isolation: isolate; }
.main::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(15, 23, 42, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0, transparent 520px);
}

/* ---------- sidebar ---------- */
.side {
  background:
    radial-gradient(400px 260px at 0% 0%, color-mix(in srgb, var(--brand) 32%, transparent), transparent 70%),
    linear-gradient(180deg, #0a1628 0%, #0c1d3a 60%, #0a1830 100%);
  border-right: 1px solid rgba(255, 255, 255, .04);
  padding: 16px 12px 30px;
}
.brand { padding: 4px 8px 18px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6); }
.brand b { font-size: 14.5px; letter-spacing: -.01em; }
.side a { border-radius: 10px; transition: background .15s, color .15s; }
.side .items a { position: relative; color: #b3c1d6; }
.side a:hover { background: rgba(255, 255, 255, .06); }
.side a.on {
  background: var(--brand-grad); color: #fff; font-weight: 600;
  box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--brand) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.side .items a.on::before {   /* neon tick on the rail */
  content: ""; position: absolute; left: -16px; top: 50%; width: 3px; height: 18px; transform: translateY(-50%);
  border-radius: 99px; background: #7cc4ff; box-shadow: 0 0 10px #7cc4ff;
}
.side .sec > button { color: #7f93b3; font-weight: 600; letter-spacing: .1em; border-radius: 8px; padding: 7px 10px; }
/* the section you are in: shaded heading with a mark, even when its list is folded */
.side .sec.on > button {
  color: #fff; background: rgba(124, 196, 255, .12);
  box-shadow: inset 3px 0 0 #7cc4ff;
}
.side .sec.on > button .ni { color: #7cc4ff; }
.side .sec.on .items { border-left-color: rgba(124, 196, 255, .35); }
.side .items { border-left-color: rgba(255, 255, 255, .07); }

/* ---------- top bar: glass ---------- */
.top {
  background: rgba(255, 255, 255, .72); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, .06); padding: 10px 28px;
}
.search-trigger { border-radius: 12px; background: rgba(255, 255, 255, .7); border-color: rgba(15, 23, 42, .1); }
.search-trigger:hover { box-shadow: var(--ring); }
.top .user .muted { font-weight: 600; color: var(--ink); }

/* ---------- page ---------- */
.content { padding: 26px 28px 70px; }
.page-head { margin-bottom: 20px; align-items: flex-end; }
.page-head h1 {
  font-size: 27px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink) 55%, color-mix(in srgb, var(--brand) 85%, var(--brand-2)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-head h1 .badge { -webkit-text-fill-color: initial; vertical-align: middle; position: relative; top: -3px; }
.page-head .small.muted { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 600;
  letter-spacing: .02em; color: var(--muted); margin-bottom: 6px; }
.page-head .small.muted a { color: var(--brand); padding: 2px 8px; border-radius: 99px;
  background: color-mix(in srgb, var(--brand) 9%, transparent); }
.page-head .small.muted a:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 16%, transparent); }
.page-head .sub { font-size: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .content > * { animation: th-rise .4s cubic-bezier(.2, .7, .2, 1) both; }
  .content > *:nth-child(2) { animation-delay: .03s; } .content > *:nth-child(3) { animation-delay: .06s; }
  .content > *:nth-child(4) { animation-delay: .09s; } .content > *:nth-child(n+5) { animation-delay: .12s; }
  @keyframes th-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* ---------- surfaces ---------- */
.card, .kpi {
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(15, 23, 42, .07); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 20px; margin-bottom: 18px; }
.grid { gap: 18px; }
.card > h2:first-child, .card > summary h2 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; }
.card > h2:first-child::before {      /* accent marker */
  content: ""; width: 4px; height: 16px; border-radius: 99px; background: var(--brand-grad); margin-right: 10px;
  flex: none; order: -1;
}
.card > h2:first-child { justify-content: flex-start; }
.card > h2:first-child > .btn, .card > h2:first-child > a.btn, .card > h2:first-child > span:last-child:not(:first-child) { margin-left: auto; }
.card.empty { text-align: center; color: var(--muted); padding: 36px; }

.kpis { gap: 14px; }
.kpi { position: relative; overflow: hidden; padding: 16px 18px; transition: transform .15s, box-shadow .15s; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--brand-grad); opacity: .85; }
.kpi.alert::before { background: linear-gradient(90deg, #fb7185, #be123c); }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.kpi .label { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.kpi .value { font-size: 26px; font-weight: 750; letter-spacing: -.03em; margin-top: 6px; }
.kpi .value.sm { font-size: 18px; letter-spacing: -.01em; }

dl.facts { gap: 0 16px; }
dl.facts dt, dl.facts dd { padding: 7px 0; border-bottom: 1px dashed rgba(15, 23, 42, .08); }
dl.facts dt { font-size: 13px; }
dl.facts dd { font-weight: 500; }
dl.facts dt:nth-last-of-type(1), dl.facts dd:last-of-type { border-bottom: 0; }

/* ---------- tables ---------- */
table.t { border-collapse: separate; border-spacing: 0; }
table.t th {
  background: transparent; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: #6b778a; padding: 10px 12px; border-bottom: 1px solid rgba(15, 23, 42, .08);
}
table.t thead th, table.t tr:first-child th { background: rgba(248, 250, 253, .9); }
table.t td { padding: 11px 12px; border-bottom: 1px solid rgba(15, 23, 42, .055); transition: background .12s; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: color-mix(in srgb, var(--brand) 4.5%, transparent); }
table.t tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.t td:first-child a { font-weight: 600; }
table.t tfoot td { background: color-mix(in srgb, var(--brand) 5%, #fff); border-top: 1px solid rgba(15, 23, 42, .1);
  font-weight: 700; }
.table-wrap { border-radius: 12px; }

/* ---------- badges: pill with status dot ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; padding: 3px 10px 3px 8px;
  border-radius: 99px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

/* ---------- buttons ---------- */
.btn {
  border-radius: 11px; padding: 8px 15px; font-weight: 600; border: 1px solid rgba(15, 23, 42, .12);
  background: rgba(255, 255, 255, .85); box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { background: #fff; border-color: rgba(15, 23, 42, .2); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(15, 23, 42, .3); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--brand-grad); border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 85%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn.primary:hover { background: var(--brand-grad); filter: brightness(1.06) saturate(1.05);
  box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--brand) 95%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.danger { background: rgba(255, 255, 255, .85); }
.btn.sm { border-radius: 9px; padding: 5px 11px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- forms ---------- */
.input, select.input, textarea.input {
  border-radius: 11px; border: 1px solid rgba(15, 23, 42, .13); background: rgba(255, 255, 255, .9); padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:hover { border-color: rgba(15, 23, 42, .22); }
.input:focus, select.input:focus, textarea.input:focus { outline: 0; border-color: var(--brand); box-shadow: var(--ring); background: #fff; }
.field label { font-size: 12px; font-weight: 650; color: #334155; letter-spacing: .01em; }
.filters { padding: 14px; border-radius: var(--radius); background: rgba(255, 255, 255, .55); border: 1px solid rgba(15, 23, 42, .06);
  backdrop-filter: blur(8px); }
.filters .field label { font-weight: 650; }
input.check { width: 17px; height: 17px; }

/* ---------- messages: glass toasts ---------- */
.msg { position: relative; border-radius: 14px; padding: 12px 16px 12px 44px; font-weight: 500; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.msg::before { content: "i"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; background: currentColor; }
.msg.success::before { content: "✓"; }
.msg.error::before { content: "!"; }
.msg.warning::before { content: "!"; }
.callout { border-radius: 14px; border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }

details.box, details.card { border-radius: 14px; }
details > summary { cursor: pointer; }
.doc { border-bottom-color: rgba(15, 23, 42, .08); padding: 9px 0; }
.note { border-left: 3px solid; border-image: var(--brand-grad) 1; background: rgba(255, 255, 255, .5); padding: 8px 12px;
  border-radius: 0 10px 10px 0; }
.bar { height: 8px; background: #e9eef5; }
.bar > i { background: var(--brand-grad); }
.empty { padding: 26px; }
.pager .btn { min-width: 36px; justify-content: center; }

/* ---------- sign-in ---------- */
.auth {
  background:
    radial-gradient(800px 500px at 85% 10%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 60%),
    radial-gradient(700px 500px at 10% 100%, rgba(16, 185, 129, .25), transparent 60%),
    linear-gradient(135deg, #07111f 0%, #0c1d3a 100%);
  position: relative; overflow: hidden;
}
.auth::before { 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: 34px 34px; mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%); }
.auth .card { position: relative; background: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 22px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6); backdrop-filter: blur(18px); }

/* ---------- tenant portal ---------- */
.portal-top { background: linear-gradient(135deg, #0a1628, #0f2a52); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .6); }

/* ---------- print stays plain ---------- */
@media print {
  body { background: #fff; }
  .main::before { display: none; }
  .card, .kpi { background: #fff; backdrop-filter: none; box-shadow: none; }
  .page-head h1 { color: var(--ink); background: none; }
}
@media (max-width: 900px) {
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .page-head h1 { font-size: 23px; }
}

/* notifications bell (v2.2) */
.top .bell { position: relative; display: inline-flex; align-items: center; color: var(--muted, #64748b); }
.top .bell .ni { width: 20px; height: 20px; }
.top .bell.has { color: var(--ink, #0f172a); }
.top .bell .bell-n { position: absolute; top: -6px; right: -9px; background: #dc2626; color: #fff; font-size: 10px;
  font-weight: 700; border-radius: 99px; padding: 1px 5px; line-height: 1.4; }
tr.unread td { background: #f5f9ff; }
.dash .tasks { margin-bottom: 18px; }
/* radio lists (e.g. applicant type): buttons beside their labels, not stretched like text inputs */
input.input[type="radio"] { width: auto; min-height: 0; height: auto; padding: 0; margin: 0 8px 0 0; box-shadow: none; flex: none; }
.field div:has(> div > label > input[type="radio"]) { display: flex; gap: 18px; flex-wrap: wrap; border: 0; padding: 4px 0; }
.field div > div > label:has(> input[type="radio"]) { display: flex; align-items: center; font-weight: 500; cursor: pointer; }

/* required-field marker */
.req { color: #c62828; font-weight: 700; }

/* ---------- breadcrumb: where you are, top left of every page ---------- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px;
  font-size: 12.5px; color: #64748b; line-height: 1.4;
}
.crumbs .c-sec { font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--brand); }
.crumbs a { color: #475569; }
.crumbs a:hover { color: var(--brand); }
.crumbs b { color: #0f172a; font-weight: 600; }
.crumbs .c-cur { max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .c-sep { color: #b6c2d2; }
@media print { .crumbs { display: none; } }

/* menu: a closed section's items shown beside the menu on hover (wide screens) */
.nav-fly { position: fixed; z-index: 80; min-width: 230px; padding: 8px; background: #0f1d3a;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6); }
.nav-fly-h { padding: 4px 10px 6px; color: #7f93b3; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.nav-fly a { display: block; padding: 7px 10px; border-radius: 8px; color: #c9d4e5; font-size: 13.5px; }
.nav-fly a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.side .sec.closed.peek > button { color: #fff; background: rgba(255, 255, 255, .05); }
/* account menu in the top bar */
.top .account { position: relative; }
.top .account > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 10px 4px 4px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; font-weight: 600; }
.top .account > summary::-webkit-details-marker { display: none; }
.top .account .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-size: 13px; background: linear-gradient(135deg, var(--brand, #1565c0), #0e7490); }
.top .account .menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 190px; padding: 6px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 16px 36px -18px rgba(15, 23, 42, .45); }
.top .account .menu-list a, .top .account .menu-list button { display: block; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; background: none; border-radius: 8px; color: var(--ink, #0f172a); font: inherit; cursor: pointer; }
.top .account .menu-list a:hover, .top .account .menu-list button:hover { background: #f1f5f9; text-decoration: none; }
.top .account .menu-list form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid #eef2f7; }
@media (max-width: 640px) { .top .account .nm { display: none; } }
