/* ==========================================================================
   partnerinai — UI stylesheet
   Light, warm-modern aesthetic · Sora + Work Sans · admin sidebar
   ========================================================================== */

:root {
  /* Color tokens */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e8ef;
  --border-strong: #cfd6e0;
  --text: #0f172a;
  --muted: #5b6472;
  --primary: #d97706;
  --primary-dark: #b45309;
  --primary-soft: #fffbeb;
  --success: #067647;
  --success-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #93370d;
  --warning-soft: #fffaeb;

  /* Shape & elevation */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.05);

  /* Type */
  --font-display: "Sora", "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  --topbar-h: 60px;
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1000px 500px at 88% -10%, rgba(217, 119, 6, 0.06), transparent 60%),
    radial-gradient(800px 420px at -8% 8%, rgba(217, 119, 6, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.layout { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; }

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  padding: 4px 10px;
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 24px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: none; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 8px 4px; }

.user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.user-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.user-email { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.user-meta .btn { padding: 5px 10px; font-size: 13px; }

/* --------------------------------------------------------------------------
   Mobile top bar + drawer controls
   -------------------------------------------------------------------------- */

.mobile-bar { display: none; }
.nav-toggle { display: none; }
.sidebar-overlay { display: none; }

/* --------------------------------------------------------------------------
   Container / headings
   -------------------------------------------------------------------------- */

.container {
  margin: 0 auto;
  padding: clamp(24px, 5vw, 40px) clamp(16px, 4vw, 28px) 72px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 32px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
h2 { font-size: 18px; margin: 36px 0 14px; letter-spacing: -0.005em; }
.muted { color: var(--muted); }
.err { color: var(--danger); }

.container > h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}
.container > h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

/* Section heading with inline actions (e.g. "Topics" + Add/Discover buttons) */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 36px 0 14px;
}
.section-head h2 { margin: 0; }
.section-head::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}
.section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s var(--ease);
}
.back:hover { color: var(--primary); }

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
}
.flash::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.flash-ok { background: var(--success-soft); color: var(--success); border: 1px solid #abe0cd; }
.flash-err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f6c9c4; }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 20px 0 8px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.card-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Tables (scroll horizontally on narrow screens)
   -------------------------------------------------------------------------- */

.table-wrap {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cdd4df transparent;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: #cdd4df; border-radius: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

.table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
}
.table-wrap--wide .table { min-width: 760px; }

