/* Prevanta - styles */
:root {
  --navy: #12324a;
  --navy-2: #1b4565;
  --navy-3: #2a5b80;
  --orange: #e8590c;
  --orange-2: #c94c08;
  --amber: #f08c00;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #dde3e9;
  --line-2: #eef2f5;
  --text: #1c2833;
  --muted: #5d6d7c;
  --faint: #8a98a6;
  --green: #2b8a3e;
  --green-bg: #e6f4ea;
  --red: #c92a2a;
  --red-bg: #fdecec;
  --yellow: #a86b00;
  --yellow-bg: #fff4d6;
  --blue: #1c64b8;
  --blue-bg: #e7f0fb;
  --purple: #6741d9;
  --purple-bg: #f0ebff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 2px 8px rgba(16, 40, 60, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: 58px 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 14px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; letter-spacing: .2px; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand .name { font-size: 1.02rem; white-space: nowrap; }
.brand .acct { font-weight: 400; font-size: .78rem; opacity: .75; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.topbar .spacer { flex: 1; }
.company-pick { display: flex; align-items: center; gap: 6px; background: var(--navy-2); border-radius: 8px; padding: 4px 8px; }
.company-pick label { font-size: .78rem; opacity: .8; }
.company-pick select { background: transparent; color: #fff; border: 0; font: inherit; font-size: .9rem; max-width: 210px; padding: 3px 2px; }
.company-pick select option { color: var(--text); }
.top-btn { background: transparent; border: 1px solid rgba(255, 255, 255, .25); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; position: relative; }
.top-btn:hover { background: rgba(255, 255, 255, .08); }
.top-btn .count { background: var(--orange); color: #fff; border-radius: 99px; font-size: .7rem; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; position: absolute; top: -6px; right: -6px; }
.btn-report { background: var(--orange); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-report:hover { background: var(--orange-2); text-decoration: none; color: #fff; }
.menu-toggle { display: none; }

.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 10px 8px 30px; overflow-y: auto; position: sticky; top: 58px; height: calc(100vh - 58px); }
.nav-group { margin: 10px 0 2px; padding: 0 10px; font-size: .7rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: .92rem; }
svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.top-btn svg { width: 20px; height: 20px; vertical-align: middle; }
.nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav a:hover { background: var(--line-2); text-decoration: none; }
.nav a.active { background: var(--blue-bg); color: var(--navy); font-weight: 600; }
.nav a.active svg { color: var(--blue); }
.nav a .pill { margin-left: auto; }

.main { padding: 22px 26px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards, grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stack > * + * { margin-top: 14px; }
.stack.tight > * + * { margin-top: 6px; }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.stat .label { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 1.9rem; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.accent-green { border-left: 4px solid var(--green); }
.stat.accent-orange { border-left: 4px solid var(--amber); }
.stat.accent-red { border-left: 4px solid var(--red); }
.stat.accent-blue { border-left: 4px solid var(--blue); }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--navy-3); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 13px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #237032; }
.btn-danger { color: var(--red); border-color: #f1c4c4; }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: .82rem; }
.btn-lg { padding: 12px 18px; font-size: 1rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--blue); padding: 0; font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

label.f, .f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 4px; }
.f > span .req { color: var(--red); }
.f .hint { display: block; font-size: .78rem; color: var(--muted); margin-top: 3px; font-weight: 400; }
input:not([type]), input[type=time], input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; border: 1px solid #c9d2db; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .93rem; background: #fff; color: var(--text);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid #4c8fd6; outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--navy); vertical-align: middle; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin-bottom: 8px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.filters .f { margin: 0; min-width: 150px; }
.filters .f.grow { flex: 1; min-width: 200px; }
.form-error { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: .9rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: #f7fafc; }
table.t tr.row-danger td { background: #fff7f7; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* ---------- Badges ---------- */
.pill { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: .74rem; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.purple { background: var(--purple-bg); color: var(--purple); }
.pill.solid-red { background: var(--red); color: #fff; }
.pill.outline { background: #fff; border: 1px solid var(--line); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 14px; border: 0; background: none; font: inherit; font-size: .92rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }

/* ---------- Lists ---------- */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list-item { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .meta { font-size: .82rem; color: var(--muted); }
.list-item .icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--line-2); color: var(--navy-3); flex: none; }
.list-item .icon svg { width: 18px; height: 18px; }
.list-item.overdue { border-left: 3px solid var(--red); }
a.list-item { color: inherit; }
a.list-item:hover { background: #f8fafc; text-decoration: none; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Bars & charts ---------- */
.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.bar.warn > i { background: var(--amber); }
.bar.bad > i { background: var(--red); }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 36px; gap: 8px; align-items: center; font-size: .85rem; margin: 6px 0; }
.hbar .track { height: 14px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbar .track > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* ---------- Dialog, toast, dropdown ---------- */
dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.modal.wide { width: min(920px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 25, 40, .5); }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.1rem; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
.x-btn { background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; font-size: .9rem; animation: pop .2s ease; }
.toast.error { background: var(--red); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); width: 360px; max-width: calc(100vw - 20px); z-index: 50; text-align: left; }
.dropdown .dd-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.dropdown .dd-head span { flex: 1; }
.dropdown .dd-list { max-height: 420px; overflow-y: auto; }
.alert-item { padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-size: .86rem; display: flex; gap: 8px; }
.alert-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--blue); }
.alert-item.danger .dot { background: var(--red); }
.alert-item.warning .dot { background: var(--amber); }
.alert-item a { color: var(--text); font-weight: 600; }
.menu-list button, .menu-list a { display: block; width: 100%; text-align: left; padding: 9px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: var(--line-2); text-decoration: none; }
.rel { position: relative; }

/* ---------- Report wizard ---------- */
.report-wrap { max-width: 720px; margin: 0 auto; }
.notice { background: var(--blue-bg); border: 1px solid #c7dbf3; color: #19406b; border-radius: 8px; padding: 9px 12px; font-size: .88rem; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.notice.warn { background: var(--yellow-bg); border-color: #f3dc9e; color: #6b4a00; }
.notice.danger { background: var(--red-bg); border-color: #f4c2c2; color: #8a1c1c; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.type-card { text-align: left; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 14px; cursor: pointer; font: inherit; color: inherit; display: flex; gap: 12px; }
.type-card:hover { border-color: var(--navy-3); }
.type-card svg { width: 26px; height: 26px; flex: none; }
.type-card b { display: block; font-size: 1rem; margin-bottom: 2px; }
.type-card span { font-size: .85rem; color: var(--muted); }
.type-card.t-near_miss { background: #fffaf0; border-color: #f5d9a4; } .type-card.t-near_miss svg { color: var(--amber); }
.type-card.t-first_aid { background: #f4f8ff; border-color: #c9dbf5; } .type-card.t-first_aid svg { color: var(--blue); }
.type-card.t-injury { background: #fff6f6; border-color: #f2c8c8; } .type-card.t-injury svg { color: var(--red); }
.type-card.t-vehicle { background: #f6f4ff; border-color: #d8cff7; } .type-card.t-vehicle svg { color: var(--purple); }
.type-card.t-hazard { background: #fff9f2; border-color: #f5d3b0; } .type-card.t-hazard svg { color: var(--orange); }
.type-card.t-property { background: #f7f9fa; } .type-card.t-property svg { color: var(--navy-3); }
.type-card.t-other { background: #fff; } .type-card.t-other svg { color: var(--muted); }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--navy); }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-strip figure { margin: 0; position: relative; }
.photo-strip img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-strip button { position: absolute; top: -6px; right: -6px; border-radius: 50%; border: 0; background: var(--red); color: #fff; width: 22px; height: 22px; cursor: pointer; line-height: 22px; padding: 0; }
.dropzone { border: 2px dashed #c3ccd5; border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; display: block; background: #fbfcfd; }
.dropzone:hover { border-color: var(--navy-3); }
.dropzone input { display: none; }

/* ---------- Audit ---------- */
.answer-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; }
.answer-row .q { font-weight: 600; }
.answer-row .ref { font-size: .78rem; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.seg label { padding: 6px 14px; cursor: pointer; font-size: .9rem; border-right: 1px solid var(--line); background: #fff; }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg input:checked + span { font-weight: 700; }
.seg label:has(input[value=yes]:checked) { background: var(--green-bg); color: var(--green); }
.seg label:has(input[value=no]:checked) { background: var(--red-bg); color: var(--red); }
.seg label:has(input[value=na]:checked) { background: var(--line-2); }

/* ---------- Company cards ---------- */
.co-card .co-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: #f7f9fb; border-radius: 8px; padding: 8px; margin: 10px 0; text-align: center; }
.co-card .co-counts b { display: block; font-size: 1.2rem; }
.co-card .co-counts span { font-size: .72rem; color: var(--muted); }
.site { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; margin-top: 8px; background: #fcfdfe; }
.site .rules { font-size: .8rem; color: #3b4a57; margin-top: 6px; }
.site .rules div { margin: 2px 0; }
.verify { color: var(--yellow); font-size: .74rem; font-weight: 600; }
.brand-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .side { background: linear-gradient(160deg, var(--navy) 0%, #0c2233 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.auth .side h1 { font-size: 2rem; margin-bottom: 12px; }
.auth .side ul { padding-left: 18px; line-height: 1.9; opacity: .92; }
.auth .form-side { display: grid; place-items: center; padding: 30px 18px; }
.auth .box { width: min(420px, 100%); }
.auth .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; font-size: 1.15rem; color: var(--navy); }
.auth .logo img { width: 40px; height: 40px; }
.brand-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; line-height: 1.6; }
.demo-box { background: var(--yellow-bg); border: 1px solid #f3dc9e; border-radius: 8px; padding: 10px 12px; font-size: .83rem; margin-top: 16px; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  .topbar, .sidebar, .no-print, .page-head .actions, #toasts, .tabs, .filters { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .card, .table-wrap, .list { box-shadow: none; border-color: #999; }
  .print-only { display: block; }
  table.t th, table.t td { padding: 4px 6px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 58px; bottom: 0; width: 270px; height: auto; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .2); }
  .shell.nav-open .sidebar { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px 14px 90px; }
  .grid-2, .grid-3, .grid-4, .grid-main { grid-template-columns: 1fr; }
  .grid-4.keep-2 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .company-pick label, .brand .acct, .hide-sm { display: none; }
  .company-pick select { max-width: 120px; }
  .auth { grid-template-columns: 1fr; }
  .auth .side { display: none; }
  .type-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { font-weight: 600; margin-top: 6px; }
  .fab-report { position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 35; justify-content: center; padding: 14px; font-size: 1.05rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
  .topbar .btn-report { display: none; }
  .hbar { grid-template-columns: 100px 1fr 30px; }
  .co-card .co-counts { grid-template-columns: repeat(2, 1fr); }
  .topbar { gap: 6px; padding: 0 8px; }
  .top-btn { padding: 6px 8px; }
  .company-pick select { max-width: 96px; }
  .brand .name { font-size: .92rem; }
  .list-item { flex-wrap: wrap; }
  .list-item > .row, .list-item > .btn { margin-left: 46px; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .page-head { flex-wrap: wrap; }
  .main, .card, .stack, .grid > * { min-width: 0; }
}
@media (max-width: 420px) {
  .brand .name { display: none; }
}
@media (min-width: 901px) { .fab-report { display: none; } }

/* Typed-name e-signature */
.signature { font-family: "Brush Script MT", "Segoe Script", "Lucida Handwriting", cursive; font-size: 1.3rem; }
input.signature { border-bottom: 2px solid var(--navy); }
a.list-item:hover { background: var(--bg); }
details > summary::-webkit-details-marker { display: none; }

/* ---------- What's new: dark green ---------- */
:root { --new: #0b5d1e; --new-bg: #e6f2e9; }
.is-new { outline: 2px solid var(--new); outline-offset: 2px; position: relative; }
.is-new::after { content: "NEW"; position: absolute; top: -9px; right: -8px; background: var(--new); color: #fff; font-size: .6rem; font-weight: 700; letter-spacing: .5px; padding: 1px 5px; border-radius: 99px; line-height: 14px; pointer-events: none; z-index: 2; }
.nav a.is-new { outline: none; color: var(--new); font-weight: 700; background: var(--new-bg); }
.nav a.is-new svg { color: var(--new); }
.nav a.is-new::after { top: 50%; right: 8px; transform: translateY(-50%); }
.btn.is-new, .ask-btn.is-new { color: var(--new); border-color: var(--new); }
.btn-primary.is-new, .ask-btn.is-new { background: var(--new); color: #fff; }
.card.is-new, h1 .is-new, span.is-new { outline-offset: 4px; }
.pill.new { background: var(--new); color: #fff; }

/* ---------- Practice mode ---------- */
.practice-bar { grid-column: 1 / -1; background: repeating-linear-gradient(45deg, #fff4d6, #fff4d6 12px, #ffe9a8 12px, #ffe9a8 24px); color: #5c4400; padding: 6px 14px; display: flex; align-items: center; gap: 10px; font-size: .88rem; position: sticky; top: 0; z-index: 31; border-bottom: 1px solid #e0c060; }
.practice-bar svg { width: 18px; height: 18px; }
.practice-bar a { margin-left: auto; color: #5c4400; font-weight: 600; }
.practice-bar button { background: #5c4400; color: #fff; border: 0; border-radius: 6px; padding: 4px 10px; font: inherit; cursor: pointer; }
.shell.practice .topbar { top: 33px; }

/* ---------- Training coach panel ---------- */
.coach { position: fixed; right: 16px; bottom: 70px; width: 360px; max-height: calc(100vh - 110px); overflow: auto; background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); z-index: 1000; border: 2px solid var(--navy); font-size: .92rem; color: var(--text, #1d2733); }
.coach-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; background: var(--navy); color: #fff; padding: 10px 12px; position: sticky; top: 0; }
.coach-x { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 1rem; line-height: 1; }
.coach-bar { height: 5px; background: #e6ebf0; } .coach-bar span { display: block; height: 100%; background: var(--orange); transition: width .3s; }
.coach-body { padding: 12px 14px 14px; }
.coach-do { font-size: 1.02rem; font-weight: 600; margin: 4px 0; }
.coach-why { max-height: 0; overflow: hidden; transition: max-height .35s ease; background: #f4f8fc; border-radius: 10px; margin-top: 10px; }
.coach-why.open { max-height: 900px; padding: 4px 12px 10px; border-left: 4px solid var(--blue); }
.coach-why h4 { margin: 10px 0 2px; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.coach-why p { margin: 0; }
.coach.minimized { width: auto; max-height: none; } .coach.minimized .coach-body, .coach.minimized .coach-bar { display: none; }
.coach.flash { animation: coachflash .6s; }
@keyframes coachflash { 0% { box-shadow: 0 0 0 0 rgba(43,138,62,.7); } 100% { box-shadow: 0 12px 40px rgba(0,0,0,.28), 0 0 0 14px rgba(43,138,62,0); } }
.coach-result { left: 50%; right: auto; bottom: auto; top: 20%; transform: translateX(-50%); width: 380px; text-align: center; }
.tour-hl { outline: 3px solid #f59f00 !important; outline-offset: 3px; border-radius: 6px; animation: tourpulse 1.6s infinite; position: relative; z-index: 5; }
.tour-hl-strong { box-shadow: 0 0 0 9999px rgba(15, 30, 45, .35) !important; }
@keyframes tourpulse { 0%, 100% { outline-color: #f59f00; } 50% { outline-color: #ffd43b; } }
.lesson.passed { border-left: 4px solid var(--green); }

/* ---------- Assistant ---------- */
.ask-btn { position: fixed; right: 16px; bottom: 16px; z-index: 900; background: var(--navy); color: #fff; border: 0; border-radius: 99px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); display: inline-flex; align-items: center; gap: 6px; }
.ask-panel { position: fixed; right: 16px; bottom: 70px; width: 380px; height: min(560px, calc(100vh - 140px)); background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); z-index: 950; display: flex; flex-direction: column; overflow: hidden; }
.ask-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f7f9fb; }
.ask-msg { padding: 8px 10px; border-radius: 10px; max-width: 92%; font-size: .9rem; }
.ask-msg.me { align-self: flex-end; background: var(--navy); color: #fff; }
.ask-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.ask-hit { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.ask-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.ask-form input { flex: 1; }
@media (max-width: 900px) {
  .ask-btn { bottom: 80px; padding: 10px 12px; } .ask-btn span { display: none; }
  .ask-panel { left: 8px; right: 8px; width: auto; bottom: 130px; }
  .coach { left: 8px; right: 8px; width: auto; bottom: 80px; max-height: 55vh; }
  .shell.practice .topbar { top: 33px; }
}
@media print { .coach, .ask-btn, .ask-panel, .practice-bar { display: none !important; } }
.shell.practice { grid-template-rows: 33px 58px 1fr; }
.shell.practice .sidebar { top: 91px; height: calc(100vh - 91px); }
.practice-bar { height: 33px; box-sizing: border-box; white-space: nowrap; overflow: hidden; }
@media (max-width: 900px) { .shell.practice .sidebar { top: 91px; } }
/* While a window (dialog) is open the coach moves to the left so it never covers the window's buttons. */
.coach.in-dialog { left: 12px; right: auto; top: 70px; bottom: auto; width: max(210px, min(320px, calc((100vw - 960px) / 2))); max-height: calc(100vh - 90px); }
@media (max-width: 1100px) {
  .coach.in-dialog { top: 6px; left: 6px; right: 6px; width: auto; max-height: 30vh; }
  .coach.in-dialog .coach-why, .coach.in-dialog .coach-bar { display: none; }
}
body.coaching .main { padding-bottom: 440px; }
.coach.dock-left:not(.in-dialog) { right: auto; left: calc(var(--sidebar) + 16px); }
@media (max-width: 900px) { .coach.dock-left:not(.in-dialog) { left: 8px; right: 8px; top: 100px; bottom: auto; } }
:lang(es) .is-new::after { content: "NUEVO"; }
