@font-face { font-family: 'Inter Tight Variable'; src: url(fonts/inter-tight-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Saira Condensed'; src: url(fonts/saira-condensed-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }

/* Console: light-first workspace for long sessions, brand-navy navigation, brand red for alerts & primary actions */
:root {
  --navy: #13233d; --navy-2: #1a2e4d; --red: #ec3237; --red-strong: #d42a30;
  --bg: #f4f6f9; --surface: #ffffff; --line: #e3e7ee; --line-2: #cfd6e1; --text: #0f1a2c; --text-2: #5a677a; --focus: #2f6fb3;
  --ok: #157a52; --ok-bg: #e3f5ec; --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #b4232a; --bad-bg: #fde7e8; --info: #1f5f99; --info-bg: #e3eefa; --violet: #5b3fa6; --violet-bg: #efeafb; --new: #b4232a; --new-bg: #fde7e8; --muted-bg: #eef1f5;
  --r: 10px; --font: 'Inter Tight Variable', system-ui, sans-serif; --display: 'Saira Condensed', 'Arial Narrow', sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.05; margin: 4px 0 6px; letter-spacing: .005em; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--text-2); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: .92em; } .num { font-variant-numeric: tabular-nums; }
.r { text-align: right; } .c { text-align: center; }
.eyebrow { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); margin: 0; font-weight: 600; }
.link { color: var(--info); } .link:hover { text-decoration: underline; }
.linkbtn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--info); }
.err { color: var(--bad); margin: 0; } .hot-txt { color: var(--bad); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.stack { display: grid; gap: 16px; align-content: start; } .stack-s { display: grid; gap: 10px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.span2 { grid-column: 1 / -1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dim { opacity: .6; }

/* Buttons */
.b { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.b:hover { border-color: #9aa6b8; } .b[disabled] { opacity: .5; cursor: not-allowed; }
.b-primary { background: var(--red-strong); border-color: var(--red-strong); color: #fff; } .b-primary:hover { background: var(--red); border-color: var(--red); }
.b-danger { color: var(--bad); border-color: #f1b9bc; } .b-danger:hover { background: var(--bad-bg); }
.b-ghost { border-color: transparent; background: transparent; } .b-ghost:hover { background: var(--muted-bg); }
.b-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.pill-red { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11.5px; margin-left: 6px; }

/* Inputs */
.in { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
textarea.in { height: auto; padding: 8px 10px; resize: vertical; }
.in:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(47,111,179,.15); }
.in[aria-invalid='true'] { border-color: var(--bad); }
.fld { display: grid; gap: 4px; } .fld label { font-size: 12.5px; font-weight: 500; color: #33405a; }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; cursor: pointer; }
.fs { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; margin: 10px 0 0; }
.form { display: grid; gap: 12px; }

/* Status chips: always text + dot, never colour alone */
.st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { color: var(--new); background: var(--new-bg); } .st-info { color: var(--info); background: var(--info-bg); } .st-warn { color: var(--warn); background: var(--warn-bg); }
.st-violet { color: var(--violet); background: var(--violet-bg); } .st-ok { color: var(--ok); background: var(--ok-bg); } .st-bad { color: var(--bad); background: var(--bad-bg); } .st-muted { color: #4a5568; background: var(--muted-bg); }

/* Shell */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--navy); color: #dfe6f1; display: flex; flex-direction: column; z-index: 40; transform: translateX(-100%); transition: transform .25s; }
.side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10,19,34,.4); }
.side-logo { display: grid; gap: 4px; padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-logo span { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #9fb0c6; }
.side nav { flex: 1; overflow-y: auto; padding: 8px 10px; }
.side-g { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #8193ad; margin: 16px 10px 6px; }
.side nav a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; color: #dfe6f1; font-size: 14px; }
.side nav a:hover { background: rgba(255,255,255,.06); }
.side nav a.on { background: rgba(255,255,255,.1); box-shadow: inset 3px 0 0 var(--red); color: #fff; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 8px; }
.side-foot .b-ghost { color: #dfe6f1; } .side-foot .b-ghost:hover { background: rgba(255,255,255,.08); }
.side-user { display: flex; gap: 10px; align-items: center; } .side-user small { display: block; color: #9fb0c6; font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--red-strong); color: #fff; font-weight: 600; font-size: 13px; }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: rgba(244,246,249,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); } .conn i { width: 8px; height: 8px; border-radius: 50%; background: #9aa6b8; } .conn.on i { background: #1fa971; }
@media (min-width: 1000px) { .shell { grid-template-columns: 260px 1fr; } .side { position: sticky; top: 0; height: 100vh; transform: none; } .burger { display: none; } }
.banner-red { background: var(--bad-bg); color: var(--bad); border: 1px solid #f3c2c5; padding: 10px 14px; border-radius: 8px; margin: 12px 20px 0; }
.banner-red ul { margin: 6px 0 0; padding-left: 18px; }
.page { padding: 22px 20px 64px; max-width: 1400px; display: grid; gap: 16px; align-content: start; }
.page.narrow { max-width: 860px; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-h p { margin: 0; }
.sticky-actions { position: sticky; top: 56px; z-index: 20; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }

/* Cards, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.flush { padding: 0; overflow-x: auto; }
.card-h { margin-bottom: 10px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfd; }
.row-hot { background: #fff6f6; } .row-hot:hover { background: #fff0f0 !important; } .row-sel { background: var(--info-bg); }
.thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; }
.pager { justify-content: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.empty { display: grid; gap: 4px; place-items: center; text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.loading { display: flex; gap: 6px; justify-content: center; padding: 40px; } .loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--navy); animation: ld 1s infinite ease-in-out; } .loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes ld { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--red); font-weight: 600; }
.tabs .num { color: var(--text-2); font-size: 12px; margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-size: 13px; } .seg button.on { background: var(--navy); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .filters .in { width: auto; min-width: 160px; } .filters .in:first-child { flex: 1; min-width: 220px; }
.bulk { display: flex; gap: 10px; align-items: center; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 8px; } .bulk .in { width: auto; color: var(--text); }

/* Dashboard */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; }
.stat strong { font-size: 26px; font-weight: 600; }
.stat-red { border-color: #f3c2c5; background: #fff8f8; } .stat-red strong { color: var(--bad); }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; } @media (min-width: 1100px) { .cols { grid-template-columns: 1.4fr 1fr; } }
.chart { margin: 0; } .chart figcaption { font-weight: 600; } .chart-box { position: relative; margin-top: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #edf0f4; stroke-width: 1; } .chart .axis { stroke: #c4ccd8; } .chart .tick { font-size: 10.5px; fill: #6b778a; }
.chart .bar { fill: #2f5b9a; transition: fill .15s; } .chart .bar.on { fill: #13233d; }
.tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; display: grid; pointer-events: none; white-space: nowrap; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-t { height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden; } .hbar-t i { display: block; height: 100%; background: #2f5b9a; border-radius: 4px; }
.hbar-v { min-width: 40px; text-align: right; }

/* Leads */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #eaeef4; border-radius: var(--r); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 300px; }
.board-col header { display: flex; justify-content: space-between; align-items: center; }
.board-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 2px; cursor: grab; }
.board-card.hot { border-color: #f1a5a9; box-shadow: inset 3px 0 0 var(--red); }
.lead-grid { display: grid; gap: 16px; grid-template-columns: 1fr; } @media (min-width: 1100px) { .lead-grid { grid-template-columns: 1.5fr 1fr; } }
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 14px; margin: 0; } .dl dt { color: var(--text-2); font-size: 13px; } .dl dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; border-left: 2px solid var(--line); }
.timeline li { padding-left: 14px; position: relative; display: grid; gap: 2px; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #c4ccd8; }
.tl-status::before { background: var(--navy) !important; } .tl-call::before { background: var(--ok) !important; } .tl-note::before { background: var(--warn) !important; } .tl-quote::before { background: var(--violet) !important; }

/* Builder & media */
.builder { display: grid; gap: 16px; }
.day-ed { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.img-ed { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 10px; }
.img-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; } .img-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; background: repeating-conic-gradient(#e9edf2 0 25%, #fff 0 50%) 0 0/16px 16px; }
.media-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: 60vh; overflow-y: auto; }
.page .media-grid { max-height: none; }
.media-tile { border: 2px solid transparent; background: #fff; border-radius: 8px; padding: 0; overflow: hidden; display: grid; text-align: left; cursor: pointer; margin: 0; }
.media-tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: repeating-conic-gradient(#e9edf2 0 25%, #fff 0 50%) 0 0/16px 16px; }
.media-tile span, .media-tile figcaption { padding: 6px 8px; display: grid; gap: 2px; }
.media-tile.on { border-color: var(--red); }
.drop { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 22px; text-align: center; color: var(--text-2); } .drop.on { border-color: var(--red); background: #fff6f6; }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.order-list li { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.settings { display: grid; gap: 4px; } .setting { display: grid; grid-template-columns: 1fr minmax(200px, 360px); gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting label { display: grid; } @media (max-width: 700px) { .setting { grid-template-columns: 1fr; } }
.pre { max-width: 420px; white-space: pre-wrap; font-size: 11px; background: var(--muted-bg); padding: 8px; border-radius: 6px; }
.notif-list { list-style: none; margin: 0; padding: 0; } .notif-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); } .notif-list li.unread { background: #f7f9ff; }

/* Modal & toasts */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px rgba(10,19,34,.35); }
.modal-wide { width: min(920px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10,19,34,.5); }
.modal-in { padding: 18px 20px 20px; display: grid; gap: 14px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 380px; } .toast-bad { background: var(--bad); }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 30% 20%, #1d3458, #0a1322 60%); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 28px; display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-card img { background: var(--navy); padding: 10px 14px; border-radius: 10px; width: auto; height: 58px; justify-self: start; }
.auth-card h1 { margin: 4px 0 0; } .auth-card p { margin: 0; }
.portal-tile { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line-2); border-radius: 10px; } .portal-tile:hover { border-color: var(--red); }

/* NEW QUERY alarm */
.alarm { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background: rgba(120, 8, 14, .55); backdrop-filter: blur(3px); animation: alarmBg 1s steps(1) infinite; }
@keyframes alarmBg { 50% { background: rgba(10,19,34,.65); } }
.alarm-card { position: relative; width: min(560px, 100%); background: var(--red-strong); color: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 30px 100px rgba(0,0,0,.5); overflow: hidden; }
.alarm-pulse { position: absolute; inset: -40%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 55%); animation: pulse 1.2s ease-out infinite; pointer-events: none; }
@keyframes pulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }
.alarm-eyebrow { margin: 0; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .9; font-family: var(--mono); }
.alarm-h { font-family: var(--display); font-size: clamp(38px, 7vw, 60px); line-height: .95; margin: 8px 0 16px; letter-spacing: .01em; }
.alarm-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 16px; } .alarm-dl dt { opacity: .8; } .alarm-dl dd { margin: 0; font-weight: 600; } .alarm-dl a { text-decoration: underline; }
.alarm .b { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.4); color: #fff; height: 46px; }
.alarm .alarm-ack { background: #fff; color: var(--red-strong); border-color: #fff; font-weight: 700; font-size: 16px; padding: 0 22px; }
@media (prefers-reduced-motion: reduce) { .alarm, .alarm-pulse { animation: none; } }
[hidden] { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
/* keep wide content (tables, charts) inside the viewport on phones */
.shell { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .shell { grid-template-columns: 260px minmax(0, 1fr); } }
.page { grid-template-columns: minmax(0, 1fr); }
.card.flush, .board { overflow-x: auto; }
.cols > * { min-width: 0; }
.card { overflow-x: auto; }
