:root {
  --bg: #edf2ff;
  --surface: #ffffff;
  --surface-soft: #f7f9ff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --accent: #06b6d4;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --border: #dbe3f6;
  --shadow: 0 12px 28px rgba(30, 64, 175, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #eaf0ff 0%, #f7fbff 100%);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 20;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu-title {
  margin: 14px 8px 8px;
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-item {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d1d5db;
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s ease;
}

.menu-item:hover,
.menu-item.active {
  color: white;
  background: rgba(37, 99, 235, 0.3);
}

.main {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.topbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-left h2 {
  margin: 0;
  font-size: 22px;
}

.topbar-left p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="search"],
select,
input[type="date"] {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

input[type="search"] {
  min-width: 250px;
}

button {
  font: inherit;
}

.ghost-btn,
.outline-btn,
.primary-btn,
.tab-btn {
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
}

.ghost-btn {
  background: var(--surface-soft);
  border-color: var(--border);
}

.outline-btn {
  background: white;
  color: var(--primary-dark);
  border-color: #bfdbfe;
}

.primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.page-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  background: white;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
}

.tab-btn.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.kpi-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.kpi-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-card h3 {
  margin: 8px 0 4px;
  font-size: clamp(26px, 2.3vw, 36px);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card {
  min-width: 0;
}

.kpi-card small {
  color: #64748b;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.card-head h3 {
  margin: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-layout {
  display: flex;
  gap: 16px;
  align-items: center;
}

.donut-chart {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-list,
.timeline,
.task-list,
.notif-list,
.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.owner-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.owner-row {
  display: grid;
  grid-template-columns: 130px 1fr 72px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  background: #e5edff;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid #edf2ff;
  text-align: left;
  font-size: 13px;
  padding: 10px;
  vertical-align: top;
}

th {
  color: #475569;
  background: #f8fbff;
  position: sticky;
  top: 0;
}

.status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.status-open {
  background: #e0f2fe;
  color: #0c4a6e;
}

.status-won {
  background: #dcfce7;
  color: #14532d;
}

.status-lost {
  background: #fee2e2;
  color: #7f1d1d;
}

.priority-high {
  color: #b91c1c;
  font-weight: 700;
}

.priority-medium {
  color: #9a3412;
  font-weight: 700;
}

.priority-low {
  color: #0f766e;
  font-weight: 700;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 10px;
}

.kanban-col {
  border: 1px solid #e4ebff;
  background: #f8fbff;
  border-radius: 12px;
  padding: 10px;
}

.kanban-col h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.kanban-card {
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}

.kanban-card p {
  margin: 0 0 4px;
  font-size: 12px;
}

.list-item {
  border: 1px solid #e8efff;
  background: #fbfdff;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}

.list-item small {
  color: var(--muted);
}

.task-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-list input[type="checkbox"] {
  margin-top: 2px;
}

.progress-row {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.progress-row .bar-track {
  height: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.placeholder-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  background: #eff6ff;
}

@media (max-width: 1360px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  input[type="search"] {
    min-width: 100%;
  }

  .donut-chart {
    width: 180px;
    height: 180px;
  }

  .stage-layout {
    flex-direction: column;
    align-items: flex-start;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .owner-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .filters select,
  .filters input {
    width: 100%;
  }
}
