/* Arana Security Helpdesk — standalone portal styles.
   Layout: security operations console — sticky top bar with section tabs; Overview is a chart grid, other sections are dense queue rows with a slide-in detail panel. */
:root {
  --bg: #f2f4f7; --surface: #ffffff; --sunk: #e8ecf1; --ink: #141d29; --muted: #5a6778; --line: #d8dfe7;
  --accent: #1c4f9c; --accent-soft: #e1eaf7; --on-accent: #ffffff; --brand: #0f2a4d;
  --ok: #1d7347; --ok-soft: #dff1e7; --warn: #9a5b00; --warn-soft: #fbeed6; --crit: #b3261e; --crit-soft: #fae2df; --idle: #6b7686; --idle-soft: #eaedf2;
  --shadow: 0 10px 40px rgba(16,30,54,.18);
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e131a; --surface: #151c26; --sunk: #1c2532; --ink: #e5eaf1; --muted: #95a2b4; --line: #293443;
  --accent: #7fa7ee; --accent-soft: #1b2b46; --on-accent: #0b1424; --brand: #0a1628;
  --ok: #5fcf93; --ok-soft: #14301f; --warn: #f0b456; --warn-soft: #32270f; --crit: #ff8b80; --crit-soft: #3a1a18; --idle: #98a3b3; --idle-soft: #222b37;
  --shadow: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0e131a; --surface: #151c26; --sunk: #1c2532; --ink: #e5eaf1; --muted: #95a2b4; --line: #293443;
  --accent: #7fa7ee; --accent-soft: #1b2b46; --on-accent: #0b1424; --brand: #0a1628;
  --ok: #5fcf93; --ok-soft: #14301f; --warn: #f0b456; --warn-soft: #32270f; --crit: #ff8b80; --crit-soft: #3a1a18; --idle: #98a3b3; --idle-soft: #222b37;
  --shadow: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark }

* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .01em }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1200px; margin: 0 auto; }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--brand); color: #e9eef6; }
.top-row { display: flex; align-items: center; gap: 14px; padding-block: 12px; flex-wrap: wrap }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0 }
.brand svg { flex: none }
.brand h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.01em; white-space: nowrap }
.brand .live { font-size: 12px; color: #a9b6c9; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap }
.brand .live i { width: 7px; height: 7px; border-radius: 50%; background: #7b8798; display: inline-block }
.brand .live.on i { background: #4fd18b; box-shadow: 0 0 0 3px rgba(79,209,139,.2) }
.role { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: rgba(255,255,255,.12); color: #fff }
.role.admin { background: #e0a43a; color: #1f1400 }
.acting { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #a9b6c9 }
.acting select { min-width: 150px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #fff }
.acting select option { color: #141d29; background: #fff }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none }
nav.tabs a { text-decoration: none; color: #a9b6c9; padding: 9px 12px 11px; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center }
nav.tabs a:hover { color: #fff }
nav.tabs a[aria-current="page"] { color: #fff; border-bottom-color: #e0a43a }
nav.tabs .count { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.12); color: #dfe6f0; padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums }
nav.tabs .count.alert { background: #c8392f; color: #fff }

main { padding-block: 20px 60px; display: grid; gap: 16px }
.rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px }
.rail button, .tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px }
.rail button { cursor: pointer }
.rail button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent) }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600 }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15 }
.big.crit { color: var(--crit) } .big.warn { color: var(--warn) } .big.ok { color: var(--ok) }
.tile .hint { font-size: 12px; color: var(--muted) }

/* overview grid */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 14px }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0 }
.card h2 { margin: 0; font-size: 14px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; justify-content: space-between }
.card h2 small { font-weight: 500; color: var(--muted); font-size: 12px }
.span-8 { grid-column: span 8 } .span-4 { grid-column: span 4 } .span-6 { grid-column: span 6 } .span-12 { grid-column: span 12 }
.chart svg { width: 100%; height: auto; display: block }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--f-body) }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted) }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center }
.donut-wrap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px }
.donut-wrap li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 13px }
.donut-wrap li i { width: 10px; height: 10px; border-radius: 2px }
.donut-wrap li b { font-variant-numeric: tabular-nums }
.hbars { display: grid; gap: 10px }
.hbar { display: grid; grid-template-columns: minmax(0, 150px) 1fr 32px; gap: 10px; align-items: center; font-size: 13px }
.hbar .name { display: flex; align-items: center; gap: 8px; min-width: 0 }
.hbar .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.track { height: 12px; background: var(--sunk); border-radius: 3px; display: flex; overflow: hidden; position: relative }
.track > span { height: 100%; display: block }
.track .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55 }
.hbar b { font-variant-numeric: tabular-nums; text-align: right }
.feed { display: grid; gap: 0 }
.feed > div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer }
.feed > div:first-child { border-top: 0 }
.feed p { margin: 0; font-size: 13px; overflow-wrap: anywhere }
.feed .meta { font-size: 12px; color: var(--muted) }
.muted { color: var(--muted) }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.toolbar .search { flex: 1 1 220px; min-width: 0 }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
input:disabled, select:disabled, textarea:disabled { background: var(--sunk); color: var(--muted) }
textarea { resize: vertical; min-height: 80px }
.toolbar select { width: auto }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap }
.btn:hover { background: var(--sunk) }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent) }
.btn.primary:hover { filter: brightness(1.08) }
.btn.danger { color: var(--crit) }
.btn.danger.armed { background: var(--crit); color: #fff; border-color: var(--crit) }
.btn.sm { padding: 4px 10px; font-size: 12px }
.btn:disabled { opacity: .5; cursor: not-allowed }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.row { display: grid; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; position: relative }
.row:first-child { border-top: 0 }
.row:hover { background: var(--sunk) }
.row.head { cursor: default; background: var(--sunk); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding-block: 8px }
.row > * { min-width: 0 }
.row .main-cell b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block }
.row .num { font-variant-numeric: tabular-nums; text-align: right }
.who { display: flex; align-items: center; gap: 8px; min-width: 0 }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px }
.stripe::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent }
.stripe.p-urgent::before { background: var(--crit) } .stripe.p-high::before { background: var(--warn) }

