:root {
  --paper: #FDFDFB;
  --panel: #F8F7F3;
  --line: #E5E3DC;
  --line-strong: #D3D1C7;
  --ink: #1a2b45;
  --text: #2C2C2A;
  --muted: #5F5E5A;
  --faint: #9a9890;
  --accent: #D85A30;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--paper); color: var(--text); font-family: var(--sans);
  font-size: 14px; line-height: 1.55; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; color: var(--ink); }
img { max-width: 100%; }

/* ---------- header ---------- */
.site-header { display: flex; align-items: center; gap: 18px; padding: 10px 20px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.masthead { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.logo { display: block; line-height: 0; }
.logo img { height: 38px; width: auto; display: block; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong);
  border-radius: 6px; font-size: 15px; padding: 3px 9px; cursor: pointer; color: var(--muted); }
.search-row { background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 20px; }
.search { max-width: 640px; margin: 0 auto; }
.search input { width: 100%; padding: 8px 14px; border: 1px solid var(--line-strong);
  border-radius: 8px; font-size: 13.5px; background: #fff; }
.search input:focus { outline: none; border-color: var(--ink); }
.user-links { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13px; }
.user-links a { color: var(--muted); }

.btn { display: inline-block; background: var(--ink); color: #fff !important; border: none;
  border-radius: 6px; padding: 8px 16px; font-size: 13px; cursor: pointer; font-family: var(--sans); }
.btn:hover { text-decoration: none; opacity: .92; }
.btn-small { padding: 5px 12px; }
.btn-outline { background: none; color: var(--muted) !important;
  border: 1px solid var(--line-strong); }
.btn-danger { background: #A32D2D; }

/* ---------- shell + left nav ---------- */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 100px); }
.shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.shell.nav-collapsed .country-nav { display: none; }
.country-nav { background: var(--panel); border-right: 1px solid var(--line);
  padding: 12px 0; position: sticky; top: 53px; height: calc(100vh - 53px); overflow-y: auto; }
.nav-head { display: flex; justify-content: space-between; align-items: center; padding: 0 14px 8px; }
.kicker { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
#nav-collapse { background: none; border: none; color: var(--faint); font-size: 16px;
  cursor: pointer; padding: 0 4px; }
.nav-item { display: flex; align-items: center; gap: 7px; padding: 5px 14px;
  font-size: 12.5px; color: var(--muted); }
.nav-item:hover { background: #F1EFE8; text-decoration: none; }
.nav-item.active { background: #E6F1FB; color: #0C447C; font-weight: 600;
  border-radius: 6px; margin: 1px 8px; padding: 5px 6px; }
.nav-flag { width: 18px; text-align: center; }
.nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 11px; color: #B4B2A9; }
.nav-count.has-new { color: var(--accent); font-weight: 600; }
.star { background: none; border: none; color: #D3D1C7; cursor: pointer; font-size: 13px;
  padding: 0 2px; line-height: 1; }
.star.on { color: var(--accent); }
.nav-hint { padding: 10px 14px; font-size: 11.5px; color: var(--faint); }

/* ---------- main ---------- */
.main { padding: 0 0 40px; background: #fff; }
.page-pad { padding: 16px 22px; }
.flash { margin: 12px 22px 0; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.flash-success { background: #EAF3DE; color: #27500A; }
.flash-error { background: #FCEBEB; color: #791F1F; }

/* country header + top-right editors card */
.country-top { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 16px 22px 0; flex-wrap: wrap; }
.country-head { padding: 0; }
.country-head h1 { margin: 0; font-family: var(--serif); font-size: 21px; }
.country-meta { margin: 2px 0 0; font-size: 12px; color: var(--faint); }
.country-meta a { color: var(--faint); text-decoration: underline; }

.editors-line { font-size: 12.5px; color: var(--muted); text-align: right; max-width: 340px;
  flex-shrink: 0; line-height: 1.5; }
.editors-line a { color: var(--ink); font-weight: 600; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: #E6F1FB; color: #0C447C;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; font-size: 24px; }

/* tabs */
.tabs { display: flex; padding: 12px 22px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 16px 10px; font-size: 14px; color: var(--faint); }
.tab:hover { text-decoration: none; color: var(--muted); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom: 2.5px solid var(--accent);
  margin-bottom: -1px; }
.tab .n { font-weight: 400; font-size: 12px; color: var(--faint); }

/* filter row */
.filters { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px; padding: 10px 22px 6px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-strong);
  color: var(--muted); }
.pill:hover { text-decoration: none; border-color: var(--muted); }
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.free-toggle { font-size: 11.5px; color: var(--faint); }
.free-toggle.active { color: #085041; font-weight: 600; }

/* wire rows */
.wire { padding: 0 22px; }
.wire-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line);
  align-items: baseline; }
.wire-date { font-family: var(--mono); font-size: 11px; color: var(--faint); min-width: 74px;
  flex-shrink: 0; }
.wire-body { flex: 1; min-width: 0; }
.wire-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink);
  line-height: 1.4; }
.wire-title:hover { color: var(--accent); text-decoration: none; }
.new-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle; }
.wire-note { font-size: 12.5px; color: var(--muted); font-style: italic; margin: 1px 0 0; }
.wire-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.wire-meta a { color: var(--faint); text-decoration: underline; }
.lock { font-size: 11px; }
.wire-tags { display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  flex-shrink: 0; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.ctag { font-size: 10.5px; padding: 1px 7px; border-radius: 4px; background: #E6F1FB;
  color: #0C447C; white-space: nowrap; }
.ctag:hover { text-decoration: none; opacity: .85; }
.tagline-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end;
  align-items: center; }
.savebtn { background: none; border: 1px solid var(--line); border-radius: 5px;
  cursor: pointer; font-size: 11px; line-height: 1; padding: 2px 5px;
  filter: grayscale(1); opacity: .55; }
.savebtn:hover { border-color: var(--line-strong); opacity: .85; }
.savebtn.on { filter: none; opacity: 1; border-color: var(--accent);
  background: #FAECE7; }
.empty { padding: 40px 22px; color: var(--faint); font-size: 14px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center;
  padding: 20px 22px; font-size: 13px; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 16px; color: var(--ink); background: #fff; }
.pager-btn:hover { border-color: var(--ink); text-decoration: none; }
.pager-btn.disabled { color: #D3D1C7; border-color: var(--line); cursor: default; }
.pager-status { color: var(--faint); font-size: 12.5px; min-width: 110px; text-align: center; }

/* key materials */
.km-group { padding: 8px 22px 4px; }
.km-group h2 { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--faint); margin: 14px 0 8px; font-weight: 600; }
.km-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.km-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  background: var(--paper); display: block; }
.km-card:hover { border-color: var(--line-strong); text-decoration: none; }
.km-title { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.km-meta { font-size: 11.5px; color: var(--faint); margin-top: 3px; }



/* forms */
.form-page { max-width: 560px; padding: 24px 22px; }
.form-page h1 { font-family: var(--serif); font-size: 20px; margin: 0 0 14px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search],
input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 13px; font-family: var(--sans); background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text);
  margin: 10px 0; }
.check input { width: auto; }
.errors { background: #FCEBEB; color: #791F1F; border-radius: 8px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 12px; }
.help { font-size: 11.5px; color: var(--faint); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.country-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 2px 14px; margin-top: 6px; }
.country-check-grid .check { margin: 3px 0; font-size: 12.5px; }

/* dupe warning */
.dupe-box { background: #FAEEDA; border: 1px solid #EF9F27; border-radius: 8px;
  padding: 12px 16px; margin: 12px 0; font-size: 13px; color: #633806; }
.dupe-box .t { font-weight: 600; }

.author-suggest-wrap { position: relative; }
.author-suggest-list { position: absolute; top: 100%; left: 0; right: 0; margin-top: 3px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.09);
  z-index: 40; display: none; }
.author-suggest-list.open { display: block; }
.author-suggest-item { padding: 7px 12px; font-size: 13px; color: var(--text); cursor: pointer; }
.author-suggest-item:hover, .author-suggest-item.active { background: var(--panel); }

/* tables (admin) */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.admin-table th { text-align: left; font-size: 10.5px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 6px 10px;
  border-bottom: 1px solid var(--line-strong); }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table input, .admin-table select { font-size: 12.5px; padding: 5px 8px; }
.inline-form { display: inline; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 14px 0; }
.stat { background: var(--panel); border-radius: 8px; padding: 12px 16px; }
.stat .v { font-size: 22px; font-weight: 600; color: var(--ink); }
.stat .l { font-size: 11.5px; color: var(--faint); }
.status-pill { font-size: 10.5px; padding: 2px 8px; border-radius: 4px; }
.st-draft { background: #FAEEDA; color: #633806; }
.st-queued, .st-sending { background: #E6F1FB; color: #0C447C; }
.st-sent { background: #EAF3DE; color: #27500A; }
.st-hidden, .st-cancelled { background: #F1EFE8; color: #444441; }
.st-published { background: #EAF3DE; color: #27500A; }

/* newsletter editor */
.nl-section { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0;
  background: var(--paper); }
.nl-section-head { padding: 8px 14px; border-bottom: 1px solid var(--line); font-weight: 600;
  font-size: 13px; color: var(--ink); background: var(--panel); border-radius: 8px 8px 0 0; }
.nl-item { display: flex; gap: 10px; align-items: baseline; padding: 8px 14px;
  border-bottom: 1px solid var(--line); font-size: 13px; }
.nl-item:last-child { border-bottom: none; }
.nl-rank { font-family: var(--serif); color: var(--accent); font-weight: 600; min-width: 18px; }
.nl-actions { display: flex; gap: 4px; }
.nl-actions button { background: none; border: 1px solid var(--line-strong); border-radius: 4px;
  font-size: 11px; cursor: pointer; color: var(--muted); padding: 1px 7px; }

/* profile */
.profile-head { display: flex; gap: 18px; align-items: center; padding: 24px 22px 10px; }
.profile-head h1 { margin: 0; font-family: var(--serif); font-size: 22px; }
.profile-bio { padding: 0 22px; max-width: 720px; font-size: 14px; }

/* footer */
.site-footer { display: flex; justify-content: space-between; padding: 14px 22px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); background: var(--panel); }
.site-footer a { color: var(--faint); }

/* responsive */
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .country-nav { display: none; position: fixed; left: 0; top: 53px; width: 240px;
    z-index: 30; box-shadow: 4px 0 12px rgba(0,0,0,.08); }
  .shell.nav-open .country-nav { display: block; }
  .nav-toggle { display: block; }
  .logo img { height: 30px; }
  .wire-tags .ctag { display: none; }
  .two-col { grid-template-columns: 1fr; }
}
