:root {
  --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  --surface: rgba(255, 255, 255, 0.85);
  --surface-2: rgba(255, 255, 255, 0.5);
  --text: #102a43;
  --muted: #486581;
  --border: rgba(188, 204, 220, 0.4);
  --shadow: 0 10px 40px rgba(16, 42, 67, 0.08);
  --shadow-hover: 0 15px 50px rgba(16, 42, 67, 0.12);
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --danger: #ef4444;
  --radius: 16px;
  --backdrop: blur(12px) saturate(180%);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
}
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-2); }

h1, h2, h3, h4, h5, h6 { font-family: 'Outfit', sans-serif; margin: 0; color: #102a43; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }

.sp-2 { margin-top: 8px; }
.sp-3 { margin-top: 12px; }
.sp-4 { margin-top: 16px; }
.sp-5 { margin-top: 24px; }

.app-shell { min-height: 100%; display: flex; }

/* Sidebar */
.sidebar {
  width: 220px;
  background: rgba(16, 42, 67, 0.95);
  backdrop-filter: blur(20px);
  color: #f0f4f8;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 30;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.brand-link {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  color: #ffffff;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.sidebar-nav { padding: 16px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #bcccdc;
  margin: 6px 0;
  transition: all 0.2s ease;
  font-weight: 500;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(4px);
}
.nav-item.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.sidebar-footer {
  margin-top: auto; padding: 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.user-chip {
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 12px;
}
.user-chip-name { font-weight: 700; font-family: 'Outfit', sans-serif; color: #fff; }
.user-chip-meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.overlay { position: fixed; inset: 0; background: rgba(16,42,67,0.6); backdrop-filter: blur(4px); z-index: 25; }

/* Main Content */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.6);
  backdrop-filter: var(--backdrop);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.page-title { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 20px; color: #102a43; }
.page-subtitle { color: var(--muted); font-size: 13px; font-weight: 500; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

.container { max-width: 1280px; margin: 32px auto; padding: 0 24px; flex: 1; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head-title { display: flex; align-items: center; gap: 12px; }
.page-head-actions { display: flex; gap: 12px; align-items: center; }

/* Cards & Containers */
.card {
  background: var(--surface);
  backdrop-filter: var(--backdrop);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card + .card { margin-top: 16px; }
.card.narrow { max-width: 440px; margin: 0 auto; }
.card-sub { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

.grid { display: grid; gap: 20px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 240px; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 16px;
  border: 1px solid rgba(188, 204, 220, 0.8);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-family: inherit; font-size: 14px;
  transition: all 0.2s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  background: #fff;
}
.help { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; border: none; cursor: pointer;
  font-weight: 600; font-family: 'Inter', sans-serif; font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4); transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, 0.5); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.btn-danger { background: linear-gradient(135deg, #f87171 0%, var(--danger) 100%); color: #fff; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3); }

.w-full { width: 100%; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 999px; background: #dbeafe; color: #1e40af;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-soft { background: rgba(255,255,255,0.1); color: #e2e8f0; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Tables */
.table-wrap {
  overflow: auto; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); backdrop-filter: var(--backdrop);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 16px; border-bottom: 1px solid var(--border); text-align: left; }
.table th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(240, 244, 248, 0.5);
}
.table tbody tr { transition: background 0.2s; }
.table tbody tr:hover { background: rgba(255,255,255,0.6); }

/* KPIs */
.kpi-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kpi {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.8));
  border: 1px solid #fff; border-radius: 20px; padding: 24px;
  box-shadow: 0 8px 30px rgba(16,42,67,0.06);
  backdrop-filter: var(--backdrop);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; top: 0; right: 0; width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(59,130,246,0.1) 0%, transparent 70%);
  border-radius: 50%; transform: translate(30%, -30%);
}
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-num { margin-top: 12px; font-size: 32px; font-weight: 900; font-family: 'Outfit', sans-serif; color: var(--text); }
.kpi-foot { margin-top: 12px; font-size: 13px; color: var(--muted); font-weight: 500; }

/* Charts */
.chart-container {
  position: relative; height: 320px; width: 100%;
  margin-top: 20px;
}

@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
  .sidebar.is-open { transform: translateX(0); }
  .overlay[hidden] { display: none; }
  .sidebar-close { display: inline-flex; }
  .kpi-grid { grid-template-columns: 1fr; }
}

/* Kanban */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kanban-col {
  flex: 1; min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-col-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-header h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.kanban-col-body {
  padding: 16px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 100px;
}
.kanban-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  box-shadow: 0 2px 8px rgba(16,42,67,0.04);
  cursor: grab;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(16,42,67,0.08); }
.kanban-title { font-size: 14px; font-weight: 600; color: var(--primary); display: block; margin-bottom: 8px; text-decoration: none; }
.kanban-title:hover { text-decoration: underline; }
.kanban-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.kanban-col-body.drag-over { background: rgba(59,130,246,0.05); }

/* Modals */
.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow-hover);
  max-width: 500px;
  width: 90%;
  margin: auto;
}
.modal::backdrop {
  background: rgba(16, 42, 67, 0.6);
  backdrop-filter: blur(4px);
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 24px;
}
