body{font:15px system-ui,sans-serif;margin:0;background:#f6f7f9;color:#1b1f24}
main{max-width:900px;margin:2rem auto;padding:0 1rem}
label{display:block;margin:.6rem 0}input{display:block;padding:.4rem;width:20rem;max-width:100%}
button{padding:.45rem 1rem}table{border-collapse:collapse;width:100%}
td,th{border-bottom:1px solid #d5d9df;padding:.3rem .5rem;text-align:left}#err{color:#b00020}
@media (prefers-color-scheme:dark){body{background:#14171a;color:#e6e8ea}td,th{border-color:#333}}
/* .row sets display:flex, which beats the browser's own [hidden] rule. Without this, hiding a row of
   fields does nothing at all -- it silently defeated both the SMTP test form and the bay profile fields. */
[hidden] { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: .75rem 0 1.5rem; }
.row label { display: flex; flex-direction: column; font-size: .85rem; gap: .2rem; }
.notice { border: 2px solid #b45309; background: #fffbeb; padding: .75rem; margin: .75rem 0; }
.notice code { font-size: 1.4rem; letter-spacing: .1em; margin: 0 .5rem; user-select: all; }
/* Every reply to an action goes through #msg, and this page is far longer than a screen. Left in the
   flow at the top it was off-screen for anyone working below the fold: an owner pressed Search, the
   answer was written somewhere they could not see, and the page looked dead. Pinned to the viewport
   it reaches them wherever they are. :empty keeps it out of the way when there is nothing to say. */
#msg { position: fixed; top: .75rem; right: 1rem; z-index: 50; margin: 0; max-width: 26rem;
       padding: .55rem .85rem; border-radius: .4rem; border: 1px solid #d5d9df; background: #fff;
       box-shadow: 0 2px 10px rgba(0,0,0,.15); }
#msg:empty { display: none; }
#msg.ok { color: #166534; border-color: #16653433; } #msg.bad { color: #b91c1c; border-color: #b91c1c55; }
@media (prefers-color-scheme: dark) { #msg { background: #1f2327; border-color: #3a4048; }
  #msg.ok { color: #86efac; } #msg.bad { color: #fca5a5; } }
@media (max-width: 640px) { #msg { left: 1rem; right: 1rem; max-width: none; } }
td button { margin-right: .35rem; }
main{max-width:1100px}
textarea { width: 100%; font-family: ui-monospace, monospace; }
#cfg-issues { color: #b00020; }
.hint { color: #475569; font-size: .9rem; }
td.mono { font-family: ui-monospace, monospace; font-size: .85rem; }

/* Pricing cards: one per profile, so a price and the bays it covers stay together. */
.price-card { border: 1px solid #d4d4d8; border-radius: 6px; padding: .75rem 1rem; margin: .75rem 0; }
.price-card h3 { margin: 0 0 .25rem; font-size: 1rem; }
.price-card .bays { font-size: .85rem; color: #52525b; margin: .25rem 0 .5rem; }
.price-card .buys { font-size: .85rem; color: #166534; margin: .25rem 0; }
.price-card .issues { color: #b91c1c; font-size: .85rem; white-space: pre-wrap; margin: .5rem 0 0; }

/* The bay board. Tiles are big enough to read across a desk, like the panel they replace. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }
.tile { border: 1px solid #a1a1aa; border-radius: 6px; padding: .6rem .7rem; min-height: 5.5rem; }
.tile .name { font-weight: 600; font-size: 1.05rem; }
.tile .sub { font-size: .78rem; color: #3f3f46; margin-top: .15rem; }
.tile .when { font-size: .78rem; margin-top: .35rem; }
/* A warning does not change the tile's state or colour, so it has to read on every background: bold, with a marker that is not colour. */
.tile .warn { font-size: .78rem; font-weight: 600; margin-top: .3rem; }
.tile .warn::before { content: "Attention: "; }
/* A lit tile means something: in use, or needs attention. Dark green busy on a card, amber busy on
   cash, red out of service, purple never set up. Idle is left plain on purpose. */
.s-in_use { background: #15803d; color: #fff; border-color: #14532d; }
.s-in_use .sub, .s-in_use .when { color: #dcfce7; }
.s-in_use_cash { background: #d97706; color: #fff; border-color: #b45309; }
.s-in_use_cash .sub, .s-in_use_cash .when { color: #fffbeb; }
.s-in_use_unpaid { background: #2563eb; color: #fff; border-color: #1d4ed8; }
.s-in_use_unpaid .sub, .s-in_use_unpaid .when { color: #eff6ff; }
.s-out_of_service { background: #dc2626; color: #fff; border-color: #991b1b; }
.s-out_of_service .sub, .s-out_of_service .when { color: #fef2f2; }
.s-idle { background: #fff; }
.s-no_profile { background: #7c3aed; color: #fff; border-color: #6d28d9; }
.s-no_profile .sub, .s-no_profile .when { color: #f5f3ff; }
.s-never_seen { background: #f4f4f5; color: #52525b; }
.legend { font-size: .8rem; color: #3f3f46; display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: center; }
.legend .key { display: inline-block; width: 1rem; height: 1rem; border: 1px solid #a1a1aa; border-radius: 3px; vertical-align: -.2rem; margin-right: .25rem; }

/* A warning that sits in a table cell, under the control it is about: readable without shouting,
   and legible in dark mode, which several earlier additions here were not. */
.warn { margin-top: .3rem; font-size: .85rem; line-height: 1.3; color: #8a5a00; max-width: 30rem; }
@media (prefers-color-scheme: dark) { .warn { color: #e0a33a; } }

/* A cell that is reporting a problem rather than a value. Used by the RF board list, where "no" in
   the Ready-to-enrol column is the whole point of the table. */
td.bad-cell { color: #b91c1c; font-weight: 600; }
@media (prefers-color-scheme: dark) { td.bad-cell { color: #fca5a5; } }
#rfb-gap ul { margin: .4rem 0 0; padding-left: 1.2rem; }
#rfb-gap li { font-size: .9rem; margin: .2rem 0; }
#rfb-bad, #rfb-result { white-space: pre-wrap; font-size: .85rem; background: #fff; border: 1px solid #d5d9df;
                        padding: .5rem .7rem; border-radius: .3rem; }
#rfb-bad { color: #b91c1c; }
@media (prefers-color-scheme: dark) { #rfb-bad, #rfb-result { background: #1f2327; border-color: #3a4048; }
  #rfb-bad { color: #fca5a5; } }
/* A checkbox that reads as one line with its label, rather than the stacked block form the page
   uses for text inputs. */
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }
label.inline input { display: inline-block; width: auto; }
/* Cash wired: coin and bill side by side, each box beside its own word. */
label.cash-line { margin: 0 1.2rem 0 0; }
/* Something to look at, but not yet a failure: a package has gone out and no answer has come back. */
td.warn-cell { color: #8a5a00; }
@media (prefers-color-scheme: dark) { td.warn-cell { color: #e0a33a; } }
td.ok-cell { color: #1a6b2f; }
td.bad-cell { color: #a01515; }
@media (prefers-color-scheme: dark) { td.ok-cell { color: #5fcf80; } td.bad-cell { color: #ff8a8a; } }

/* ---- Operator portal layout (portal.js). Groups are shown by data-view on #status; with no
   data-view (must-change-password, or before portal.js runs) every group shows as before. ---- */
#portal-nav { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1.25rem; padding: .4rem 0; border-bottom: 1px solid var(--tv-line); }
#portal-nav a { padding: .65rem .9rem; border-radius: .5rem; text-decoration: none; font-weight: 500; color: inherit; min-height: 1.4rem; }
#portal-nav a:hover { background: var(--tv-pale); }
#portal-nav a[aria-current="page"] { background: var(--tv-navy); color: #fff; font-weight: 600; }
#status[data-view="home"] [data-g]:not([data-g="home"]),
#status[data-view="money"] [data-g]:not([data-g="money"]),
#status[data-view="equipment"] [data-g]:not([data-g="equipment"]),
#status[data-view="settings"] [data-g]:not([data-g="settings"]),
#status[data-view="trouble"] [data-g]:not([data-g="trouble"]),
#status[data-view="clients"] [data-g]:not([data-g="clients"]) { display: none !important; }
#home[data-g] { display: none; }
#status[data-view="home"] #home { display: block !important; }

.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: .75rem 0 1.5rem; }
.home-card { background: #fff; border: 1px solid var(--tv-line); border-top: 6px solid var(--tv-navy); border-radius: .6rem; padding: 1rem; display: flex; flex-direction: column; gap: .4rem; color: #1f2933; }
.home-card.bad { border-top-color: #b42318; } .home-card.warn { border-top-color: #b7791f; } .home-card.ok { border-top-color: #1f7a3d; }
.home-card strong { font-size: 1.1rem; }
.home-tag { font-size: .75rem; font-weight: 700; letter-spacing: .05em; }
.home-card.bad .home-tag { color: #8a1c1c; } .home-card.warn .home-tag { color: #7a4b00; } .home-card.ok .home-tag { color: #145a2c; }
.home-btn { align-self: flex-start; margin-top: .4rem; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1rem; border-radius: .5rem; background: var(--tv-navy); color: #fff; font-weight: 600; text-decoration: none; }
.home-split { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.home-main { flex: 999 1 560px; min-width: 0; } .home-side { flex: 1 1 260px; min-width: 240px; }
.home-tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--tv-line); border-radius: .6rem; color: #1f2933; }
.home-tablewrap td, .home-tablewrap th { padding: .7rem .9rem; }
.home-chip { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.home-chip.bad { background: #fde8e8; color: #8a1c1c; } .home-chip.warn { background: #fff4e0; color: #7a4b00; } .home-chip.ok { background: #e6f4ea; color: #145a2c; }
.home-actions { display: flex; flex-direction: column; gap: .6rem; }
.home-action { display: flex; align-items: center; justify-content: space-between; min-height: 3.2rem; padding: 0 1rem; background: #fff; border: 1px solid var(--tv-line); border-radius: .6rem; color: #1f2933; font-weight: 600; text-decoration: none; }
.home-action::after { content: "→"; color: var(--tv-link); }
.home-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.home-group { background: #fff; border: 1px solid var(--tv-line); border-radius: .6rem; padding: 1rem; color: #1f2933; }
.home-group h3 { margin: 0 0 .1rem; } .home-group ul { margin: .4rem 0 0; padding: 0; list-style: none; }
.home-group li a { display: block; padding: .5rem 0; }
@media (prefers-color-scheme: dark) { #portal-nav { border-color: #333; } }

.premium-badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: #fff4d6; color: #6b4a00; border: 1px solid #e0b84c; font-size: .8rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
.home-group.premium { border-top: 4px solid #e0b84c; }
.home-group .plan { font-weight: 700; font-size: .85rem; }
.home-group .plan.on { color: #145a2c; } .home-group .plan.off { color: #7a4b00; }
#clients .home-tablewrap th, #cl-rows td { padding: .55rem .8rem; vertical-align: top; }
#clients table { table-layout: auto; min-width: 70rem; }
#clients th { white-space: nowrap; }
#clients input[type="checkbox"] { display: inline-block; width: auto; padding: 0; margin: 0; }
#clients .row label:has(> input[type="checkbox"]) { flex-direction: row; align-items: center; gap: .4rem; }
#clients th:nth-child(6), #clients td:nth-child(6), #clients th:nth-child(5), #clients td:nth-child(5) { white-space: nowrap; }
#clients th:nth-child(8), #clients td:nth-child(8) { min-width: 13rem; }
#clients th:nth-child(9), #clients td:nth-child(9), #clients th:nth-child(10), #clients td:nth-child(10), #clients th:nth-child(11), #clients td:nth-child(11) { text-align: center; }
#cl-rows tr.owner td { background: var(--tv-pale); font-weight: 700; color: #1f2933; }
@media (prefers-color-scheme: dark) { .premium-badge { background: #3a2f10; color: #ffd978; border-color: #8a6d1d; } #cl-rows tr.owner td { background: #243038; color: #e8eef2; } }

.premium-banner { margin: .5rem 0; padding: .5rem .9rem; border-radius: 6px; background: #fff4d6; color: #5c3f00; border: 1px solid #e0b84c; }
.premium-banner p { margin: .15rem 0; font-weight: 600; }
@media (prefers-color-scheme: dark) { .premium-banner { background: #3a2f10; color: #ffd978; border-color: #8a6d1d; } }

/* ---------------------------------------------------------------------------
   TapVerify palette for the signed-in console and the bay board.
   COLOUR ONLY: no padding, margin, border width, size, font or display is changed below, so nothing
   can move. The seven bay status colours (.s-*) are not touched. Text uses --tv-link (#0176a8,
   5.05:1 on white), never azure (#019bda, 3.13:1), which is for focus rings only.
   The Home cards, the Home tables and the action rows are white in both schemes, so they re-pin
   the light values of the variables for everything inside them.
   --------------------------------------------------------------------------- */
:root { --tv-navy: #00326e; --tv-link: #0176a8; --tv-azure: #019bda; --tv-ground: #f2f7fa;
        --tv-pale: #e8f4fb; --tv-ice: #c9e6f6; --tv-line: #cfdde7;
        --tv-text: #33475c; --tv-head: #00326e; --tv-a: #0176a8; --tv-rule: #cfdde7; --tv-muted: #475569;
        --tv-field: #fff; --tv-field-text: #1b1f24; --tv-field-edge: #33475c;
        --tv-btn: #00326e; --tv-btn-bg: #fff; --tv-btn-hover: #e8f4fb; --tv-code: #e8f4fb;
        --tv-ok: #166534; --tv-bad: #b91c1c; }
@media (prefers-color-scheme: dark) {
  :root { --tv-text: #e6e8ea; --tv-ground: #14171a; --tv-head: #c9e6f6; --tv-a: #019bda; --tv-rule: #3a4048;
          --tv-muted: #9aa5b1; --tv-field: #14171a; --tv-field-text: #e6e8ea; --tv-field-edge: #5b6670;
          --tv-btn: #c9e6f6; --tv-btn-bg: #1f2327; --tv-btn-hover: #243038; --tv-code: #243038; --tv-pale: #243038;
          --tv-ok: #86efac; --tv-bad: #fca5a5; }
  #portal-nav a[aria-current="page"] { background: var(--tv-link); } }
.home-card, .home-group, .home-tablewrap, .home-action, .notice { --tv-head: #00326e; --tv-a: #0176a8; --tv-rule: #cfdde7;
        --tv-text: #1f2933; --tv-muted: #475569; --tv-pale: #e8f4fb; }

body { background: var(--tv-ground); color: var(--tv-text); }
h1, h2, h3 { color: var(--tv-head); }
a { color: var(--tv-a); }
th { color: var(--tv-head); }
td, th { border-bottom-color: var(--tv-rule); }
.hint { color: var(--tv-muted); }
pre { background: var(--tv-code); }
#portal-nav { border-bottom-color: var(--tv-rule); }
#portal-nav a:not([aria-current="page"]):hover { background: var(--tv-pale); }
#portal-nav a[aria-current="page"] { color: #fff; }
.home-group h3 a { color: var(--tv-a); }

/* Controls: colour only. Border width and style are left to the browser so the box does not change. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  background-color: var(--tv-field); color: var(--tv-field-text); border-color: var(--tv-field-edge); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea { border-style: solid; }
button { color: var(--tv-btn); background-color: var(--tv-btn-bg); border-color: var(--tv-btn); border-style: solid; }
button:hover:not(:disabled) { background-color: var(--tv-btn-hover); }
button:disabled { opacity: .55; }
/* The unit name on Equipment: a button that looks like a link (click it to rename). Colour only, plus no box. */
button.unit-name { color: var(--tv-a); background: transparent; border: 0; padding: 0; font: inherit; text-decoration: underline dotted; cursor: pointer; }
button.unit-name:hover:not(:disabled) { background: transparent; text-decoration: underline; }
:is(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--tv-azure); outline-offset: 2px; }

/* Text colours that were fixed for the light page and unreadable on the dark one. */
.notice { color: #1b1f24; }
.price-card { border-color: var(--tv-rule); }
.price-card .bays { color: var(--tv-muted); }
.price-card .buys { color: var(--tv-ok); }
.price-card .issues, #cfg-issues, #err { color: var(--tv-bad); }
.legend { color: var(--tv-muted); }
/* Bay tiles: only the TEXT on idle tiles and on warnings is set here. Idle took its text colour from the
   page, so it went light-on-white in dark mode; a warning took its colour from the page's amber, which is
   unreadable on a white, grey, green, purple or red tile. Status backgrounds and borders are not touched. */
.s-idle { color: #1b1f24; }
.tile .warn { color: inherit; }


/* ---------------------------------------------------------------------------
   Signed-out sign-in card.
   Reached from the Log in link on gettapverify.com, so it is the first TapVerify
   page some operators see and it was unstyled browser default.
   Every rule below is scoped either to #login, or to the page state where the
   sign-in form is showing. Nothing here can reach the signed-in console: when
   #login carries [hidden], :has() stops matching and all of it switches off.
   --------------------------------------------------------------------------- */
body:has(#login:not([hidden])) { background: #f2f7fa; }
body:has(#login:not([hidden])) > main { max-width: 25rem; margin: 9vh auto 2rem; }
body:has(#login:not([hidden])) > main > h1 {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.028em;
  color: #00326e; margin: 0 0 1.1rem; }

#login { background: #fff; border: 1px solid #cfdde7; border-radius: 10px;
         padding: 1.6rem 1.6rem 1.4rem; box-shadow: 0 1px 3px rgba(0, 50, 110, .07); }
#login label { display: block; margin: 0 0 .95rem;
               font-size: .9rem; font-weight: 700; color: #00326e; }
#login input { display: block; width: 100%; margin-top: .3rem;
               padding: .6rem .7rem; font: inherit; color: #33475c;
               background: #fff; border: 1px solid #cfdde7; border-radius: 7px; }
#login input:focus-visible { outline: 3px solid #019bda; outline-offset: 2px; }
#login button { width: 100%; margin-top: .35rem; padding: .7rem 1rem;
                font: inherit; font-weight: 700; color: #fff; background: #00326e;
                border: 2px solid transparent; border-radius: 7px; cursor: pointer; }
#login button:hover { background: #002451; }
#login button:focus-visible { outline: 3px solid #019bda; outline-offset: 3px; }
#login #err { margin: .9rem 0 0; font-size: .92rem; }
#login #err:empty { display: none; }

@media (prefers-color-scheme: dark) {
  body:has(#login:not([hidden])) { background: #14171a; }
  body:has(#login:not([hidden])) > main > h1 { color: #c9e6f6; }
  #login { background: #1f2327; border-color: #3a4048; box-shadow: none; }
  #login label { color: #c9e6f6; }
  #login input { background: #14171a; color: #e6e8ea; border-color: #3a4048; }
  #login button { background: #0176a8; color: #fff; }
  #login button:hover { background: #019bda; }
}
