:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #101827;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #dbe2ea;
  --nav: #0f172a;
  --nav-2: #172238;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f97316;
  --cyan: #06b6d4;
  --radius: 16px;
  --shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.84rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.2vw, 0.98rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --text-lg: clamp(1.125rem, 1rem + 0.4vw, 1.3rem);
  --text-xl: clamp(1.35rem, 1.1rem + 0.75vw, 1.8rem);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "General Sans", Inter, system-ui, sans-serif;
  font-size: var(--text-base);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
}

.skip-link:focus {
  top: 12px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary), #60a5fa);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.login-card .brand {
  justify-content: center;
  font-size: var(--text-lg);
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: var(--text-xs);
}

.form {
  margin-top: 26px;
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 700;
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
  color: var(--ink);
}

.btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 10px 14px;
  transition: transform 160ms ease, background 160ms ease;
}

.btn:hover {
  background: var(--primary-2);
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.error {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  color: #991b1b;
  background: #fee2e2;
  font-size: var(--text-sm);
}

.error.show {
  display: block;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--nav);
  color: #e5eefb;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-head {
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .brand {
  color: white;
}

.nav-section {
  padding: 18px 12px 4px;
  color: #91a0b8;
  font-size: var(--text-xs);
}

.nav-button {
  width: calc(100% - 24px);
  margin: 4px 12px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #dbeafe;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: var(--nav-2);
}

.sidebar-user {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(246, 247, 248, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.content {
  min-width: 0;
}

main {
  padding: 28px;
  max-width: 1480px;
}

.page-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  font-size: var(--text-base);
  letter-spacing: -0.02em;
}

.grid {
  display: grid;
  gap: 16px;
}

.kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-pad {
  padding: 20px;
}

.kpi {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.kpi-label {
  color: var(--muted);
  font-size: var(--text-xs);
  display: flex;
  gap: 8px;
  align-items: center;
}

.kpi-value {
  font-size: var(--text-lg);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.dashboard-grid {
  grid-template-columns: 2fr 1fr;
  margin-top: 16px;
}

.chart-wrap {
  height: 280px;
}

.lead-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.lead-mini:last-child {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid currentColor;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.events {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.event-card {
  padding: 16px;
}

.event-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.event-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--text-xs);
  display: grid;
  gap: 7px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  gap: 3px;
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--text-xs);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: var(--text-xs);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.task-row:last-child {
  border-bottom: 0;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .events {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 30;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  main {
    padding: 20px 16px 32px;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head {
    display: grid;
  }

  .task-row {
    grid-template-columns: 1fr;
  }
}
