/* ============================================================
   AI Blog Generator — Main Stylesheet
   Palette: Warm Beige / Orange / Charcoal Black
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Palette */
  --cream:      #F7F3EE;
  --beige:      #EDE8E0;
  --beige-mid:  #DED7CB;
  --beige-dark: #C8BFB0;
  --sand:       #B8AFA3;

  --orange:     #E8541A;
  --orange-lt:  #F4855A;
  --orange-dk:  #C43E0E;
  --orange-bg:  #FDF0EB;

  --ink:        #1A1714;
  --ink-80:     #2E2925;
  --ink-60:     #5C5650;
  --ink-40:     #8C8880;
  --ink-20:     #C0BCB8;

  --white:      #FFFFFF;
  --surface:    #FAF8F5;

  /* Status colors */
  --status-pending:    #A07C50;
  --status-generating: #E8881A;
  --status-generated:  #5A8A5A;
  --status-publishing: #1A6EA8;
  --status-published:  #2E7D3F;
  --status-error:      #CC2E2E;

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Spacing */
  --sidebar-w: 260px;
  --header-h:  60px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(26,23,20,.06), 0 1px 2px rgba(26,23,20,.04);
  --shadow-md:  0 4px 16px rgba(26,23,20,.08), 0 2px 6px rgba(26,23,20,.04);
  --shadow-lg:  0 12px 40px rgba(26,23,20,.12), 0 4px 12px rgba(26,23,20,.06);
  --shadow-orange: 0 4px 20px rgba(232,84,26,.25);

  /* Transitions */
  --t: 200ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dk); }

input, select, textarea, button { font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar__logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar__logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--orange);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 18px; height: 18px; fill: white; }

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--white);
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-40);
  font-family: var(--font-mono);
  letter-spacing: .05em;
}

/* Nav */
.sidebar__nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section { margin-bottom: 8px; }

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-40);
  padding: 8px 20px 4px;
  font-family: var(--font-mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,.55);
  font-size: 14px;
  font-weight: 450;
  border-radius: 0;
  transition: all var(--t);
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.04);
}

.nav-item.active {
  color: var(--white);
  background: rgba(232,84,26,.12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--orange);
  border-radius: 0 2px 2px 0;
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  opacity: .7;
  flex-shrink: 0;
}

.nav-item.active .nav-item__icon { opacity: 1; }

/* Badge */
.nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

/* Modules coming soon */
.nav-item.disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.coming-soon {
  margin-left: auto;
  font-size: 9px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Sidebar footer */
.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--ink-40);
  font-family: var(--font-mono);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.3);
  transition: all var(--t);
  flex-shrink: 0;
}

.btn-logout:hover {
  background: rgba(204,46,46,.15);
  color: #e87a7a;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  background: var(--cream);
  border-bottom: 1px solid var(--beige-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header__page-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.header__actions { display: flex; align-items: center; gap: 10px; }

/* ── Main Content ─────────────────────────────────────────────── */
.app-main {
  background: var(--cream);
  overflow-y: auto;
  min-height: calc(100vh - var(--header-h));
}

.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px;
}

/* ── Flash Messages ─────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 24px;
  font-size: 14px;
}

.flash--success {
  background: #EDF7EE;
  border: 1px solid #AECFB0;
  color: #2E7D3F;
}

.flash--error {
  background: #FDF0F0;
  border: 1px solid #F0BEBE;
  color: var(--status-error);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--beige-mid);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--beige);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.card-body { padding: 24px; }

/* ── Metric Cards ─────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--beige-mid);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--orange-bg);
  transform: translate(30px, -30px);
}

.metric-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-40);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.metric-card--orange .metric-value { color: var(--orange); }

.metric-sub {
  font-size: 12px;
  color: var(--ink-40);
  margin-top: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background: var(--orange);
  color: white;
  box-shadow: var(--shadow-orange);
}

.btn--primary:hover {
  background: var(--orange-dk);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(232,84,26,.35);
}

.btn--secondary {
  background: var(--beige);
  color: var(--ink-80);
  border: 1px solid var(--beige-dark);
}

.btn--secondary:hover {
  background: var(--beige-mid);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-60);
  border: 1px solid var(--beige-dark);
}

.btn--ghost:hover { background: var(--beige); color: var(--ink); }

.btn--danger { background: #FDF0F0; color: var(--status-error); border: 1px solid #F0BEBE; }
.btn--danger:hover { background: var(--status-error); color: white; }

.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--lg { padding: 12px 24px; font-size: 15px; }

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid--full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-60);
  letter-spacing: .03em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--cream);
  border: 1px solid var(--beige-mid);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,84,26,.12);
  background: var(--white);
}

textarea { resize: vertical; min-height: 90px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238C8880' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 11px;
  color: var(--ink-40);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead { background: var(--beige); }

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-60);
  font-family: var(--font-mono);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--beige);
  color: var(--ink-80);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--t);
}

tbody tr:hover { background: var(--beige); }

/* ── Status Badge ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .04em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

.badge--pending    { background: #FFF3E8; color: var(--status-pending); }
.badge--generating { background: #FFF8E8; color: var(--status-generating); animation: pulse-badge 1.4s ease-in-out infinite; }
.badge--generated  { background: #EDF7EE; color: var(--status-generated); }
.badge--publishing { background: #E8F4FD; color: var(--status-publishing); }
.badge--published  { background: #E8F5EA; color: var(--status-published); }
.badge--error      { background: #FDF0F0; color: var(--status-error); }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}

/* ── Page header row ─────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-head__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.page-head__sub {
  font-size: 13px;
  color: var(--ink-60);
  margin-top: 4px;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  background: var(--beige);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state__icon svg { width: 24px; height: 24px; color: var(--ink-40); }

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; color: var(--ink-60); margin-bottom: 20px; }

/* ── Section Divider ─────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  color: var(--ink-40);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--beige-mid);
}

/* ── Log Entry ───────────────────────────────────────────── */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--beige);
  font-size: 13px;
}

