:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --ok: #22c55e;
  --alert: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 24px;
}

header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo { font-size: 1.2rem; font-weight: 700; color: var(--text); }

nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

nav a {
  color: var(--muted);
  font-size: 0.95rem;
}
nav a:hover, nav a.active { color: var(--text); }

.user-badge {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h1 { margin: 0 0 8px; font-size: 1.5rem; }
.card h2 { margin: 0 0 16px; font-size: 1.15rem; }

.rate-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0;
}

.status-ok { color: var(--ok); font-weight: 600; }
.status-alert { color: var(--alert); font-weight: 600; }

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 14px;
}

textarea { min-height: 140px; resize: vertical; font-family: inherit; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.alert-error { background: #3f1212; border: 1px solid #7f1d1d; color: #fecaca; }
.alert-success { background: #14532d; border: 1px solid #166534; color: #bbf7d0; }
.alert-info { background: #1e3a5f; border: 1px solid #1d4ed8; color: #bfdbfe; }

.form-row { margin-bottom: 4px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.checkbox-row input { width: auto; margin: 0; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card { width: 100%; max-width: 400px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; }

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form input { width: auto; margin-bottom: 0; min-width: 140px; }

.hint { color: var(--muted); font-size: 0.85rem; margin-top: -8px; margin-bottom: 14px; }

.preview-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  white-space: pre-wrap;
  font-size: 0.95rem;
}

.readonly-field[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}

.notify-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}
.notify-section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }
.inline-check { margin-bottom: 0; }

.event-type { font-size: 0.85rem; font-weight: 600; }
.event-breach { color: var(--alert); }
.event-notify_ok { color: var(--ok); }
.event-notify_fail { color: var(--alert); }
.event-error { color: var(--alert); }
.event-check { color: var(--muted); }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pager-info { color: var(--muted); font-size: 0.9rem; }
.nowrap { white-space: nowrap; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 32px 0;
}

.chart-wrap {
  position: relative;
  height: 380px;
  margin-top: 12px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-form fieldset.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 10px;
  margin: 0 0 16px;
}

.chart-form legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.radio-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
}

.radio-row input[type="date"],
.radio-row input[type="number"],
.radio-row select {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.forecast-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.stat-box {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.stat-box h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--accent);
}

.stat-box p {
  margin: 6px 0;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.news-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.news-list li:last-child { border-bottom: none; }

.news-sentiment {
  font-size: 0.8rem;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}

.sent-pos { color: var(--ok); }
.sent-neg { color: var(--alert); }
.sent-neu { color: var(--muted); }
