/* Kinetik Billing workbench. Ported once from the six mockup artboards; the palette is theirs. */
:root {
  --ink: #16191d; --muted: #5b6470; --faint: #9aa3ae; --line: #d9dde3; --line-soft: #e6e9ed; --bg: #f3f4f6; --card: #fff;
  --accent: #0b5e7a; --accent-dark: #08465b; --accent-wash: #e3f1f5; --focus-wash: #f7fbfc;
  --ok: #1b6b3a; --ok-wash: #e4f3ea; --warn: #8a4b00; --warn-wash: #fff1de; --warn-line: #f3d9a8;
  --risk: #b3261e; --risk-wash: #fbeae8; --risk-line: #f2b8b2; --plum: #4f3a9e; --plum-wash: #f0ecfa; --grey-wash: #eef0f3; --grey-ink: #4a535e;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { margin: 0; font-size: 22px; font-weight: 600; }
.mono { font-family: var(--mono); }
.sub, .muted { color: var(--muted); }
.sub { font-size: 12px; }
.strong { font-weight: 600; }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 11px/1 var(--mono); padding: 3px 5px; border: 1px solid #c8cdd5; border-bottom-width: 2px; border-radius: 4px; background: #fff; color: var(--grey-ink); }
.btn-primary kbd { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 0 24px; min-height: 52px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .01em; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: 16px; }
.nav a { color: #c8cdd5; text-decoration: none; padding: 6px 8px; border-radius: 6px; }
.nav a[aria-current] { color: #fff; background: #2a2f36; }
.nav a:focus-visible, .topbar .btn:focus-visible { outline-color: #fff; }
.spacer { flex: 1 1 auto; }
.session { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; margin-left: auto; }
.topbar .who-line { color: #c8cdd5; font-size: 13px; }
.topbar .btn { height: 28px; font-size: 12px; background: transparent; color: #e6e9ed; border-color: #4a535e; }
.topbar .btn:hover { background: #2a2f36; color: #fff; }
.banner { display: flex; align-items: center; gap: 12px; padding: 8px 24px; background: var(--warn-wash); color: var(--warn); font-size: 13px; border-bottom: 1px solid var(--warn-line); }
.banner svg { flex: none; }
.page { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; flex: 1 1 auto; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 24px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
.legend kbd + kbd { margin-left: 3px; }
.row { display: flex; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip-ready, .chip-progress-soft { background: var(--accent-wash); color: var(--accent); }
.chip-progress { background: var(--accent); color: #fff; }
.chip-hold, .chip-pending, .chip-warn, .chip-open { background: var(--warn-wash); color: var(--warn); }
.chip-await, .chip-dft, .chip-super, .chip-closed { background: var(--grey-wash); color: var(--grey-ink); }
.chip-returned, .chip-qa { background: var(--plum-wash); color: var(--plum); }
.chip-ok, .chip-coder, .chip-final, .chip-answered { background: var(--ok-wash); color: var(--ok); }
.chip-risk, .chip-error, .chip-overdue { background: var(--risk-wash); color: var(--risk); }
.chip-reopen { background: var(--risk-wash); color: var(--risk); border: 1px solid var(--risk-line); }
.chip.small { height: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid #c8cdd5; background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--bg); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-primary { border-color: transparent; background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); color: #fff; filter: brightness(.95); }
/* :disabled also matches a button that a disabled fieldset turns off, which carries no attribute of its own. */
.btn[disabled], .btn:disabled, .btn[aria-disabled='true'] { background: #e9ebee; color: var(--faint); border-color: #e0e3e8; cursor: not-allowed; filter: none; }
.btn-primary[disabled], .btn-primary:disabled { background: var(--faint); color: #fff; }
.btn-ok { border-color: var(--ok); color: var(--ok); }
.btn-danger { border-color: var(--risk); color: var(--risk); }
.btn-on { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.lbl { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #c8cdd5; border-radius: 6px; background: #fff; padding: 0 10px; height: 36px; max-width: 100%; }
textarea { height: auto; padding: 10px; width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.inline { flex-direction: row; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.card-b { padding: 12px 14px; }
.scroll-x { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.queue-table td, .lead-table td { vertical-align: middle; }
.hist th, .hist td, .lead-table th, .lead-table td { padding-left: 8px; padding-right: 8px; }
.lead-table td:first-child, .hist td:first-child { white-space: nowrap; }
th.num { font-family: inherit; }
tr.focus td { background: var(--focus-wash); box-shadow: none; }
tr.focus td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.removal td { color: var(--muted); }
tr.removal .mono.code { text-decoration: line-through; }
.desc { color: var(--muted); font-size: 12px; font-family: var(--sans); font-weight: 400; }

.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.notice.error { background: var(--risk-wash); border-color: var(--risk-line); color: var(--risk); }
.notice.warn { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.notice.ok { background: var(--ok-wash); border-color: #b9dcc6; color: var(--ok); }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.filt { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid #c8cdd5; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.filt:hover { background: var(--bg); }
.filt.on { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.filt .n { font: 11px var(--mono); color: var(--muted); background: var(--grey-wash); border-radius: 999px; padding: 1px 6px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile { flex: 1 1 170px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--ink); text-decoration: none; display: block; }
a.tile:hover { background: var(--focus-wash); color: var(--ink); }
.tile .n { font-size: 28px; font-weight: 600; line-height: 1.1; margin-top: 4px; }
.tile .sub.warn { color: var(--risk); }

.patient-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.patient-strip .wide { grid-column: span 2; }
.patient-name { font-size: 16px; font-weight: 600; }
.taskbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.workspace { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px 24px 24px; flex: 1 1 auto; min-width: 0; align-items: flex-start; }
.pane { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.doc-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.note { padding: 16px 18px; overflow: auto; max-height: 720px; font-size: 14px; line-height: 1.6; }
.note p { margin: 0 0 10px; }
.note mark { background: var(--warn-wash); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--warn-line); }
.note mark.cur { background: #ffd24a; box-shadow: 0 0 0 2px var(--warn); }
.doc-find { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); }
.doc-find input { flex: 1 1 220px; max-width: 320px; height: 30px; font-size: 13px; }
.match-n { font: 11px var(--mono); color: var(--muted); background: var(--grey-wash); border-radius: 999px; padding: 1px 6px; }
.match-n.hit { color: var(--warn); background: var(--warn-wash); }
.meta-line { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.meta-line strong { color: var(--ink); }
.findings { list-style: none; margin: 0; padding: 6px 0; }
.findings li { display: flex; gap: 10px; padding: 8px 14px; align-items: flex-start; }
.findings .chip { flex: none; }
.add-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 12px; padding: 12px 14px; border-top: 1px solid var(--line-soft); align-items: start; }
.add-form .full { grid-column: 1 / -1; }
fieldset.gated { display: contents; }
.gated-why { grid-column: 1 / -1; margin: 0; }
.add-form input, .add-form select { width: 100%; }
.roles input[type='checkbox'] { width: auto; height: auto; padding: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input[type='checkbox'] { appearance: none; flex: none; position: relative; width: 38px; height: 22px; padding: 0; margin: 0; border-radius: 11px; border-color: var(--faint); background: var(--grey-wash); cursor: pointer; transition: background .12s; }
.switch input[type='checkbox']::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--faint); transition: transform .12s; }
.switch input[type='checkbox']:checked { background: var(--accent); border-color: var(--accent); }
.switch input[type='checkbox']:checked::after { transform: translateX(16px); box-shadow: none; }
.switch input[type='checkbox']:disabled { cursor: not-allowed; opacity: .6; }

.drawer-back { position: fixed; inset: 0; background: rgba(22, 25, 29, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100%; background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0, 0, 0, .12); display: flex; flex-direction: column; z-index: 21; }
.drawer-h, .drawer-f { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.drawer-h { border-bottom: 1px solid var(--line-soft); font-size: 16px; font-weight: 600; }
.drawer-f { border-top: 1px solid var(--line-soft); margin-top: auto; }
.drawer-b { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.modal { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); width: 420px; max-width: calc(100% - 32px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); z-index: 30; padding: 16px 20px; }
.modal ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.modal li { display: flex; gap: 12px; }
.modal li span:first-child { min-width: 120px; }

.q-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.q-item:hover { background: var(--focus-wash); color: var(--ink); }
.q-item.on { background: var(--focus-wash); box-shadow: inset 3px 0 0 var(--accent); }
.msg { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fff; }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.bar { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; width: 90px; }
.bar span { display: block; height: 100%; background: var(--accent); }

.signin { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.signin-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 20px; }
.who { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; width: 100%; font: inherit; color: var(--ink); }
.who:hover { background: var(--focus-wash); }
.who.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--grey-wash); color: var(--grey-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; }
.who.on .avatar { background: var(--accent-wash); color: var(--accent); }

@media (max-width: 640px) {
  .topbar, .page, .workspace, .taskbar, .patient-strip, .legend, .banner { padding-left: 16px; padding-right: 16px; }
  .nav { margin-left: 0; }
  .patient-strip .wide { grid-column: auto; }
}