.log-entry:last-child { border-bottom: none; }

.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.log-dot--success { background: var(--status-published); }
.log-dot--error   { background: var(--status-error); }
.log-dot--pending { background: var(--status-pending); }

.log-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-40);
  white-space: nowrap;
  margin-left: auto;
}

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--cream);
}

.auth-left {
  background: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 56px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  bottom: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: var(--orange);
  opacity: .08;
}

.auth-left::after {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--orange);
  opacity: .05;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}

.auth-tagline {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 20px;
}

.auth-tagline span { color: var(--orange); }

.auth-desc {
  font-size: 15px;
  color: rgba(255,255,255,.45);
  line-height: 1.7;
  max-width: 360px;
}

.auth-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,.6);
}

.auth-feature-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 14px;
  color: var(--ink-60);
  margin-bottom: 32px;
}

.auth-form .form-group { margin-bottom: 16px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }

  .sidebar {
    display: none;
    grid-row: auto;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-left { display: none; }

  .form-grid { grid-template-columns: 1fr; }

  .metrics-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}

/* ============================================================
   DARK MODE — append to main.css
   ============================================================ */

[data-theme="dark"] {
  --cream:      #151210;
  --beige:      #1E1A17;
  --beige-mid:  #2A2520;
  --beige-dark: #352E28;
  --sand:       #4A4238;

  --white:      #1E1A17;
  --surface:    #181410;

  --ink:        #F0EBE4;
  --ink-80:     #D8D0C8;
  --ink-60:     #A89E94;
  --ink-40:     #6E6560;
  --ink-20:     #3A3430;

  --orange-bg:  #1E1208;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.2);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
}

/* Dark mode sidebar stays dark either way */
[data-theme="dark"] .sidebar {
  background: #0E0C0A;
  border-right: 1px solid rgba(255,255,255,.04);
}

[data-theme="dark"] .app-header {
  background: var(--cream);
  border-bottom-color: var(--beige-mid);
}

[data-theme="dark"] .card {
  background: var(--beige);
  border-color: var(--beige-mid);
}

[data-theme="dark"] thead {
  background: var(--beige-mid);
}

[data-theme="dark"] td {
  border-bottom-color: var(--beige-mid);
}

[data-theme="dark"] tbody tr:hover {
  background: var(--beige-mid);
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--beige-mid);
  border-color: var(--beige-dark);
  color: var(--ink);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  background: var(--beige-dark);
  border-color: var(--orange);
}

[data-theme="dark"] .btn--secondary {
  background: var(--beige-mid);
  border-color: var(--beige-dark);
  color: var(--ink-80);
}

[data-theme="dark"] .btn--ghost {
  border-color: var(--beige-dark);
  color: var(--ink-60);
}

[data-theme="dark"] .btn--ghost:hover {
  background: var(--beige-mid);
  color: var(--ink);
}