.table th,
.table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover { background: #fafcff; }
.table a { color: var(--primary); text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }
.table td, .table td code { word-break: break-word; }
.table td code { font-size: 12.5px; }

code {
  background: #f5f0e6;
  color: #8a4b0d;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Status badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge-queued, .badge-running, .badge-draft, .badge-pending,
.badge-in_progress, .badge-generating, .badge-in_review {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.badge-completed, .badge-done, .badge-approved, .badge-published,
.badge-succeeded, .badge-passed, .badge-ready {
  background: var(--success-soft);
  color: var(--success);
}
.badge-failed, .badge-rejected, .badge-error {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-revision, .badge-skipped, .badge-paused {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Live indicator: pulses next to a run's status while it is still active. */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--primary);
  vertical-align: middle;
  animation: live-pulse 1.4s var(--ease) infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.35);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f0c3bf; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: none; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; margin-bottom: 22px; }
.form-grid input { width: 100%; }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: none;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  animation: fade 0.2s var(--ease);
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  animation: rise 0.25s var(--ease);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-form { display: grid; gap: 14px; }
.modal-form label { display: grid; gap: 6px; }
.modal-form label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.modal-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.modal-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Filter bar (search + status)
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 20px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filter-bar input[type="search"], .filter-bar select {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.filter-bar select { flex: 0 1 200px; }
.filter-bar input[type="search"]:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.filter-bar .btn { flex: none; }

/* Compact filter for heading rows (sits inline next to action buttons) */
.filter-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.filter-inline input[type="search"], .filter-inline select {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.filter-inline input[type="search"] { flex: 1 1 160px; min-width: 0; }
.filter-inline select { flex: 0 1 150px; }
.filter-inline input[type="search"]:focus, .filter-inline select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.filter-inline .btn { flex: none; }

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 8px;
}
.pagination-info { color: var(--muted); font-size: 13px; }
.pagination-controls { display: flex; align-items: center; gap: 10px; }
.page-numbers { display: flex; align-items: center; gap: 4px; }
.page-num {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.page-num:hover { color: var(--text); background: var(--surface-2); }
.page-num.is-current {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--border);
  font-weight: 600;
}
.page-ellipsis { color: var(--muted); padding: 0 2px; }
.pagination .is-disabled { opacity: 0.45; pointer-events: none; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="search"], select, textarea {
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  min-height: 42px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

/* --------------------------------------------------------------------------
   Auth (login)
   -------------------------------------------------------------------------- */

.auth-card {
  max-width: 400px;
  margin: clamp(24px, 8vh, 72px) auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(24px, 5vw, 36px);
  box-shadow: var(--shadow-md);
}
.auth-card h1 { margin-bottom: 6px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.auth-card label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 600; }
.auth-card input { min-height: 46px; }

/* --------------------------------------------------------------------------
   Article detail
   -------------------------------------------------------------------------- */

.meta { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; }
.meta dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.meta dd { margin: 0; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 20px; }
.publish-box { margin: 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.publish-box p { margin: 0; }
.featured { margin: 18px 0; padding: 0; overflow: hidden; }
.featured img { display: block; width: 100%; height: auto; }
.featured figcaption { padding: 12px 16px; font-size: 13px; border-top: 1px solid var(--border); word-break: break-all; }

/* --------------------------------------------------------------------------
   Prose (article body)
   -------------------------------------------------------------------------- */

.prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  line-height: 1.7;
}
.prose h1, .prose h2, .prose h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.5em;
}
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 22px; margin: 1.5em 0 0.6em; }
.prose h3 { font-size: 18px; }
.prose p { margin: 1em 0; }
.prose pre {
  background: #0b1220;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.prose code { background: #f5f0e6; color: #8a4b0d; padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose blockquote { border-left: 3px solid var(--border-strong); margin-left: 0; padding-left: 18px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Page-load reveal
   -------------------------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.container > * { animation: rise 0.35s var(--ease) both; }
.container > *:nth-child(2) { animation-delay: 0.04s; }
.container > *:nth-child(3) { animation-delay: 0.08s; }
.cards .card { animation: rise 0.4s var(--ease) both; }
.cards .card:nth-child(2) { animation-delay: 0.05s; }
.cards .card:nth-child(3) { animation-delay: 0.1s; }
.cards .card:nth-child(4) { animation-delay: 0.15s; }

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 901px) {
  .sidebar { animation: sidebarIn 0.35s var(--ease) both; }
}

@keyframes sidebarIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Responsive — mobile drawer
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .layout { display: block; }

  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
  }
  .nav-toggle .bar {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
  }
  .layout.sidebar-open .nav-toggle .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .layout.sidebar-open .nav-toggle .bar:nth-child(2) { opacity: 0; }
  .layout.sidebar-open .nav-toggle .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(84vw, 300px);
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    z-index: 60;
  }
  .layout.sidebar-open .sidebar { transform: none; }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease);
  }
  .layout.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
}

@media (max-width: 600px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-inline > * { flex: 1 1 100%; }
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="url"], input[type="search"], select, textarea {
    font-size: 16px; /* prevents iOS zoom-on-focus */
    min-height: 46px;
  }
  .filter-bar input[type="search"], .filter-bar select { flex: 1 1 100%; }
  .btn { min-height: 44px; }
  .table th, .table td { padding: 11px 12px; }
  .prose { font-size: 15.5px; }
  .publish-box { align-items: stretch; flex-direction: column; }
  .publish-box .btn { width: 100%; }
  .back { padding: 8px 2px; }
}

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