/* LIOS Care ready-made parts. Built ONLY from the tokens in theme.css; every value is the prototype's
   ("LIOS Care Portal Screens v2.html", spec §1.4). Loaded after the old stylesheets, so it wins over them.

   Part 1 — the new parts (prototype class names), for the redesigned screens.
   Part 2 — the portal's EXISTING classes mapped onto the same look, so today's pages work in both themes
            without markup changes. Part 2 goes when the old CSS goes (end of Step 3). */

/* =====================================================================================================
   PART 1 — NEW PARTS
   ===================================================================================================== */

/* Page title */
.titlerow { display: flex; min-height: 40px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.titlerow h1, h1.page-h1 { margin: 0; font-size: var(--fs-h1); line-height: 1.1; font-weight: 800; }
.titlerow .status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sub { margin: 2px 0 0; font-size: var(--fs-label); color: var(--muted); }
.hint { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.err { margin: 0; color: var(--warn); font-size: var(--fs-label); font-weight: 600; }

/* Card (Today) */
.area { background: var(--card); border: var(--b-box); border-radius: var(--r-area); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.area[data-href], a.area { cursor: pointer; }
.area .ah { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; color: var(--soft); font-weight: 700; font-size: var(--fs-row); }
.area .ah .ic { width: 32px; height: 32px; border-radius: var(--r-tile); background: var(--panel); display: inline-flex; align-items: center; justify-content: center; color: var(--soft); }
.area .ah .go { margin-left: auto; color: var(--hint); transform: rotate(-90deg); }
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px 14px; }
.hero .hl { font-size: var(--fs-small); font-weight: 700; color: var(--soft); }
.hero .hv { font-size: var(--fs-hero); font-weight: 800; line-height: 1.15; letter-spacing: -.4px; white-space: nowrap; }
.hero .hs { font-size: var(--fs-label); color: var(--muted); line-height: 1.35; margin: 2px 0 4px; }
.hero .hd { font-size: var(--fs-small); font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; }
.trow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 16px; border: 0; border-top: var(--b-box); background: transparent; text-align: left; color: var(--fg); font: inherit; line-height: normal; }
.trow:hover { background: var(--panel); }
.trow b { display: block; line-height: 1.3; }
.trow.flat { cursor: default; }
.trow.flat:hover { background: transparent; }
.trow > svg { margin-left: auto; color: var(--hint); flex: 0 0 16px; transform: rotate(-90deg); }
.tx { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tx b { font-size: var(--fs-row); font-weight: 600; }
.tx small { font-size: var(--fs-small); color: var(--muted); }
em.w { font-style: normal; color: var(--warn); font-weight: 800; }
a.trow, a.ah { text-decoration: none; }
a.trow { cursor: pointer; }

/* Today card grid + week bars (prototype "a-today" / "today": .cards, .wbars, .wax). Bars: 6 weeks, this week mint;
   hover / keyboard focus shows the value. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hero.has-bars { position: relative; padding-bottom: 28px; }
.wbars { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 60px; padding-top: 4px; margin-bottom: 18px; }
.wbars .b { position: relative; width: 14px; height: 100%; display: flex; align-items: flex-end; outline: none; }
.wbars .b i { display: block; width: 100%; background: var(--edge); border-radius: 3px 3px 1px 1px; min-height: 3px; }
.wbars .b.now i { background: var(--accent); }
.wbars .b em { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-style: normal; font-size: var(--fs-tag); font-weight: 700; padding: 4px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 3; }
.wbars .b em small { display: block; font-weight: 600; opacity: .75; font-size: 11px; }
.wbars .b:hover em, .wbars .b:focus-visible em { opacity: 1; }
.wbars .b:focus-visible i { outline: 2px solid var(--accent); outline-offset: 2px; }
.wbars .b:nth-child(n+4) em { left: auto; right: -4px; transform: none; }
.wax { position: absolute; left: 0; right: 0; top: calc(100% + 4px); display: flex; justify-content: space-between; font-size: 11px; color: var(--hint); white-space: nowrap; pointer-events: none; }

/* Panel (detail / generic box) */
.panel { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); padding: var(--pad-panel); display: flex; flex-direction: column; gap: var(--gap-panel); min-width: 0; }
.panel h3 { margin: 0; font-size: var(--fs-panel-h3); display: flex; justify-content: space-between; }
.panel h3 small { font-size: var(--fs-row); color: var(--soft); }
.panel.blank { min-height: 300px; justify-content: center; text-align: center; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: var(--fs-label); }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.note { background: var(--panel); border-radius: var(--r-search); padding: 12px 14px; }
.note b { font-size: var(--fs-small); color: var(--muted); }
.note p { margin: 4px 0 0; font-size: var(--fs-row); line-height: 1.45; }
.erow { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-label); padding: 8px 0; border-top: var(--b-box); }
.erow span { color: var(--soft); }
.erow.tot { border-top: var(--b-control); font-weight: 700; }
/* Popup explanation lines under a row (e.g. why a request was missed), as in the prototype. */
.pnote { margin: 4px 0 10px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.pact { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap-tiles); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .l { font-size: var(--fs-small); color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-size: var(--fs-tile); font-weight: 800; line-height: 1.15; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { font-size: var(--fs-small); color: var(--muted); }

/* Buttons */
.btn { border: 0; border-radius: var(--r-pill); min-height: 42px; font-family: inherit; font-weight: 700; font-size: var(--fs-row); line-height: 1.2; padding: 8px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border: var(--b-control); color: var(--fg); font-weight: 600; }
.btn.sm { min-height: 34px; padding: 4px 14px; font-size: var(--fs-small); }
.btn.wide { width: 100%; }
.btn.danger, .linkbtn.danger { color: var(--warn); }
.btn.ghost.danger { border-color: var(--warn); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.linkbtn { background: transparent; border: 0; color: var(--accent); font-family: inherit; font-weight: 700; font-size: var(--fs-label); padding: 0; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.lnk { color: var(--accent); font-weight: 700; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: var(--b-control); background: transparent; color: var(--soft); display: inline-flex; align-items: center; justify-content: center; position: relative; flex: 0 0 42px; padding: 0; cursor: pointer; }
.iconbtn:hover { color: var(--fg); border-color: var(--hover); }

/* Tabs — the portal's one pill switcher */
.tabs { display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; border: var(--b-control); border-radius: var(--r-pill); background: var(--bg); max-width: max-content; }
.tabs > button, .tabs > a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; font-family: inherit; font-size: var(--fs-row); font-weight: 600; color: var(--muted); border-radius: var(--r-pill); min-height: 40px; white-space: nowrap; border: 0; background: transparent; cursor: pointer; text-decoration: none; }
.tabs > button:hover, .tabs > a:hover { color: var(--fg); }
.tabs > .on, .tabs > [aria-pressed="true"], .tabs > [aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.tabs > .on:hover, .tabs > [aria-pressed="true"]:hover, .tabs > [aria-current="page"]:hover { color: var(--on-accent); }

/* Count badge */
.n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--warn); color: var(--on-accent); font-size: var(--fs-tag); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.n.live { background: var(--accent); }
.tabs .n { margin-left: 2px; }
.tabs > .on .n, .tabs > [aria-pressed="true"] .n, .tabs > [aria-current="page"] .n { background: var(--on-accent); color: var(--accent); }

/* Tag / status badge */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-tag); font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); border: var(--b-control); color: var(--soft); white-space: nowrap; }
.tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.ok { border-color: var(--accent); color: var(--accent); }

