:root {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #1f2937;
  --surface-3: #273548;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #334155;
  --accent: #38bdf8;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #020617, #0f172a 40%, #111827);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
code { background: rgba(56,189,248,.12); padding: 2px 6px; border-radius: 8px; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(15, 23, 42, .9);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  font-weight: 700;
}
.muted { color: var(--muted); font-size: 14px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a {
  padding: 11px 14px;
  border-radius: 12px;
  color: #cbd5e1;
  border: 1px solid transparent;
}
.nav a.active,
.nav a:hover {
  background: rgba(56, 189, 248, .09);
  border-color: rgba(56, 189, 248, .22);
  color: white;
}
.sidebar-note {
  margin-top: 28px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(31, 41, 55, .78);
  border: 1px solid var(--line);
}
.banner, .flash {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, .6);
}
.banner { border-color: rgba(245, 158, 11, .35); }
.flash-success { border-color: rgba(34, 197, 94, .35); }
.flash-error { border-color: rgba(239, 68, 68, .35); }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.page-header h1 { margin: 0 0 8px; font-size: 32px; }
.page-header p { margin: 0; color: var(--muted); max-width: 900px; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: rgba(17, 24, 39, .82);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 12px 36px rgba(2, 6, 23, .3);
}
.card h2 { margin-top: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat-card {
  background: rgba(17, 24, 39, .82);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 20px;
  padding: 18px;
}
.stat-label { color: var(--muted); margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 700; }

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
tbody td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(51, 65, 85, .35);
  vertical-align: top;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 14px; color: #cbd5e1; }
input, select, textarea {
  width: 100%;
  background: rgba(15, 23, 42, .72);
  color: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { resize: vertical; }
.actions { grid-column: 1 / -1; display: flex; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: rgba(31, 41, 55, .85);
  color: white;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  border-color: rgba(79, 70, 229, .35);
}
.feature-list, .inline-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.helper {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid var(--line);
}
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .18);
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .mini-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}

.checkbox-field {
  align-items: flex-start;
  justify-content: center;
}
.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkbox-field input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(148, 163, 184, .08);
}
.badge-active, .badge-active { border-color: rgba(34, 197, 94, .28); background: rgba(34, 197, 94, .12); }
.badge-inactive { border-color: rgba(148, 163, 184, .22); background: rgba(148, 163, 184, .1); }
.badge-active, .badge-planned, .badge-completed, .badge-cancelled, .badge-blocked, .badge-inactive, .badge-active, .badge-error { color: var(--text); }
.badge-active { border-color: rgba(34, 197, 94, .28); background: rgba(34, 197, 94, .12); }
.badge-planned { border-color: rgba(56, 189, 248, .28); background: rgba(56, 189, 248, .12); }
.badge-completed { border-color: rgba(99, 102, 241, .28); background: rgba(99, 102, 241, .12); }
.badge-cancelled, .badge-blocked { border-color: rgba(239, 68, 68, .28); background: rgba(239, 68, 68, .12); }
.badge-inactive { border-color: rgba(245, 158, 11, .28); background: rgba(245, 158, 11, .12); }