.av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; letter-spacing: .02em }
.av.lg { width: 44px; height: 44px; font-size: 15px }
.av.none { background: var(--sunk); color: var(--muted); border: 1px dashed var(--line) }

.g-tickets { grid-template-columns: 92px minmax(0,2.4fr) minmax(0,1.3fr) minmax(0,1.2fr) 112px 72px 52px }
.g-customers { grid-template-columns: minmax(0,1.6fr) minmax(0,1.6fr) minmax(0,1.1fr) 90px }
.g-inventory { grid-template-columns: 110px minmax(0,2fr) minmax(0,1fr) 140px 120px 64px }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 12px; cursor: pointer; text-align: left }
.person:hover { border-color: var(--accent) }
.person .top { display: flex; gap: 12px; align-items: center; min-width: 0 }
.person .top > div { min-width: 0 }
.person b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.person .load { display: grid; gap: 6px }
.person .load .row2 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted) }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; width: fit-content }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor }
.s-open { background: var(--accent-soft); color: var(--accent) }
.s-pending { background: var(--warn-soft); color: var(--warn) }
.s-resolved { background: var(--ok-soft); color: var(--ok) }
.s-closed { background: var(--idle-soft); color: var(--idle) }
.st-available { background: var(--ok-soft); color: var(--ok) }
.st-busy { background: var(--warn-soft); color: var(--warn) }
.st-away { background: var(--idle-soft); color: var(--idle) }
.lvl-low { background: var(--crit-soft); color: var(--crit) }
.lvl-ok { background: var(--ok-soft); color: var(--ok) }
.lvl-out { background: var(--crit); color: #fff } .lvl-out::before { background: #fff }
.prio { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: capitalize }
.prio.urgent { color: var(--crit) } .prio.high { color: var(--warn) }
.qty { display: inline-flex; align-items: center; gap: 6px }
.qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; line-height: 1 }
.qty b { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums }
.gauge { height: 8px; border-radius: 4px; background: var(--sunk); position: relative; overflow: hidden }
.gauge span { position: absolute; inset: 0 auto 0 0; border-radius: 4px }

.empty { padding: 40px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; color: var(--muted) }
.empty h3 { margin: 0; color: var(--ink); font-size: 16px }
.empty p { margin: 0; max-width: 48ch }
.empty .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 500 }
.banner.info { background: var(--accent-soft); color: var(--accent) }
.banner span { flex: 1 1 240px }

