/* Perennial admin — editorial minimalism, matches trainperennial.com brand. */

:root {
  --bg: #fdfcf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e3dc;
  --accent: #19D7F8;
  --accent-ink: #053c45;
  --danger: #c0392b;
  --success: #2c8a4a;
  --warn: #b87a00;
  --font-ui: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}
.brand--center { text-align: center; display: block; margin-bottom: 24px; }
.topbar__nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.topbar__nav a { text-decoration: none; }
.topbar__logout { margin: 0; }
.link {
  background: none; border: none; padding: 0;
  font: inherit; color: var(--accent-ink);
  text-decoration: underline; cursor: pointer;
}

/* ---------- Layout ---------- */
.main { max-width: 1100px; margin: 0 auto; padding: 48px 32px 96px; }

.masthead { margin-bottom: 32px; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 8px;
}
.page-sub { font-family: var(--font-serif); font-size: 18px; color: var(--muted); margin: 0; }

/* ---------- Filters ---------- */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 32px 0 24px;
}
.chip {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  text-transform: capitalize;
}
.chip:hover { border-color: var(--accent-ink); }
.chip--active { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-row__cta { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  border: 1px solid transparent;
  transition: background 80ms;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(0.96); }
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--text); }
.btn-ghost--danger { color: var(--danger); border-color: rgba(192, 57, 43, 0.3); }
.btn-ghost--danger:hover { border-color: var(--danger); }

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 80ms;
}
.card:hover { border-color: var(--text); }
.card--draft { border-left: 3px solid var(--accent); }
.card--published { border-left: 3px solid var(--success); }
.card--rejected { border-left: 3px solid var(--muted); opacity: 0.7; }

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.card__date { color: var(--muted); font-variant-numeric: tabular-nums; }
.card__title {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
  font-weight: 600;
}
.card__title a { color: var(--text); text-decoration: none; }
.card__title a:hover { color: var(--accent-ink); }
.card__excerpt { font-family: var(--font-serif); font-style: italic; color: var(--muted); margin: 0; font-size: 14px; }
.card__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.card__slug { color: var(--muted); font-size: 11px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: lowercase;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.badge--draft { background: rgba(25, 215, 248, 0.15); color: var(--accent-ink); }
.badge--published { background: rgba(44, 138, 74, 0.15); color: var(--success); }
.badge--rejected { background: #efefef; color: var(--muted); }

/* ---------- Empty ---------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.empty h2 { font-family: var(--font-serif); font-weight: 600; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 20px; font-family: var(--font-serif); font-style: italic; }

/* ---------- Editor ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.editor-head { margin-bottom: 24px; }
.actions-row { display: flex; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.actions-row form { margin: 0; }

.editor-form fieldset { border: none; padding: 0; margin: 0; }
.editor-form fieldset[disabled] { opacity: 0.65; }

.editor-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.editor-form .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}
.editor-form input[type=text],
.editor-form input[type=date],
.editor-form input[type=number],
.editor-form select,
.editor-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: var(--surface);
}
.editor-form input:focus,
.editor-form select:focus,
.editor-form textarea:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px rgba(25, 215, 248, 0.2);
}
.body-editor {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
}
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.form-foot { margin-top: 24px; }

/* ---------- Toasts ---------- */
#toast-slot { position: fixed; bottom: 24px; right: 24px; z-index: 1000; }
.toast {
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: toast-in 200ms ease-out;
}
.toast--ok { border-left: 3px solid var(--success); }
.toast--err { border-left: 3px solid var(--danger); color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 48px;
  width: min(420px, 100% - 32px);
  text-align: center;
}
.login-title { font-family: var(--font-serif); font-size: 36px; font-weight: 600; margin: 0 0 8px; }
.login-sub { font-family: var(--font-serif); color: var(--muted); margin: 0 0 32px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.login-form input {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  margin-bottom: 16px;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px rgba(25, 215, 248, 0.2);
}
.login-form button { width: 100%; padding: 12px; }
.form-error {
  background: rgba(192, 57, 43, 0.08);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
