:root {
  --navy: #1F3864; --navy-2: #2B4A80; --ink: #14213D; --ink-2: #3D4A5C; --muted: #5A6678;
  --line: #D9DEE8; --line-2: #E9EDF3; --bg: #F5F6F8; --card: #FFFFFF; --accent: #B8651E; --accent-soft: #FBEFE3;
  --good: #0b7a0b; --good-bg: #E6F4E6; --warn: #8A5A00; --warn-bg: #FFF4D6; --serious: #A84A1F; --serious-bg: #FDEBE2;
  --crit: #B42323; --crit-bg: #FBE5E5; --info: #1F5FA8; --info-bg: #E5EEF9; --neutral-bg: #EEF0F4;
  --radius: 8px; --shadow: 0 1px 2px rgba(20,33,61,.06), 0 1px 1px rgba(20,33,61,.04);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--navy-2); }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #DCE3F0; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 8px 2px; }
.brand small { display: block; color: #AFC0DD; font-weight: 400; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.side nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.side nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8FA3C6; margin: 14px 8px 4px; }
.side nav a { color: #DCE3F0; text-decoration: none; padding: 7px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side nav a.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #E39A4F; }
.side .pill { background: #E39A4F; color: #14213D; border-radius: 10px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side .me { border-top: 1px solid rgba(255,255,255,.12); margin-top: 18px; padding: 12px 8px 0; font-size: 12px; color: #AFC0DD; }
.side .me b { color: #fff; display: block; font-size: 13px; }
.side .me form { display: inline; }
.side .me button { background: none; border: 0; color: #AFC0DD; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
main { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.topbar { background: var(--navy); color: #fff; }
.topbar .in { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.topbar a { color: #DCE3F0; text-decoration: none; padding: 6px 8px; border-radius: 6px; }
.topbar a.on, .topbar a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .brand { padding: 0; margin-right: 10px; }
.topbar .sp { flex: 1; }
.topbar form button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.narrow { max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; }

/* ---------- cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.card h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 a { font-size: 12px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

/* stat tiles */
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--navy-2); }
.tile .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .val { font-size: 28px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 14px; color: var(--muted); font-weight: 500; }
.tile .foot { font-size: 12px; color: var(--ink-2); }
.tile.alert { border-left: 4px solid var(--crit); }
.tile.warn { border-left: 4px solid #E0A100; }
.tile.ok { border-left: 4px solid var(--good); }

/* meters */
.meter { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; display: flex; gap: 2px; }
.meter > span { display: block; height: 100%; background: var(--navy-2); border-radius: 4px; }
.meter.big { height: 14px; }
.seg-approved { background: #0ca30c !important; }
.seg-submitted { background: #2B6CB0 !important; }
.seg-progress { background: #E0A100 !important; }
.seg-todo { background: #B9C2D0 !important; }
.seg-rework { background: #d03b3b !important; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.secrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 70px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.secrow:last-child { border-bottom: 0; }
.secrow a { text-decoration: none; color: var(--ink); }
.secrow a:hover { text-decoration: underline; }

/* badges */
.b { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--ink-2); }
.b::before { font-size: 10px; }
.b-ok { background: var(--good-bg); color: var(--good); } .b-ok::before { content: "\2714"; }
.b-warn { background: var(--warn-bg); color: var(--warn); } .b-warn::before { content: "\25B2"; }
.b-bad { background: var(--crit-bg); color: var(--crit); } .b-bad::before { content: "\2716"; }
.b-info { background: var(--info-bg); color: var(--info); } .b-info::before { content: "\25CF"; }
.b-serious { background: var(--serious-bg); color: var(--serious); } .b-serious::before { content: "!"; font-weight: 900; }
.b-plain::before { content: none; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: #fff; white-space: nowrap; }
.is-overdue { color: var(--crit); font-weight: 600; }
.is-soon { color: var(--serious); font-weight: 600; }
.is-upcoming { color: var(--warn); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #FAFBFC; position: sticky; top: 0; }
tr:hover td { background: #FAFBFD; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.list li:last-child { border-bottom: 0; }
.empty { color: var(--muted); padding: 10px 0; }

/* forms */
label { display: block; font-weight: 600; font-size: 12.5px; margin: 10px 0 4px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #C5CCD8; border-radius: 6px; font: inherit; color: var(--ink); background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid #2B6CB0; outline-offset: 1px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.btn { display: inline-block; background: var(--navy); color: #fff; border: 1px solid var(--navy); padding: 8px 14px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn.sec { background: #fff; color: var(--navy); border-color: #B7C1D3; }
.btn.sec:hover { background: #F1F4F9; }
.btn.warn { background: var(--crit); border-color: var(--crit); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--navy); border-color: var(--accent); font-weight: 600; }
.flash { background: var(--good-bg); border: 1px solid #B5DDB5; color: #0A520A; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.error { background: var(--crit-bg); border: 1px solid #F0B9B9; color: #8A1616; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.notice { background: var(--warn-bg); border: 1px solid #F1D58A; color: #6B4600; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.inline { display: inline; }
details { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: #fff; }
details + details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
pre.report { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }
.quote { background: #FAFBFC; border-left: 3px solid var(--line); padding: 10px 12px; white-space: pre-wrap; font-size: 13px; }
.scss { border-left-color: var(--accent); background: var(--accent-soft); }
.qtable td:first-child { width: 48%; }
.qtable .opt { white-space: nowrap; }
.qtable .opt label { display: inline-flex; gap: 4px; font-weight: 500; margin: 0 8px 0 0; }
.qtable .opt input { width: auto; }
.cal-month { margin-top: 18px; }
.cal-month h3 { border-bottom: 2px solid var(--navy); padding-bottom: 4px; }
.auth { max-width: 400px; margin: 9vh auto; padding: 0 16px; }
.auth .card { padding: 26px; }
.auth .brand-line { text-align: center; margin-bottom: 18px; }
.auth .brand-line b { display: block; color: var(--navy); font-size: 17px; }
.status-big { font-size: 20px; font-weight: 700; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-wide { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; } .side nav .grp { display: none; }
  main { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
@media print { .side, .topbar, .btns, .filters, form button { display: none !important; } .shell { display: block; } body { background: #fff; } .card { box-shadow: none; } }

/* AI review */
.ai-box { border: 1px dashed #B7C1D3; border-radius: 6px; padding: 10px 12px; margin: 8px 0; background: #FAFBFD; }
.ai-checks { list-style: none; margin: 6px 0; padding: 0; font-size: 12.5px; }
.ai-checks li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.ai-checks li:last-child { border-bottom: 0; }
.ai-ico { width: 18px; flex: none; font-weight: 700; text-align: center; }
.ai-pass .ai-ico { color: var(--good); } .ai-fail .ai-ico { color: var(--crit); } .ai-unclear .ai-ico { color: var(--warn); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy-2); text-decoration: underline; cursor: pointer; font: inherit; }
.ai-note { background: var(--warn-bg); border: 1px solid #F1D58A; border-radius: 6px; padding: 8px 10px; margin-top: 6px; color: #6B4600; }
.checkrow { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.batchbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; position: sticky; top: 8px; z-index: 2; }
/* platform owner: company switcher in the sidebar */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.side .switcher { display: flex; gap: 6px; padding: 6px 8px 10px; margin: 0; }
.side .switcher select { flex: 1; min-width: 0; font-size: 12px; padding: 4px 6px; }
.side .switcher .btn { padding: 4px 8px; }
.co-list td .small { display: block; }
.kv dd { overflow-wrap: anywhere; }

/* client profile banner in the side menu */
.clientflag { margin: 8px 0 4px; padding: 8px 10px; border-radius: 6px; background: #E0A100; color: #14213D; font-size: 12px; font-weight: 600; }
.clientflag form { display: inline; }
.clientflag button { background: none; border: 0; padding: 0; margin-left: 4px; color: #14213D; text-decoration: underline; cursor: pointer; font: inherit; }

/* help box in the side menu, help pages */
.helpbox { margin: 10px 0 6px; }
.helpbox input { width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 13px; }
.helpbox input::placeholder { color: #C9D3E6; }
.helpdoc h3 { margin: 16px 0 6px; }
.helpdoc li { margin: 3px 0; }

/* platform logo (CTPATLynk) */
.plogo { display: block; padding: 2px 8px 12px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.12); }
.plogo img { display: block; height: 27px; width: auto; }
.topbar .plogo { padding: 0; margin: 0 6px 0 0; border: 0; }
.topbar .plogo img { height: 24px; }
.auth .brand-line .authlogo { display: block; margin: 0 auto 8px; height: 43px; width: auto; }

/* company logo */
.cologo { background: #fff; border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; display: flex; align-items: center; justify-content: center; }
.cologo img { display: block; max-width: 100%; max-height: 56px; width: auto; height: auto; }
.topbar .cologo-top { display: block; max-height: 34px; max-width: 140px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.auth .cobrand .cologo-lg { display: block; margin: 0 auto 12px; max-width: 260px; max-height: 90px; width: auto; height: auto; }
.auth .cobrand b { font-size: 19px; }
.auth .poweredby { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; font-size: 11px; color: var(--muted); }
.auth .poweredby img { height: 18px; width: auto; }
.logo-preview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: inline-flex; }
.logo-preview img { max-height: 80px; max-width: 260px; }

/* phones: the menu folds away behind a Menu button */
.sidetop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidetop .plogo { flex: 1; }
.menubtn { display: none; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; }
@media (max-width: 820px) {
  .menubtn { display: block; }
  .side { padding: 10px 12px; }
  .side .sidetop .plogo { border: 0; margin: 0; padding: 2px 0; }
  .side:not(.open) > *:not(.sidetop):not(.clientflag) { display: none; }
  .side.open nav { flex-direction: column; } .side.open nav .grp { display: block; }
  .btn, button.btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; } /* no zoom-in on iPhone */
  .tbl-wrap { overflow-x: auto; }
}
/* camera and scanning buttons under file inputs */
.camtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 4px; }
.camtools .camstatus { flex-basis: 100%; }
.geo { display: inline-block; font-size: 12px; color: var(--muted); }
/* digital forms (phones and tablets) */
.dform .card { margin-bottom: 14px; }
.dform .wrap2 { flex-wrap: wrap; } .dform .wrap2 > div { flex: 1 1 240px; }
.dpoint { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.dpoint legend { font-weight: 600; padding: 0; margin-bottom: 6px; float: left; width: 100%; }
.dpoint legend + * { clear: both; }
.dpoint.missing legend { color: #8A1616; }
.pn { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 13px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; margin-right: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid #C9D1DC; border-radius: 8px; font-weight: 600; background: #fff; cursor: pointer; text-align: center; padding: 4px; }
.seg input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
.seg-pass input:checked + span { background: #DDF1E1; border-color: #1E6B3A; color: #14532D; }
.seg-fail input:checked + span { background: #FBE2E2; border-color: #B42318; color: #7F1D1D; }
.seg-na input:checked + span { background: #ECEFF3; border-color: #6B7280; color: #374151; }
.sigpad { width: 100%; max-width: 500px; height: auto; aspect-ratio: 10 / 3; border: 1px dashed #9AA6B5; border-radius: 8px; background: #fff; touch-action: none; display: block; margin-top: 6px; }
.btn.big { padding: 14px 26px; font-size: 16px; }
.dline { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.bad { color: #8A1616; }
.emailitem { border-top: 1px solid var(--line); padding: 12px 0; } .emailitem:first-of-type { border-top: 0; padding-top: 4px; }

[hidden] { display: none !important; }
.dhint { margin: 0; line-height: 1.45; }

.langswitch{text-align:center;font-size:13px;margin-top:10px}.langswitch a{color:var(--muted,#5b6577)}.langswitch a.on{font-weight:600;color:var(--ink,#1b2f52);text-decoration:none}
/* online training quiz */
fieldset.quizq { border: 1px solid #D9DEE8; border-radius: 8px; padding: 10px 14px 6px; margin: 0 0 12px; }
fieldset.quizq legend { padding: 0 4px; font-size: 15px; }
fieldset.quizq .check { margin: 6px 0; }
.qedit textarea { font-size: 13px; }
.learnitem { padding: 12px 0; border-top: 1px solid #E5E9F0; }
.learnitem:first-of-type { border-top: 0; }
.learnrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.ideas { border-left: 3px solid #F0A830; background: #FFF8EC; padding: 6px 10px; margin: 6px 0; border-radius: 4px; }
.ideas ul { margin: 4px 0 0; padding-left: 18px; }

/* Install the app page: the steps for this device are shown first (all are shown without JavaScript) */
.install-page .qr { border: 1px solid #DDE3EE; border-radius: 8px; padding: 6px; background: #fff; }
.install-page .os-block { margin-top: 14px; }
.install-page .ok-note { background: #EAF6EE; border-left: 4px solid #2E8B57; padding: 8px 12px; border-radius: 6px; }
html[data-os="ios"] .install-page .os-block:not(.os-ios),
html[data-os="android"] .install-page .os-block:not(.os-android),
html[data-os="desktop"] .install-page .os-block:not(.os-desktop) { display: none; }
html.is-app [data-install-link] { display: none; }
.install-page .install-h { display: flex; align-items: center; gap: 12px; }
.install-page .install-h img { border-radius: 10px; }
