/* ───────────────────────── LunurrMail · deep-space theme ───────────────────────── */

:root {
  --bg: #05040c;
  --bg-2: #0b0918;
  --surface: rgba(18, 14, 36, 0.62);
  --surface-2: rgba(28, 22, 54, 0.7);
  --surface-hover: rgba(42, 33, 80, 0.55);
  --border: rgba(167, 139, 250, 0.13);
  --border-strong: rgba(167, 139, 250, 0.32);

  --text: #ece9fb;
  --text-dim: #b8b2d6;
  --muted: #847ea3;

  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-deep: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.45);
  --star: #bae6fd;

  --ok: #5eead4;
  --warn: #fcd34d;
  --bad: #fb7185;
  --info: #93c5fd;

  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Stars: pre-rendered tiles, twinkling via opacity only (compositor-friendly, no repaints). */
#starfield { position: fixed; inset: 0; z-index: 0; pointer-events: none; contain: strict; }
.star-layer { position: absolute; inset: 0; background-repeat: repeat; will-change: opacity; animation: twinkle ease-in-out infinite alternate; }
.star-layer-1 { animation-duration: 3.8s; }
.star-layer-2 { animation-duration: 5.3s; animation-delay: -2.1s; }
.star-layer-3 { animation-duration: 7.1s; animation-delay: -4.4s; }
.star-layer-4 { animation-duration: 9.7s; animation-delay: -1.3s; }
@keyframes twinkle { from { opacity: 1; } to { opacity: 0.35; } }
.nebula {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40vw 30vw at 88% 6%, rgba(139, 92, 246, 0.16), transparent 70%),
    radial-gradient(30vw 26vw at 4% 96%, rgba(109, 40, 217, 0.12), transparent 70%),
    radial-gradient(22vw 18vw at 60% 70%, rgba(56, 189, 248, 0.04), transparent 70%),
    radial-gradient(ellipse at 50% 120%, #120c2a 0%, transparent 55%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #c4b5fd; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
::selection { background: rgba(139, 92, 246, 0.45); }

.muted { color: var(--muted); }
.dim { color: var(--text-dim); }

/* Opaque-ish gradient instead of backdrop-filter: same look, no per-frame re-blur. */
.glass {
  background: linear-gradient(180deg, rgba(22, 17, 46, 0.88), rgba(13, 10, 28, 0.88));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px -18px rgba(0, 0, 0, 0.8);
}

/* ── Buttons & inputs ─────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font: 500 14px var(--font); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.05s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 0 24px -6px var(--accent-glow);
}
.btn-primary:hover { background: linear-gradient(135deg, #9d74fb, #7c3aed); box-shadow: 0 0 30px -4px var(--accent-glow); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-dim); letter-spacing: 0.02em; }
.field .hint { font-size: 12px; color: var(--muted); }
input, textarea, select {
  width: 100%;
  background: rgba(8, 6, 20, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 14px var(--font);
  padding: 9px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
input::placeholder, textarea::placeholder { color: #5f5980; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type='file'] { padding: 7px; font-size: 13px; }
input[type='file']::file-selector-button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 5px 10px; margin-right: 10px; font: 500 12.5px var(--font); cursor: pointer;
}
input[type='datetime-local'] { color-scheme: dark; }

.form-error { color: var(--bad); font-size: 13px; min-height: 1em; margin: 0; }

/* ── Login ───────────────────────────────────────── */

.login { position: relative; z-index: 1; min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); padding: 36px 30px 30px; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.login-card h1 { font-size: 28px; }
.login-card p { margin: -10px 0 4px; }
.login-card .field { text-align: left; }
.login-logo { margin: 0 auto; filter: drop-shadow(0 0 22px var(--accent-glow)); animation: float 7s ease-in-out infinite; will-change: transform; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ── Shell ───────────────────────────────────────── */

.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(14, 10, 30, 0.92), rgba(8, 6, 18, 0.85));
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--text); font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand img { filter: drop-shadow(0 0 10px var(--accent-glow)); }
.brand b { font-weight: 700; color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(167, 139, 250, 0.07); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.04)); color: #fff; }
.nav a.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.nav a.active .ico { background: var(--accent); }
.badge {
  margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--accent-strong); color: #fff; box-shadow: 0 0 12px -2px var(--accent-glow);
}
.logout { margin-top: auto; justify-content: flex-start; }

