:root {
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #17233b;
  --border: #243352;
  --text: #e8eef9;
  --muted: #8fa0bf;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a {
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.nav a:hover, .nav a.active { background: var(--surface-2); }
.user-box {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.user-box .role { color: var(--muted); }

.main { padding: 24px 28px; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: 28px; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: #15803d; color: white; }
.btn-danger { background: #b91c1c; color: white; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: #422006; color: #fbbf24; }
.badge-approved { background: #172554; color: #93c5fd; }
.badge-rejected { background: #450a0a; color: #fca5a5; }
.badge-published { background: #052e16; color: #86efac; }
.badge-failed { background: #450a0a; color: #f87171; }

.form { display: grid; gap: 14px; max-width: 720px; }
.form label { display: grid; gap: 6px; font-size: 14px; }
.form input, .form textarea, .form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.form textarea { min-height: 160px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error { background: #450a0a; color: #fecaca; border: 1px solid #7f1d1d; }
.alert-info { background: #172554; color: #bfdbfe; border: 1px solid #1d4ed8; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.filters a.active { background: var(--primary); border-color: var(--primary); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.meta-list { list-style: none; padding: 0; margin: 0; }
.meta-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.meta-list strong { color: var(--muted); display: block; font-size: 12px; margin-bottom: 2px; }
.news-text { white-space: pre-wrap; line-height: 1.6; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  border-radius: 10px;
}
.group-list { display: grid; gap: 10px; }
.group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.group-item-active { border-color: #15803d; }
.group-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-item-meta { font-size: 13px; margin-top: 4px; }
.add-group-panel {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.add-group-panel.is-open { display: block; }

.period-options { border: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.period-option { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.period-option input { width: auto; }
fieldset legend { padding: 0 0 8px; font-size: 13px; }

  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid-4, .grid-2, .detail-grid { grid-template-columns: 1fr; }
}