/* Chip */
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-small); font-weight: 700; padding: 5px 12px; border-radius: var(--r-pill); background: var(--panel); border: var(--b-box); color: var(--soft); white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chip.ok { color: var(--accent); }
.chip.sm { font-size: var(--fs-tag); padding: 3px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { border: var(--b-control); background: transparent; border-radius: var(--r-pill); padding: 7px 14px; font-family: inherit; font-size: var(--fs-label); font-weight: 600; color: var(--soft); cursor: pointer; }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--fg); }

/* Rows (list) */
.rows { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); overflow: hidden; }
.orow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px; border: 0; border-top: var(--b-box); background: transparent; color: var(--fg); text-align: left; font-family: inherit; }
.rows > .orow:first-child, .day + .orow, .rows > .trow:first-child { border-top: 0; }
button.orow, a.orow { cursor: pointer; }
button.orow:hover, a.orow:hover { background: var(--panel); }
.orow.sel { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.orow.dim { opacity: .5; }
.orow .rt { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; text-align: right; }
.orow .rt b { font-size: var(--fs-row); font-weight: 700; font-variant-numeric: tabular-nums; }
.day { padding: 10px 16px 4px; font-size: var(--fs-tag); font-weight: 800; letter-spacing: 2px; color: var(--hint); border-top: var(--b-box); }
.rows > .day:first-child { border-top: 0; }
.av { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: var(--b-control); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-small); color: var(--soft); }
.av.big { width: 46px; height: 46px; flex-basis: 46px; }
.num { width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--r-tile); background: var(--panel); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-small); color: var(--soft); }

/* Split page: list + 380px detail (Support Providers; spec §2.1 "Split layouts", prototype .split/.listcol/.detailcol) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.split .listcol { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.split .detailcol { position: sticky; top: 76px; min-width: 0; }
.split .detailcol .panel { scroll-margin-top: 84px; }
/* A list row that is a link + a tick box for bulk delete (kept on Support Providers, Varsha 27 Nov). */
.orow.pickrow { padding: 0 0 0 16px; gap: 0; }
.orow.pickrow > input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--accent); margin: 0 4px 0 0; }
.orow.pickrow > a { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; min-height: 64px; padding: 10px 16px 10px 10px; color: inherit; text-decoration: none; }
.orow.pickrow:hover { background: var(--panel); }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 34px; }
/* Detail panel parts (spec §1.4) */
.dhead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dhead b { display: block; font-size: var(--fs-panel-h3); overflow-wrap: anywhere; }
.dhead small { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.dl dd { overflow-wrap: anywhere; }
.up { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--edge); border-radius: var(--r-input); padding: 12px 14px; color: var(--fg); }
.up.done { border-style: solid; border-color: var(--accent); }
a.up { border-style: solid; border-color: var(--accent); text-decoration: none; }
a.up .lnk { margin-left: auto; color: var(--accent); font-weight: 700; font-size: var(--fs-label); }
.up > div { min-width: 0; } .up small { overflow-wrap: anywhere; }
.up > svg { flex: 0 0 20px; color: var(--muted); }
.up div { display: flex; flex-direction: column; }
.up small { color: var(--muted); font-size: var(--fs-small); }
.up > :last-child:not(div) { margin-left: auto; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-label); }
.checks li { display: flex; gap: 8px; align-items: center; color: var(--soft); }
.checks li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; flex: none; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm3.7 5.7l-4.5 4.5a1 1 0 01-1.4 0L4.3 8.7a1 1 0 011.4-1.4l.8.8 3.8-3.8a1 1 0 011.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm3.7 5.7l-4.5 4.5a1 1 0 01-1.4 0L4.3 8.7a1 1 0 011.4-1.4l.8.8 3.8-3.8a1 1 0 011.4 1.4z'/%3E%3C/svg%3E") center/contain no-repeat; }
.checks li.opt::before { background: var(--hint); }
.panel form.inline { display: contents; }
/* Reject / Deactivate reason step: same spacing as the rest of the panel (hint, box, buttons). */
.panel [data-step="2"] { display: flex; flex-direction: column; gap: var(--gap-panel); }
.panel [data-step][hidden] { display: none; }
.panel .linkbtn { align-self: flex-start; min-height: 40px; text-decoration: none; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .split .detailcol { position: static; } }

