/* ═══════════════════════════════════════════════════════════════
   Casavertia Studio — Premium Dark UI v2
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #1c2230;
  --border:    #2a3545;
  --border2:   #384557;
  --text:      #e8edf4;
  --muted:     #7a8898;
  --faint:     #3d4f63;

  --accent:    #e65f3e;
  --accent2:   #f07a5a;
  --gold:      #d4a043;
  --green:     #4ade80;
  --red:       #f87171;
  --purple:    #a78bfa;

  --radius:    10px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; font-weight: 600; }
p  { color: var(--muted); font-size: .92rem; }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-page { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 10;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  text-decoration: none;
}
.logo-brand img { height: 36px; width: auto; object-fit: contain; }
.logo-brand small {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  transition: all .15s ease;
  text-decoration: none;
}
.sidebar nav a:hover   { background: var(--surface2); color: var(--text); }
.sidebar nav a.active  {
  background: rgba(230, 95, 62, .15);
  color: var(--accent2);
  font-weight: 600;
}

.sidebar form {
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.text-button {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: .8rem;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  transition: all .15s;
}
.text-button:hover { border-color: var(--red); color: var(--red); }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 36px 48px 80px;
  overflow-x: hidden;
}

/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 16px;
}
.date-chip {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 99px;
  white-space: nowrap;
}

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.stats-row > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  transition: border-color .2s;
}
.stats-row > div:hover { border-color: var(--border2); }
.stats-row strong {
  display: block;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.stats-row span {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 6px;
  display: block;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Studio Grid ─────────────────────────────────────────────── */
.studio-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

/* ── Cards / Panels ──────────────────────────────────────────── */
.generator, .week-board, .library {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: .95rem;
}
.section-heading small {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 99px;
}

/* ── Form Fields ─────────────────────────────────────────────── */
label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--surface); }

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-row { margin-bottom: 18px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .18s ease;
  white-space: nowrap;
}
.button-primary {
  background: var(--accent);
  color: #fff;
}
.button-primary:hover { background: var(--accent2); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(230,95,62,.35); }

.button-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
}
.button-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(230,95,62,.06); }

.button-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
}
.button-ghost:hover { color: var(--text); }

.button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Content Library ─────────────────────────────────────────── */
.library {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}
.library .section-heading {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.content-table-header {
  display: grid;
  grid-template-columns: 80px 1fr 160px 140px 110px 80px;
  gap: 0;
  padding: 10px 28px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.content-row {
  display: grid;
  grid-template-columns: 80px 1fr 160px 140px 110px 80px;
  gap: 0;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  text-decoration: none;
  color: var(--text);
}
.content-row:last-child { border-bottom: none; }
.content-row:hover { background: rgba(255,255,255,.03); }

.content-row .format {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
  width: fit-content;
}
.content-row strong {
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
}
.content-row > span:nth-child(3) {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}
.content-row > span:last-child {
  color: var(--muted);
  font-size: .8rem;
  text-align: right;
}


/* ── Status Badges ────────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  font-family: var(--mono);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-published  { background: rgba(74,222,128,.12); color: var(--green); }
.status-scheduled  { background: rgba(212,160,67,.12);  color: var(--gold); }
.status-draft      { background: rgba(122,136,152,.12); color: var(--muted); }
.status-failed     { background: rgba(248,113,113,.12); color: var(--red); }
.status-publishing { background: rgba(167,139,250,.12); color: var(--purple); }

/* ── Week Board ──────────────────────────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day-cell {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
  min-height: 90px;
  font-size: .7rem;
}
.day-cell .day-label {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.day-cell.today { border-color: var(--accent); }
.day-pill {
  background: rgba(230,95,62,.18);
  color: var(--accent2);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: .64rem;
  line-height: 1.3;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Editor ──────────────────────────────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
}
.editor-form, .preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.preview { position: sticky; top: 24px; align-self: start; }

.back-link {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  transition: color .15s;
}
.back-link:hover { color: var(--text); }

.editor-stack { display: flex; flex-direction: column; gap: 20px; }
.advanced-field { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 4px; }
.advanced-field summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.advanced-field summary:hover { color: var(--text); }

/* ── Instagram Preview Card ──────────────────────────────────── */
.instagram-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
}
.ig-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ig-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: grid;
  place-items: center;
  font-size: .58rem;
  font-weight: 700;
  color: white;
  font-family: var(--mono);
  flex-shrink: 0;
}
.ig-head span { font-size: .82rem; font-weight: 600; }
.ig-head span:last-child { margin-left: auto; font-size: .7rem; color: var(--muted); }
.ig-media {
  aspect-ratio: 1;
  background: var(--surface2);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ig-media img, .ig-media video {
  width: 100%; height: 100%; object-fit: cover;
}
.preview-media-open {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}
.preview-media-open:focus-visible,
.media-open:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
}
.ig-media.is-reel { aspect-ratio: 9/16; max-height: 480px; }
.carousel-count {
  position: absolute;
  right: 10px; top: 10px;
  background: rgba(13,17,23,.85);
  color: var(--text);
  padding: 4px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-family: var(--mono);
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.ig-actions { padding: 12px 14px 4px; font-size: 1.2rem; display: flex; gap: 10px; }
.instagram-card p {
  padding: 4px 14px 14px;
  font-size: .78rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-line;
  max-height: 140px;
  overflow: auto;
}

/* ── Notices / Flash ─────────────────────────────────────────── */
.notice {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .88rem;
  font-weight: 500;
}
.success { background: rgba(74,222,128,.1);  border: 1px solid rgba(74,222,128,.3); color: var(--green); }
.error   { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--red); }
.info    { background: rgba(167,139,250,.1); border: 1px solid rgba(167,139,250,.3); color: var(--purple); }
.warning { background: rgba(212,160,67,.1);  border: 1px solid rgba(212,160,67,.3);  color: var(--gold); }

