:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-subtle: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --border: #334155;
  --border-light: #475569;
  --radius: 10px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

.app-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.brand-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-mvp {
  background: var(--accent);
  color: #0f172a;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
}

.pill-safe {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.pill-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.pill-strict {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

/* METRICS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.metric-icon {
  font-size: 28px;
}

.metric-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* NAVIGATION */
.app-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-secondary);
}

.nav-tab.active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* CONTENT AREAS */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.tab-content.active {
  display: flex;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.content-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.action-group {
  display: flex;
  gap: 10px;
}

/* BUTTONS */
.btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: #475569;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 4px 10px;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* CARDS & GRIDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.task-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.task-keyword-tag {
  display: inline-block;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.task-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.4);
  padding: 10px;
  border-radius: 6px;
}

.task-meta-item strong {
  color: var(--text-main);
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* DATA TABLES */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(51, 65, 85, 0.2);
}

/* STATUS BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.unconnected {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.active {
  background: var(--success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.error {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ARTICLES SECTION */
.status-summary-banner {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.articles-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.article-title-link {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e2e8f0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.article-meta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.article-summary {
  font-size: 0.85rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.3);
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.article-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.translate-button { white-space: nowrap; }

.translation-panel {
  padding: 12px 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.45);
  color: #dbeafe;
  line-height: 1.55;
  white-space: pre-wrap;
}

.translation-panel h4 {
  margin: 6px 0;
  color: #f8fafc;
}

.translation-panel p { margin: 6px 0 0; }
.translation-label, .translation-note { color: var(--text-muted); font-size: 0.78rem; }
.translation-error { border-left-color: #f59e0b; color: #fde68a; }

.translation-option > label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.translation-option input { accent-color: var(--accent); }

/* DRAFTS SECTION */
.drafts-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: 480px;
}

.drafts-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 700px;
  overflow-y: auto;
}

.draft-item {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.draft-item:hover {
  background: var(--bg-subtle);
  border-color: var(--border-light);
}

.draft-item.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent);
}

.draft-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.draft-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.draft-detail-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.draft-content-viewer {
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: #e2e8f0;
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.6;
}

