/* Client-area theme: navy side menu, white header with account counts, lavender panel headers, striped tables.
   Brand name and logo come from the web config (portal_name, logo); nothing here is brand-specific. */
:root {
	--bg: #fafafa;
	--surface: #ffffff;
	--text: #212121;
	--muted: #6b6f7b;
	--line: #d9dae0;
	--navy: #2b2d55;        /* menu section headers, primary buttons */
	--navy-2: #383b62;      /* menu body */
	--ink: #1f2a56;         /* links and the client name */
	--panel: #cfd0e6;       /* panel header band */
	--th: #e2e3e8;
	--row: #f7f7f8;
	--row-alt: #efeff1;
	--accent: #2b2d55;
	--accent-ink: #ffffff;
	--ok: #1b6e3c;   --ok-bg: #e3f3e8;
	--warn: #8a5300; --warn-bg: #fff2d9;
	--bad: #b3261e;  --bad-bg: #fde9e7;
	--info: #1f2a56; --info-bg: #e6e7f3;
	--radius: 0px;
	--in: #4f6fd6;
	--out: #d9722e;
	font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 Roboto, "Helvetica Neue", Arial, system-ui, sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--ink); text-decoration: underline; }
a:hover { color: #000; }
h1 { font-size: 2.4rem; font-weight: 300; color: #555; margin: 0 0 1.2rem; line-height: 1.2; }
h2 { font-size: 1rem; margin: 0 0 .8rem; text-transform: uppercase; color: #1c1d3a; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid #9a9ba5; }
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 26px 0 14px; min-height: 56px; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.brand img { max-height: 44px; max-width: 220px; display: block; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.top-actions form { margin: 0; }
.gear { font-size: 1.35rem; text-decoration: none; color: #222; line-height: 1; }
.logout { background: none; border: 0; font: inherit; font-size: 1.15rem; color: var(--ink); cursor: pointer; padding: 0; }
.logout::before { content: "\21E5"; margin-right: 6px; }
.logout:hover { text-decoration: underline; }
.top-summary { display: grid; grid-template-columns: minmax(240px, 1.6fr) minmax(260px, 1.2fr) minmax(260px, 420px); gap: 20px; align-items: center; padding: 14px 26px 22px 14px; }
.client-name { font-size: 1.85rem; color: var(--ink); line-height: 1.2; overflow-wrap: anywhere; }
.counts { display: flex; gap: 60px; }
.counts > div { display: flex; flex-direction: column; gap: 6px; }
.counts a { color: var(--ink); white-space: nowrap; }
.top-search { display: flex; align-items: center; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .14); padding: 6px 8px; margin: 0; }
.top-search select { width: auto; border: 0; background: transparent; padding: 6px 4px; }
.top-search input { border: 0 !important; flex: 1; min-width: 0; padding: 6px 8px !important; }
.top-search button { border: 0; background: none; cursor: pointer; font-size: 1rem; opacity: .55; }

/* Shell: side menu + content */
.shell { display: flex; flex: 1 0 auto; align-items: stretch; }
.side { width: 296px; flex: none; background: var(--navy-2); color: #fff; padding-bottom: 40px; }
.side a { color: #fff; text-decoration: none; display: block; }
.menu-check, .menu-button { display: none; }
.side-body > a { background: var(--navy); font-weight: 700; padding: 13px 14px 13px 24px; font-size: 1.05rem; }
.side summary { background: var(--navy); font-weight: 700; padding: 13px 44px 13px 24px; font-size: 1.05rem; cursor: pointer; list-style: none; position: relative; }
.side summary::-webkit-details-marker { display: none; }
.side summary::after { content: ""; position: absolute; right: 38px; top: 50%; border: 6px solid transparent; border-top-color: #fff; margin-top: -2px; }
.side details:not([open]) summary::after { border-top-color: transparent; border-left-color: #fff; margin-top: -6px; right: 34px; }
.side-links { padding: 10px 0; }
.side-links a { padding: 8px 14px 8px 10px; }
.side a:hover, .side summary:hover { text-decoration: underline; }
.side a.active { font-weight: 700; box-shadow: inset 4px 0 0 #fff; }
main { flex: 1; min-width: 0; padding: 24px 26px 48px; }
.signed-out main, body.signed-in .shell > main:only-child { max-width: 1100px; margin: 0 auto; width: 100%; }
.foot { color: var(--muted); font-size: .85rem; padding: 10px 26px; background: var(--surface); border-top: 1px solid var(--line); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Panels */
.card { background: var(--surface); border: 1px solid var(--line); padding: 18px; margin-bottom: 24px; }
.card > h2:first-child, .card > .page-head:first-child { background: var(--panel); margin: -18px -18px 16px; padding: 13px 18px; }
.card > .page-head:first-child h2 { margin: 0; }
.card.flush { padding: 0; overflow-x: auto; border: 0; background: none; }
.pad { padding: 18px; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .6rem; }
.page-head > div { display: flex; gap: 8px; flex-wrap: wrap; }
.edit { font-size: .8rem; font-weight: 700; text-decoration: none; color: #1c1d3a; }
.edit:hover { text-decoration: underline; }
.crumbs { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sum-row { display: flex; justify-content: space-between; padding: 6px 30px 0; }
.sum-link { text-align: right; padding: 2px 30px 12px; border-bottom: 1px solid #e6e6ea; margin-bottom: 8px; }
.sum-link:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 2px; }
.kv { display: grid; grid-template-columns: minmax(140px, 30%) 1fr; gap: 9px 12px; margin: 0; }
.kv dt { color: #222; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; color: var(--text); text-decoration: none; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-value { font-size: 1.6rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: .85rem; }
.empty-state, .auth-card { max-width: 440px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.auth-card h1 { font-size: 1.7rem; }
.empty-state { text-align: center; max-width: 520px; }
.shown { margin: 8px 0 6px 4px; }
.right-row { display: flex; justify-content: flex-end; gap: 8px; margin: 4px 0 10px; }
.view-pick { display: flex; align-items: center; gap: 6px; margin: 0; }
.view-pick label { flex-direction: row; align-items: center; gap: 6px; font-weight: 700; }
.view-pick select { width: auto; background: var(--th); border: 0; padding: 5px 8px; }

/* Tables and lists */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-bottom: 1px solid #c9cad1; }
.table th, .table td { text-align: left; padding: 10px 12px; vertical-align: middle; }
.table th { background: var(--th); font-weight: 700; color: #1d1d1f; white-space: nowrap; padding-top: 13px; padding-bottom: 13px; }
.table tbody tr:nth-child(odd) td { background: var(--row); }
.table tbody tr:nth-child(even) td { background: var(--row-alt); }
.table tfoot td { background: var(--th); }
.table.plain tbody tr td { background: #f6f6f8; }
.table td.tick { width: 34px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0 30px; }
.list li { padding: 7px 0; border-bottom: 1px solid #e6e6ea; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.tabs { display: flex; gap: 0; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--navy); }
.tabs a { padding: 8px 14px; color: var(--ink); text-decoration: none; background: var(--th); margin-right: 2px; }
.tabs a.active { background: var(--navy); color: #fff; font-weight: 700; }

/* Badges, flash */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; background: var(--th); color: #444; vertical-align: middle; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { background: var(--th); color: #555; }
.paybox { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.secure-note { display: flex; gap: 8px; align-items: flex-start; }
.flash { padding: 12px 14px; margin-bottom: 16px; background: var(--info-bg); color: var(--info); border-left: 4px solid var(--info); }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash-warning { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.flash-error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .btn { align-self: flex-start; }
.narrow { max-width: 460px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .93rem; }
label.choice { flex-direction: row; align-items: center; gap: 8px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
	font: inherit; color: var(--text); background: var(--surface); border: 1px solid #b9bac4; border-radius: 0; padding: 8px 10px; width: 100%;
}
input[type=checkbox] { width: 16px; height: 16px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #5b63c9; outline-offset: 1px; }
fieldset { border: 1px solid var(--line); padding: 14px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
details.new-card summary { list-style: none; cursor: pointer; }
details.new-card summary::-webkit-details-marker { display: none; }
details.new-card[open] > .stack { margin-top: 14px; padding-left: 26px; }
form.inline { display: inline; margin: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .82rem; font-weight: 500; text-transform: uppercase; padding: 9px 18px;
	border: 2px solid #1c1c1c; background: var(--surface); color: #111; cursor: pointer; text-decoration: none !important; border-radius: 0; }
.btn:hover { background: #f0f0f3; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #1f2145; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .78rem; border-width: 1px; }
button.link { background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
a.pay { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }

/* Tickets */
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.post { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.post.staff { border-left: 4px solid var(--navy); }
.post header { margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.post .body { overflow-wrap: anywhere; }
.files { margin: 10px 0 0; padding-left: 18px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: var(--row); padding: 14px; margin: 16px 0 0; }

/* Invoice frame */
.invoice-frame { width: 100%; height: 900px; border: 1px solid var(--line); display: block; background: #fff; }

/* Graphs */
.bw-graph { width: 100%; height: auto; display: block; margin: 8px 0; }
.bw-graph .grid { stroke: var(--line); stroke-width: 1; }
.bw-graph .axis { fill: var(--muted); font-size: 11px; }
.bw-graph .in { fill: var(--in); fill-opacity: .35; stroke: var(--in); stroke-width: 1; }
.bw-graph .out { fill: none; stroke: var(--out); stroke-width: 1.4; }
.bw-graph .pct { stroke: var(--bad); stroke-width: 1.3; stroke-dasharray: 6 4; }
.bw-graph .pct-label { fill: var(--bad); font-size: 11px; font-weight: 600; }
.legend { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.key { display: inline-block; width: 14px; height: 10px; }
.key.in { background: var(--in); opacity: .6; }
.key.out { background: var(--out); height: 3px; }
.key.pct { border-top: 2px dashed var(--bad); height: 0; }
.pager { display: flex; gap: 6px; margin: 12px 0; }

.qr svg { width: 220px; height: 220px; display: block; }
.codes { columns: 2; list-style: none; padding: 0; margin: 0; font-size: 1.05rem; }
.codes li { padding: 4px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--row-alt); padding: 2px 6px; }
.steps { margin: 0; padding-left: 20px; }

/* Service management */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 4px 0; }
.inline-form label { display: flex; flex-direction: column; gap: 2px; }
.inline-form label.small { flex-direction: row; align-items: center; gap: 6px; }
.inline-form input, .inline-form select { min-width: 0; width: auto; }
td.stack { display: flex; flex-direction: column; gap: 4px; }
td.break, .break { word-break: break-all; }
.subcard { border: 1px solid var(--line); padding: 12px; margin-bottom: 12px; }
.input-suffix { display: inline-flex; align-items: center; gap: 4px; }
.input-suffix span { color: var(--muted); white-space: nowrap; }
.device-graph { max-width: 100%; height: auto; display: block; margin: 6px 0 16px; border: 1px solid var(--line); }
fieldset.reauth { border: 1px solid var(--line); padding: 12px; margin: 12px 0; }
.console-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.console-screen { width: 100%; height: 75vh; background: #111; overflow: hidden; }

@media (max-width: 1000px) {
	.top-summary { grid-template-columns: 1fr; gap: 12px; }
	.counts { gap: 30px; }
	.cols.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
	.shell { flex-direction: column; }
	.side { width: 100%; padding-bottom: 0; }
	/* Phones: the menu is folded behind a Menu button (a plain checkbox, no script). */
	.menu-button { display: block; background: var(--navy); color: #fff; font-weight: 700; padding: 13px 24px; cursor: pointer; }
	.menu-button::after { content: " \25BE"; }
	.menu-check { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; }
	.menu-check:focus-visible + .menu-button { outline: 2px solid #fff; outline-offset: -4px; }
	.side-body { display: none; }
	.menu-check:checked ~ .side-body { display: block; }
	main { padding: 16px 12px 40px; }
	h1 { font-size: 1.7rem; }
	.table { display: block; overflow-x: auto; }
	.sum-row, .sum-link, .list { padding-left: 6px; padding-right: 6px; }
}

/* "Confirm this change" box */
.confirm-box { max-width: 560px; border-top: 4px solid var(--info); }
.confirm-box label { font-weight: 600; }
.confirm-box .actions { display: flex; gap: 10px; align-items: center; }
button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--link, #1a4fa3); text-decoration: underline; cursor: pointer; }
