/* Zenith Degree Leasing Dashboard — styles */
:root {
  --navy: #20284E;
  --navy-700: #2E3868;
  --navy-100: #E6E8F1;
  --orange: #FF9708;
  --orange-100: #FFF1DC;
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --text: #1B1F2E;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --border: #E4E6EE;
  --green: #1E8E5A;  --green-100: #E3F5EC;
  --red: #C43D3D;    --red-100: #FBE7E7;
  --blue: #2F6FDB;   --blue-100: #E6EEFC;
  --purple: #6B46C1; --purple-100: #EFE9FA;
  --teal: #0E8A8A;   --teal-100: #E0F4F4;
  --gray-100: #EEF0F4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.boot { padding: 40px; color: var(--muted); }
code { background: var(--gray-100); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; padding: 20px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: inherit; text-decoration: none; border-radius: 8px; cursor: pointer; }
.brand:hover { background: rgba(255,255,255,.06); }
/* quick search */
.qsbox { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; cursor: text; color: var(--muted); box-shadow: var(--shadow); text-align: left; }
.qsbox:hover { border-color: #C9CDDA; }
.qsbox svg { width: 18px; height: 18px; color: var(--navy); flex: none; }
.qsbox span { flex: 1; }
.qsbox kbd { font: 600 11px var(--font); color: var(--muted); background: var(--gray-100); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.qsmodal { max-width: 620px; }
.qsmodal .mbody { padding: 12px; }
.qswrap { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
.qswrap:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(32,40,78,.12); }
.qswrap svg { width: 18px; height: 18px; color: var(--navy); flex: none; }
.qswrap input { flex: 1; border: 0; outline: none; padding: 9px 0; font-size: 15px; background: transparent; }
.qsres { margin-top: 10px; max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.qshint { color: var(--muted); font-size: 13px; padding: 14px 8px; text-align: center; }
.qsitem { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 9px 10px; cursor: pointer; font: inherit; color: inherit; }
.qsitem:hover, .qsitem.sel { background: var(--navy-100); border-color: #D7DBE8; }
.qskind { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; flex: none; width: 58px; text-align: center; }
.qskind.lead { background: var(--teal-100); color: var(--teal); }
.qskind.owner { background: var(--orange-100); color: #9A5B00; }
.qsmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qsmain b { font-weight: 600; }
.qsmain .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 960px) { .qsbox kbd { display: none; } .qsitem .pill { display: none; } }
.brand img { width: 44px; height: auto; background: #fff; border-radius: 8px; padding: 4px; }
.brand .name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand .sub { font-size: 11px; color: rgba(255,255,255,.65); }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; color: rgba(255,255,255,.82); padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.active { background: rgba(255,255,255,.14); color: #fff; }
.nav button .ico { width: 18px; height: 18px; display: inline-flex; }
.nav button .badge { margin-left: auto; background: var(--orange); color: #1B1F2E; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.navgroup { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 14px 12px 4px; }
.navgroup:empty { padding: 6px 0 0; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; font-size: 12px; color: rgba(255,255,255,.75); display: flex; flex-direction: column; gap: 6px; }
.userbox .email { color: #fff; font-weight: 500; word-break: break-all; }
.userbox button { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.userbox button:hover { background: rgba(255,255,255,.1); }
.modechip { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--orange); color: #1B1F2E; }
.modechip.live { background: var(--green); color: #fff; }

.main { padding: 26px 32px 60px; min-width: 0; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); padding: 8px 13px; border-radius: 8px; cursor: pointer; font-weight: 500; box-shadow: var(--shadow); white-space: nowrap; }
.btn:hover { border-color: #C9CDDA; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-700); }
.btn.accent { background: var(--orange); color: #1B1F2E; border-color: var(--orange); }
.btn.accent:hover { filter: brightness(.96); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--gray-100); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

/* ---------- cards & tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .cardhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.card .cardbody { padding: 18px; }
.card .cardbody.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; }
.grid.two { grid-template-columns: 1.2fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.tile { padding: 16px 18px; }
.tile .label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.tile .delta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tile.accent { border-top: 3px solid var(--orange); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #FAFBFD; position: sticky; top: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #F7F8FC; }
.table .sub { color: var(--muted); font-size: 12px; }
.table .nowrap { white-space: nowrap; }
.table-wrap { overflow: auto; max-height: 70vh; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.s-New { background: var(--orange-100); color: #9A5B00; }
.pill.s-Contacted { background: var(--gray-100); color: #4B5563; }
.pill.s-Scheduled.Tour, .pill.s-Scheduled { background: var(--blue-100); color: var(--blue); }
.pill.s-Toured { background: var(--teal-100); color: var(--teal); }
.pill.s-Applied { background: var(--purple-100); color: var(--purple); }
.pill.s-Approved { background: var(--green-100); color: var(--green); }
.pill.s-Lost { background: var(--red-100); color: var(--red); }
.pill.s-Withdrawn { background: var(--gray-100); color: var(--muted); }
.pill.on { background: var(--green-100); color: var(--green); }
.pill.off { background: var(--gray-100); color: var(--muted); }
.pill.warn { background: var(--orange-100); color: #9A5B00; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .filters select, .filters input {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .filters select:focus, .filters input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(32,40,78,.12); }
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--faint); }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.formgrid .span2 { grid-column: span 2; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.filters input.search { min-width: 220px; }
.inline-select { border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.inline-select:hover { border-color: var(--border); background: #fff; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* toggle switch */
.switch { position: relative; width: 40px; height: 22px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #CBD0DC; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch .track::after { content: ""; position: absolute; width: 18px; height: 18px; top: 2px; left: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16, 20, 40, .45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 900px; }
.modal .mhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal .mbody { padding: 20px; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: #FAFBFD; border-radius: 0 0 14px 14px; }
.modal .mfoot .left { margin-right: auto; }
.xbtn { background: transparent; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px 8px; border-radius: 6px; }
.xbtn:hover { background: var(--gray-100); }

/* activity log */
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.activity li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; font-size: 13px; padding: 8px 10px; background: #FAFBFD; border-radius: 8px; }
.activity .when { color: var(--muted); font-size: 12px; }
.activity .type { font-weight: 600; text-transform: capitalize; }
.activity svg { width: 13px; height: 13px; vertical-align: -2px; color: var(--muted); }
.quicklog { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13px; animation: pop .15s ease-out; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); font-weight: 600; font-size: 14px; padding: 12px 18px; }
.toast.ok::before { content: "✓ "; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 300; }
.activity .when { white-space: nowrap; }
.activity li { grid-template-columns: 128px 1fr; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart .axis line { stroke: var(--border); }
.chart .bar { fill: var(--navy); }
.chart .bar:hover { fill: var(--navy-700); }
.chart .line { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--navy); opacity: .06; }
.chart .dot { fill: #fff; stroke: var(--navy); stroke-width: 2; }
.chart .vlabel { fill: var(--text); font-weight: 600; }
.tooltip { position: fixed; background: var(--text); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; pointer-events: none; z-index: 90; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.2); }

/* ---------- weekly email ---------- */
.emailgrid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.emailpreview textarea { width: 100%; min-height: 440px; font-family: var(--font); line-height: 1.5; border: 1px solid var(--border); border-radius: 10px; padding: 14px; resize: vertical; }
.emailmeta { display: grid; grid-template-columns: 60px 1fr; gap: 6px 10px; font-size: 13px; margin-bottom: 12px; }
.emailmeta .k { color: var(--muted); font-weight: 600; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.statrow div { background: #FAFBFD; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.statrow .v { font-size: 18px; font-weight: 700; color: var(--navy); }
.statrow .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.proplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.proplist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.proplist li:hover { background: #F7F8FC; }
.proplist li.sel { background: var(--navy-100); }
.proplist li:last-child { border-bottom: 0; }

/* ---------- owner pipeline (kanban) ---------- */
.pill.svc-mgmt { background: var(--navy-100); color: var(--navy); }
.pill.svc-tp { background: var(--teal-100); color: var(--teal); }
.pill.svc-hw { background: var(--orange-100); color: #9A5B00; }
.kanban { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 18px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; align-items: flex-start; }
.kcol { flex: 0 0 290px; scroll-snap-align: start; background: #ECEEF4; border-radius: 14px; border: 2px solid transparent; display: flex; flex-direction: column; max-height: calc(100vh - 300px); min-height: 220px; transition: border-color .12s, background .12s; }
.kcol.over { border-color: var(--orange); background: var(--orange-100); }
.khead { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.ktitle { font-weight: 700; font-size: 13px; color: var(--navy); }
.kcount { background: #fff; border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.ksum { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kbody { padding: 4px 10px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kempty { color: var(--faint); font-size: 12px; text-align: center; padding: 26px 0; border: 1px dashed #CBD0DC; border-radius: 10px; }
.kcard { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.kcard:hover { border-color: #C9CDDA; border-left-color: var(--navy); }
.kcard.stale { border-left-color: var(--orange); }
.kcard.dragging { opacity: .35; }
.kcard.ghost { position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; transform: translate(-9999px, -9999px); box-shadow: 0 14px 40px rgba(0,0,0,.28); rotate: 2deg; opacity: .95; }
.krow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kcode { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.khandle { color: #C3C7D3; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; cursor: grab; touch-action: none; margin-right: -6px; }
.khandle svg { width: 16px; height: 16px; }
.khandle:active { cursor: grabbing; background: var(--gray-100); }
.kaddr { font-weight: 600; margin-top: 2px; line-height: 1.3; }
.kowner { color: var(--muted); font-size: 12px; margin-top: 2px; }
.krent { font-weight: 600; font-variant-numeric: tabular-nums; }
.kfee { margin-top: 6px; font-size: 12px; color: var(--green); font-weight: 600; }
.kmeta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.kmeta span { display: inline-flex; align-items: center; gap: 4px; }
.kmeta svg { width: 13px; height: 13px; }
.kmeta .warn { color: #9A5B00; font-weight: 600; }
.klink { margin-left: auto; color: var(--navy); display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 6px; background: var(--gray-100); }
.klink + .klink { margin-left: 0; }
.klink svg { width: 14px; height: 14px; }
.feebox { margin-top: 16px; background: #F7F8FC; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.feehead { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.feehead b { font-size: 18px; color: var(--green); }
.feeline { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.feeline span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.feesep { border-top: 1px dashed var(--border); margin: 6px 0; }
.quicklog input { flex: 1; min-width: 160px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #F4F5F9 0%, #E9ECF5 100%); }
.login .card { width: 100%; max-width: 420px; padding: 36px 32px; text-align: center; }
.login img { width: 150px; height: auto; margin-bottom: 8px; }
.login h1 { font-size: 20px; margin-top: 6px; }
.login-sub { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); margin-bottom: 10px; }
.rowacts { display: inline-flex; gap: 4px; }
.rowacts button { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; color: var(--navy); padding: 0; }
.rowacts button:hover { background: var(--navy-100); }
.rowacts button svg { width: 14px; height: 14px; }
.lc { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lc svg { width: 13px; height: 13px; color: var(--muted); }
.lcbtn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.lcbtn:hover { background: var(--navy-100); border-color: #C9CDDA; }
.lcbtn svg { width: 13px; height: 13px; }
.kmeta .lcbtn { font-size: 12px; color: var(--muted); padding: 2px 4px; margin-left: -4px; }
.kmeta .lcbtn.warn { color: #9A5B00; font-weight: 600; }
.pwwrap { position: relative; }
.pwwrap input { width: 100%; padding-right: 40px; }
.pwwrap .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer; }
.pwwrap .eye:hover { background: var(--gray-100); color: var(--navy); }
.pwwrap .eye svg { width: 17px; height: 17px; }
.login p { color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; text-align: left; }
.login .msg { margin-top: 14px; font-size: 13px; }
.authlinks { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; font-size: 13px; }
.authlinks a { color: var(--navy); text-decoration: none; font-weight: 500; }
.authlinks a:hover { text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand user" "nav nav"; gap: 6px 10px; padding: 8px 12px 0; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand { grid-area: brand; padding: 2px 0; }
  .brand img { width: 34px; }
  .brand .sub { display: none; }
  .nav { grid-area: nav; display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 8px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { width: auto; padding: 8px 12px; white-space: nowrap; flex: none; }
  .nav button .badge { margin-left: 6px; }
  .navgroup { display: none; }
  .sidebar .spacer { display: none; }
  .userbox { grid-area: user; border: 0; padding: 0; flex-direction: row; align-items: center; gap: 8px; }
  .userbox .email { display: none; }
  .main { padding: 16px 14px 60px; }
  .pagehead { margin-bottom: 14px; }
  h1 { font-size: 20px; }
  .grid.two, .emailgrid, .formgrid { grid-template-columns: 1fr; }
  .grid.tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 12px 14px; } .tile .value { font-size: 24px; }
  .formgrid .span2 { grid-column: auto; }
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .filters select, .filters input, .filters input.search { min-width: 0; flex: 1 1 140px; }
  .filters .check { flex: 1 1 100%; white-space: nowrap; }
  .kcol { flex-basis: min(300px, 84vw); max-height: none; }
  .kbody { max-height: 60vh; }
  .table th, .table td { padding: 9px 10px; }
  .table-wrap { max-height: none; }
  .overlay { padding: 0; align-items: stretch; }
  .modal, .modal.wide { max-width: none; min-height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .modal .mbody { flex: 1; }
  .modal .mfoot { position: sticky; bottom: 0; border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal .mfoot .left { margin-right: auto; }
  .btn { min-height: 40px; }
  .inline-select { min-height: 36px; }
  #toast-root { left: 14px; right: 14px; bottom: 14px; }
  .emailpreview textarea { min-height: 320px; }
}
@media (max-width: 520px) {
  .grid.tiles { grid-template-columns: 1fr 1fr; }
  .tile .label { font-size: 11px; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions .btn { flex: 1; justify-content: center; }
}
