/* System Admin Lab - one stylesheet. Colors are CSS variables; --primary comes from 371 System Settings. */

:root {
  --primary: #4f46e5;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --side-bg: #0f172a;
  --side-text: #cbd5e1;
  --side-muted: #64748b;
  --side-hover: #1e293b;
  --ok: #059669;   --ok-soft: #ecfdf5;   --ok-line: #a7f3d0;
  --warn: #b45309; --warn-soft: #fffbeb; --warn-line: #fde68a;
  --bad: #dc2626;  --bad-soft: #fef2f2;  --bad-line: #fecaca;
  --info: #2563eb; --info-soft: #eff6ff; --info-line: #bfdbfe;
  --off: #64748b;  --off-soft: #f1f5f9;  --off-line: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 6px 18px rgba(15, 23, 42, .07);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans Thai", sans-serif;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #162038;
  --surface-3: #1c2744;
  --border: #253152;
  --border-strong: #34446b;
  --text: #e5e9f5;
  --text-2: #b4bdd6;
  --muted: #8c97b5;
  --side-bg: #070b16;
  --side-hover: #141c33;
  --ok: #34d399;   --ok-soft: #0f2e27;   --ok-line: #14532d;
  --warn: #fbbf24; --warn-soft: #33270c; --warn-line: #713f12;
  --bad: #f87171;  --bad-soft: #3a1620;  --bad-line: #7f1d1d;
  --info: #60a5fa; --info-soft: #11223f; --info-line: #1e3a8a;
  --off: #94a3b8;  --off-soft: #1c2744;  --off-line: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.55 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; margin: 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
pre.light { background: var(--surface-3); color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #0ea5e9); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .4); }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand span { font-size: 11px; color: var(--side-muted); }
.side-search { margin: 4px 14px 8px; }
.side-search input { width: 100%; background: #1e293b; border: 1px solid #263248; color: #e2e8f0; border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 13px; }
.side-search input::placeholder { color: #64748b; }
.side nav { padding: 2px 10px 16px; flex: 1; }
.nav-group { margin-top: 12px; }
.nav-group > div { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--side-muted); padding: 4px 10px; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--side-text); font-size: 13.5px; }
.nav-link:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav-link.active { background: color-mix(in srgb, var(--primary) 26%, transparent); color: #fff; }
.nav-link.active .no { background: var(--primary); color: #fff; }
.no { font: 700 10.5px/1 var(--mono); background: #1e293b; color: #94a3b8; border-radius: 6px; padding: 4px 5px; min-width: 32px; text-align: center; }
.nav-link .ico { width: 32px; text-align: center; font-size: 14px; }
.side-foot { padding: 12px 18px 18px; border-top: 1px solid #1e293b; font-size: 12px; color: var(--side-muted); }
.side-foot a { color: #a5b4fc; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .menu-btn { display: none; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--text); }
.env { font: 700 11px/1 var(--font); letter-spacing: .6px; padding: 6px 9px; border-radius: 999px; }
.env-DEV { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.env-UAT { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.env-PROD { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.icon-btn:hover { background: var(--surface-3); }

.content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .big-no { font: 800 13px/1 var(--mono); color: #fff; background: linear-gradient(135deg, var(--primary), #0ea5e9); padding: 10px 11px; border-radius: 12px; box-shadow: var(--shadow); }
.page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 820px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.banner { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.banner-bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.banner-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.banner-info { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-line); }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 70px; right: 24px; z-index: 50; display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ok); box-shadow: var(--shadow); border-radius: 10px; padding: 11px 38px 11px 14px; position: relative; white-space: pre-wrap; word-break: break-word; animation: slide .25s ease; font-size: 13.5px; max-height: 300px; overflow: auto; }
.toast.err { border-left-color: var(--bad); }
.toast button { position: absolute; top: 6px; right: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
@keyframes slide { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- cards & grids ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 16px 18px; }
.card-b.tight { padding: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.stat .hint { font-size: 12.5px; color: var(--muted); }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 15px; color: var(--text); position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s, border-color .12s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--info); }
.tile.ok::before { background: var(--ok); } .tile.warn::before { background: var(--warn); } .tile.bad::before { background: var(--bad); } .tile.off::before { background: var(--off); }
.tile .t-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.tile .t-top .no { background: var(--surface-3); color: var(--text-2); }
.tile .t-value { font-size: 20px; font-weight: 700; margin-top: 8px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- badges, dots ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; line-height: 1.4; }
.b-ok, .b-UP, .b-SUCCESS, .b-SENT, .b-ACTIVE, .b-OK { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.b-warn, .b-WARNING, .b-SIMULATED, .b-SKIPPED, .b-EXPIRED, .b-RUNNING { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.b-bad, .b-DOWN, .b-FAILED, .b-REVOKED, .b-OUT_OF_SERVICE, .b-REJECTED { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.b-info, .b-NATIVE, .b-JSON, .b-BACKUP, .b-RESTORE { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.b-off, .b-INACTIVE, .b-UNKNOWN { background: var(--off-soft); color: var(--off); border-color: var(--off-line); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--off); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.chip { display: inline-block; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border-radius: 6px; padding: 2px 7px; margin: 1px 2px 1px 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tr.sel td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t td.actions { white-space: nowrap; text-align: right; }
.t td.actions form { display: inline; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 7px 13px; border-radius: 9px; font: 600 13px/1.3 var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 85%, #000); }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ok { color: var(--ok); border-color: var(--ok-line); }
.btn-ok:hover { background: var(--ok-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .lbl { font-weight: 600; font-size: 13px; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); font-weight: 600; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--bad); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=password], input[type=search],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type=color] { width: 54px; height: 36px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 3px; background: var(--surface); cursor: pointer; }
.color-row { display: flex; gap: 8px; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 140px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .55; cursor: not-allowed; }
.switch.static input:disabled + span { opacity: 1; cursor: pointer; }
button.switch-btn:disabled .switch span { opacity: .55; cursor: not-allowed; }
button.switch-btn { border: 0; background: none; padding: 0; cursor: pointer; }

/* ---------- learn box ---------- */
details.learn { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 7%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); border-radius: var(--radius); margin-top: 18px; }
details.learn summary { cursor: pointer; padding: 12px 18px; font-weight: 650; list-style: none; display: flex; gap: 8px; align-items: center; }
details.learn summary::-webkit-details-marker { display: none; }
details.learn summary::before { content: "▸"; transition: transform .15s; color: var(--primary); }
details.learn[open] summary::before { transform: rotate(90deg); }
details.learn .learn-b { padding: 0 18px 16px; }
details.learn ul { margin: 6px 0 10px; padding-left: 20px; }
details.learn li { margin: 3px 0; }

/* ---------- bars / charts ---------- */
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.hbars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.hbars .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; height: 100%; position: relative; }
.hbars .col i { display: block; border-radius: 3px 3px 0 0; }
.hbars .col i.s { background: var(--ok); opacity: .8; }
.hbars .col i.f { background: var(--bad); }
.hbars .col:hover { outline: 1px dashed var(--border-strong); }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
svg.spark { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* key/value list */
dl.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; margin: 0; }
dl.kv dt { color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
dl.kv dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border); word-break: break-word; font-weight: 550; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-bottom: 0; }

/* secret / key boxes */
.keybox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 12px; }
.keybox code { background: transparent; flex: 1; word-break: break-all; font-size: 13px; padding: 0; }
.reveal { cursor: pointer; }

/* paging */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* burst tester */
.burst { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; margin-top: 12px; }
.burst span { height: 26px; border-radius: 6px; display: grid; place-items: center; font: 700 10px/1 var(--mono); color: #fff; background: var(--surface-3); }
.burst span.ok { background: var(--ok); } .burst span.bad { background: var(--bad); } .burst span.warn { background: var(--warn); }

/* module cards */
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mod { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.mod.disabled { opacity: .72; background: var(--surface-2); }
.mod .m-top { display: flex; gap: 10px; align-items: center; }
.mod .m-ico { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface-3); border-radius: 12px; }
.mod .m-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 30%, transparent), transparent), radial-gradient(900px 500px at 110% 110%, rgba(14, 165, 233, .25), transparent), var(--bg); padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 30px 70px rgba(15, 23, 42, .18); padding: 30px; }
.login-card .brand { color: var(--text); padding: 0 0 18px; }
.login-card .brand span { color: var(--muted); }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.demo-users button { text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 9px 11px; cursor: pointer; font: inherit; color: var(--text); }
.demo-users button:hover { border-color: var(--primary); }
.demo-users b { display: block; font-size: 13px; }
.demo-users span { font-size: 11.5px; color: var(--muted); }

/* responsive */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .topbar .menu-btn { display: grid; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .crumbs { display: none; }
}
