:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1c2430; --muted: #5d6b7c; --line: #dde3ea;
  --brand: #0d4f8b; --brand-ink: #fff; --accent: #12a38a;
  --info: #2f6fb3; --warn: #b7791f; --crit: #c53030; --ok: #2f855a;
  --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }

.topbar { display: flex; align-items: center; gap: 1.5rem; background: var(--brand); color: var(--brand-ink);
  padding: .6rem 1.25rem; flex-wrap: wrap; }
.topbar a { color: var(--brand-ink); text-decoration: none; }
.topbar nav { display: flex; gap: 1.1rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { opacity: .9; } .topbar nav a:hover { opacity: 1; text-decoration: underline; }
.brand { font-size: 1.1rem; letter-spacing: .02em; display: flex; align-items: center; gap: .45rem; }
.brand-mark { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.who { display: flex; align-items: center; gap: .6rem; }
.who button.link { color: var(--brand-ink); }

.page { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.25rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 0 1.5rem; }

.auth .auth-card { max-width: 430px; margin: 8vh auto; background: var(--panel); padding: 2rem 2.2rem;
  border-radius: 12px; box-shadow: 0 6px 30px rgba(20, 40, 70, .12); }
.auth-brand { font-size: 1.3rem; display: flex; gap: .5rem; align-items: center; justify-content: center; margin-bottom: 1.25rem; color: var(--brand); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.grid2 > .card { margin-bottom: 0; } .grid2 { margin-bottom: 1.25rem; }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.stack { display: flex; flex-direction: column; gap: .85rem; } .narrow { max-width: 460px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.alerts { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; display: flex; gap: 1rem; flex-wrap: wrap; }
fieldset.alerts legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label.check { flex-direction: row; align-items: center; font-weight: 500; gap: .45rem; }
input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #c4ccd6; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid #9cc3ea; border-color: var(--brand); }
input.code { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-family: Consolas, monospace; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .9rem 1.2rem; margin-bottom: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 0 1 320px; }
form.inline { display: inline; }

.pw-wrap { display: flex; gap: .35rem; }
.pw-wrap input { flex: 1; }
.pw-toggle { flex: 0 0 auto; font-size: .8rem; padding: 0 .7rem; background: #eef2f6; color: var(--ink); border: 1px solid #c4ccd6; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { background: #e2e8ef; }

button, .button { font: inherit; display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
button.primary, .button.primary { background: var(--brand); color: #fff; }
button.primary:hover, .button.primary:hover { background: #0a3f70; }
button.secondary, .button.secondary { background: #fff; color: var(--brand); border-color: #b9c7d6; }
button.secondary:hover, .button.secondary:hover { background: #f0f5fa; }
button.small { padding: .25rem .6rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-error { background: #fdecec; border-color: #f3b4b4; color: #8b1c1c; }
.flash-success { background: #e9f7ef; border-color: #a6dcbc; color: #1f5f3a; }
.flash-info { background: #eaf2fb; border-color: #b6d0ee; color: #1d4870; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: .92rem; }
.table th, .table td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #eef2f6; font-weight: 600; }
.table tr.inactive td { color: var(--muted); }
.table.audit td { font-size: .88rem; }
table.detail { font-size: .82rem; margin-top: .3rem; border-collapse: collapse; }
table.detail th, table.detail td { padding: .15rem .5rem; border: 1px solid var(--line); text-align: left; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.props dt { color: var(--muted); } .props dd { margin: 0; }

.role, .tag, .lvl { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; vertical-align: middle; }
.role { background: #e3ecf6; color: #1d4870; }
.role-admin { background: #fdf0d8; color: #7a5212; }
.role-master { background: #f8dfe6; color: #8a1d3c; }
.topbar .role { background: rgba(255,255,255,.18); color: #fff; }
.tag { background: #eef2f6; color: var(--muted); font-weight: 500; }
.tag-business { background: #e4f1ff; color: #1d4f86; } .tag-individual { background: #eaf7ef; color: #23663f; }
.tag-warn { background: #fdecec; color: var(--crit); }
.lvl-info { background: #e3ecf6; color: var(--info); } .lvl-warning { background: #fdf0d8; color: var(--warn); } .lvl-critical { background: #fde2e2; color: var(--crit); }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .5rem; }
.filters input, .filters select { width: auto; }
.filters label { flex-direction: row; align-items: center; font-weight: 500; }
.pager { display: flex; gap: 1rem; justify-content: center; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.tile-num { font-size: 2rem; font-weight: 700; color: var(--brand); }
.phases li { margin: .3rem 0; } .phases li.done { color: var(--ok); } .phases li.done::after { content: "  ✓ done"; font-weight: 600; }

details.cat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: .5rem 0; padding: .35rem .9rem; }
details.cat details.cat { margin-left: .5rem; border-left: 3px solid #cfe0f1; border-radius: 0 var(--radius) var(--radius) 0; }
details.cat > summary { cursor: pointer; padding: .35rem 0; display: flex; gap: .6rem; align-items: center; }
details.cat.depth-0 > summary .cat-name { font-size: 1.1rem; font-weight: 700; }
details.cat > summary .cat-name { font-weight: 600; }
details.cat > summary .count { margin-left: auto; color: var(--muted); font-size: .85rem; }
a.on { font-weight: 700; text-decoration: none; color: var(--ink); }
ul.items { list-style: none; padding: 0; margin: .25rem 0 .5rem; }
ul.items li { padding: .5rem .2rem; border-top: 1px dashed var(--line); }
.item-title { font-weight: 600; } .item-guidance { color: var(--muted); font-size: .88rem; margin-top: .15rem; }

.qr { margin: .6rem 0; } .qr svg { display: block; width: 240px; max-width: 100%; height: auto; aspect-ratio: 1; background: #fff; }
.secret { display: inline-block; margin: .4rem 0; font-size: 1rem; letter-spacing: .05em; user-select: all; }
.steps { padding-left: 1.2rem; } .steps li { margin-bottom: .75rem; }
ul.codes { columns: 2; list-style: none; padding: 0; font-size: 1.1rem; } ul.codes li { padding: .2rem 0; }
.temp-pw { display: flex; gap: .5rem; max-width: 460px; align-items: center; }

/* Phase 2: library editor */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 0 0 1rem; }
.tabs a { padding: .5rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.toolbar { color: var(--muted); }
.crumbs { color: var(--muted); font-size: .9rem; }
h3 { font-size: 1rem; margin: .25rem 0 .5rem; }
textarea { resize: vertical; }
ul.plain { list-style: none; padding: 0; margin: 0 0 .75rem; }
.row-line { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.row-tools { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }
.retired, .retired a { color: #8a96a3; }
details.cat.retired { background: #f7f8fa; }
ul.items li.retired .item-title { text-decoration: line-through; }
.add-links { margin: .25rem 0 .5rem; }
.add-links a { text-decoration: none; }
summary a.small { margin-left: .25rem; }
button.danger, .button.danger { background: #fff; color: var(--crit); border: 1px solid #efb0b0; }
button.danger:hover { background: #fdecec; }
form.rename { flex: 1; min-width: 12rem; }
form.rename input { padding: .25rem .45rem; border-color: transparent; background: transparent; }
form.rename input:hover, form.rename input:focus { border-color: #c4ccd6; background: #fff; }
.inline-add { display: flex; gap: .4rem; }
.inline-add input { flex: 1; }
.pill { display: inline-block; border-radius: 999px; padding: .15rem .65rem; font-size: .8rem; font-weight: 600; border: 1px solid transparent; cursor: default; }
button.pill { cursor: pointer; }
.pill-ok { background: #e3f4ea; color: var(--ok); border-color: #b5dfc4; }
.pill-bad { background: #fde2e2; color: var(--crit); border-color: #f2b8b8; }

/* Phase 3: clients, locations, QuickBooks import */
.actions-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid #c4ccd6; border-radius: 6px; overflow: hidden; }
.seg a { padding: .4rem .8rem; text-decoration: none; color: var(--ink); background: #fff; border-right: 1px solid #c4ccd6; }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--brand); color: #fff; }
.tag-client { background: #e3f4ea; color: var(--ok); }
.tag-prospect { background: #f1e8fb; color: #6b3fa0; }
.logo-cell { width: 56px; }
.logo-thumb { max-width: 48px; max-height: 32px; object-fit: contain; display: block; }
.client-head { display: flex; gap: 1.25rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.client-head h1 { margin-bottom: .25rem; }
.client-head .actions-inline { margin-left: auto; }
.logo-large { max-width: 160px; max-height: 80px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .35rem; }
.logo-preview { max-width: 240px; max-height: 120px; object-fit: contain; display: block; margin-bottom: .75rem; }
.notes { white-space: pre-wrap; background: #f7f9fb; border-radius: 6px; padding: .6rem .8rem; }
.radio-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.radio-row legend { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input.short { max-width: 8rem; }
.sticky-bar { position: sticky; top: 0; background: var(--bg); padding: .6rem 0; z-index: 2; border-bottom: 1px solid var(--line); }
.table.import td { font-size: .88rem; }
.table.import tr.job-row td:nth-child(2) { padding-left: 1.6rem; }
.table.import select { width: auto; padding: .25rem .4rem; }

/* Phase 4: checklists, categories, equipment */
.bad { color: var(--crit); }
.tile-num.bad { color: var(--crit); }
progress { width: 7rem; height: .7rem; vertical-align: middle; accent-color: var(--ok); }
.tiles.stats progress { width: 100%; margin-top: .4rem; }
p.filters a { padding: 0 .2rem; }
ul.cat-tree { list-style: none; margin: 0; padding-left: 1.6rem; border-left: 2px solid #e1e9f2; }
ul.cat-tree.root { padding-left: 0; border-left: 0; }
li.cat-pick { margin: .15rem 0; }
li.cat-pick.depth-0 { margin-top: .7rem; }
.cat-top { font-weight: 700; font-size: 1.05rem; }
.tag-saved { background: #fdf0d8; color: #7a5212; }
.checklist-sec h2 { color: var(--brand); }
.ck-item { padding: .6rem 0 .8rem; border-top: 1px dashed var(--line); }
.ck-item:first-of-type { border-top: 0; }
table.ck { margin-top: .4rem; font-size: .88rem; }
table.ck td { padding: .35rem .4rem; }
table.ck input[type=date] { width: 9.5rem; padding: .3rem .4rem; }
table.ck select { min-width: 9rem; padding: .3rem .4rem; }
table.ck textarea { min-width: 14rem; padding: .3rem .4rem; }
table.ck tr.state-done td { background: #f1faf4; }
table.ck tr.state-overdue td { background: #fdf3f3; }
table.ck tr.state-soon td { background: #fffaf0; }
table.ck tr.state-overdue .state-label { color: var(--crit); font-weight: 600; }
table.ck tr.state-soon .state-label { color: var(--warn); font-weight: 600; }
table.ck tr.state-done .state-label { color: var(--ok); }
table.ck tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.save-bar { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: .75rem 1rem;
  margin: 0 -1.25rem; box-shadow: 0 -4px 12px rgba(0,0,0,.05); z-index: 5; }
details.add-box { margin-top: .75rem; }
details.add-box > summary { list-style: none; }
details.add-box > summary::-webkit-details-marker { display: none; }
details.add-box[open] > summary { margin-bottom: .75rem; }

/* Phase 5: reports */
table.report tr.state-overdue td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
table.report tr.sub-row td { background: #fafbfd; padding-top: .3rem; padding-bottom: .3rem; }
table.report tr.client-row td { border-top: 2px solid var(--line); }
.sched-status-ok { color: var(--ok); } .sched-status-bad { color: var(--crit); }
label.grow { flex: 1 1 100%; }
iframe.email-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.email-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #fff; overflow-x: auto; }

[hidden] { display: none !important; }

/* client readiness sheet (prints on its own: browser Print > Save as PDF) */
.sheet-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.25rem; }
.sheet-head h1 { margin: 0; }
.sheet-score { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
@media print {
  .topbar, .footer, .no-print, .flash { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .page { margin: 0; max-width: none; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  a { color: inherit; text-decoration: none; }
}

/* SECURE-WAN.com logo: on a white chip in the dark top bar, above the name on the sign-in pages, and at the top of
   anything printed or saved as PDF (the top bar itself is not printed). */
.brand-logo { display: inline-flex; align-items: center; background: #fff; border-radius: 6px; padding: 3px 8px; }
.brand-logo img { display: block; height: 26px; width: auto; }
.auth-logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 1rem; }
.print-logo { display: none; }
@media print {
  .print-logo { display: block; height: 42px; width: auto; margin: 0 0 14px; }
  .auth .print-logo { display: none; }
}
.brand-name { white-space: nowrap; }   /* "SecureREADINESS" stays one word (the brand row is a spaced-out flex row) */