/* ── Settings ─────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.settings-card h2 { margin-bottom: 6px; }
.settings-card > p { margin-bottom: 24px; }

/* ── Analytics ───────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
.analytics-grid article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  transition: border-color .2s;
}
.analytics-grid article:hover { border-color: var(--border2); }
.analytics-grid article span { font-size: .72rem; color: var(--muted); font-family: var(--mono); text-transform: uppercase; }
.analytics-grid article strong { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.04em; color: var(--text); }

.performance-row {
  display: grid;
  grid-template-columns: 64px 1fr minmax(240px, .7fr) 20px;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.performance-thumb {
  width: 64px; height: 64px;
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.performance-thumb img { width: 100%; height: 100%; object-fit: cover; }
.performance-row > div:nth-child(2) { display: flex; flex-direction: column; gap: 4px; }
.performance-row > div:nth-child(2) > strong { font-size: .85rem; }
.performance-row small { color: var(--muted); font-size: .74rem; }
.performance-row dl { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.performance-row dl div { text-align: center; }
.performance-row dt { font-size: .62rem; color: var(--muted); font-family: var(--mono); }
.performance-row dd { margin: 4px 0 0; font-weight: 700; font-size: .95rem; }

/* ── Profile Strip ───────────────────────────────────────────── */
.profile-strip {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
}
.profile-strip img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.profile-strip h2 { margin: 4px 0 0; }
.profile-strip > div:nth-last-child(-n+2) { display: flex; flex-direction: column; min-width: 110px; }
.profile-strip strong { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; }
.profile-strip span:not(.eyebrow) { font-size: .75rem; color: var(--muted); font-family: var(--mono); }

/* ── Media Studio ────────────────────────────────────────────── */
.media-studio { padding-bottom: 24px; }
.dropzone {
  border: 1px dashed var(--border2);
  background: var(--surface2);
  padding: 20px;
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  transition: border-color .15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone label { margin: 0; cursor: pointer; }
.dropzone label span { display: block; color: var(--muted); font-size: .75rem; margin-top: 5px; }
.dropzone .button { width: auto; }
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.media-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  padding: 6px;
  transition: border-color .15s;
}
.media-tile:hover { border-color: var(--border2); }
.media-open {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg);
}
.media-tile img, .media-tile video {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  display: block; border-radius: 6px;
}
.media-open:hover img,
.media-open:hover video {
  filter: brightness(1.08);
}
.media-tile small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 6px 0 3px;
  font-size: .7rem;
  color: var(--muted);
}
.media-kind {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(13,17,23,.85);
  color: var(--text);
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: .56rem;
  border-radius: 4px;
}
.media-remove {
  border: none;
  background: none;
  color: var(--red);
  padding: 4px 0;
  font-size: .72rem;
  cursor: pointer;
}