/* Payouts (redesign 2.3; prototype .split2 / .bulk / .panel h3) */
.paypage { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.monthbar { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; min-width: 0; }
.monthbar .tabs > [hidden] { display: none; }
/* All months open: the row wraps on a computer, and swipes sideways on a phone (Varsha, 30 Nov). */
.monthbar .tabs { flex-wrap: wrap; max-width: 100%; border-radius: 26px; }
@media (max-width: 640px) { .monthbar .tabs { flex-wrap: nowrap; overflow-x: auto; border-radius: var(--r-pill); } }
.monthbar .linkbtn { min-height: 40px; white-space: nowrap; }
.split2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.split2 .panel { scroll-margin-top: 84px; }
.bulk { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: var(--b-box); font-size: var(--fs-label); flex-wrap: wrap; }
.bulk + .orow { border-top: 0; }
.orow .rt .tag { min-width: 96px; justify-content: center; }
.dialog .pact { margin-top: 4px; }
@media (max-width: 1100px) { .split2 { grid-template-columns: 1fr; } }

/* Admins (redesign 2.4; prototype .content.narrow / .addform / .arow) */
.app .content.narrow { max-width: 760px; }
.addform { margin-bottom: 32px; }
.addform[hidden] { display: none; }
.arow { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; min-height: 64px; padding: 8px 16px; border-top: var(--b-box); color: var(--fg); }
.rows > .arow:first-child, .rows > .listbar + .arow { border-top: 0; }
.arow > input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.arow .tx { display: flex; flex-direction: column; min-width: 0; }
.arow .tx b, .arow .tx small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow small, .arow .mid { color: var(--muted); font-size: var(--fs-small); }
.arow .you { color: var(--hint); font-size: var(--fs-small); font-weight: 700; }
.arow .acts { display: flex; gap: 16px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.arow .acts form { display: contents; }
.rows > .listbar { padding: 10px 16px; border-bottom: var(--b-box); }
@media (max-width: 640px) { .arow { grid-template-columns: auto auto minmax(0, 1fr) auto; } .arow .mid { display: none; } }

/* Account (redesign 2.6; prototype .ghead / .prow on a-account) */
.acct { display: flex; flex-direction: column; gap: 18px; }
.acct .ghead { display: flex; align-items: center; gap: 10px; padding: 0 4px; margin-top: 6px; }
.acct .ghead b { font-size: var(--fs-row); font-weight: 700; color: var(--soft); }
.acct .prow { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 56px; padding: 8px 16px; border-top: var(--b-box); font-size: var(--fs-label); }
.acct .rows > .prow:first-child { border-top: 0; }
.acct .prow > span:first-child { color: var(--muted); }
.acct .prow b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct .prow form { display: contents; }
.acct .prow .hint { font-size: var(--fs-small); color: var(--hint); }
.dialog .fld + .fld { margin-top: 2px; }
.dialog .err { margin: 0; color: var(--warn); font-size: var(--fs-small); }
@media (max-width: 640px) { .acct .prow { grid-template-columns: 1fr auto; } .acct .prow > span:first-child { grid-column: 1 / -1; } }
/* Provider Account (redesign 3.4; prototype "account"): preview card, pill pickers, hours popup */
.acct .ghead small { margin-left: auto; color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
.acct .who { display: flex; gap: 18px; align-items: flex-start; padding: 20px; background: var(--card); border: var(--b-box); border-radius: var(--r-panel); }
.acct .who .av.big { width: 56px; height: 56px; flex-basis: 56px; font-size: var(--fs-row); }
.acct .whotx { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.acct .whotx b { font-size: var(--fs-row); font-weight: 700; }
.acct .whotx small { color: var(--muted); font-size: var(--fs-label); }
.acct .whotx p { margin: 4px 0 0; color: var(--soft); font-size: var(--fs-label); line-height: 1.5; overflow-wrap: anywhere; }
.picks { display: flex; flex-wrap: wrap; gap: 10px; }
.picks > label, .picks.static > span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border-radius: var(--r-pill); border: var(--b-control); color: var(--soft); font-weight: 600; font-size: var(--fs-label); cursor: pointer; user-select: none; }
.picks > label > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.picks > label:has(input:checked), .picks.static > span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--fg); }
.picks > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.picks.static { margin-top: 6px; }
.picks.static > span { cursor: default; min-height: 40px; }
.picks.days > label { padding: 8px 14px; min-width: 64px; justify-content: center; }
.dialog .radios { display: flex; flex-direction: column; gap: 10px; }
.dialog .radios label { display: flex; align-items: center; gap: 12px; color: var(--soft); font-size: var(--fs-label); cursor: pointer; }
.dialog .radios input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.dialog .hoursbox { display: flex; flex-direction: column; gap: 12px; }
.dialog .hoursbox[hidden] { display: none; }
.dialog .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .acct .who { padding: 16px; } }

/* Provider Requests (redesign 3.2) */
.runbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: var(--r-panel); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--fg); text-decoration: none; font-size: var(--fs-label); flex-wrap: wrap; }
.runbar:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.split .listcol .titlerow { justify-content: space-between; }
.rows > .emp.pad + .orow { border-top: 0; }
.rows > .yearbar { margin: 12px 16px; }
.rows > .yearbar[hidden] + .orow { border-top: 0; }
.yearbar[hidden] { display: none; }
.panel > .monall { padding: 10px 0 0; min-height: 40px; border-top: var(--b-box); width: 100%; justify-content: flex-start; border-radius: 0; }
.rows > .monall { padding: 12px 16px; min-height: 44px; border-top: var(--b-box); width: 100%; justify-content: flex-start; }
.panel .reply { display: flex; flex-direction: column; gap: var(--gap-panel); }
.panel .reply textarea { min-height: 140px; resize: vertical; }
.panel form.inline .btn[disabled] { cursor: not-allowed; }

/* Table — same look as the rows */
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-label); color: var(--fg); }
.dtable th { text-align: left; padding: 10px 16px; color: var(--hint); font-weight: 700; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.dtable td { text-align: left; padding: 12px 16px; border-top: var(--b-box); vertical-align: middle; }
.dtable tbody tr:hover { background: var(--panel); }
.dtable small { display: block; font-size: var(--fs-small); color: var(--muted); }

/* Form field */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-label); font-weight: 700; color: var(--soft); }
.fld small { font-weight: 500; color: var(--muted); font-size: var(--fs-small); }
.fld em { font-style: normal; font-weight: 500; color: var(--hint); }
.fld input, .fld textarea, .fld select { font: inherit; font-size: var(--fs-row); color: var(--fg); background: var(--field, var(--bg)); border: var(--b-control); border-radius: var(--r-input); padding: 10px 14px; resize: none; outline: none; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--accent); }
.fld input::placeholder, .fld textarea::placeholder { color: var(--hint); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-label); color: var(--soft); line-height: 1.4; }
.check input { accent-color: var(--accent); margin-top: 2px; width: 18px; height: 18px; }
.srch { display: flex; align-items: center; gap: 10px; border: var(--b-control); border-radius: var(--r-search); padding: 0 14px; height: 44px; color: var(--muted); background: var(--card); }
.srch input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: var(--fs-label); outline: 0; padding: 0; height: 100%; box-shadow: none; }

/* Empty state */
.emp { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 40px 20px; color: var(--muted); }
.emp b { font-size: var(--fs-empty); color: var(--fg); }
.emp.pad { padding: 28px 18px; gap: 4px; }
.emp.pad span { color: var(--muted); font-size: var(--fs-label); }

/* Popup */
.overlay { position: fixed; inset: 0; z-index: 80; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease both; }
.dialog { background: var(--card); border: var(--b-box); border-radius: var(--r-dialog); padding: 24px; width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; display: flex; flex-direction: column; gap: 12px; color: var(--fg); animation: rise .3s cubic-bezier(.2, .7, .2, 1) both; }
.dialog.wide { width: min(560px, 100%); }
.dialog h3 { margin: 0; font-size: var(--fs-dialog-h3); }
.dialog .sub { margin: 0; color: var(--muted); font-size: var(--fs-label); line-height: 1.45; }

/* Toast (built centred; the prototype's stray translate is not copied) */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-label); }


