/* =====================================================================
   Design tokens — from the dataviz skill's reference palette.
   Light mode only for v1; tokens are named by role so a dark theme
   can be added later by re-declaring this block under a media query.
   ===================================================================== */
:root {
  --surface-1: #fcfcfb;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --success-text: #006300;

  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #4a3aa7; /* violet */
  --series-8: #e34948; /* red */

  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
  --seq-450: #2a78d6; --seq-500: #256abf; --seq-600: #184f95;

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--page-plane);
  font-size: 14px;
  line-height: 1.5;
}

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

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

/* ---------------- Sidebar nav ---------------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 16px;
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
}
.sidebar nav a:hover { background: var(--page-plane); text-decoration: none; }
.sidebar nav a.active {
  color: var(--series-1);
  background: var(--seq-100);
  border-right: 3px solid var(--series-1);
}
.sidebar .nav-icon { width: 16px; text-align: center; }
.sidebar .sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------------- Main content ---------------- */
.main { flex: 1; min-width: 0; padding: 24px 32px 60px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 20px; margin: 0; }
.page-header p.subtitle { color: var(--text-secondary); margin: 4px 0 0; font-size: 13px; }

/* ---------------- Stat tiles ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-tile .label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.stat-tile .value { font-size: 24px; font-weight: 700; }
.stat-tile .delta { font-size: 12.5px; margin-top: 4px; }
.stat-tile .delta.up { color: var(--success-text); }
.stat-tile .delta.down { color: var(--status-critical); }

/* ---------------- Cards / panels ---------------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card > h2, .card > h3 {
  margin-top: 0;
  font-size: 15px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------------- Tables ---------------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}
table.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
table.data-table tbody tr:hover { background: var(--page-plane); }
table.data-table td.num, table.data-table th.num { text-align: right; }
td.positive { color: var(--success-text); }
td.negative { color: var(--status-critical); }

/* ---------------- Badges / status ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-good { background: rgba(12,163,12,.12); color: var(--status-good); }
.badge-warning { background: rgba(250,178,25,.18); color: #8a5a00; }
.badge-serious { background: rgba(236,131,90,.18); color: #a04620; }
.badge-critical { background: rgba(208,59,59,.14); color: var(--status-critical); }
.badge-muted { background: var(--page-plane); color: var(--text-secondary); }

/* ---------------- Forms / buttons ---------------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--baseline);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--series-1);
  box-shadow: 0 0 0 3px rgba(42,120,214,.15);
}
.form-row { margin-bottom: 14px; max-width: 420px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font);
}
.btn-primary { background: var(--series-1); color: #fff; }
.btn-primary:hover { background: var(--seq-500); text-decoration: none; }
.btn-secondary { background: var(--surface-1); color: var(--text-primary); border-color: var(--baseline); }
.btn-secondary:hover { background: var(--page-plane); text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.alert-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
}
.alert-success { background: rgba(12,163,12,.10); color: var(--success-text); border: 1px solid rgba(12,163,12,.25); }
.alert-error { background: rgba(208,59,59,.08); color: var(--status-critical); border: 1px solid rgba(208,59,59,.25); }
.alert-info { background: var(--seq-100); color: var(--seq-600); border: 1px solid rgba(42,120,214,.2); }

/* ---------------- Filter bar ---------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-bar select, .filter-bar input[type=date] { width: auto; }

/* ---------------- Chart containers ---------------- */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.short { height: 200px; }
.legend-row {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary);
}
.legend-row .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-plane);
}
.login-card {
  width: 360px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin: 0 0 20px; }

/* ---------------- Kanban board (Tasks page) ---------------- */
.kanban-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
}
.kanban-column {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.kanban-rename-form { flex: 1; min-width: 0; }
.kanban-column-title-input {
  border: none !important;
  background: transparent !important;
  padding: 2px 4px !important;
  font-weight: 700;
  font-size: 13.5px;
  width: 100%;
}
.kanban-column-title-input:focus { box-shadow: none !important; background: var(--page-plane) !important; }
.kanban-column-count {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--page-plane);
  border-radius: 100px;
  padding: 1px 8px;
  flex-shrink: 0;
}
.kanban-column-menu { display: flex; gap: 2px; flex-shrink: 0; }
.kanban-icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.kanban-icon-btn:hover { background: var(--page-plane); color: var(--text-primary); }

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-card {
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  cursor: grab;
  font-size: 13px;
}
.kanban-card.dragging { opacity: 0.4; }
.kanban-card-badge { margin-bottom: 6px; }
.kanban-card-title { font-weight: 600; word-break: break-word; }
.kanban-card-desc { color: var(--text-secondary); font-size: 12.5px; margin-top: 5px; word-break: break-word; }
.kanban-card-due { color: var(--text-muted); font-size: 11.5px; margin-top: 6px; }
.kanban-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.kanban-link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--font);
}
.kanban-link-btn:hover { color: var(--series-1); text-decoration: underline; }

.kanban-add-card-form { padding: 8px 10px 12px; }
.kanban-add-card-form input[type=text] {
  border-style: dashed;
  font-size: 12.5px;
}

.kanban-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11,11,11,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.kanban-modal {
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 24px;
  width: 380px;
  max-width: 92vw;
}
.kanban-modal h2 { margin-top: 0; font-size: 16px; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 18px; }
}
