:root {
  --navy: #43174d; --navy-2: #57205f; --primary: #8c3693; --primary-600: #9e45a5; --primary-50: #f7eff8; --accent: #c89b3c;
  --bg: #f3f5f8; --surface: #ffffff; --border: #e2e6ec; --border-strong: #cdd3dc; --line: #edf0f4;
  --text: #1b2533; --muted: #667085; --faint: #98a2b3;
  --green: #1f7a4d; --green-bg: #e8f4ee; --amber: #a6670f; --amber-bg: #fbf2e2;
  --red: #b42318; --red-bg: #fcebea; --grey-bg: #f1f3f6;
  --radius: 6px; --shadow: 0 1px 2px rgba(16,24,40,.04);
  --panel-w: 480px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13.5px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 19px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 14px; margin: 0; font-weight: 650; }
h3 { font-size: 11px; margin: 0 0 8px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { background: var(--navy); color: #e6d6e9; display: flex; flex-direction: column; }
.brand { padding: 20px 20px 18px; display: flex; gap: 11px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .mark { width: 34px; height: 34px; border-radius: 6px; background: #fff; display: grid; place-items: center; flex: none; }
.brand .mark svg { width: 20px; height: 20px; }
.brand b { display: block; font-size: 15px; color: #fff; letter-spacing: .01em; }
.brand span { font-size: 11.5px; color: #c3a8c8; }
.nav { padding: 14px 10px; flex: 1; }
.nav .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #a786ad; padding: 6px 12px 6px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 5px; cursor: pointer; text-align: left; color: #e6d6e9; position: relative; margin-bottom: 2px; }
.nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav button.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav button.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; }
.me { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.side .avatar { background: rgba(255,255,255,.12); color: #fff; }
.me .who { flex: 1; min-width: 0; color: #fff; }
.me .who small { display: block; color: #c3a8c8; font-size: 11.5px; }
.me .btn { color: #e6d6e9; border-color: rgba(255,255,255,.18); background: transparent; }
.me .btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.main { overflow: auto; position: relative; }
.topbar { position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--border); padding: 14px 28px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 68px; }
.topbar .titles { flex: 1; min-width: 220px; }
.topbar .crumb { font-size: 11.5px; color: var(--muted); margin-bottom: 1px; }
.topbar .crumb b { color: var(--text); font-weight: 600; }
.topbar .controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page { padding: 22px 28px 60px; max-width: 1480px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .hint { margin-left: auto; }
.mobile-bar { display: none; }

/* page header = white top bar; everything after it gets page padding */
#page { padding-bottom: 60px; }
#page > .head { position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--border); padding: 14px 28px; margin: 0 0 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 70px; }
#page > .head .grow { flex: 1; min-width: 240px; }
#page > .head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#page > :not(.head) { margin-left: 28px; margin-right: 28px; max-width: 1480px; }
/* older section style: heading + content inside one card */
.card.section:not(:has(> .section-head)) { padding: 16px 18px; }
.card.section > h2 { margin: 0 0 14px; }
.card.section > .table-wrap { margin: 0 -18px -16px; border-top: 1px solid var(--line); }
.card.section > .table-wrap .list th:first-child, .card.section > .table-wrap .list td:first-child { padding-left: 18px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 5px; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; white-space: nowrap; font-weight: 500; line-height: 1.35; }
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #74297a; }
.btn.danger { color: var(--red); border-color: #f0c4c0; }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
select, input:not([type]), input[type=text], input[type=number], input[type=password], input[type=search], input[type=month], textarea {
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 7px 10px; background: #fff; min-width: 0; line-height: 1.35;
}
select { padding-right: 28px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23667085'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; cursor: pointer; }
textarea { width: 100%; resize: vertical; min-height: 70px; }
select:focus, input:focus, textarea:focus { outline: 3px solid #ecd9ee; border-color: var(--primary-600); }
.search { width: 240px; padding-left: 32px !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center / 15px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 5px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: #fff; padding: 7px 13px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--primary-50); color: var(--primary); font-weight: 600; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: #344054; margin-bottom: 5px; }
label.field input, label.field select, label.field textarea { width: 100%; }
.req::after { content: " *"; color: var(--red); }
.hint { font-size: 12px; color: var(--muted); }
.err-text { color: var(--red); font-size: 12px; margin-top: 4px; }
.invalid { border-color: var(--red) !important; background: #fffafa; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat { padding: 15px 18px 14px; position: relative; }
.stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat.alert .value { color: var(--red); }
.stat .bar { margin-top: 10px; }
.delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }
.section { margin-bottom: 18px; }
.section-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.section-head h2 { flex: 1; }
.section-head .hint { font-weight: 400; }
.section-body { padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.grey { background: var(--grey-bg); color: #475467; }
.badge.blue { background: var(--primary-50); color: var(--primary); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; background: var(--grey-bg); color: #475467; white-space: nowrap; }
.count { background: var(--red); color: #fff; border-radius: 999px; font-size: 10.5px; padding: 1px 7px; font-weight: 700; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; border: 1px solid; border-left-width: 4px; background: #fff; }
.banner.green { border-color: #cfe7da; border-left-color: var(--green); }
.banner.amber { border-color: #f1e0bf; border-left-color: var(--accent); }
.banner.red { border-color: #f3cdc9; border-left-color: var(--red); }
.banner .grow { flex: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
.list th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #f9fafb; white-space: nowrap; user-select: none; }
.list th.sort { cursor: pointer; }
.list th.sort:hover { color: var(--text); }
.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tr.click { cursor: pointer; }
.list tr.click:hover td { background: #fbf7fb; }
.list tr.sel td { background: var(--primary-50) !important; }
.list tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.list tr.group td { background: #f9f5f9; cursor: default; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); padding: 9px 14px; }
.list tr.group:hover td { background: #f9f5f9; }
.list tr.problem td { background: #fff6f5; }
.list tr.problem td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .muted, .muted { color: var(--muted); }
.person-row { display: flex; align-items: center; gap: 10px; }
.person-row .avatar { width: 28px; height: 28px; font-size: 11px; }
.person-row .nm { font-weight: 600; }
.person-row .nm small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.person-row .scores { margin-left: auto; display: flex; gap: 18px; font-size: 12px; color: var(--muted); }
.person-row .scores b { color: var(--text); font-size: 13px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.kname { font-weight: 550; color: var(--text); }
.kname small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 1px; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .btn { margin-top: 12px; }
.bar { height: 6px; background: #edf0f4; border-radius: 999px; overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.scorecell { display: flex; align-items: center; gap: 10px; }
.scorecell .bar { flex: 1; max-width: 130px; }
.scorecell b { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- panel ---------- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 100vw; background: #fff; border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(67,23,77,.12); display: flex; flex-direction: column; z-index: 20; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.panel-head { padding: 16px 20px 0; border-bottom: 1px solid var(--border); }
.panel-head .top { display: flex; gap: 10px; align-items: flex-start; }
.panel-head .title { flex: 1; font-weight: 650; font-size: 15.5px; }
.panel-head .title small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tabs { display: flex; gap: 2px; margin-top: 12px; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; }
.tabs button.on { color: var(--primary); border-color: var(--primary); }
.panel-body { flex: 1; overflow: auto; padding: 18px 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: #f9fafb; }
.panel-foot .grow { flex: 1; }
.x { border: 0; background: none; cursor: pointer; padding: 2px 7px; border-radius: 5px; color: var(--muted); font-size: 20px; line-height: 1; }
.x:hover { background: var(--grey-bg); color: var(--text); }
.infobox { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 16px; font-size: 13px; }
.infobox p { margin: 0 0 6px; }
.infobox p:last-child { margin: 0; }
.scorebox { display: flex; align-items: center; gap: 14px; border-radius: var(--radius); padding: 12px 14px; margin: 4px 0 16px; border: 1px solid var(--border); border-left-width: 4px; }
.scorebox .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.scorebox.green { border-left-color: var(--green); background: #f6fbf8; }
.scorebox.amber { border-left-color: var(--accent); background: #fdfaf3; }
.scorebox.red { border-left-color: var(--red); background: #fef8f7; }
.scorebox.grey { border-left-color: var(--faint); background: var(--grey-bg); }
table.rules { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 5px; }
.rules td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.rules td:first-child { width: 64px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rules tr.hit td { background: var(--primary-50); font-weight: 600; color: var(--primary); }
.levels label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--border); border-radius: 5px; margin-bottom: 6px; cursor: pointer; }
.levels label:hover { border-color: var(--border-strong); }
.levels label.on { border-color: var(--primary-600); background: var(--primary-50); }
.levels b { min-width: 42px; }
.files { list-style: none; padding: 0; margin: 0 0 8px; }
.files li { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 5px; margin-bottom: 6px; font-size: 13px; }
.files li a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--border); margin-left: 5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary-600); }
.timeline .when { font-size: 12px; color: var(--muted); }
.history-mini { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.history-mini span { font-size: 12px; padding: 3px 9px; border-radius: 4px; background: var(--grey-bg); }
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.steps-edit { width: 100%; border-collapse: collapse; margin: 6px 0; }
.steps-edit td { padding: 3px 4px 3px 0; }
.steps-edit input { width: 100%; }
.measure-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 10px; background: #fbfcfd; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(67,23,77,.35); display: grid; place-items: center; z-index: 40; }
.modal { background: #fff; border-radius: 8px; padding: 22px; width: min(460px, 92vw); box-shadow: 0 24px 48px rgba(67,23,77,.2); }
.modal h2 { font-size: 16px; }
.modal p { margin: 8px 0 16px; color: #344054; }
.modal ul { margin: 6px 0 16px; padding-left: 18px; max-height: 260px; overflow: auto; font-size: 13px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; }
#toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 13px; box-shadow: 0 8px 20px rgba(0,0,0,.2); animation: slide .16s ease-out; border-left: 3px solid var(--accent); }
.toast.err { background: var(--red); border-left-color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr); background: #fff; }
.login .hero { position: relative; overflow: hidden; color: #e6d6e9; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(200,155,60,.16), transparent 60%),
    radial-gradient(900px 500px at -20% 120%, rgba(140,54,147,.35), transparent 60%),
    linear-gradient(160deg, #43174d 0%, #331039 100%); }
.login .hero::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.login .hero > * { position: relative; }
.login .hero .brand { padding: 0; border: 0; }
.login .hero .brand b { font-size: 16px; }
.login .hero-main { max-width: 520px; }
.login .eyebrow { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; padding-left: 28px; position: relative; }
.login .eyebrow::before { content: ""; position: absolute; left: 0; top: 50%; width: 18px; height: 2px; background: var(--accent); }
.login .hero h2 { color: #fff; font-size: 38px; font-weight: 650; line-height: 1.15; letter-spacing: -.025em; margin: 0 0 16px; }
.login .hero-main > p { font-size: 15px; line-height: 1.65; color: #aebcd2; margin: 0 0 34px; max-width: 460px; }
.login .features { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.login .features li { display: flex; gap: 14px; align-items: flex-start; }
.login .features .fi { width: 38px; height: 38px; border-radius: 8px; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: #e6c37a; }
.login .features .fi svg { width: 19px; height: 19px; }
.login .features b { display: block; color: #fff; font-weight: 600; font-size: 14px; }
.login .features small { display: block; color: #c3a8c8; font-size: 13px; margin-top: 2px; }
.login .hero-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #a786ad; border-top: 1px solid rgba(255,255,255,.08); padding-top: 18px; }
.login .formside { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 32px 24px; background: #fff; position: relative; }
.login form { width: min(380px, 100%); margin: auto 0; }
.login .form-mark { width: 44px; height: 44px; border-radius: 10px; background: var(--navy); display: grid; place-items: center; margin-bottom: 22px; box-shadow: 0 6px 16px rgba(67,23,77,.2); }
.login .form-mark svg { width: 24px; height: 24px; }
.login .form-mark svg path { stroke: #fff; }
.login h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
.login .lead { color: var(--muted); margin: 6px 0 26px; font-size: 14px; }
.login-err { background: var(--red-bg); color: var(--red); border: 1px solid #f3c9c5; border-radius: 6px; padding: 9px 12px; font-size: 13px; margin-bottom: 16px; }
.lfield { display: block; margin-bottom: 16px; }
.lfield > span { display: block; font-size: 12.5px; font-weight: 600; color: #344054; margin-bottom: 6px; }
.inwrap { position: relative; display: flex; align-items: center; }
.inwrap > svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.inwrap input { width: 100%; height: 44px; padding: 0 44px 0 40px !important; border-radius: 7px !important; font-size: 14px; border: 1px solid var(--border-strong); background: #fff; }
.inwrap input:focus { outline: 3px solid #ecd9ee; border-color: var(--primary-600); }
.inwrap input:focus ~ svg, .inwrap:focus-within > svg { color: var(--primary); }
.peek { position: absolute; right: 6px; width: 34px; height: 34px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--faint); display: grid; place-items: center; }
.peek:hover, .peek.on { color: var(--primary); background: var(--primary-50); }
.peek svg { width: 18px; height: 18px; }
.login .signin { width: 100%; height: 44px; justify-content: center; font-size: 14.5px; font-weight: 600; border-radius: 7px; margin-top: 6px; box-shadow: 0 4px 12px rgba(140,54,147,.22); }
.login .help { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.login .demo { font-size: 12px; color: var(--amber); background: var(--amber-bg); border-radius: 6px; padding: 8px 12px; margin-top: 16px; text-align: center; }
.login .form-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); margin-top: 28px; }
/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: #667085; font-family: inherit; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 7px) !important; }
.attention { list-style: none; padding: 0; margin: 0; }
.attention li { padding: 10px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.attention li:last-child { border: 0; }
.attention .grow { flex: 1; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dist { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--grey-bg); margin: 4px 0 12px; }
.dist i { display: block; height: 100%; }
.dist-legend { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 12.5px; }
.dist-legend span { display: flex; align-items: center; gap: 8px; color: #344054; }
.dist-legend span i { width: 10px; height: 10px; border-radius: 2px; }
.dist-legend b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: 1fr; } }
.tabbar { display: none; }
@media (max-width: 900px) {
  /* app-style layout for phones and small tablets */
  .shell { grid-template-columns: 1fr; height: 100dvh; grid-template-rows: 1fr auto; }
  .side { display: none; }
  .main { -webkit-overflow-scrolling: touch; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 8; }
  .mobile-bar .mark { width: 28px; height: 28px; border-radius: 6px; background: #fff; display: grid; place-items: center; }
  .mobile-bar .mark svg { width: 17px; height: 17px; }
  .mobile-bar b { font-size: 15px; }
  .mobile-bar .grow { flex: 1; }
  .mobile-bar .avatar { width: 30px; height: 30px; background: rgba(255,255,255,.14); color: #fff; }
  .mobile-bar .btn { background: transparent; color: #e6d6e9; border-color: rgba(255,255,255,.2); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 14px rgba(67,23,77,.06); z-index: 9; }
  .tabbar button { border: 0; background: none; padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); cursor: pointer; position: relative; }
  .tabbar button svg { width: 22px; height: 22px; }
  .tabbar button.on { color: var(--primary); }
  .tabbar button.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .tabbar .dot { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--red); color: #fff; font-style: normal; font-size: 10px; min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; padding: 0 4px; }

  /* page header: title on top, filters full width */
  #page > .head { position: static; padding: 14px 14px 12px; margin-bottom: 14px; min-height: 0; gap: 8px; }
  #page > .head .grow { flex-basis: 100%; min-width: 0; }
  #page > .head h1 { font-size: 18px; }
  #page > .head select, #page > .head .seg, #page > .head .btn { flex: 1 1 auto; min-height: 40px; }
  #page > .head .seg button { flex: 1; }
  #page > :not(.head) { margin-left: 12px; margin-right: 12px; }
  .toolbar > * { flex: 1 1 140px; min-height: 40px; }
  .toolbar .hint { flex-basis: 100%; margin: 0; }
  .search { width: 100%; }
  select, input:not([type]), input[type=text], input[type=number], input[type=password], input[type=search], input[type=month], textarea { font-size: 16px; } /* stops phones zooming in */
  .btn { min-height: 38px; }
  .banner { flex-wrap: wrap; }

  /* tiles: two per row, compact */
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px 13px; }
  .stat .label { font-size: 10px; }
  .stat .value { font-size: 22px; }
  .stat .foot { font-size: 11.5px; }
  .grid2 { grid-template-columns: 1fr; gap: 14px; }
  .section-head { padding: 12px 14px; flex-wrap: wrap; }
  .section-body { padding: 14px; }

  /* tables become cards */
  .table-wrap { overflow: visible; }
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .list tbody tr:last-child { border-bottom: 0; }
  .list td { border: 0 !important; padding: 3px 0 !important; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: right; min-height: 26px; }
  .list td::before { content: attr(data-label); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; flex: none; }
  .list td:first-child { display: block; text-align: left; padding-bottom: 6px !important; }
  .list td:first-child::before { display: none; }
  .list td.nolabel:empty, .list td.nolabel:not(:has(*)) { display: none; }
  .list td.nolabel::before { display: none; }
  .list td .scorecell { justify-content: flex-end; flex: 1; }
  .list td .scorecell .bar { max-width: 120px; }
  .list td.num { text-align: right; }
  .list tr.group { padding: 0; border-bottom: 1px solid var(--border); }
  .list tr.group td { padding: 10px 14px !important; background: #f9f5f9; }
  .person-row { flex-wrap: wrap; }
  .person-row .scores { margin-left: 0; width: 100%; gap: 12px; flex-wrap: wrap; }
  .list tr.sel td:first-child, .list tr.problem td:first-child { box-shadow: none; }
  .list tr.sel { box-shadow: inset 3px 0 0 var(--primary); background: var(--primary-50); }
  .list tr.problem { box-shadow: inset 3px 0 0 var(--red); background: #fff6f5; }
  .list tr.sel td, .list tr.problem td { background: transparent !important; }
  .card.section > .table-wrap { margin: 0 -18px -16px; }
  .attention li { flex-wrap: wrap; padding: 10px 14px; }

  /* side panel becomes a full-screen page */
  .panel { width: 100vw; border-left: 0; animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
  .panel-head { padding: 12px 14px 0; padding-top: calc(12px + env(safe-area-inset-top)); }
  .panel-body { padding: 14px; }
  .panel-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .panel-foot .btn { flex: 1; justify-content: center; min-height: 44px; }
  .panel-foot .grow { display: none; }
  .x { font-size: 26px; padding: 4px 10px; }
  .levels label { padding: 12px; }
  .row2 { grid-template-columns: 1fr; }
  .panel input:not([type]), .panel input[type=number], .panel input[type=text], .panel select, .steps-edit input { min-height: 40px; }
  .steps-edit td { padding: 4px 6px 4px 0; }
  .modal { padding: 18px; }
  #toasts { left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); }

  /* login */
  .login { grid-template-columns: 1fr; }
  .login .hero { padding: 22px 22px 20px; padding-top: calc(22px + env(safe-area-inset-top)); gap: 0; }
  .login .hero-main, .login .hero-foot { display: none; }
  .login .formside { padding: 32px 20px 20px; }
  .login .form-mark { display: none; }
}
@media (max-width: 380px) { .cards { gap: 8px; } .stat .value { font-size: 20px; } }/* ---------- Feem logo (no background box) ---------- */
.mark { width: auto !important; height: 30px !important; padding: 0 !important; background: none !important; border-radius: 0 !important; box-shadow: none !important; display: flex !important; align-items: center; flex: none; }
.mark img { height: 100%; width: auto; display: block; }
.side .brand { flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 24px; }
.side .brand .mark { height: 40px !important; }
.login .hero .brand { flex-direction: column; align-items: flex-start; gap: 12px; }
.login .hero .brand .mark { height: 52px !important; }
.login .form-mark { width: auto !important; height: 54px !important; padding: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important; display: inline-flex !important; margin-bottom: 24px; }
.login .form-mark img { height: 100%; width: auto; display: block; }
@media (max-width: 900px) {
  .mobile-bar .mark { height: 24px !important; }
  .login .hero .brand { flex-direction: row; align-items: center; gap: 12px; }
  .login .hero .brand .mark { height: 34px !important; }
}
/* ---------- AI features ---------- */
.ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.btn.ai { color: var(--primary); border-color: #dcc2df; background: var(--primary-50); font-weight: 600; }
.btn.ai:hover { background: #efdff1; }
.btn.ai svg { width: 15px; height: 15px; }
.ai-summary { border-top: 3px solid var(--primary); }
.ai-text h3 { font-size: 12px; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 4px; }
.ai-text h3:first-child { margin-top: 0; }
.ai-text p { margin: 0 0 6px; }
.ai-text ul { margin: 0 0 6px; padding-left: 18px; }
.ai-text li { margin-bottom: 3px; }
@media print {
  .side, .mobile-bar, .no-print, .panel, .topbar .controls { display: none !important; }
  .shell { display: block; height: auto; }
  .main { overflow: visible; }
  .topbar { position: static; border: 0; padding: 0 0 12px; }
  .page { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