@media (max-width: 860px) {
    .toast { bottom: 90px; }
}
@media (max-width: 900px) {
    .cards { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .tiles.three { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .tabs { max-width: 100%; overflow-x: auto; }
}
@media (max-width: 560px) {
    .titlerow h1, h1.page-h1 { font-size: var(--fs-h1-sm); }
    .titlerow .status { flex: 1 1 100%; justify-content: flex-start; }
    /* The hero number stays 30px on phones: the prototype's later ".hero .hv{font-size:30px}" wins over its 26px phone rule. */
    .wbars { gap: 4px; }
    .wbars .b { width: 11px; }
    .wax span:first-child { display: none; }
    .tile { padding: 12px 14px 10px; }
    .tile .v { font-size: var(--fs-tile-sm); }
    .tabs > button, .tabs > a { padding: 7px 10px; font-size: var(--fs-label); gap: 6px; }
}
@media (max-width: 360px) {
    .tabs > button, .tabs > a { gap: 5px; }
    .tabs > button > svg, .tabs > a > svg, .tabs > a > i { display: none; }
}

/* =====================================================================================================
   SHELL — sidebar, top bar, menus, phone bar (prototype spec §2; exact prototype values)
   Selectors carry .app so they beat the old site.css (.main margin, .brand, .avatar).
   ===================================================================================================== */
[hidden] { display: none !important; }
.lios-logo { display: inline-block; flex: 0 0 auto; vertical-align: middle; background: currentColor;
    -webkit-mask: url("../logo/lios-logo.png") left center / contain no-repeat; mask: url("../logo/lios-logo.png") left center / contain no-repeat; }
@media (forced-colors: active) { .lios-logo { forced-color-adjust: none; background: CanvasText; } }
.lios-logo-side { width: 100px; height: 26px; }
.lios-logo-top { width: 85px; height: 22px; }
.lios-logo-gate { width: 110px; height: 29px; }

.app { display: flex; min-height: 100vh; }
.app a { text-decoration: none; }
.app .side { flex: 0 0 240px; border-right: 1px solid var(--rail); padding-block: 18px 24px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: 14px; display: flex; flex-direction: column; gap: 18px; }
.app .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-left: 8px; color: var(--fg); }
.app .brand .bl { display: flex; align-items: center; gap: 10px; }
.app .brand .bsub { font-size: 11px; font-weight: 700; letter-spacing: 3px; color: var(--muted); padding-left: 4px; margin-top: 2px; }
/* Logo = the theme's main text colour, like the prototype: white on dark, #1C1B2B on light (never the link colour). */
.app a.brand, .app a.brand:visited, .app a.brand:hover, .app .top .mb a, .app .top .mb a:visited { color: var(--fg); }
.lios-logo-side, .lios-logo-top, .lios-logo-gate { background: var(--fg); }
.app .nav { display: flex; flex-direction: column; gap: 1px; }
.app .nav a { display: flex; align-items: center; gap: 12px; padding: 7px 12px; border-radius: var(--r-pill); font-size: 15px; color: var(--soft); min-height: 38px; white-space: nowrap; font-weight: 400; }
.app .nav a:hover { background: var(--panel); color: var(--fg); }
.app .nav a[aria-current="page"] { background: var(--card); color: var(--fg); font-weight: 700; }
.app .nav svg { flex: 0 0 18px; color: var(--muted); }
.app .nav a[aria-current="page"] svg { color: var(--accent); }
.app .nav .n { margin-left: auto; }
.app > .main { flex: 1 1 auto; min-width: 0; margin-left: 0; display: flex; flex-direction: column; }
.app .top { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 72px; padding-block: 0; padding-left: 24px; padding-right: max(24px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--rail); }
.app .top .mb { display: none; margin-right: auto; color: var(--fg); }
.app .top .mb a { color: inherit; display: inline-flex; }
.app .top .spacer { flex: 1; }
.app .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }

/* Available switch (provider) */
.availf { margin: 0 auto 0 0; display: inline-flex; }
.avail { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: var(--r-pill); min-height: 42px; padding: 0 6px; font-family: inherit; font-weight: 700; font-size: 14px; color: var(--soft); cursor: pointer; }
.avail.on { color: var(--fg); }
.avail .sw { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--edge); transition: background .15s; flex: none; }
.avail .sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); box-shadow: var(--sh-knob); transition: left .15s; }
.avail.on .sw { background: var(--accent); }
.avail.on .sw i { left: 19px; }
.avail .lb { min-width: 62px; text-align: left; }
.avail:not(.on) .lb { color: var(--muted); }
@media (max-width: 900px) { .availf { margin-right: 0; } }
/* Phone: the prototype's provider top bar is wider than a 390px screen (its avatar is cut off). Here the switch keeps
   its knob and aria-label and drops the word, so nothing scrolls sideways. */
@media (max-width: 430px) { .avail .lb { display: none; } .avail { padding: 0 2px; } }

/* Bell + account menu */
.kbell, .kme { position: relative; }
.kbell .kn { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--warn); color: #1C1B2B; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.kmebtn { display: flex; align-items: center; gap: 6px; background: transparent; border: 0; padding: 0; border-radius: 999px; min-height: 44px; font-family: inherit; color: var(--fg); cursor: pointer; }
.kmebtn:hover { background: var(--row); }
.kmebtn .chev { color: var(--muted); transition: transform .2s; }
.kmebtn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.kpop { position: absolute; right: 0; top: 52px; z-index: 40; min-width: 300px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: var(--sh-pop); display: flex; flex-direction: column; gap: 2px; }
.kpop a, .kpop button.kmi { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 0; background: transparent; color: var(--soft); font-size: 14px; font-weight: 600; text-align: left; min-height: 42px; width: 100%; font-family: inherit; cursor: pointer; text-decoration: none; }
.kpop a:hover, .kpop button.kmi:hover { background: var(--panel); color: var(--fg); }
.kpop svg { color: var(--muted); flex: 0 0 18px; }
.kpop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.kpop .khead { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpop .khead b { display: block; font-size: 14px; color: var(--fg); }
.kpop .khead .kl { display: block; font-size: 13px; color: var(--muted); }
.knot { width: 360px; max-width: calc(100vw - 32px); }
.knot .ktop { padding: 8px 12px 6px; font-size: 15px; color: var(--fg); }
.knot .krow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; min-height: 0; }
.knot .krow b { display: block; max-width: 100%; font-size: 14px; font-weight: 700; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knot .krow span { display: block; max-width: 100%; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knot .krow.new b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 2px; }
.knot .krow:hover { background: var(--row); }
.knot .kempty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .kpop { position: fixed; left: 16px; right: 16px; top: 72px; min-width: 0; } .knot { width: auto; } }