/* ── Media Lightbox ───────────────────────────────────────────── */
.media-lightbox {
  width: min(96vw, 1180px);
  max-width: 1180px;
  max-height: 94vh;
  z-index: 1000;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius-lg);
  background: rgba(5, 8, 13, .96);
  color: var(--text);
  padding: 20px;
  overflow: hidden;
}
.media-lightbox:not([open]) {
  display: none;
}
.media-lightbox::backdrop {
  background: rgba(5, 8, 13, .88);
  backdrop-filter: blur(10px);
}
.media-lightbox-stage {
  width: 100%;
  height: min(82vh, 880px);
  display: grid;
  place-items: center;
}
.media-lightbox-stage img,
.media-lightbox-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  background: #05080d;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.media-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(22,27,34,.86);
  color: var(--text);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.media-lightbox-close:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
.media-lightbox-caption {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 16px;
  color: var(--muted);
  font-size: .85rem;
}
.media-lightbox-caption a {
  white-space: nowrap;
  font-weight: 700;
}

/* ── Design Panel ────────────────────────────────────────────── */
.design-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.design-panel > p, .publish-note {
  font-size: .78rem;
  line-height: 1.5;
  color: var(--muted);
}
.canva-link {
  display: block;
  text-align: center;
  color: var(--purple);
  font-weight: 700;
  font-size: .82rem;
  padding: 10px;
}
.danger { color: var(--red); margin: 10px auto; display: block; }

/* ── Ideas / AI Pills ────────────────────────────────────────── */
#ideas-container {
  background: rgba(167,139,250,.07) !important;
  border: 1px solid rgba(167,139,250,.2) !important;
  border-radius: var(--radius) !important;
  margin: 8px 0 18px !important;
}

/* ── Login ───────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-shell > .brand {
  background: linear-gradient(160deg, #0d1117 0%, #1a2540 50%, #0d1117 100%);
  display: grid;
  place-items: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.login-shell > .brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 40% 50%, rgba(230,95,62,.15) 0%, transparent 65%);
}
.login-shell > .brand img { width: 240px; position: relative; z-index: 1; }
.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  max-width: 440px;
}
.login-form h1 { font-size: 1.9rem; margin-bottom: 8px; }
.login-form p { margin-bottom: 32px; }

/* ── Utility ─────────────────────────────────────────────────── */
.editor-form small { text-align: right; color: var(--muted); font-size: .74rem; display: block; margin-top: 4px; }
.section-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; font-family: var(--mono); }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .analytics-grid { grid-template-columns: repeat(3, 1fr); }
  .performance-row { grid-template-columns: 56px 1fr 20px; }
  .performance-row dl { grid-column: 2/4; }
}

@media (max-width: 900px) {
  .sidebar {
    position: sticky; top: 0;
    width: 100% !important; height: auto !important;
    flex-direction: row !important;
    align-items: center;
    padding: 12px 16px !important;
    gap: 16px;
  }
  .logo-brand { padding: 0; border: none; margin: 0; }
  .logo-brand img { height: 30px; }
  .logo-brand small { display: none; }
  .sidebar nav { flex-direction: row !important; margin: 0 !important; gap: 4px; overflow-x: auto; }
  .sidebar nav a { padding: 8px 12px; font-size: .8rem; }
  .sidebar form { margin: 0 0 0 auto !important; padding: 0; border: none; }
  .app-main { padding: 28px 20px 60px; }
  .studio-grid, .editor-grid, .settings-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .app-main { padding: 20px 14px 60px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stats-row strong { font-size: 2rem; }
  .content-row { grid-template-columns: 56px 1fr auto; }
  .content-row > .status { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-shell > .brand { display: none; }
  .login-form { padding: 40px 24px; max-width: 100%; }
  .week-grid { grid-template-columns: repeat(7, 1fr); }
  .performance-row dl { grid-template-columns: repeat(2, 1fr); }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
}

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