/* The Office. Uses site.css tokens, buttons and inputs; everything here is scoped to .office. */
.office { --s1: #3987e5; --s2: #c98500; font-size: 15px; }
:root[data-theme="light"] .office { --s1: #2a78d6; --s2: #b97700; }
.office [hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
/* Same shell as the panel: the sidebar floats on the sky, cards and headers are glass. */
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 14px; }
/* Office <-> team board: the sidebar stays put (no size/position morph) and only cross-fades; team.css names it too. */
.side { view-transition-name: staff-side; }
::view-transition-group(staff-side) { animation: none; }
.side-brand img { width: 160px; height: auto; margin: 4px 8px; }
.side-sub { margin: -6px 8px 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.app-tick { display: inline-flex; align-items: center; gap: 8px; }
.app-tick input { width: 18px; height: 18px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
/* Categories fold up; name="office-nav" lets only one be open at a time. */
.side nav details { display: flex; flex-direction: column; gap: 2px; }
.side nav summary { display: flex; justify-content: space-between; align-items: center; min-height: 36px; margin-top: 6px; padding: 0 12px; border-radius: var(--r-sm); font: 700 12px/1.4 var(--font-body); letter-spacing: .01em; color: var(--red); cursor: pointer; list-style: none; }
.side nav summary::-webkit-details-marker { display: none; }
.side nav summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.side nav details[open] > summary::after { transform: rotate(45deg); }
.side nav summary:hover { background: var(--surface); }
/* Tasks waiting inside a closed category: a dot, so the count isn't lost. */
.side nav details:not([open]):has(.nav-badge:not([hidden])) > summary::before { content: ""; width: 8px; height: 8px; margin-right: auto; margin-left: 8px; order: 1; border-radius: 50%; background: var(--maint); }
.side nav summary::after { order: 2; }
/* A closed category holding the current page keeps the red marker, so you know where you are. */
.side nav details.has-current:not([open]) > summary { background: var(--surface); box-shadow: inset 2px 0 0 var(--red), inset 0 0 0 1px var(--line); }
.side nav a { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
.side nav a:hover { background: var(--surface); }
.side nav a[aria-current] { background: var(--surface); box-shadow: inset 2px 0 0 var(--red), inset 0 0 0 1px var(--line); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-foot .who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 8px; overflow-wrap: anywhere; }
.nav-badge { min-width: 20px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--maint); color: #0a1120; font: 600 12px/1.5 var(--font-body); text-align: center; }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 48px) 72px; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 40px; }
.topbar .btn, .topbar .icon-btn { flex: none; }
.topbar #menu { display: none; margin-right: auto; }
.signed-out .side, .signed-out #menu { display: none !important; }
.signed-out .shell { grid-template-columns: minmax(0, 1fr); }
.gate { max-width: 460px; margin: 12vh auto 0; }
.gate .btn { margin-top: 22px; }
.gate p { margin-top: 10px; }

.office .page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; padding-block: 6px 24px; }
.office .page-head h1 { font-size: clamp(26px, 2.6vw, 32px); }
.panel, .stat { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); }
/* Subheaders are brand red: #dc2626 light, #ef4444 dark (both from --red); they sit on glass cards, 4.5:1+. */
.office .panel-head h2, .office .chart figcaption h3, .office dialog h2 { color: var(--red); }
.office .page-head p { margin-top: 8px; max-width: 70ch; }
.office h2 { font-size: 17px; letter-spacing: -0.01em; }
.office h3 { font-size: 16px; letter-spacing: -0.01em; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 12px; }
.back .icon { transform: rotate(180deg); }

.panel, .stat { border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel + .panel, .two + .panel, .stats + .two, .two + .two, .filters + .cards, .notice + .panel { margin-top: 16px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px; }
.panel-head h2 a { text-decoration: none; } .panel-head h2 a:hover { text-decoration: underline; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-val { font: 600 28px/1.15 var(--font-head); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.stat-val.risk { color: var(--maint); }
.stat-val a { text-decoration-thickness: 1px; text-underline-offset: 4px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.two > .panel + .panel { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.cards > .panel + .panel { margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters > .input[type=search] { flex: 1 1 300px; } .filters > select { flex: 0 1 180px; }
.office .input { min-height: 44px; padding: 9px 13px; }
.office select.input { padding-right: 36px; }
.office .input-sm { min-height: 34px; padding: 4px 8px; font-size: 14px; margin-top: 8px; }
.office .field { margin-top: 14px; } .filters .field, .field-row .field { margin-top: 0; }
.field-row, .prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.prof-prefs { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; }
.chips-row { display: flex; flex-wrap: wrap; gap: 14px; }
.input-row { display: flex; gap: 8px; margin-bottom: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.crm-inline { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.office .btn { --h: 42px; } .office .btn-sm { --h: 34px; padding: 0 14px; }
.btn-stop { background: transparent; border-color: color-mix(in srgb, var(--red) 55%, var(--line)); color: var(--text); }
.btn-stop:hover { background: var(--red-tint); }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }

.table-wrap { overflow-x: auto; }
.office table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.office th { text-align: left; font: 600 13px/1.4 var(--font-body); color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.office td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.office tr:last-child td { border-bottom: 0; }
.office .num { border-left: 0; text-align: right; font-variant-numeric: tabular-nums; }
.office td.mono { font-size: 13.5px; }
.strong { font-weight: 600; }
.meta { font-size: 13px; color: var(--muted); }
.due { color: var(--maint); font-weight: 600; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; }
.office .badge { display: inline-flex; margin: 0; padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid var(--line); font-size: 13px; color: var(--text); white-space: nowrap; }
.office .badge.warn, .ch-past_due, .pay-failed { color: var(--maint) !important; border-color: currentColor !important; }
.office .badge.ok, .ch-paid, .ch-active, .pay-paid { color: var(--ok) !important; }
.stage-pill, .role-pill, .ro-pill, .kind-pill { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.ro-pill { border-color: var(--maint); color: var(--maint); font-weight: 600; }
.stage-active { color: var(--ok); } .stage-at_risk { color: var(--maint); } .stage-churned { color: var(--muted); }
.office .notice { margin: 0 0 16px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-control); }
.office .notice.err, .office .notice.warn { color: var(--maint); border-color: currentColor; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.tabs button { min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--r-pill); background: none; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button:hover { color: var(--text); background: var(--tint); }
.tabs [aria-selected="true"], .tabs [aria-pressed="true"] { color: var(--text); background: var(--tint-2); border-color: var(--line); }
.seg { display: flex; gap: 14px; flex-wrap: wrap; } .seg label { display: flex; gap: 6px; align-items: center; }
.skeleton { display: inline-block; width: 100%; height: 18px; border-radius: 4px; background: var(--tint-2); }

.hearts { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.heart-on { fill: var(--emerald); } .heart-off { fill: var(--line); }

.board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-panel); background: color-mix(in srgb, var(--inset) 92%, transparent); min-height: 240px; }
.board-col.over { border-color: var(--text); }
.board-col > header { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.board-col > header .muted { font-weight: 400; font-size: 13px; }
.board-card { padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow-wrap: anywhere; }
.board-card[data-id] { cursor: grab; user-select: none; }
.board-card.dragging { position: relative; z-index: 5; pointer-events: none; cursor: grabbing; box-shadow: var(--shadow-float); }
.board-empty { font-size: 14px; }

.task-list, .timeline, .facts, .checklist { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); } .task:last-child { border: 0; }
.task-check input { width: 22px; height: 22px; accent-color: var(--emerald); }
.task-title { font-weight: 600; } .task-reason { color: var(--muted); margin-block: 2px; }
.task.done .task-title { text-decoration: line-through; }
.crm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.detail-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.note-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.tl-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pinned-notes .tl-item { padding-inline: 18px; }
.tl-dot { flex: none; width: 10px; height: 10px; margin-top: 7px; background: var(--off); }
.tl-billing .tl-dot { background: var(--emerald); } .tl-refund .tl-dot, .tl-risk .tl-dot { background: var(--lava); } .tl-ticket .tl-dot { background: var(--diamond); } .tl-email .tl-dot { background: var(--s1); } .tl-note .tl-dot { background: var(--torch); }
.tl-title { font-weight: 600; } .tl-detail { color: var(--muted); overflow-wrap: anywhere; } .note-body { white-space: pre-wrap; color: var(--text); }
.tl-item > div { min-width: 0; }
.facts li { display: flex; justify-content: space-between; gap: 14px; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.facts li:last-child { border: 0; } .facts li > :first-child { color: var(--muted); } .facts li > :last-child { text-align: right; overflow-wrap: anywhere; min-width: 0; }
.checklist li { display: flex; gap: 10px; padding-block: 6px; } .ok-i, .ok-text { color: var(--ok); } .bad-i, .warn-text { color: var(--maint); }
.ok-text, .warn-text { display: inline-flex; gap: 6px; align-items: center; }
.setup summary { cursor: pointer; }
.reason + .reason { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.reason blockquote { margin: 10px 0; padding: 10px 14px; background: var(--inset); border-radius: var(--r-sm); }
.weight { display: grid; grid-template-columns: 120px 1fr 36px; gap: 12px; align-items: center; min-height: 44px; } .weight input { accent-color: var(--emerald); width: 100%; }

.chart { margin: 0; } .chart figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chart-box { position: relative; } .chart svg { width: 100%; height: auto; overflow: visible; }
.chart .s1 { fill: var(--s1); background: var(--s1); } .chart .s2 { fill: var(--s2); background: var(--s2); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); } .legend span { display: inline-flex; gap: 6px; align-items: center; } .legend i { width: 10px; height: 10px; border-radius: 2px; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .axis { fill: var(--muted); font: 12px var(--font-body); } .chart .hit { fill: transparent; }
.bar-g:hover .hit, .bar-g:focus .hit { fill: var(--tint-2); } .bar-g:focus { outline: none; } .bar-g:focus-visible .hit { stroke: var(--text); }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); padding: 6px 10px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 13px; white-space: nowrap; pointer-events: none; z-index: 3; }
.chart details { margin-top: 10px; font-size: 14px; } .chart summary { cursor: pointer; color: var(--muted); }

.office dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); }
.office dialog::backdrop { background: rgba(5, 9, 19, .6); }
.office dialog .chip { display: inline-block; padding: 1px 9px; }
.office dialog h2 { font-size: 22px; } .office dialog p.muted { margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.office .form-error { margin-top: 14px; white-space: pre-line; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-float); }
.toast.ok .icon { color: var(--ok); } .toast.err .icon { color: var(--maint); }
.spinner { animation: office-spin 1s linear infinite; } @keyframes office-spin { to { transform: rotate(1turn); } }

@media (max-width: 1100px) { .two, .crm-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: auto; z-index: 70; background: var(--surface); }
  .menu-open .side { display: flex; }
  .topbar #menu { display: inline-flex; }
  .main { padding: 12px 16px 64px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; } .stat-val { font-size: 22px; }
  .board { grid-auto-columns: 84vw; }
  .field-row, .prof-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
/* Dashboard: everything at a glance (servers, tickets, team board, status), then this month. */
.glance-head { font: 600 18px/1.3 var(--font-head); margin: 4px 0 12px; }
.glance-goals { margin-bottom: 24px; }
.goal-list { list-style: none; margin: 0; padding: 6px 18px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 24px; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; padding-block: 6px; }
.goal-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--emerald); transform-origin: left; }
.meta-row { display: flex; gap: 12px; padding: 6px 0; } .meta-row b { flex: 0 0 150px; font-weight: 600; } .meta-row + .row-actions { margin-top: 12px; }

.out-grid td, .out-grid th { padding: 4px 3px; min-width: 24px; text-align: center; }
.out-grid td:first-child, .out-grid th:first-child { text-align: left; min-width: 140px; }
.out-grid .out { background: var(--tint-2); font-weight: 600; }
.out-grid .wk { opacity: .55; }

/* Printing a pay stub: only the open stub dialog prints. */
@media print { body.printing-stub > *:not(dialog.stub) { display: none !important; } dialog.stub { position: static; margin: 0; box-shadow: none; border: 0; max-width: none; } dialog.stub .dialog-actions { display: none; } }
/* Tax banner: wording and weight rise with the level; red stays for the button. */
.office .notice[class*="tax-"] { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .notice[class*="tax-"] > span { flex: 1 1 260px; }
.notice.tax-soon, .notice.tax-urgent, .notice.tax-overdue { color: var(--maint); border-color: currentColor; } .notice.tax-urgent, .notice.tax-overdue { border-width: 2px; font-weight: 600; } .notice.tax-overdue { background: color-mix(in srgb, var(--maint) 12%, var(--tint)); }