/* Content */
.app .content { width: 100%; max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 40px; align-items: start; padding-block: 32px 120px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.app .content > .pagebody { min-width: 0; }
.app .titlerow h1 { margin: 0; color: var(--fg); letter-spacing: 0; }

/* Phone bottom bar */
.mnav { display: none; }
@media (max-width: 860px) {
    .app .side { display: none; }
    .app .top { justify-content: space-between; }
    .app .top .mb { display: flex; align-items: center; gap: 8px; }
    .mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; }
    .mnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; position: relative; padding: 4px 0; }
    .mnav a[aria-current] { color: var(--accent); }
    .mnav .n { position: absolute; top: -2px; left: calc(50% + 6px); font-size: 10px; font-weight: 800; background: var(--warn); color: var(--on-accent); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
    .app > .main { padding-bottom: 80px; }
    #toast-container { bottom: 90px; }
}
@media (max-width: 560px) {
    .app .top { gap: 8px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
    .app .content { padding-block: 20px 120px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
}

/* =====================================================================================================
   GATE — sign-in pages (_AuthLayout): logo centred above one card (prototype spec §3.1–3.4)
   ===================================================================================================== */
/* Sign-in pages: card centred horizontally AND vertically (Varsha 27 Nov; the prototype is top-aligned). */
.gate { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; align-items: center; padding: 48px 20px; background: var(--bg); color: var(--fg); }
/* Browser auto-fill paints fields blue/yellow: keep the theme's field colour and text colour. */
.gate .fld input:-webkit-autofill, .gate .fld input:-webkit-autofill:hover, .gate .fld input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg); caret-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px var(--field, var(--bg)) inset; box-shadow: 0 0 0 1000px var(--field, var(--bg)) inset;
  transition: background-color 9999s ease-out 0s;
}
.gcol { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; }
.gcol.wide { max-width: 560px; }
.glogo { color: var(--fg); align-self: center; }
.gcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-gate); padding: 28px; display: flex; flex-direction: column; gap: 18px; color: var(--fg); }
.gcard form, .gcard .gpane { display: flex; flex-direction: column; gap: 18px; margin: 0; }
.gcard h1 { margin: 0; font-size: var(--fs-gate-h1); font-weight: 800; line-height: 1.1; color: var(--fg); letter-spacing: 0; }
.gcard .sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.gate .validation-summary-valid { display: none; }
/* RecoverKey switches its two cards with style.display = "block" (unchanged script): keep the card a flex column. */
form.gcard[style*="block"] { display: flex !important; }
.gstep { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .4px; color: var(--accent); margin-bottom: 6px; }
.gfoot { text-align: center; color: var(--muted); margin: 0; font-size: 15px; }
.glinks { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.gate .lnk, .gate .lnk:visited { color: var(--accent); font-weight: 700; font-size: 15px; text-decoration: none; }
.gate .lnk:hover { text-decoration: underline; }
.gate .fld { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--soft); margin: 0; }
.gate .fld small { font-weight: 500; color: var(--muted); font-size: 13px; }
.gate .fld input { width: 100%; margin: 0; font: inherit; font-size: 15px; color: var(--fg); background: var(--field, var(--bg)); border: var(--b-control); border-radius: var(--r-input); padding: 10px 14px; outline: none; box-shadow: none; min-height: 0; }
.gate .fld input:focus { border-color: var(--accent); box-shadow: none; }
.gate .fld input:disabled { opacity: .6; cursor: not-allowed; }
.gate .btn { margin: 0; }
.gate .btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.gate .btn.ghost { background: transparent; color: var(--fg); border: var(--b-control); }
.gate .btn:disabled { opacity: .45; cursor: not-allowed; }
.gact { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.gate .err, .gate .validation-summary-errors { color: var(--warn); font-size: 14px; font-weight: 600; margin: 0; background: transparent; border: 0; padding: 0; }
.gate .validation-summary-errors ul { margin: 0; padding: 0; list-style: none; }
.gate .ok { color: var(--accent); font-size: 14px; font-weight: 600; margin: 0; }
.gate .warnbox { background: var(--panel); border: 1.5px solid var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; color: var(--fg); }
.qr { width: 150px; height: 150px; margin: 4px auto 6px; border-radius: 12px; background: #fff; border: 10px solid #fff; display: block; }
.qr img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.gkey { margin: -8px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.gkey code { display: block; margin-top: 4px; color: var(--fg); font-size: 13px; letter-spacing: .5px; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code, .codes span { font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; text-align: center; letter-spacing: .5px; color: var(--fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.gate .check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--soft); line-height: 1.4; font-weight: 400; }
.gate .check input { accent-color: var(--accent); margin-top: 2px; width: 18px; height: 18px; flex: none; }
.dc-spin { display: inline-block; animation: dcspin 1s linear infinite; }
@keyframes dcspin { to { transform: rotate(360deg); } }

/* =====================================================================================================
   PART 2 — EXISTING PORTAL CLASSES → NEW LOOK (remove with the old CSS at the end of Step 3)
   ===================================================================================================== */

/* Old token names used by site.css / layout-enhancements.css / ui-components.css */
:root {
    --blue: var(--accent);
    --blue2: var(--accent);
    --surface: var(--card);
    --ink: var(--fg);
    --green: var(--accent);
    --amber: var(--warn);
    --red: var(--warn);
    --violet: var(--soft);
    --shadow: none;
    --radius: var(--r-panel);
    --border: var(--line);
}

body { color: var(--fg); }
a { color: var(--accent); text-decoration: none; }
label { color: var(--soft); font-size: var(--fs-label); font-weight: 700; }
.muted { color: var(--muted); }
.clean { color: var(--soft); }
[style*="color:#64748b"] { color: var(--muted) !important; }
[style*="color:#334155"] { color: var(--soft) !important; }
[style*="color:#dc2626"], [style*="color:#b91c1c"] { color: var(--warn) !important; }

/* --- Cards --- */
.card, .card-modern, .job-card, .notice, .skeleton-card { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); box-shadow: none; color: var(--fg); }
.card, .card-modern { padding: 16px 18px; }
.card h2, .card-modern h3, .notice h3 { margin: 0 0 12px; font-size: var(--fs-panel-h3); font-weight: 700; color: var(--fg); }
.card p, .card-modern p, .notice p { color: var(--muted); font-size: var(--fs-label); }
.card-modern:hover { box-shadow: none; }
.notice.unread { border-left: 3px solid var(--accent); }
.job-card .job-top .expires, .expires { color: var(--muted); }
.job-card p { color: var(--soft); }
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--row) 50%, var(--panel) 75%); background-size: 200% 100%; }