/* side panel */
.scrim { position: fixed; inset: 0; background: rgba(10,18,30,.4); z-index: 20 }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100%); background: var(--surface); z-index: 21; box-shadow: var(--shadow); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px) }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line) }
.panel-head h2 { margin: 0; font-size: 16px; flex: 1; min-width: 0; text-wrap: balance }
.panel-body { padding: 18px; overflow-y: auto; flex: 1; display: grid; gap: 14px; align-content: start }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.panel-foot .spacer { flex: 1 }
.panel-foot .note-ro { font-size: 12px; color: var(--muted) }
.field { display: grid; gap: 5px }
.field label { font-size: 12px; font-weight: 600; color: var(--muted) }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.quick { display: flex; gap: 6px; flex-wrap: wrap }
.quick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent) }
.notes { display: grid; gap: 10px }
.notes h3 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted) }
.note { background: var(--sunk); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px }
.note .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center }
.note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere }
.linked { display: grid; gap: 6px }
.linked a { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 500 }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 40; font-weight: 500; max-width: calc(100% - 32px) }

@media (max-width: 900px) { .span-8, .span-4, .span-6 { grid-column: span 12 } }
@media (max-width: 760px) {
  .row.head { display: none }
  .g-tickets, .g-customers, .g-inventory { grid-template-columns: 1fr auto; row-gap: 6px }
  .row .hide-sm { display: none }
  .row .main-cell { grid-column: 1 / -1 }
  .row .num { text-align: left }
  .two { grid-template-columns: 1fr }
  .acting { width: 100% } .acting select { flex: 1 }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center }
  .donut-wrap ul { width: 100% }
  .hbar { grid-template-columns: minmax(0, 110px) 1fr 28px }
}
@media (prefers-reduced-motion: no-preference) {
  .panel { animation: slide .18s ease-out } @keyframes slide { from { transform: translateX(24px); opacity: .6 } }
  .track > span, .gauge span { transition: width .4s ease }
}

/* ---- standalone additions ---- */
html { -webkit-text-size-adjust: 100% }
body { margin: 0; min-height: 100vh }
[hidden] { display: none !important }
.userchip { display: flex; align-items: center; gap: 8px; color: #dfe6f0; text-decoration: none; font-size: 13px; font-weight: 600 }
.userchip:hover { color: #fff }
.demo-flag { background: #e0a43a; color: #1f1400; font-size: 12px; font-weight: 600; text-align: center; padding: 6px 16px }

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) }
.login-side { background: var(--brand); color: #e9eef6; padding: 48px max(24px, 6vw); display: grid; align-content: space-between; gap: 32px; position: relative; overflow: hidden }
.login-side h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.1; margin: 18px 0 12px; letter-spacing: -.02em; text-wrap: balance }
.login-side p { color: #a9b6c9; max-width: 42ch; margin: 0 }
.login-side .grid-bg { position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 32px 32px; pointer-events: none }
.login-side > * { position: relative }
.login-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: #c9d3e1; font-size: 14px }
.login-side li::before { content: ""; display: inline-block; width: 8px; height: 8px; background: #e0a43a; border-radius: 2px; margin-right: 10px }
.login-main { display: grid; place-items: center; padding: 40px 24px }
.login-form { width: min(380px, 100%); display: grid; gap: 16px }
.login-form h2 { margin: 0; font-size: 22px }
.login-form p { margin: 0; color: var(--muted) }
.login-form input { padding: 11px 12px }
.login-form .btn.primary { padding: 11px 14px; font-size: 15px }
.err { background: var(--crit-soft); color: var(--crit); border-radius: 6px; padding: 9px 12px; font-size: 13px; font-weight: 500 }
.demo-box { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; font-size: 13px; color: var(--muted) }
.demo-box button { text-align: left }
.pw-row { display: flex; gap: 8px } .pw-row input { flex: 1; min-width: 0 }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--sunk); color: var(--muted) }
.tag.admin { background: #e0a43a; color: #1f1400 }
.tag.off { background: var(--crit-soft); color: var(--crit) }
.g-users { grid-template-columns: minmax(0,1.7fr) minmax(0,1.6fr) 80px 110px 90px }
.acct { display: grid; gap: 16px; max-width: 640px }
.section-title { margin: 0; font-size: 18px }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr } .login-side { padding: 28px 20px } .login-side ul { display: none }
  .g-users { grid-template-columns: 1fr auto; row-gap: 6px }
}

/* customer portal markers in the staff app */
.tag.cust { background: var(--warn-soft); color: var(--warn) }
.tag.sent { background: var(--accent-soft); color: var(--accent) }
.tag.reply { background: var(--crit); color: #fff; vertical-align: 1px }
.note.from-cust { background: var(--warn-soft); border-left: 3px solid var(--warn) }
.note.to-cust { background: var(--accent-soft); border-left: 3px solid var(--accent) }
