:root {
  --bg: #fcfcfa;
  --surface: #fff;
  --text: #18181b;
  --muted: #52525b;
  --line: rgba(0, 0, 0, 0.06);
  --emerald: #10b981;
  --cyan: #06b6d4;
  --orange: #f97316;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(16,185,129,.12), transparent 34%),
    linear-gradient(45deg, transparent 58%, rgba(249,115,22,.12));
}
.login-panel {
  width: min(460px, 100%);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(15,23,42,.08);
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(90deg, #10b981, #06b6d4 52%, #fb923c);
}
.eyebrow { margin: 18px 0 8px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: 0; line-height: 1.04; }
.muted { color: var(--muted); line-height: 1.6; }
.stack { display: grid; gap: 14px; margin-top: 24px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
.primary, .ghost {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 800;
}
.primary { color: #fff; background: linear-gradient(90deg, #10b981, #06b6d4 52%, #fb923c); }
.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.error { color: #dc2626; min-height: 20px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.brand-row { display: flex; gap: 12px; align-items: center; }
.brand-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
nav { display: grid; gap: 8px; }
nav button {
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}
nav button.active { color: var(--text); background: #ecfdf5; }
.sidebar .ghost { margin-top: auto; }
.workspace { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(252,252,250,.88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar .eyebrow { margin: 0 0 6px; }
.content { padding: 28px 30px 60px; }
.toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.toolbar input { min-width: 240px; flex: 1; }
.toolbar select { width: auto; min-width: 150px; }
.record-count { align-self: center; white-space: nowrap; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.table th, .table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; background: #f4f4f5; }
.badge.published { background: #dcfce7; color: #15803d; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions button { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.button-link { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 700; }
.row-actions .danger { color: #b91c1c; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(360px, calc(100vw - 44px)); padding: 12px 16px; border-radius: 8px; background: #18181b; color: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.18); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
button:disabled { cursor: wait; opacity: .65; }
.editor, .seo-form {
  display: grid;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.seo-box { border-top: 1px solid var(--line); padding-top: 16px; }
.seo-box h3 { margin: 0 0 14px; }
.actions { display: flex; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.metric strong { display: block; font-size: 26px; margin-top: 6px; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .form-grid, .cards { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .table { display: block; overflow-x: auto; }
}