/* --- Metric cards (_Metrics) → tiles --- */
.metric-grid { gap: var(--gap-tiles); }
.metric { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); padding: 16px 18px 14px; gap: 12px; box-shadow: none; align-items: flex-start; }
.metric:hover { box-shadow: none; transform: none; }
.metric span { font-size: var(--fs-small); color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.metric strong { font-size: var(--fs-tile); font-weight: 800; line-height: 1.15; letter-spacing: -.3px; color: var(--fg); margin: 0; }
.metric small { font-size: var(--fs-small); color: var(--muted); }
.metric .metric-icon,
.metric.primary .metric-icon, .metric.neutral .metric-icon, .metric.violet .metric-icon { width: 32px; height: 32px; border-radius: var(--r-tile); background: var(--panel); color: var(--soft); font-size: 16px; }
.metric.positive .metric-icon, .metric.green .metric-icon { background: var(--panel); color: var(--accent); }
.metric.warning .metric-icon, .metric.amber .metric-icon, .metric.negative .metric-icon { background: var(--panel); color: var(--warn); }

/* --- Buttons --- */
.btn { transition: none; }
.btn-primary, .btn-modern-primary, .btn.btn-modern.btn-modern-primary { background: var(--accent); color: var(--on-accent); border: 0; }
.btn-primary:hover, .btn-modern-primary:hover { background: var(--accent); color: var(--on-accent); box-shadow: none; filter: brightness(1.05); }
.btn-ghost, .btn-outline, .btn-light, .btn-secondary, .btn-modern-secondary, .btn-modern-ghost { background: transparent; border: var(--b-control); color: var(--fg); font-weight: 600; }
.btn-ghost:hover, .btn-outline:hover, .btn-light:hover, .btn-secondary:hover, .btn-modern-secondary:hover, .btn-modern-ghost:hover { background: transparent; color: var(--fg); border-color: var(--hover); }
.btn-danger { background: transparent; border: 1.5px solid var(--warn); color: var(--warn); font-weight: 600; }
.btn-danger:hover { background: transparent; color: var(--warn); box-shadow: none; }
.btn-modern { border-radius: var(--r-pill); min-height: 42px; padding: 8px 20px; font-size: var(--fs-row); font-weight: 700; transition: none; }
.btn-sm, .btn.btn-sm { min-height: 34px; padding: 4px 14px; font-size: var(--fs-small); border-radius: var(--r-pill); }
.link { color: var(--accent); font-weight: 700; font-size: var(--fs-label); font-family: inherit; }
.link.danger { color: var(--warn); }
.bulk-delete { background: transparent; border: 1.5px solid var(--warn); color: var(--warn); border-radius: var(--r-pill); min-height: 34px; padding: 4px 14px; font-size: var(--fs-small); font-weight: 700; }
.bulk-delete:hover:not(:disabled) { background: transparent; border-color: var(--warn); }
.bulk-delete:disabled { border-color: var(--warn); color: var(--warn); opacity: .45; }
.bulk-count { color: var(--muted); }
.check-col input { accent-color: var(--accent); }

/* --- Popups: every .modal, incl. #confirmModal / #logoutModal (their ID-scoped <style> in _Layout is
       beaten with :root #id, so the old block can stay until Step 3 cleanup) --- */
.modal, :root #logoutModal.modal, :root #confirmModal.modal { background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 20px; }
.modal-content, :root #logoutModal .modal-content, :root #confirmModal .modal-content { background: var(--card); border: var(--b-box); border-radius: var(--r-dialog); padding: 24px; width: min(480px, 100%); max-width: 480px; max-height: calc(100vh - 40px); overflow: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: none; color: var(--fg); animation: rise .3s cubic-bezier(.2, .7, .2, 1) both; }
.modal-header, :root #logoutModal .modal-header, :root #confirmModal .modal-header { padding: 0; border: 0; gap: 12px; }
.modal-header h3, :root #logoutModal .modal-header h3, :root #confirmModal .modal-header h3 { margin: 0; font-size: var(--fs-dialog-h3); font-weight: 700; color: var(--fg); }
.modal-close, :root #logoutModal .modal-close, :root #confirmModal .modal-close { width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border-radius: 50%; border: var(--b-box); background: transparent; color: var(--muted); font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.modal-close:hover, :root #logoutModal .modal-close:hover, :root #confirmModal .modal-close:hover { background: transparent; color: var(--fg); border-color: var(--edge); }
.modal-body, :root #logoutModal .modal-body, :root #confirmModal .modal-body { padding: 0; color: var(--muted); font-size: var(--fs-label); line-height: 1.45; }
.modal-body p { margin: 0; color: var(--muted); line-height: 1.45; }
.modal-body label { font-size: var(--fs-label); font-weight: 700; color: var(--soft); }
.modal-body small { color: var(--warn); font-size: var(--fs-label); font-weight: 600; margin-top: 6px; }
:root #confirmCode, :root #confirmReason { border: var(--b-control) !important; border-radius: var(--r-input) !important; padding: 10px 14px !important; font-size: var(--fs-row) !important; }
.modal-footer, :root #logoutModal .modal-footer, :root #confirmModal .modal-footer { padding: 0; border: 0; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
:root .modal-footer .btn-secondary, :root #logoutModal .btn-secondary, :root #confirmModal .btn-secondary { background: transparent; border: var(--b-control); color: var(--fg); padding: 8px 20px; border-radius: var(--r-pill); font-weight: 600; }
:root .modal-footer .btn-secondary:hover, :root #logoutModal .btn-secondary:hover, :root #confirmModal .btn-secondary:hover { background: transparent; border-color: var(--hover); }
:root .modal-footer .btn-danger, :root #logoutModal .btn-danger, :root #confirmModal .btn-danger { background: var(--accent); border: 0; color: var(--on-accent); padding: 8px 20px; border-radius: var(--r-pill); font-weight: 700; }
:root .modal-footer .btn-danger:hover, :root #logoutModal .btn-danger:hover, :root #confirmModal .btn-danger:hover { background: var(--accent); filter: brightness(1.05); }

/* --- Toasts (#toast-container, js/ui-components.js) → one centred pill at the bottom --- */
#toast-container { top: auto; right: auto; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); align-items: center; z-index: 10001; pointer-events: none; }
#toast-container .toast { position: static; transform: none; display: flex; align-items: center; gap: 10px; background: var(--fg); color: var(--bg); border: 0; border-radius: var(--r-pill); padding: 10px 18px; box-shadow: none; font-size: var(--fs-label); font-weight: 700; animation: rise .3s ease both; }
#toast-container .toast.hiding { animation: fade .3s ease reverse forwards; }
#toast-container .toast-icon { display: none; }
#toast-container .toast-content { color: inherit; font-size: var(--fs-label); }
#toast-container .toast-content strong { display: inline; color: inherit; font-weight: 800; margin: 0 6px 0 0; }
#toast-container .toast-close { color: inherit; opacity: .6; font-size: 18px; }
#toast-container .toast-close:hover { color: inherit; opacity: 1; }
@media (max-width: 860px) { #toast-container { bottom: 90px; } }

/* --- Alerts / validation --- */
.alert { background: var(--panel); border: 0; border-radius: var(--r-search); padding: 12px 14px; color: var(--soft); font-size: var(--fs-label); }
.alert-success { background: var(--panel); color: var(--fg); }
.alert-success i { color: var(--accent); }
.alert-danger, .alert-warning { color: var(--warn); }
.validation, .text-danger, .field-validation-error, .validation-summary-errors { color: var(--warn); font-size: var(--fs-label); font-weight: 600; }
.validation.validation-summary-errors { background: transparent; border: 0; padding: 0; color: var(--warn); }

/* --- Form fields (inputs, selects, textareas) --- */
input:where(:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], [type="range"], [type="submit"], [type="button"], [type="color"])),
select, textarea,
.form-control, .input, .input-sm,
.form-modern input, .form-modern select, .form-modern textarea,
.login-card input[type="text"], .login-card input[type="password"], .login-card input[type="email"],
.chat-composer textarea {
    font-family: inherit; font-size: var(--fs-row); font-weight: 700; color: var(--fg); background: var(--field, var(--bg));
    border: var(--b-control); border-radius: var(--r-input); padding: 10px 14px; box-shadow: none;
}
input:where(:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], [type="range"], [type="submit"], [type="button"], [type="color"])):focus,
select:focus, textarea:focus,
.form-control:focus, .input-sm:focus,
.form-modern input:focus, .form-modern select:focus, .form-modern textarea:focus,
.login-card input:focus {
    outline: none; border-color: var(--accent); box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--hint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.form-label, .form-modern label { color: var(--soft); font-size: var(--fs-label); font-weight: 700; }
.input-sm { padding: 6px 12px; font-size: var(--fs-small); }
.topic-choices { border: var(--b-box); }
.topic-choices legend { color: var(--soft); }
.pw-eye { color: var(--muted); }
.pw-eye:hover { color: var(--fg); }
.pw-eye:focus-visible { outline: 3px solid var(--accent); }

/* --- Status filter (.status-tabs) → pill switcher --- */
.status-tabs { display: inline-flex; flex-wrap: nowrap; gap: 4px; padding: 4px; border: var(--b-control); border-radius: var(--r-pill); background: var(--bg); max-width: max-content; }
.status-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; font-size: var(--fs-row); font-weight: 600; color: var(--muted); border-radius: var(--r-pill); min-height: 40px; white-space: nowrap; }
.status-tabs a:hover { background: transparent; color: var(--fg); }
.status-tabs a.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.status-tabs a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .status-tabs { max-width: 100%; overflow-x: auto; } }
@media (max-width: 560px) { .status-tabs a { padding: 7px 10px; font-size: var(--fs-label); gap: 6px; } }

