:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef4f8;
  --text: #17202c;
  --muted: #657184;
  --line: #dce4ee;
  --primary: #116a6d;
  --primary-2: #0f8f87;
  --accent: #cc6b2c;
  --success: #2f9f62;
  --danger: #d84b4b;
  --warn: #c9981a;
  --shadow: 0 16px 45px rgba(21, 35, 54, .12);
  --radius: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151b;
  --panel: #171d25;
  --panel-2: #202833;
  --text: #f2f5f8;
  --muted: #aab5c2;
  --line: #303b49;
  --primary: #27b3aa;
  --primary-2: #46c7a7;
  --accent: #f09a58;
  --shadow: 0 16px 45px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, var(--bg)), var(--bg) 55%),
    var(--bg);
}
.login-screen.hidden { display: none; }
.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.login-form { display: grid; gap: 14px; }
.demo-users { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.login-note { margin: 0; font-size: 13px; }
.app-shell.locked { filter: blur(2px); pointer-events: none; user-select: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 3;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 8px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}
.brand small { display: block; color: var(--muted); }
.nav { display: grid; gap: 5px; }
.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 13px;
  font-weight: 650;
}
.nav-item:hover, .nav-item.active { background: var(--panel-2); color: var(--text); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--primary); }
.sidebar-card {
  margin-top: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 8px;
}
.sidebar-card span { color: var(--muted); }

.main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.search-wrap {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  min-height: 42px;
}
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.topbar-actions, .hero-actions, .row-actions, .report-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 5px 10px 5px 6px;
}
.user-chip span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.user-chip strong, .user-chip small { display: block; white-space: nowrap; }
.user-chip small { color: var(--muted); font-size: 11px; }
.icon-btn, .primary-btn, .secondary-btn, .ghost-btn {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 38px;
  padding: 0 13px;
  background: var(--panel);
  color: var(--text);
}
.icon-btn { width: 38px; padding: 0; display: grid; place-items: center; }
.primary-btn { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 750; }
.secondary-btn { background: var(--panel-2); font-weight: 700; }
.ghost-btn { background: transparent; }
select, input, textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}

.hero-band {
  margin: 22px 24px 0;
  padding: 24px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--primary) 15%, var(--panel)), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 12px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: 0; line-height: 1.05; }
.hero-band p:last-child { max-width: 760px; color: var(--muted); margin-bottom: 0; }
.view-root { padding: 24px; display: grid; gap: 20px; }
.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .chart-card, .table-card, .kanban-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(21, 35, 54, .06);
}
.card { padding: 16px; }
.stat-card { min-height: 126px; display: grid; align-content: space-between; }
.stat-card span, .muted { color: var(--muted); }
.stat-card strong { font-size: 26px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.chart-card { padding: 16px; min-height: 310px; }
.chart-card header, .table-card header, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.chart-card h2, .table-card h2, .card h2, .section-head h2 { margin: 0; font-size: 18px; }
canvas { width: 100%; max-width: 100%; height: 235px; display: block; }

.table-card { overflow: hidden; }
.table-card header { padding: 16px 16px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 16px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--panel-2);
}
.status.good { color: var(--success); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--danger); }
.timeline { display: grid; gap: 14px; }
.timeline-item { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.timeline-item time { color: var(--muted); font-size: 12px; }
.notification-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(390px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform .2s ease;
  z-index: 10;
  padding: 18px;
}
.notification-panel.open { transform: translateX(0); }
.notification-panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.notice { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--panel-2); }
.notice strong { display: block; }
.notice small { color: var(--muted); }

.module-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.module-toolbar input { width: min(360px, 100%); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
label input, label select, label textarea { color: var(--text); font-weight: 400; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 16px; }
.remove-item-btn { background: var(--danger); color: #fff; border-color: var(--danger); }
#noItemsMessage { margin-top: 12px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; }
.kanban-col { padding: 12px; min-height: 320px; }
.task-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary-2); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 24, .52);
  display: none;
  place-items: center;
  padding: 18px;
  z-index: 20;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal h2 { margin: 0; }
.modal form { display: grid; gap: 14px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 120px);
  background: #17202c;
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: transform .2s ease;
  z-index: 30;
}
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .stats-grid, .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .topbar { padding: 12px; }
  .search-wrap { max-width: none; }
  .hero-band { margin: 14px 12px 0; padding: 18px; flex-direction: column; }
  .view-root { padding: 14px 12px; }
  .stats-grid, .three-col, .form-grid { grid-template-columns: 1fr; }
  .topbar-actions .primary-btn, .user-chip div { display: none; }
  h1 { font-size: 30px; }
}
