:root {
  --font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
  --black: #0A0A0A;
  --ink: #111214;
  --ink-soft: #4A4D52;
  --ink-faint: #8A8D93;
  --paper: #FFFFFF;
  --paper-warm: #F7F6F3;
  --cream: #E7E3DD;
  --accent: #FF3131;
  --accent-2: #FF914D;
  --accent-grad: linear-gradient(100deg, #FF3131, #FF914D);
  --hairline: #E4E2DD;
  --ok: #1E8E5A;
  --danger: #D92D20;
}

* , *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper-warm);
  color: var(--ink);
  line-height: 1.5;
}

a { color: inherit; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand img { height: 28px; }
.brand span { font-size: 14px; color: var(--ink-faint); font-weight: 500; }

/* ---------- login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(10,10,10,0.06);
}
.login-card .brand { justify-content: center; margin-bottom: 24px; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; text-align: center; }
.login-card p.sub { margin: 0 0 24px; text-align: center; color: var(--ink-faint); font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn--primary { background: var(--accent-grad); color: #fff; width: 100%; }
.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
.btn--danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.full-w { width: 100%; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 1em; }
.status-msg { font-size: 13px; margin-top: 10px; min-height: 1em; }

/* ---------- dashboard shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { color: #fff; margin-bottom: 28px; padding: 0 8px; }
.sidebar .brand span { color: rgba(255,255,255,0.5); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav button {
  all: unset;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
}
.sidebar nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav button.is-active { background: rgba(255,255,255,0.1); color: #fff; font-weight: 600; }
.sidebar .sidebar-foot { margin-top: auto; padding: 0 8px; }
.sidebar .sidebar-foot .who { font-size: 12px; color: rgba(255,255,255,0.5); margin-bottom: 10px; word-break: break-all; }

.main { flex: 1; min-width: 0; padding: 32px; }
.main-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.main-head h1 { font-size: 22px; margin: 0; }

.table-wrap { background: var(--paper); border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
th { color: var(--ink-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
td.actions { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge--published { background: rgba(30,142,90,0.12); color: var(--ok); }
.badge--draft { background: rgba(138,141,147,0.15); color: var(--ink-soft); }
.empty-row td { text-align: center; color: var(--ink-faint); padding: 40px 16px; }

/* ---------- editor panel ---------- */
.editor-overlay {
  position: fixed; inset: 0; background: rgba(10,10,10,0.4);
  display: flex; justify-content: flex-end; z-index: 50;
}
.editor-panel {
  width: min(720px, 100%);
  background: var(--paper);
  height: 100%;
  overflow-y: auto;
  padding: 28px 32px 100px;
}
.editor-panel h2 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-actions {
  position: sticky; bottom: 0; margin: 24px -32px -24px; padding: 16px 32px;
  background: var(--paper); border-top: 1px solid var(--hairline);
  display: flex; gap: 10px; align-items: center;
}
.results-editor .result-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.image-preview { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.image-preview img { height: 56px; width: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--hairline); }

.close-x { all: unset; cursor: pointer; float: right; font-size: 20px; color: var(--ink-faint); padding: 4px 8px; }
.close-x:hover { color: var(--ink); }