/* --- Status badges (.badge.*) → tags --- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-tag); font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); border: var(--b-control); background: transparent; color: var(--soft); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.badge.approved, .badge.active, .badge.completed, .badge.paid, .badge.answered { border-color: var(--accent); background: transparent; color: var(--accent); }
.badge.pendingapproval, .badge.pending, .badge.open, .badge.violet, .badge.danger, .badge.badge-primary { border-color: var(--warn); background: transparent; color: var(--warn); }
.badge.inactive, .badge.rejected, .badge.blue, .badge.closed, .badge.expired, .badge.cancelled { border-color: var(--edge); background: transparent; color: var(--soft); }

/* --- Tables (.data-table in .responsive-table-wrapper) → rows look --- */
.responsive-table-wrapper { background: var(--card); border: var(--b-box); border-radius: var(--r-panel); }
.data-table, .table { font-size: var(--fs-label); color: var(--fg); }
.data-table th, .table th { background: transparent; padding: 10px 16px; color: var(--hint); font-weight: 700; font-size: 11px; letter-spacing: 1px; border-bottom: 0; }
.data-table td, .table td { padding: 12px 16px; border-bottom: 0; border-top: var(--b-box); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--panel); }
.data-table td strong { color: var(--fg); }
.data-table small, .table small { color: var(--muted); font-size: var(--fs-small); }
@media (max-width: 768px) {
    .data-table tr { border-bottom: 0; border-top: var(--b-box); padding: 12px 16px; }
    .data-table tbody tr:first-child { border-top: 0; }
    .data-table td { border-top: 0; padding: 4px 0; }
    .data-table td::before { color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
}

/* --- Pager --- */
.pager { justify-content: space-between; gap: 12px; margin-top: 12px; padding: 4px 6px 0; border-top: 0; font-size: var(--fs-small); color: var(--muted); }
.pager-status { color: var(--muted); font-size: var(--fs-small); font-weight: 700; }
.pager .btn { min-height: 34px; padding: 4px 14px; font-size: var(--fs-small); }

/* --- Empty states --- */
.empty-state, .empty { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 40px 20px; color: var(--muted); background: var(--card); border: 1px dashed var(--edge); border-radius: var(--r-panel); }
.empty-state-icon, .empty i { display: none; }
.empty-state h3 { margin: 0; font-size: var(--fs-empty); font-weight: 700; color: var(--fg); }
.empty-state p { margin: 0 0 6px; color: var(--muted); font-size: var(--fs-label); }

/* --- Chat (colours only: Sessions keeps the current chat) --- */
.chat-workspace { background: var(--card); border-color: var(--line); }
.chat-sidebar { background: var(--panel); border-right-color: var(--line); }
.chat-sidebar-header { border-bottom-color: var(--line); }
.chat-sidebar-header h3, .chat-main-header h3 { color: var(--fg); }
.chat-list-item { border-bottom-color: var(--line); color: var(--fg); }
.chat-list-item:hover, .chat-list-item.active { background: var(--row); }
.chat-list-item.active { border-left-color: var(--accent); }
.chat-list-item.unread { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.chat-type { background: var(--row); color: var(--soft); }
.unread-dot { background: var(--warn); }
.chat-list-time, .chat-list-mood, .chat-list-empty, .chat-empty { color: var(--muted); }
.chat-main-header { background: var(--card); border-bottom-color: var(--line); }
.patient-mood-pill { background: var(--panel); color: var(--soft); }
.chat-readonly-note { color: var(--hint); }
.chat-messages, .messages { background: var(--card); }
.bubble { background: var(--panel); border-color: var(--panel); color: var(--fg); }
.bubble.mine { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chat-composer, .composer { background: var(--card); border-top-color: var(--line); }
.chat-composer textarea { font-weight: 400; }
.chat-workspace.has-selection .chat-back-to-list { color: var(--accent); }
.confidential { background: var(--panel); color: var(--accent); }

/* Recovery-PIN popup injected by js/therapy-recovery.js (its <style> is added later, hence :root) */
:root .lios-rec-backdrop { background: var(--overlay); }
:root .lios-rec-card { background: var(--card); border: var(--b-box); border-radius: var(--r-dialog); color: var(--fg); box-shadow: none; }
:root .lios-rec-card h2, :root .lios-rec-card label { color: var(--fg); }
:root .lios-rec-card p { color: var(--muted); }
:root .lios-rec-err { color: var(--warn); }
:root .lios-rec-btn.primary { background: var(--accent); color: var(--on-accent); }
:root .lios-rec-btn.ghost { background: transparent; border: var(--b-control); color: var(--fg); }
:root .lios-rec-forgot a { color: var(--accent); }

/* Page popups whose <style> sits in the page body (Member requests, Support history, chat closed notice) */
:root .rj-modal, :root .sh-modal, :root #closedNoticeModal { background: var(--overlay); }
:root .rj-modal .rj-dialog, :root .sh-modal .sh-dialog, :root #closedNoticeModal .cn-card { background: var(--card); border: var(--b-box); border-radius: var(--r-dialog); color: var(--fg); box-shadow: none; }
:root .rj-modal .rj-head, :root .sh-modal .sh-head, :root #closedNoticeModal .cn-head,
:root .rj-modal .rj-foot, :root .sh-modal .sh-foot, :root #closedNoticeModal .cn-foot { background: transparent; border-color: var(--line); }
:root .rj-modal .rj-head h3, :root .sh-modal .sh-head h3, :root #closedNoticeModal .cn-head h3, :root .rj-modal label, :root .sh-modal .sh-text { color: var(--fg); }
:root .rj-modal .rj-body p, :root .sh-modal .sh-head .sh-sub, :root .sh-modal .sh-label, :root #closedNoticeModal .cn-body, :root .rj-modal label span { color: var(--muted); }
:root .rj-modal .rj-who, :root .sh-modal .sh-meta { background: var(--panel); color: var(--soft); }
:root .sh-modal .sh-text.sh-answer { background: var(--panel); border-left-color: var(--accent); }
:root .rj-modal .rj-x, :root .sh-modal .sh-x { color: var(--muted); }
:root .rj-modal .rj-x:hover, :root .sh-modal .sh-x:hover { background: var(--row); color: var(--fg); }
:root .rj-modal textarea { background: var(--field, var(--bg)); border: var(--b-control); color: var(--fg); }
:root .rj-modal textarea:focus { border-color: var(--accent); box-shadow: none; }
:root #closedNoticeModal .cn-head i { color: var(--warn); }
:root #closedNoticeModal .cn-ok { background: var(--accent); color: var(--on-accent); border-radius: var(--r-pill); }
:root #closedNoticeModal .cn-ok:hover { background: var(--accent); filter: brightness(1.05); }

/* --- Error pages (Home/Error, AccessDenied) --- */
.error-card { background: var(--card); border: var(--b-box); border-radius: var(--r-gate); padding: 28px; box-shadow: none; color: var(--fg); }
.error-content h2 { font-size: var(--fs-gate-h1); font-weight: 800; line-height: 1.1; color: var(--fg); margin: 0 0 4px; }
.error-content p { color: var(--muted); font-size: var(--fs-label); }
.error-icon { background: var(--panel); color: var(--warn); }
.error-code { background: var(--panel); color: var(--soft); }

/* Sign up + Waiting (redesign 3.3 / 3.4; prototype "signup" / "waiting") */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.stepper li { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--muted); }
.stepper li b { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: var(--b-control); font-size: 13px; }
.stepper li + li::before { content: ""; width: 22px; height: 1px; background: var(--line); margin-right: 6px; }
.stepper li.on { color: var(--fg); } .stepper li.on b { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper li.done b { border-color: var(--accent); color: var(--accent); }
.gate .opt { font-style: normal; font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
.gate .fld textarea { width: 100%; font: inherit; font-size: 15px; color: var(--fg); background: var(--field, var(--bg)); border: var(--b-control); border-radius: var(--r-input); padding: 10px 14px; outline: none; resize: vertical; }
.gate .fld textarea:focus { border-color: var(--accent); }
.gate .fld .picks { margin-top: 4px; }
.gate .linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.uprow { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: var(--r-input); cursor: pointer; }
.uprow.done { border-style: solid; border-color: var(--accent); }
.uprow input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.uprow .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.uprow .tx b { font-size: 15px; } .uprow .tx small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.uprow .btn.sm { pointer-events: none; min-height: 34px; padding: 4px 14px; font-size: 13px; }
.uprow:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.gate .agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--soft); }
.gate .agree input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.gate .btn.wide { width: 100%; justify-content: center; }
.track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.track li { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.track li:last-child { padding-bottom: 0; }
.track li i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none; margin-top: 3px; background: var(--card); z-index: 1; }
.track li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.track li.done i { background: var(--accent); border-color: var(--accent); }
.track li.now i { background: var(--warn); border-color: var(--warn); }
.track li span { display: flex; flex-direction: column; gap: 2px; }
.track li b { font-size: 15px; } .track li small { color: var(--muted); font-size: 13px; }
.track li:not(.done):not(.now) b { color: var(--muted); }
/* Phone picker (_PhoneInput) on the new pages: theme colours instead of its old white look (sign-up, redesign 3.3). */
.gate .phone-input { margin-top: 0; }
.gate .phone-input .phone-control { background: var(--field, var(--bg)); border: var(--b-control); border-radius: var(--r-input); }
.gate .phone-input .phone-control:focus-within { border-color: var(--accent); box-shadow: none; }
.gate .phone-input .phone-control.invalid { border-color: var(--warn); }
.gate .phone-input .phone-country { color: var(--fg); border-right: var(--b-control); padding: 10px 12px; font-weight: 600; }
.gate .phone-input .phone-country:hover { background: var(--panel); }
.gate .phone-input .phone-country .bi { color: var(--muted); }
.gate .phone-input .phone-local { color: var(--fg); padding: 10px 14px; font-weight: 500; }
.gate .phone-input .phone-menu { background: var(--card); border: var(--b-box); border-radius: var(--r-input); box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.gate .phone-input .phone-search { background: var(--field, var(--bg)); color: var(--fg); border: var(--b-control); border-radius: 10px; font-weight: 500; }
.gate .phone-input .phone-opt { color: var(--fg); font-weight: 500; }
.gate .phone-input .phone-opt:hover { background: var(--panel); }
.gate .phone-input .phone-opt-dial { color: var(--muted); }
.gate .phone-input ~ .field-error, .gate .phone-input .field-error { color: var(--warn); }
/* The number box sits inside the picker's one border: no second border / focus ring from `.gate .fld input`. */
.gate .fld .phone-input .phone-local, .gate .fld .phone-input .phone-local:focus { border: 0; border-radius: 0; box-shadow: none; outline: none; background: transparent; }
.gate .fld .phone-input .phone-search { padding: 8px 10px; }
/* Sign-up step 2 (1 Dec): the hidden tick box inside a pill must stay 1px — `.gate .fld input` made it full width and the
   page scrolled sideways on phones. */
.picks > label { position: relative; }
.gate .fld .picks > label > input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; inset: auto; }
/* Tick boxes + round buttons drawn by us (1 Dec, Varsha): iPhone Safari ignores accent-color and showed them black on the
   dark theme. Same look on every browser and both themes: themed box, mint + tick when on. Hidden pill inputs unaffected. */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer; position: relative;
  width: 18px; height: 18px; min-height: 0; padding: 0;
  background: var(--field, var(--bg)); border: 1.5px solid var(--edge); border-radius: 5px;
  display: inline-grid; place-content: center; vertical-align: middle; transition: background .12s, border-color .12s;
}
input[type=radio] { width: 20px; height: 20px; border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]::after {
  content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--on-accent); border-width: 0 2px 2px 0;
  transform: rotate(45deg); opacity: 0;
}
input[type=checkbox]:checked::after { opacity: 1; }
input[type=radio]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-accent); opacity: 0; }
input[type=radio]:checked::after { opacity: 1; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .45; cursor: not-allowed; }
.picks > label > input[type=checkbox] { opacity: 0; }   /* pills show their own "on" look */
