/* ============================================================
   DSVV Newsroom CMS — admin UI styles
   Palette: 3 neutrals + 1 primary (saffron) + 1 accent/success
   ============================================================ */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --text: #1c1917;
  --text-muted: #78716c;
  --text-soft: #a8a29e;

  --primary: #c2410c;
  --primary-hover: #9a3412;
  --primary-soft: #fff7ed;

  --accent: #0f766e;      /* teal for success/published */
  --accent-soft: #ccfbf1;

  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  --warn: #a16207;
  --warn-soft: #fef3c7;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.06), 0 4px 12px rgba(28, 25, 23, 0.04);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: 1.625rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem 0; }

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.inline { display: inline-block; }
.link { color: var(--primary); font-weight: 500; }

/* ============================================================
   App shell
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--surface);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 0.95rem; }
.brand-text span { font-size: 0.75rem; color: var(--text-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 0.92rem;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-link.is-active .nav-dot { background: var(--primary); }
.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.user-card {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.25rem;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.user-meta strong { font-size: 0.88rem; }
.user-meta span {
  font-size: 0.75rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================================================
   Notification bell
   ============================================================ */

.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.bell:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--primary);
  text-decoration: none;
}
.bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: var(--surface);
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  line-height: 1;
}

.unread-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ============================================================
   Timeline (status history)
   ============================================================ */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.timeline-item {
  position: relative;
  padding-left: 0.25rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.35rem;
  top: 0.35rem;
  width: 9px; height: 9px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border);
}
.timeline-item p { margin: 0 0 0.15rem 0; font-size: 0.85rem; }

/* ============================================================
   Notification inbox
   ============================================================ */

.notif-panel { padding: 0; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.notif-row:last-child { border-bottom: none; }
.notif-row.is-unread { background: var(--primary-soft); }
.notif-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--primary);
  font-weight: 700;
  border: 1px solid var(--border);
}
.notif-body { flex: 1; min-width: 0; }
.notif-body p { margin: 0; font-size: 0.92rem; }
.notif-time {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.2rem;
  display: block;
}
.notif-actions { flex-shrink: 0; }

.main {
  flex: 1;
  padding: 2rem 2.5rem;
  min-width: 0;
  max-width: 1280px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.page-body { display: flex; flex-direction: column; gap: 1.5rem; }

/* ============================================================
   Flash / alerts
   ============================================================ */

.flash-stack {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.flash-success { background: var(--accent-soft); border-color: #99f6e4; color: #0f766e; }
.flash-error   { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }

/* ============================================================
   Panels, cards, grids
   ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.panel h3 { margin-bottom: 0.75rem; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.stack { display: flex; flex-direction: column; gap: 1.25rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.35rem 0; }
.stat-value { font-size: 1.9rem; font-weight: 600; margin: 0 0 0.2rem 0; letter-spacing: -0.02em; }
.stat-hint  { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

/* ============================================================
   Row lists
   ============================================================ */

.row-list { list-style: none; margin: 0; padding: 0; }
.row-list.compact .row { padding: 0.5rem 0; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-title { font-weight: 600; color: var(--text); }
.row-title:hover { color: var(--primary); text-decoration: none; }
.row-meta { margin: 0.2rem 0 0; font-size: 0.82rem; }

.empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: none; }
.col-actions { text-align: right; white-space: nowrap; }

/* ============================================================
   Forms
   ============================================================ */

.form { display: flex; flex-direction: column; gap: 0.9rem; }
.form.panel > * + * { margin-top: 0; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="datetime-local"],
input[type="file"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { resize: vertical; min-height: 80px; font-family: var(--font-sans); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}

.checks {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.checks legend { padding: 0 0.4rem; font-weight: 600; font-size: 0.82rem; }
.checks label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; cursor: pointer;
}

.filter-bar {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar input, .filter-bar select { max-width: 280px; }
.filter-bar input[type="number"] { max-width: 140px; }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.form-main, .form-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: var(--surface); }
.btn-primary:hover { background: var(--primary-hover); color: var(--surface); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover { background: var(--danger-soft); }

/* ============================================================
   Tags / status chips
   ============================================================ */

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-muted);
  margin-right: 0.25rem;
  border: 1px solid var(--border);
}
.tag-neutral { background: var(--surface-2); color: var(--text-muted); }
.tag-accent  { background: var(--primary-soft); color: var(--primary); border-color: #fed7aa; }

.status-draft             { background: var(--surface-2); color: var(--text-muted); }
.status-review            { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.status-pending_review    { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.status-in_review         { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.status-changes_required  { background: #ffedd5; color: var(--primary); border-color: #fed7aa; }
.status-approved          { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-ready_to_publish  { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.status-published         { background: var(--accent-soft); color: var(--accent); border-color: #99f6e4; }
.status-rejected          { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.status-rejected_public   { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.status-archived          { background: #f5f5f4; color: var(--text-muted); }

/* ============================================================
   Content / prose
   ============================================================ */

.prose .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.prose blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-style: italic;
}
.content-body {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.meta-list {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.4rem 0.75rem;
  margin: 0;
  font-size: 0.9rem;
}
.meta-list dt { color: var(--text-muted); font-weight: 500; }
.meta-list dd { margin: 0; }

/* ============================================================
   Media grid
   ============================================================ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.media-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.media-placeholder {
  height: 140px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}
.media-card figcaption {
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.media-card figcaption strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Auth / fullscreen
   ============================================================ */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.auth-brand strong { font-size: 1rem; display: block; }
.auth-brand p { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.auth-sub { color: var(--text-muted); margin-bottom: 1.25rem; }
.auth-foot {
  margin-top: 1.5rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 960px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
  }
  .brand { border: none; padding: 0; margin: 0; }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 100%;
  }
  .sidebar-footer {
    border: none; margin: 0; padding: 0;
    flex-direction: row;
    align-items: center;
  }
  .main { padding: 1.5rem 1rem; }
  .two-col, .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .page-header { flex-direction: column; align-items: stretch; }
}
