/* ================================================================
   ARTICLE PLATFORM — Economist-inspired design system
   ================================================================ */

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
  --red:         #e3120b;
  --red-hover:   #c20e09;
  --navy:        #1a3468;
  --navy-hover:  #122650;
  --ink:         #111111;
  --body:        #2c2c2c;
  --muted:       #636363;
  --faint:       #909090;
  --bg:          #f6f6f4;
  --paper:       #ffffff;
  --paper-alt:   #fafaf8;
  --border:      #d8d8d4;
  --border-lt:   #ebebea;
  --yellow:      #f7c948;
  --green:       #1d7a4a;
  --r:           3px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
p, ul, ol, dl { margin-top: 0; }
h1,h2,h3,h4,h5,h6 { margin-top: 0; line-height: 1.1; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
button { cursor: pointer; }

/* ── Layout ──────────────────────────────────────────────────── */
.wrap { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }

/* ── Red top accent ──────────────────────────────────────────── */
.top-stripe { height: 5px; background: var(--red); }

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.header-body {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 20px; padding: 12px 0;
}

/* Logo */
.logo {
  display: flex; flex-direction: column; justify-content: center;
  width: 96px; min-height: 62px; padding: 8px 10px;
  background: var(--red); color: #fff; border-radius: 2px;
  font-family: Georgia, serif; font-style: italic;
  font-weight: 700; font-size: .95rem; line-height: 1.1;
  letter-spacing: -.01em; flex-shrink: 0;
  transition: opacity .15s;
}
.logo:hover { color: #fff; opacity: .9; }

/* Nav */
.site-nav {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.site-nav a {
  padding: 7px 12px; border-radius: var(--r);
  font-family: system-ui, Arial, sans-serif;
  font-size: .82rem; font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--ink); background: var(--bg); }
.site-nav a.active { color: var(--ink); }

.nav-notif {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r);
  font-family: system-ui, Arial, sans-serif;
  font-size: .82rem; font-weight: 600;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.nav-notif:hover { color: var(--ink); background: var(--bg); }

.notif-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: .68rem; font-weight: 700; font-family: system-ui, sans-serif;
}
.nav-sep {
  width: 1px; height: 18px; background: var(--border); margin: 0 4px;
}
.btn-logout {
  padding: 7px 14px; border-radius: var(--r);
  border: 1px solid var(--border);
  font-family: system-ui, Arial, sans-serif;
  font-size: .82rem; font-weight: 600;
  color: var(--muted); background: transparent;
  transition: all .15s;
}
.btn-logout:hover { color: var(--ink); border-color: #aaa; background: var(--bg); }

/* ── Main ────────────────────────────────────────────────────── */
.site-main {
  flex: 1;
  padding: 40px 0 88px;
}

/* ── Messages ────────────────────────────────────────────────── */
.flash-list { margin-bottom: 28px; display: grid; gap: 8px; }
.flash {
  padding: 12px 16px 12px 20px;
  border-left: 4px solid var(--red);
  background: #fff5f4; border-radius: 0 var(--r) var(--r) 0;
  font-family: system-ui, sans-serif; font-size: .9rem; color: var(--body);
}
.flash.success { border-color: var(--green); background: #f0fbf5; }
.flash.info    { border-color: var(--navy);  background: #f0f4fb; }

/* ── Page heading ────────────────────────────────────────────── */
.page-head { margin-bottom: 36px; }
.page-head + .page-head { margin-top: -20px; }

.eyebrow {
  display: inline-block; margin-bottom: 10px;
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
  color: var(--red);
}

.page-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700; font-style: italic;
  letter-spacing: -.04em; margin: 0 0 10px;
  color: var(--ink);
}

.page-lead {
  max-width: 660px; margin: 0;
  font-family: system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: .975rem; line-height: 1.7; color: var(--muted);
}

/* ── Section title ───────────────────────────────────────────── */
.sec {
  margin: 48px 0 20px;
  padding-top: 14px;
  border-top: 3px solid var(--ink);
  font-size: 1.35rem; font-weight: 700; font-style: italic;
  letter-spacing: -.025em; color: var(--ink);
}
.sec:first-child { margin-top: 0; }

/* ── Divider ─────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border-lt); margin: 28px 0; }

/* ── Stat row ────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  background: var(--border); margin-bottom: 36px;
}
.stat {
  background: var(--paper); padding: 20px 24px 18px;
}
.stat-label {
  display: block; margin-bottom: 6px;
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint);
}
.stat-value {
  display: block; font-size: 2.6rem; line-height: 1;
  font-weight: 700; letter-spacing: -.05em; color: var(--ink);
}
.stat-value.small { font-size: 1.4rem; letter-spacing: -.02em; padding-top: 6px; }

/* ── Cards grid ──────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--border);
}
.card {
  background: var(--paper); padding: 26px 28px;
  display: flex; flex-direction: column;
  transition: background .18s;
}
.card:hover { background: #fafaf8; }

.card-tag {
  display: inline-flex; align-items: center;
  padding: 3px 8px; margin-bottom: 12px;
  border-radius: 2px; background: var(--red); color: #fff;
  font-family: system-ui, sans-serif; font-size: .68rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  align-self: flex-start;
}
.card-tag.blue   { background: var(--navy); }
.card-tag.yellow { background: var(--yellow); color: var(--ink); }
.card-tag.green  { background: var(--green); }

.card-title {
  margin: 0 0 10px; font-size: 1.35rem; font-weight: 700;
  letter-spacing: -.02em; color: var(--ink); line-height: 1.2;
}
.card-title a:hover { color: var(--red); }

.card-desc {
  margin: 0 0 14px; flex: 1;
  font-family: system-ui, sans-serif; font-size: .9rem;
  line-height: 1.65; color: var(--muted);
}
.card-meta {
  font-family: system-ui, sans-serif; font-size: .82rem;
  color: var(--faint); margin-bottom: 5px;
}
.card-meta strong { color: var(--body); font-weight: 600; }
.card-foot { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Panel (white box) ───────────────────────────────────────── */
.panel {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r); padding: 28px 32px;
  margin-bottom: 16px;
}
.panel-sm { padding: 20px 24px; }

/* ── Article list ────────────────────────────────────────────── */
.art-list { list-style: none; margin: 0; padding: 0; }
.art-list li {
  padding: 20px 0; border-top: 1px solid var(--border-lt);
}
.art-list li:first-child { border-top: none; padding-top: 0; }

.art-title {
  margin: 0 0 6px; font-size: 1.2rem; font-weight: 700;
  letter-spacing: -.02em; color: var(--ink);
}
.art-title a:hover { color: var(--red); }

.art-meta {
  font-family: system-ui, sans-serif; font-size: .82rem;
  color: var(--muted); margin: 0 0 4px;
}
.art-meta strong { color: var(--body); font-weight: 600; }

.art-row {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  margin-top: 8px;
  font-family: system-ui, sans-serif; font-size: .78rem;
  color: var(--faint);
}

.empty {
  font-family: system-ui, sans-serif; font-style: italic;
  color: var(--faint); padding: 12px 0; font-size: .9rem;
}

/* ── Tag / badge ─────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 2px;
  background: var(--red); color: #fff;
  font-family: system-ui, sans-serif; font-size: .68rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
}
.tag.blue   { background: var(--navy); }
.tag.yellow { background: var(--yellow); color: var(--ink); }
.tag.green  { background: var(--green); }
.tag.gray   { background: var(--border); color: var(--muted); }

/* ── Action bar ──────────────────────────────────────────────── */
.action-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px; margin-bottom: 28px;
}
.action-bar-right { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Toolbar / filters ───────────────────────────────────────── */
.filters {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 24px;
  margin-bottom: 28px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px;
}
.fld {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 190px; flex: 1;
}
.fld label {
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
}
.fld-actions { display: flex; gap: 8px; align-items: flex-end; padding-top: 20px; }

/* ── All inputs ──────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=url],
select, textarea {
  display: block; width: 100%;
  padding: 9px 12px; border: 1px solid #c6c6c2;
  border-radius: var(--r); background: var(--paper);
  color: var(--ink); font-family: system-ui, sans-serif; font-size: .92rem;
  transition: border-color .15s, box-shadow .15s; appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,52,104,.13);
}
input::placeholder { color: var(--faint); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn, button[type=submit], input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 40px; padding: 8px 20px;
  border: 1px solid transparent; border-radius: var(--r);
  background: var(--navy); color: #fff;
  font-family: system-ui, Arial, sans-serif; font-size: .85rem;
  font-weight: 600; letter-spacing: .02em;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}
.btn:hover, button[type=submit]:hover, input[type=submit]:hover {
  background: var(--navy-hover); color: #fff;
}
.btn-outline {
  background: var(--paper); color: var(--ink); border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); color: var(--ink); border-color: #aaa; }
.btn-red { background: var(--red); border-color: var(--red); }
.btn-red:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: .8rem; }

/* inline form wrapper so buttons sit next to each other */
.inline-form { display: inline-flex; margin: 0; }

/* ── Form layout ─────────────────────────────────────────────── */
.form-wrap {
  max-width: 680px;
  margin: 0;
}

.panel-center .form-wrap {
  margin-left: auto;
  margin-right: auto;
}

.panel-center form {
  display: grid;
  gap: 20px;
}

.panel-center form p {
  margin: 0;
  display: grid;
  gap: 7px;
  text-align: left;
}

.panel-center .btn,
.panel-center button[type=submit],
.panel-center input[type=submit] {
  justify-self: center;
}

.panel-center > p,
.panel-center .form-wrap > p {
  text-align: center;
}

.form-wrap form,
.form-grid { display: grid; gap: 20px; }

/* Django as_p */
.form-wrap form p { margin: 0; display: grid; gap: 7px; }
.form-wrap form label {
  font-family: system-ui, sans-serif; font-size: .78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.form-wrap form input,
.form-wrap form select,
.form-wrap form textarea { width: 100%; }

/* Checkbox group */
.check-group { display: grid; gap: 8px; }
.check-title {
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 4px;
}
.check-item {
  display: flex !important; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--paper-alt);
  font-family: system-ui, sans-serif; font-size: .9rem; color: var(--body);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.check-item:hover { background: #f0f0ee; border-color: #bbb; }
.check-item input[type=checkbox] {
  width: 17px !important; height: 17px; margin: 0; flex-shrink: 0;
  accent-color: var(--navy);
}

/* ── Invite link box ─────────────────────────────────────────── */
.invite-box {
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--bg);
  font-family: "Courier New", monospace; font-size: .83rem;
  color: var(--muted); word-break: break-all; line-height: 1.5;
}
.copy-note {
  margin-top: 8px; font-family: system-ui, sans-serif;
  font-size: .82rem; color: var(--navy); min-height: 18px;
}

/* ── Hero (home) ─────────────────────────────────────────────── */
.hero {
  padding: 60px 0 52px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 52px;
}
.hero-kicker {
  display: inline-block; margin-bottom: 14px;
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .14em;
  color: var(--red);
}
.hero-title {
  margin: 0 0 20px;
  font-size: clamp(3rem, 6vw, 4.8rem);
  font-style: italic; font-weight: 700;
  letter-spacing: -.06em; line-height: .96;
  color: var(--ink); max-width: 760px;
}
.hero-lead {
  max-width: 580px; margin: 0 0 36px;
  font-family: system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.05rem; line-height: 1.7; color: var(--muted);
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Detail layout ───────────────────────────────────────────── */
.detail-grid {
  display: grid; gap: 28px;
  grid-template-columns: 1fr; /* single col by default */
}

/* key-value pairs inside panels */
.kv { display: grid; gap: 12px; }
.kv-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-family: system-ui, sans-serif; font-size: .88rem;
  color: var(--body);
}
.kv-label {
  min-width: 140px; flex-shrink: 0;
  font-weight: 700; color: var(--muted);
  text-transform: uppercase; font-size: .72rem; letter-spacing: .05em;
  padding-top: 1px;
}
.kv-value { flex: 1; line-height: 1.5; }

/* ── Nested review list ──────────────────────────────────────── */
.rev-list { list-style: none; margin: 0; padding: 0; }
.rev-list li {
  padding: 16px 0; border-top: 1px solid var(--border-lt);
}
.rev-list li:first-child { border-top: none; padding-top: 0; }
.rev-title {
  font-size: 1rem; font-weight: 700; color: var(--ink);
  margin: 0 0 6px;
}
.rev-body {
  font-family: system-ui, sans-serif; font-size: .88rem;
  color: var(--muted); line-height: 1.6; margin: 6px 0;
}

/* ── Status colours ──────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.sp-pending  { background: #fff4e0; color: #875000; }
.sp-review   { background: #e8eeff; color: var(--navy); }
.sp-revision { background: #fff0ef; color: var(--red); }
.sp-accepted { background: #e6f9ee; color: var(--green); }
.sp-rejected { background: #f5f5f5; color: var(--faint); }
.sp-neutral {
  background: #f1f1ef;
  color: #6b6b6b;
}
/* ── Notification item ───────────────────────────────────────── */
.notif-item {
  padding: 18px 0; border-top: 1px solid var(--border-lt);
  display: flex; gap: 14px; align-items: flex-start;
}
.notif-item:first-child { border-top: none; padding-top: 0; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); flex-shrink: 0; margin-top: 7px;
}
.notif-dot.read { background: var(--border); }
.notif-content { flex: 1; }
.notif-title {
  font-size: 1rem; font-weight: 700; color: var(--ink);
  margin: 0 0 4px;
}
.notif-msg {
  font-family: system-ui, sans-serif; font-size: .88rem;
  color: var(--muted); margin: 0 0 8px; line-height: 1.55;
}
.notif-meta {
  font-family: system-ui, sans-serif; font-size: .78rem;
  color: var(--faint);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  border-top: 3px solid var(--ink);
  background: var(--paper); margin-top: 64px; padding: 28px 0;
}
.footer-body {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.footer-logo {
  font-family: Georgia, serif; font-style: italic; font-size: .9rem;
  color: var(--muted);
}
.footer-links {
  display: flex; gap: 24px;
  font-family: system-ui, sans-serif; font-size: .8rem; color: var(--faint);
}
.footer-links a { color: var(--faint); }
.footer-links a:hover { color: var(--red); }

/* ── Warning delete block ────────────────────────────────────── */
.danger-box {
  border: 1px solid #f0c9c5; border-left: 4px solid var(--red);
  background: #fff5f4; border-radius: var(--r); padding: 18px 22px;
  margin-bottom: 20px;
  font-family: system-ui, sans-serif; font-size: .9rem; color: var(--body);
}
.danger-box strong { color: var(--red); }

/* ── Utility ─────────────────────────────────────────────────── */
.mt-0  { margin-top: 0 !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.text-muted { color: var(--muted); font-family: system-ui, sans-serif; font-size: .88rem; }
.text-faint { color: var(--faint); }
.mono { font-family: "Courier New", monospace; font-size: .85rem; }
.gap-8 { gap: 8px !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 800px) {
  .wrap { width: calc(100% - 32px); }
  .header-body { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .site-nav { gap: 4px; }
  .hero { padding: 36px 0 32px; margin-bottom: 36px; }
  .hero-title { font-size: 2.4rem; }
  .page-title { font-size: 2rem; }
  .sec { font-size: 1.2rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .kv-label { min-width: 100px; }
  .filters { gap: 12px; }
  .fld { min-width: 150px; }
  .footer-body { flex-direction: column; align-items: flex-start; }
}


.book-form {
  display: grid;
  gap: 20px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.field-errors {
  font-family: system-ui, sans-serif;
  font-size: .82rem;
  color: var(--red);
}

.file-current-box {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--paper-alt);
}

.file-current-label {
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.file-current-name {
  font-family: system-ui, sans-serif;
  font-size: .9rem;
  color: var(--body);
  line-height: 1.5;
  word-break: break-word;
}

.file-current-name a {
  color: var(--navy);
}

.file-current-name a:hover {
  color: var(--navy-hover);
  text-decoration: underline;
}

.clear-file-row {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  font-family: system-ui, sans-serif;
  font-size: .9rem;
  color: var(--body);
  width: fit-content;
}

.clear-file-row input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  margin: 0;
  accent-color: var(--navy);
}

.file-upload-row {
  display: grid;
  gap: 8px;
}

.file-upload-label {
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}


.template-clear-checkbox {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
}