/* EMPTY STATES */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(30, 41, 59, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 40px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 90%;
  max-width: 580px;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.required {
  color: var(--danger);
}

.form-input, .form-select, .form-textarea {
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ALERT BOX */
.alert-box {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.alert-success {
  background: var(--success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert-error {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.hidden {
  display: none !important;
}

/* FOOTER */
.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .drafts-layout {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* SYSTEM NOTICE BANNER & CODEX ENHANCEMENTS */
.system-notice-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.5;
}

.system-notice-banner b {
  color: #fbbf24;
}

.snippet-label {
  color: #f59e0b;
  font-weight: 700;
  font-size: 0.78rem;
  display: inline-block;
  margin-right: 6px;
  background: rgba(245, 158, 11, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

.article-reason {
  font-size: 0.78rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid #f59e0b;
}

.status-badge.warning {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.draft-warning-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-config-hint {
  font-size: 0.72rem;
  color: #f59e0b;
  margin-left: 4px;
  font-style: italic;
}

.news-search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  align-items: end;
  gap: 14px;
  padding: 20px;
  margin: 20px 0 12px;
  background: var(--bg-card, #111827);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.news-search-form .form-group { margin: 0; }
.news-search-form input, .news-search-form select { width: 100%; }
.news-search-form button:disabled { opacity: 0.6; cursor: wait; }
.search-status { margin: 16px 0; color: var(--text-muted); }
.task-topic-picker { position: relative; }
.task-topic-picker > input { width: 100%; }
.task-topic-suggestions {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}
.task-topic-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 5px;
  text-align: left;
  color: var(--text-main);
  background: transparent;
  cursor: pointer;
}
.task-topic-option:hover, .task-topic-option.active { background: rgba(56, 189, 248, 0.15); }
.task-topic-option small { color: var(--text-muted); white-space: nowrap; }
.search-source-warning { margin: 0 0 14px; padding: 12px; border-left: 3px solid #f59e0b; background: rgba(245,158,11,0.08); }
@media (max-width: 900px) {
  .news-search-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .news-search-form { grid-template-columns: 1fr; }
}

/* DELIVERY SETTINGS STYLES */
.delivery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.delivery-card:hover {
  border-color: var(--accent);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-subtle, #334155);
  transition: .3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
  background-color: #22c55e;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Bangtin visual refresh: brighter football newsroom, clearer interactions. */
:root {
  --bg-primary: #0b1020;
  --bg-secondary: #141c31;
  --bg-card: rgba(20, 28, 49, 0.92);
  --bg-subtle: #202c46;
  --text-main: #f5f7ff;
  --text-muted: #a5b1cc;
  --text-dim: #7f8ba8;
  --accent: #a3e635;
  --accent-hover: #84cc16;
  --border: rgba(148, 163, 184, 0.16);
  --border-light: rgba(148, 163, 184, 0.3);
  --radius: 16px;
}

body {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(34, 197, 94, 0.13), transparent 32rem),
    radial-gradient(ellipse at 95% 8%, rgba(56, 189, 248, 0.14), transparent 30rem),
    linear-gradient(150deg, #0b1020 0%, #10182b 55%, #0b1220 100%);
  background-attachment: fixed;
}

/* Subtle night-stadium atmosphere behind the app panels. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background:
    linear-gradient(180deg, rgba(7, 13, 26, .4), rgba(7, 13, 26, .64)),
    url("/static/images/football-legends-bg.png") center 34% / cover no-repeat,
    conic-gradient(from 155deg at 8% 0%, transparent 0 32deg, rgba(190, 242, 100, .035) 42deg, transparent 66deg),
    conic-gradient(from 155deg at 92% 0%, transparent 0 32deg, rgba(125, 211, 252, .04) 42deg, transparent 66deg),
    radial-gradient(ellipse at 8% 5%, rgba(224, 255, 174, .32), transparent 3rem),
    radial-gradient(ellipse at 92% 5%, rgba(186, 230, 253, .3), transparent 3.5rem),
    radial-gradient(ellipse at 50% 100%, rgba(34, 197, 94, .16), transparent 42rem);
  filter: saturate(.88);
}
body::after {
  inset: 34vh -8vw -7vh;
  opacity: .42;
  background:
    /* center circle + halfway line */
    radial-gradient(ellipse at 50% 72%, transparent 0 18%, rgba(190, 242, 100, .34) 18.25% 18.7%, transparent 19%),
    linear-gradient(90deg, transparent 49.65%, rgba(190, 242, 100, .3) 49.85% 50.15%, transparent 50.35%),
    /* far touchline and penalty areas */
    linear-gradient(0deg, transparent 89%, rgba(190, 242, 100, .26) 89.25% 89.65%, transparent 89.9%),
    linear-gradient(90deg, transparent 24%, rgba(190, 242, 100, .24) 24.25% 24.6%, transparent 24.9%),
    linear-gradient(90deg, transparent 75.1%, rgba(190, 242, 100, .24) 75.4% 75.75%, transparent 76%),
    linear-gradient(0deg, transparent 49%, rgba(190, 242, 100, .2) 49.25% 49.6%, transparent 49.9%),
    /* soft grass under the markings */
    repeating-linear-gradient(0deg, rgba(34, 197, 94, .045) 0 24px, rgba(163, 230, 53, .075) 24px 48px),
    radial-gradient(ellipse at 50% 78%, rgba(22, 101, 52, .52), rgba(20, 83, 45, .24) 56%, transparent 88%),
    /* indistinct crowd lights in the stands */
    radial-gradient(circle, rgba(226, 232, 240, .36) 0 1px, transparent 1.9px);
  background-size: auto, auto, auto, auto, auto, auto, auto, auto, auto, 17px 13px;
  background-position: center, center, center, center, center, center, center, center, center, 0 0;
  transform: perspective(650px) rotateX(12deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, black 0%, rgba(0, 0, 0, .7) 37%, transparent 92%);
}

.app-layout { max-width: 1500px; padding: 30px clamp(16px, 3vw, 42px); gap: 22px; }

.app-header {
  position: relative;
  overflow: hidden;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(115deg, rgba(20, 31, 52, .97), rgba(15, 25, 43, .88));
  box-shadow: 0 18px 55px rgba(0, 0, 0, .22);
}
.app-header::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: 21%;
  top: -190px;
  border-radius: 50%;
  background: rgba(163, 230, 53, .12);
  filter: blur(15px);
  pointer-events: none;
}
.logo-icon {
  color: #102013;
  background: linear-gradient(145deg, #d9f99d, #84cc16 65%, #4ade80);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 8px 24px rgba(132, 204, 22, .2);
}
.brand-text h1 { letter-spacing: -.045em; }
.badge-mvp { background: rgba(163, 230, 53, .16); color: #bef264; border: 1px solid rgba(163, 230, 53, .28); border-radius: 999px; padding: 3px 9px; }
.tagline { margin-top: 3px; }
.pill-badge { padding: 6px 11px; backdrop-filter: blur(8px); }

.system-notice-banner {
  border-color: rgba(250, 204, 21, .24);
  background: linear-gradient(100deg, rgba(133, 77, 14, .2), rgba(30, 41, 59, .64));
  border-radius: 13px;
}

.metrics-grid { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; }
.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 98px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(25, 36, 59, .82), rgba(16, 25, 43, .78));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--metric-color, #a3e635); opacity: .85; }
.metric-card:nth-child(2) { --metric-color: #38bdf8; }
.metric-card:nth-child(3) { --metric-color: #fb923c; }
.metric-card:nth-child(4) { --metric-color: #2dd4bf; }
.metric-card:nth-child(5) { --metric-color: #c084fc; }
.metric-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--metric-color, #a3e635) 55%, transparent); box-shadow: 0 16px 34px rgba(0, 0, 0, .22); }
.metric-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: color-mix(in srgb, var(--metric-color, #a3e635) 13%, transparent); }
.metric-num { font-size: 1.75rem; letter-spacing: -.04em; }

.app-nav {
  position: sticky;
  top: 8px;
  z-index: 30;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(12, 19, 34, .78);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.nav-tab { flex: 0 0 auto; padding: 10px 14px; border: 1px solid transparent; border-radius: 11px; }
.nav-tab:hover { background: rgba(255, 255, 255, .06); }
.nav-tab.active { color: #d9f99d; border-color: rgba(163, 230, 53, .25); background: linear-gradient(135deg, rgba(132, 204, 22, .2), rgba(34, 197, 94, .09)); box-shadow: inset 0 1px rgba(255, 255, 255, .05); }
.tab-icon { font-size: 1.03rem; }

.tab-content { gap: 20px; animation: panel-arrive .24s ease both; }
@keyframes panel-arrive { from { opacity: .55; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.content-header { padding: 4px 1px; }
.content-header h2 { font-size: clamp(1.35rem, 2vw, 1.65rem); letter-spacing: -.035em; }
.section-desc { max-width: 850px; line-height: 1.65; }

.btn { border-radius: 10px; min-height: 38px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible, .nav-tab:focus-visible, .draft-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(163, 230, 53, .55); outline-offset: 2px; }
.btn-primary { color: #12200b; background: linear-gradient(135deg, #bef264, #84cc16); border-color: rgba(217, 249, 157, .4); box-shadow: 0 5px 16px rgba(132, 204, 22, .15); }
.btn-primary:hover { color: #10200c; background: linear-gradient(135deg, #d9f99d, #a3e635); box-shadow: 0 8px 21px rgba(132, 204, 22, .24); }
.btn-secondary { background: rgba(148, 163, 184, .08); border-color: var(--border-light); }
.btn-secondary:hover { background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .4); }
.btn-danger:hover { box-shadow: 0 7px 18px rgba(239, 68, 68, .2); }

.task-card, .delivery-card, .draft-detail-pane, .drafts-sidebar, .table-card {
  border-color: var(--border);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(24, 34, 56, .84), rgba(17, 26, 44, .82));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .13);
}
.task-card { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.task-card:hover, .delivery-card:hover { transform: translateY(-3px); border-color: rgba(163, 230, 53, .42); box-shadow: 0 18px 38px rgba(0, 0, 0, .2); }
.task-keyword-tag { color: #bef264; background: rgba(163, 230, 53, .1); border-color: rgba(163, 230, 53, .2); }
.task-meta { background: rgba(4, 10, 22, .3); border: 1px solid rgba(148, 163, 184, .08); border-radius: 10px; }

.article-card {
  position: relative;
  overflow: hidden;
  border-color: var(--border);
  border-radius: 15px;
  background: linear-gradient(110deg, rgba(23, 34, 56, .84), rgba(17, 27, 46, .82));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.article-card:hover { transform: translateY(-2px); border-color: rgba(56, 189, 248, .32); box-shadow: 0 14px 30px rgba(0, 0, 0, .2); }
.article-title-link { color: #f1f5ff; line-height: 1.45; }
.article-title-link:hover { color: #bef264; }
.article-summary { background: rgba(5, 12, 25, .34); border-left-color: #38bdf8; border-radius: 0 10px 10px 0; line-height: 1.65; }
.news-search-form { border-radius: 17px; border-color: rgba(56, 189, 248, .18); background: linear-gradient(120deg, rgba(20, 35, 56, .98), rgba(17, 27, 47, .95)); box-shadow: 0 14px 36px rgba(0, 0, 0, .18); }
.form-input, .form-select, .form-textarea { background-color: #0c1425; border-color: rgba(148, 163, 184, .22); border-radius: 9px; min-height: 40px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #a3e635; box-shadow: 0 0 0 3px rgba(163, 230, 53, .12); }
.search-status { padding: 10px 12px; border-radius: 10px; }
.status-summary-banner { border-radius: 12px; background: linear-gradient(100deg, rgba(56, 189, 248, .13), rgba(163, 230, 53, .06)); }

.draft-item { border-radius: 10px; background: rgba(7, 14, 27, .4); }
.draft-item.active { background: linear-gradient(120deg, rgba(163, 230, 53, .15), rgba(34, 197, 94, .07)); border-color: #a3e635; }
.draft-content-viewer { background: rgba(5, 10, 20, .68); border-color: var(--border); border-radius: 12px; }
.empty-state { min-height: 210px; justify-content: center; border-color: rgba(148, 163, 184, .26); border-radius: 17px; background: radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, .08), transparent 70%), rgba(17, 27, 46, .55); }
.empty-icon { filter: drop-shadow(0 6px 16px rgba(163, 230, 53, .18)); }
.table-card { overflow: auto; }
.data-table th { background: rgba(8, 14, 26, .76); }
.data-table tbody tr { transition: background .15s ease; }
.data-table tr:hover td { background: rgba(56, 189, 248, .045); }
.modal-box { border-radius: 18px; background: linear-gradient(145deg, #19243a, #111a2d); box-shadow: 0 28px 80px rgba(0, 0, 0, .55); }
.alert-box { border-radius: 11px; }

@media (max-width: 768px) {
  .app-layout { padding: 14px; gap: 16px; }
  .app-header { padding: 17px; border-radius: 17px; }
  .header-badges { gap: 6px; }
  .pill-badge { font-size: .68rem; }
  .app-nav { top: 4px; margin: 0 -2px; }
  .nav-tab { padding: 9px 11px; font-size: .84rem; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: 13px; gap: 10px; min-height: 84px; }
  .metric-icon { width: 40px; height: 40px; font-size: 23px; }
  .metric-num { font-size: 1.45rem; }
}
@media (max-width: 460px) {
  .brand-text h1 { font-size: 1.12rem; }
  .tagline { font-size: .76rem; }
  .header-badges { display: none; }
  .metric-label { font-size: .7rem; }
  .content-header { align-items: stretch; }
  .content-header > .btn, .content-header .action-group { width: 100%; }
  .action-group { flex-direction: column; }
  .article-header { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Draft workspace: source selection, audience text, and editor notes. */
.draft-candidates { max-height: 310px; overflow-y: auto; margin-top: 12px; }
.draft-candidate { display: flex; align-items: flex-start; gap: 10px; padding: 12px; margin: 8px 0; border: 1px solid var(--border-color, #374151); border-radius: 8px; cursor: pointer; }
.draft-candidate input { margin-top: 5px; flex-shrink: 0; }
.draft-candidate span { display: block; line-height: 1.55; }
.draft-candidate small { display: block; color: var(--text-muted); margin: 4px 0; }
.draft-editor-header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.draft-editor-header p, #draft-save-state { font-size: .8rem; color: var(--text-muted); }
.draft-editor-text { min-height: 330px; width: 100%; line-height: 1.8; margin-top: 8px; resize: vertical; }
.draft-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.draft-source-panel { margin-top: 14px; border-top: 1px solid var(--border-color, #374151); padding-top: 12px; }
.draft-source-panel summary { cursor: pointer; font-weight: 600; }
