/* JIGO 3D Classroom Planner — app styles */
:root {
  --brand: #d62828;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.text-danger { color: var(--danger) !important; }
.text-ok { color: var(--ok); }
.nowrap { white-space: nowrap; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand); filter: brightness(.93); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check.sm { font-size: 12px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 36px; cursor: pointer; }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { height: 36px; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- alerts & badges ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.page-alert { margin: 14px 24px 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #e2e8f0; color: var(--ink-2); vertical-align: middle; }
.st-lead { background: #e0e7ff; color: #3730a3; }
.st-survey { background: #cffafe; color: #155e75; }
.st-presented { background: #fef3c7; color: #92400e; }
.st-negotiation { background: #ffedd5; color: #9a3412; }
.st-won { background: #dcfce7; color: #166534; }
.st-lost { background: #f1f5f9; color: #64748b; }
.st-bg-lead { background: #6366f1; } .st-bg-survey { background: #06b6d4; } .st-bg-presented { background: #f59e0b; }
.st-bg-negotiation { background: #f97316; } .st-bg-won { background: #16a34a; } .st-bg-lost { background: #94a3b8; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; text-decoration: none !important; }
.brand img { height: 38px; width: auto; border-radius: 8px; background: #fff; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand small { color: #94a3b8; font-size: 11.5px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: #cbd5e1; font-weight: 500; text-decoration: none; }
.sidebar nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .85; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 8px; }
.sidebar-foot .who { display: flex; flex-direction: column; color: #fff; }
.sidebar-foot .who small { color: #94a3b8; }
.sidebar-foot .btn { color: #cbd5e1; border-color: rgba(255,255,255,.15); }
.credit { font-size: 11px; color: #64748b; margin: 4px 0 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.content { padding: 22px 24px 40px; }

/* ---------- cards & common blocks ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; border: 1px solid #eef1f5; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2, .card-title { font-size: 15px; }
.card-title { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid #eef1f5; display: flex; flex-direction: column; gap: 2px; }
.kpi small { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.kpi b { font-size: 24px; }
.kpi span { color: var(--muted); font-size: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table.compact td { padding: 5px 4px; font-size: 13px; }
.card > .table { margin: -6px 0; }
.empty { text-align: center; padding: 30px !important; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.list li:last-child { border: 0; }
.list li a { display: flex; flex-direction: column; color: var(--ink); }
.list li small { color: var(--muted); }
.activity li { font-size: 13px; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 30px 110px; gap: 10px; align-items: center; color: var(--ink); text-decoration: none !important; }
.funnel-bar { height: 12px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; border-radius: 99px; }
.funnel-num { font-weight: 700; text-align: right; }
.funnel-val { color: var(--muted); text-align: right; font-size: 12.5px; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input { max-width: 340px; }
.filters select { max-width: 200px; }
.school-cell { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.school-cell img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.school-cell span { display: flex; flex-direction: column; }
.school-cell small { color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; color: #fff; font-weight: 800; flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; border-radius: 14px; }
.danger-zone { margin-top: 10px; }

/* school view */
.school-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 20px; align-items: center; }
.school-id { display: flex; gap: 16px; align-items: center; }
.school-id h2 { font-size: 20px; }
.school-id p { margin: 3px 0 0; }
.school-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); }
.school-stats { display: flex; gap: 22px; }
.school-stats div { display: flex; flex-direction: column; }
.school-stats small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.school-stats b { font-size: 20px; }
.stage-form select { min-width: 150px; }
.share-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: linear-gradient(90deg, #fff, #fff7f7); }
.copy-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.copy-row input { max-width: 460px; font-size: 13px; background: #f8fafc; }
.share-actions { display: flex; gap: 6px; flex-direction: column; }
.empty-state { text-align: center; padding: 40px; }
.empty-state p { color: var(--muted); }
.room-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.room-head h3 { font-size: 17px; }
.room-head p { margin: 4px 0; }
.room-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatches { display: flex; gap: 6px; align-items: center; }
.swatches i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.15); display: inline-block; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.option { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.option.primary { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent); }
.option-img { aspect-ratio: 16 / 10; background: #eef2f6; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.option-img img { width: 100%; height: 100%; object-fit: cover; }
.option-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.mini-stats { display: flex; gap: 10px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.option-actions { display: flex; gap: 6px; }
.option.add { border-style: dashed; display: grid; place-items: center; min-height: 180px; color: var(--muted); font-weight: 600; text-decoration: none !important; }
.option.add:hover { border-color: var(--brand); color: var(--brand); }

/* room form */
.room-form .card { margin-bottom: 18px; }
.area-box { display: flex; flex-direction: column; justify-content: center; background: #f8fafc; border-radius: 10px; padding: 8px 12px; border: 1px dashed #cbd5e1; }
.area-box small { color: var(--muted); font-weight: 600; }
.feat-row { display: grid; grid-template-columns: 70px 1.2fr 1fr 1fr 1fr 1fr 36px; gap: 8px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.feat-row[data-kind=doors] { grid-template-columns: 70px 1.2fr 1fr 1fr 36px; }
.feat-kind { font-weight: 700; padding-bottom: 9px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chips i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); cursor: pointer; }
.chips i:hover { transform: scale(1.12); }
#planPrev { width: 100%; height: auto; background: #f8fafc; border-radius: 10px; }
.sticky-actions { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 8px; }

/* products */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.prod-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.prod-card.off { opacity: .55; }
.prod-img { aspect-ratio: 4 / 3; background: linear-gradient(180deg, #f8fafc, #eef2f6); display: grid; place-items: center; overflow: hidden; }
.prod-img img { width: 100%; height: 100%; object-fit: contain; }
.prod-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod-body .dims { font-size: 12.5px; color: var(--ink-2); }
.prod-body .row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.prod-preview { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #eef2f6; position: relative; }
.colour-list { display: flex; flex-direction: column; gap: 6px; }
.colour-item { display: grid; grid-template-columns: 44px 1fr 36px; gap: 6px; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: #0f172a; padding: 20px; }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; max-width: 980px; width: 100%; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-hero { background: linear-gradient(145deg, var(--brand), #7f1d1d); color: #fff; padding: 44px; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-hero h2 { font-size: 28px; margin: 34px 0 18px; line-height: 1.2; }
.brand.big { padding: 0; }
.brand.big small { color: rgba(255,255,255,.8); }
.brand.big .brand-mark { background: #fff; color: var(--brand); }
.hero-points { padding-left: 18px; margin: 0; display: flex; flex-direction: column; gap: 8px; color: rgba(255,255,255,.92); }
.auth-card { padding: 44px; background: #fff; border-radius: 20px; width: 100%; }
.auth-wrap .auth-card { border-radius: 0; }
.auth-title { font-size: 24px; margin-bottom: 18px; }
.demo-box { margin-top: 18px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; font-size: 13px; }
.yogi-credit { font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ---------- planner ---------- */
.planner-body .content { padding: 0; }
.planner-body .page-alert { display: none; }
.save-state { font-size: 12.5px; color: var(--ok); font-weight: 600; margin-right: 6px; }
.save-state.err { color: var(--danger); }
.planner { display: grid; grid-template-columns: 300px minmax(0, 1fr) 290px; height: calc(100vh - 63px); }
.pl-panel, .pl-stats { overflow-y: auto; background: #fff; border-right: 1px solid var(--line); }
.pl-stats { border-right: 0; border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pl-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.pl-sec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.pl-row { display: flex; gap: 6px; align-items: center; }
.pl-row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.pl-title { font-weight: 700; font-size: 15px; border-color: transparent; padding: 6px 8px; }
.pl-title:hover { border-color: var(--line); }
.pl-info { font-size: 12.5px; background: #f8fafc; border-radius: 8px; padding: 8px 10px; color: var(--ink-2); }
.pl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.pl-grid2 .span-2 { grid-column: span 2; }
.pl-adv summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 4px 0; }
.pl-adv[open] { padding-bottom: 6px; }
.range { gap: 2px; font-weight: 500; font-size: 12.5px; margin-top: 6px; }
.range span { display: flex; justify-content: space-between; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.sw-custom { width: 30px; height: 30px; padding: 0; border: 1px dashed #94a3b8; border-radius: 7px; }
.pl-view { display: flex; flex-direction: column; min-width: 0; background: #e9edf2; }
.pl-toolbar { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pl-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.viewer { position: relative; flex: 1; min-height: 300px; overflow: hidden; background: #eef2f6; }
.viewer canvas { display: block; outline: none; }
.walk-help, .walk-pad { display: none; }
.viewer.walking .walk-help { display: block; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.75); color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 12.5px; pointer-events: none; white-space: nowrap; }
.viewer.walking .walk-pad { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; position: absolute; right: 14px; bottom: 14px; }
.walk-pad button { width: 44px; height: 44px; border-radius: 10px; border: 0; background: rgba(15,23,42,.72); color: #fff; font-size: 18px; cursor: pointer; touch-action: none; }
.walk-pad button:active { background: var(--brand); }
.rec-badge { position: absolute; top: 12px; right: 12px; background: #dc2626; color: #fff; font-weight: 700; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .6; } }
.big-stat { display: flex; align-items: baseline; gap: 8px; }
.big-stat small { font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; }
.big-stat b { font-size: 36px; line-height: 1; }
.big-stat span { font-size: 13px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-grid div { background: #f8fafc; border-radius: 9px; padding: 8px 10px; display: flex; flex-direction: column; }
.stat-grid small { color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-grid b { font-size: 14px; }
.free-bar { height: 8px; border-radius: 99px; background: #bbf7d0; overflow: hidden; }
.free-bar i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.warn-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.warn-list li { background: #fff7ed; color: #9a3412; border-radius: 8px; padding: 6px 9px; font-size: 12.5px; }
.warn-list li.ok { background: #f0fdf4; color: #166534; }
.pl-stats h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin-top: 4px; }
.totals { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.totals div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.totals input { width: 64px; padding: 3px 6px; }
.totals .grand { font-size: 15px; border-top: 1px dashed var(--line); padding-top: 6px; }
.present-card { position: absolute; left: 20px; bottom: 20px; background: rgba(15,23,42,.82); color: #fff; padding: 16px 18px; border-radius: 14px; display: flex; flex-direction: column; gap: 6px; max-width: 360px; backdrop-filter: blur(6px); }
.present-card > b { font-size: 20px; }
.present-card > span { color: #cbd5e1; font-size: 13px; }
.pc-stats { display: flex; gap: 18px; margin: 6px 0; }
.pc-stats div { display: flex; flex-direction: column; }
.pc-stats b { font-size: 24px; }
.pc-stats small { color: #cbd5e1; }
.planner.presenting { grid-template-columns: 0 1fr 0; }
.planner.presenting .pl-panel, .planner.presenting .pl-stats { display: none; }
.viewer:fullscreen { width: 100vw; height: 100vh; }

.prep-toast { position: fixed; right: 20px; bottom: 20px; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 60; }

/* compare */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.compare .card img { width: 100%; border-radius: 10px; background: #eef2f6; aspect-ratio: 16 / 10; object-fit: cover; }
.cmp-table td:first-child { color: var(--muted); }
.cmp-best { color: var(--ok); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .grid-2, .grid-main { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .school-head { grid-template-columns: 1fr; }
  .share-card { flex-direction: column; align-items: stretch; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px; }
  .auth-hero h2 { font-size: 22px; margin-top: 20px; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .feat-row, .feat-row[data-kind=doors] { grid-template-columns: 1fr 1fr; }
  .table { font-size: 13px; }
  .card { overflow-x: auto; }
  .funnel-row { grid-template-columns: 90px 1fr 24px; }
  .funnel-val { display: none; }
}

/* v1.1.1 — compact measurement card on smaller viewers */
@media (max-width: 1500px), (max-height: 800px) {
  .measure-card { min-width: 0; width: 250px; padding: 9px 11px 7px; font-size: 12px; border-radius: 12px; }
  .measure-card > b { font-size: 13px; margin-bottom: 4px; }
  .mc-row { padding: 2px 0; }
  .mc-x { width: 26px; height: 26px; font-size: 12px; }
}

/* ---------- print (report) ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
.option-body > .badge { align-self: flex-start; }

/* ================= Tablet / touch presentation ================= */
.drawer-btn, .drawer-shade { display: none; }
.measure-card { position: absolute; left: 12px; top: 12px; z-index: 8; background: rgba(255,255,255,.97); border-radius: 14px; padding: 12px 14px 10px; min-width: 240px; max-width: min(340px, calc(100% - 24px)); box-shadow: 0 10px 30px rgba(15,23,42,.22); border-left: 5px solid #0ea5e9; font-size: 13.5px; }
.measure-card > b { display: block; font-size: 15px; margin: 0 26px 6px 0; }
.mc-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid #f1f5f9; }
.mc-row span { color: var(--muted); }
.mc-row.gap b { color: #b45309; }
.mc-x { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; background: #f1f5f9; border-radius: 50%; font-size: 14px; cursor: pointer; }
.tap-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 7; background: rgba(15,23,42,.82); color: #fff; padding: 9px 16px; border-radius: 99px; font-size: 13.5px; white-space: nowrap; pointer-events: none; transition: opacity 1s; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.tap-hint.fade { opacity: 0; }
.float-bar { display: none; position: absolute; top: 12px; right: 12px; z-index: 9; background: rgba(15,23,42,.85); border-radius: 14px; padding: 6px; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 24px); backdrop-filter: blur(6px); }
.float-bar button { border: 0; background: transparent; color: #fff; font: inherit; font-weight: 600; font-size: 14px; padding: 10px 14px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.float-bar button.on { background: var(--brand); }
.float-bar .sep { width: 1px; height: 26px; background: rgba(255,255,255,.25); margin: 0 2px; }
.btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.viewer:fullscreen .float-bar, body.is-presenting .float-bar, .planner.presenting .float-bar { display: flex; }
body.is-presenting .viewer { position: fixed !important; inset: 0; z-index: 200; width: 100vw; height: 100vh; height: 100dvh; }
.viewer:fullscreen .present-card, body.is-presenting .present-card { bottom: 20px; }
.viewer { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Tablets (any touch screen) and narrow windows: 3D view fills the screen, panels slide in */
@media (max-width: 1200px), (pointer: coarse) {
  .drawer-btn { display: inline-flex; }
  .planner { grid-template-columns: 1fr; height: calc(100vh - 63px); height: calc(100dvh - 63px); position: relative; }
  .pl-view { height: 100%; }
  .pl-panel, .pl-stats { position: fixed; top: 0; bottom: 0; z-index: 60; width: min(380px, 88vw); max-height: none; box-shadow: 0 0 40px rgba(0,0,0,.3); transition: transform .25s ease; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .pl-panel { left: 0; transform: translateX(-105%); }
  .pl-stats { right: 0; transform: translateX(105%); border-top: 0; }
  .planner.show-panel .pl-panel, .planner.show-stats .pl-stats { transform: none; }
  .planner.show-panel .drawer-shade, .planner.show-stats .drawer-shade { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 55; }
  .planner.presenting { grid-template-columns: 1fr; }
}
/* Bigger touch targets on touch screens */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 42px; padding: 8px 14px; font-size: 14px; }
  .seg button { padding: 10px 16px; font-size: 14px; min-height: 40px; }
  .sw { width: 38px; height: 38px; border-radius: 9px; }
  .sw-custom { width: 40px; height: 40px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
  input[type=range] { height: 32px; }
  .walk-pad { grid-template-columns: repeat(3, 60px) !important; }
  .walk-pad button { width: 60px; height: 60px; font-size: 22px; }
  .sidebar nav a { padding: 13px 12px; }
  .pl-toolbar { gap: 8px; }
  .tabs button { padding: 12px 18px; }
  .opt-row button { padding: 10px 16px; }
}
/* Share page on tablets: viewer first, info below */
@media (max-width: 1100px) {
  .sh-main { grid-template-columns: 1fr; height: auto; }
  .sh-view { height: 72vh; height: 72dvh; }
  .sh-side { border-left: 0; }
}
/* Planner on tablets: give the 3D view the whole width */
@media (max-width: 1366px) and (pointer: coarse), (max-width: 1200px) {
  .planner-body .sidebar { position: fixed; left: -260px; z-index: 70; transition: left .2s; }
  .planner-body .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .planner-body .menu-btn { display: block; }
  .planner-body .topbar { padding: 8px 14px; }
  .planner-body .topbar h1 { font-size: 16px; }
  .pl-toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .pl-toolbar::-webkit-scrollbar { display: none; }
  .pl-tools { flex-wrap: nowrap; }
  .pl-toolbar > *, .pl-tools > * { flex-shrink: 0; }
}