.content { padding: 30px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Icons (CSS masks) ───────────────────────────── */

.ico { width: 18px; height: 18px; flex: none; display: inline-block; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ico-orbit { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cellipse cx='12' cy='12' rx='10' ry='4.5' transform='rotate(-25 12 12)'/%3E%3C/svg%3E"); }
.ico-inbox { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 13l2.5-8h13L21 13v6H3z'/%3E%3Cpath d='M3 13h5l1.5 3h5L16 13h5'/%3E%3C/svg%3E"); }
.ico-send { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M21 3L3 10.5l7 3 3 7.5z'/%3E%3Cpath d='M10 13.5L21 3'/%3E%3C/svg%3E"); }
.ico-pen { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4L16 5l3 3L8 19z'/%3E%3Cpath d='M14 7l3 3'/%3E%3C/svg%3E"); }
.ico-layers { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3l9 5-9 5-9-5z'/%3E%3Cpath d='M3 13l9 5 9-5'/%3E%3C/svg%3E"); }
.ico-gear { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1'/%3E%3C/svg%3E"); }
.ico-sync { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M20 11a8 8 0 0 0-14.5-4.5M4 13a8 8 0 0 0 14.5 4.5'/%3E%3Cpath d='M5 3v4h4M19 21v-4h-4'/%3E%3C/svg%3E"); }
.ico-clip { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M20 11.5l-8 8a5 5 0 0 1-7-7l8.5-8.5a3.3 3.3 0 0 1 4.7 4.7L9.7 17.2a1.7 1.7 0 0 1-2.4-2.4L15 7'/%3E%3C/svg%3E"); }
.ico-back { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
.ico-copy { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3'/%3E%3C/svg%3E"); }

/* ── Cards / stats ───────────────────────────────── */

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(139, 92, 246, 0.18), transparent 70%); }
.stat .label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.stat .value { font-size: 32px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.card { padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card h2 .muted { font-weight: 400; font-size: 13px; }
.two-col { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }

.chart { width: 100%; height: 200px; display: block; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* ── Lists ───────────────────────────────────────── */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type='search'] { max-width: 340px; flex: 1 1 220px; }
.toolbar select { width: auto; min-width: 150px; }

.list { padding: 6px; }
.row {
  display: grid; grid-template-columns: 12px minmax(140px, 220px) minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 14px; border-radius: 10px; cursor: pointer; color: var(--text);
  transition: background 0.12s;
}
.row:hover { background: var(--surface-hover); color: var(--text); }
.row + .row { box-shadow: 0 -1px 0 rgba(167, 139, 250, 0.06); }
.row .who { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .what { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.row .what b { color: var(--text); font-weight: 500; }
.row .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.row.unread .who, .row.unread .what b { font-weight: 700; color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.row.unread .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .moon { font-size: 34px; display: block; margin-bottom: 8px; opacity: 0.7; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px 4px; font-size: 13px; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: capitalize;
  background: rgba(167, 139, 250, 0.12); color: var(--accent); border: 1px solid rgba(167, 139, 250, 0.2);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(94, 234, 212, 0.08); border-color: rgba(94, 234, 212, 0.2); }
.pill.bad { color: var(--bad); background: rgba(251, 113, 133, 0.08); border-color: rgba(251, 113, 133, 0.22); }
.pill.warn { color: var(--warn); background: rgba(252, 211, 77, 0.08); border-color: rgba(252, 211, 77, 0.2); }
.pill.info { color: var(--info); background: rgba(147, 197, 253, 0.08); border-color: rgba(147, 197, 253, 0.2); }
.pill.neutral { color: var(--text-dim); background: rgba(255, 255, 255, 0.04); border-color: var(--border); }

/* ── Email detail ────────────────────────────────── */

.detail-head { display: flex; flex-direction: column; gap: 12px; }
.detail-head h2 { font-size: 21px; margin: 0; }
.meta { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text); }
a.chip:hover { border-color: var(--accent); }
.chip .ico { width: 14px; height: 14px; }

.mail-frame { width: 100%; min-height: 520px; height: 62vh; border: 0; border-radius: 10px; background: #fff; resize: vertical; display: block; }
.mail-text { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; background: rgba(8, 6, 20, 0.6); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 0; overflow-x: auto; }
.tabs { display: inline-flex; padding: 3px; background: rgba(8, 6, 20, 0.6); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.tabs button { background: none; border: 0; color: var(--muted); font: 500 13px var(--font); padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.tabs button.active { background: var(--surface-hover); color: var(--text); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.timeline li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: none; }
.timeline time { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ── Forms ───────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.composer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.preview-pane { position: sticky; top: 20px; }
.preview-pane .mail-frame { height: 70vh; min-height: 420px; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
details.more summary { cursor: pointer; color: var(--text-dim); font-size: 13.5px; user-select: none; }
details.more[open] summary { margin-bottom: 12px; }
.vars { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.callout { padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(252, 211, 77, 0.25); background: rgba(252, 211, 77, 0.06); font-size: 13.5px; color: var(--text-dim); }
.callout.info { border-color: rgba(167, 139, 250, 0.25); background: rgba(139, 92, 246, 0.07); }
.callout b { color: var(--text); }

.tpl-layout { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
.tpl-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.tpl-list a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--text-dim); }
.tpl-list a:hover { background: var(--surface-hover); color: var(--text); }
.tpl-list a.active { background: rgba(139, 92, 246, 0.18); color: #fff; }
.tpl-list a small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Tables / code ───────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid rgba(167, 139, 250, 0.06); vertical-align: top; }
td.mono { word-break: break-all; max-width: 420px; }

.code {
  position: relative; background: rgba(5, 4, 14, 0.8); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #d8d0fb; margin: 0; white-space: pre;
}
.code .copy { position: absolute; top: 8px; right: 8px; }

/* ── Toasts ──────────────────────────────────────── */

.toasts { position: fixed; z-index: 50; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 11px; background: rgba(20, 15, 40, 0.92); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; animation: rise 0.25s ease-out; }
.toast.error { border-color: rgba(251, 113, 133, 0.5); }
.toast.success { border-color: rgba(94, 234, 212, 0.45); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 1080px) {
  .two-col, .composer { grid-template-columns: minmax(0, 1fr); }
  .preview-pane { position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center;
    gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto;
  }
  .brand span, .logout { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 8px 10px; }
  .nav a span { display: none; }
  .nav a.active::before { display: none; }
  .badge { position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .content { padding: 22px 16px 60px; }
  .tpl-layout { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .row .what { grid-column: 2 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