[data-theme="dark"] .metric-card {
  background: var(--beige);
  border-color: var(--beige-mid);
}

[data-theme="dark"] .flash--success {
  background: #0E1F10;
  border-color: #2A5C2E;
  color: #6FCF80;
}

[data-theme="dark"] .flash--error {
  background: #1F0E0E;
  border-color: #5C2A2A;
  color: #CF7070;
}

[data-theme="dark"] .auth-right {
  background: var(--cream);
}

[data-theme="dark"] .auth-box input {
  background: var(--beige-mid);
  border-color: var(--beige-dark);
  color: var(--ink);
}

/* ── Dark mode toggle button ─────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--beige-mid);
  cursor: pointer;
  color: var(--ink-60);
  transition: all var(--t);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--beige);
  color: var(--ink);
  border-color: var(--beige-dark);
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   RESPONSIVE MOBILE — sidebar drawer
   ============================================================ */

@media (max-width: 900px) {

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }

  /* Sidebar becomes a drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    display: flex; /* override the display:none from before */
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,.3);
  }

  /* Backdrop overlay */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop.visible { display: block; }

  /* Show hamburger */
  #menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    background: var(--beige);
    border: 1px solid var(--beige-mid);
    color: var(--ink);
    cursor: pointer;
    transition: all var(--t);
  }

  #menu-toggle:hover { background: var(--beige-mid); }

  /* Main takes full width */
  .app-header { grid-column: 1; }
  .app-main   { grid-column: 1; }

  /* Page content padding */
  .page-content { padding: 20px 16px; }

  /* Metrics stack */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Page head stacks */
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-head .btn { align-self: flex-start; }

  /* Form grid → single col */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-group--full { grid-column: 1; }

  /* Tables scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Dashboard two-col → single */
  .dashboard-grid { grid-template-columns: 1fr !important; }

  /* Auth layout */
  .auth-layout { grid-template-columns: 1fr; }
  .auth-left   { display: none; }
  .auth-right  { padding: 40px 24px; }
}

@media (max-width: 520px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .header__actions .btn span { display: none; } /* hide text, keep icon on mobile */
  .metric-value { font-size: 26px; }
}

/* ============================================================
   CHART STYLES
   ============================================================ */

.chart-container {
  position: relative;
  width: 100%;
}

.chart-bar {
  transition: opacity var(--t);
}
.chart-bar:hover { opacity: .85; }

.chart-tooltip {
  position: fixed;
  background: var(--ink);
  color: white;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  transform: translate(-50%, -110%);
}

/* Donut chart */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-label { color: var(--ink-60); flex: 1; }
.donut-legend-value { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

/* ============================================================
   BLOG EDITOR / PREVIEW
   ============================================================ */

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--beige);
  border-bottom: 1px solid var(--beige-mid);
  flex-wrap: wrap;
}

.editor-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-60);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: all var(--t);
}

.editor-toolbar-btn:hover {
  background: var(--beige-mid);
  color: var(--ink);
}

.editor-content {
  width: 100%;
  min-height: 500px;
  padding: 20px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--white);
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-body);
}

.editor-content:focus { outline: none; }

/* Preview mode */
.preview-content {
  padding: 28px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
}

.preview-content h1, .preview-content h2, .preview-content h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 1.4em 0 .5em;
  line-height: 1.2;
}

.preview-content h1 { font-size: 26px; font-weight: 800; }
.preview-content h2 { font-size: 20px; font-weight: 700; }
.preview-content h3 { font-size: 17px; font-weight: 600; }

.preview-content p { margin-bottom: 1em; }

.preview-content a { color: var(--orange); }

.preview-content ul, .preview-content ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.preview-content li { margin-bottom: .4em; }

.preview-content blockquote {
  border-left: 3px solid var(--orange);
  padding-left: 16px;
  margin: 1.2em 0;
  color: var(--ink-60);
  font-style: italic;
}

.preview-content code {
  background: var(--beige);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.preview-content pre {
  background: var(--ink);
  color: #F0EBE4;
  padding: 16px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin-bottom: 1em;
}

/* Tab switcher */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--beige-mid);
  background: var(--white);
}

.tab-btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-60);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* Publish bar */
.publish-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--orange-bg);
  border-top: 1px solid rgba(232,84,26,.15);
  gap: 12px;
  flex-wrap: wrap;
}

.publish-bar__info {
  font-size: 13px;
  color: var(--ink-60);
}

.publish-bar__info strong { color: var(--ink); }
