@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --bg: #f3f6fb;
  --bg-2: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #0b1220;
  --muted: #5b6777;
  --line: #e2e8f0;
  --primary: #0f172a;
  --accent: #0ea5e9;
  --accent-2: #10b981;
  --warm: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
  --font-body: "Manrope", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at -10% -20%, #dbeafe 0, transparent 60%),
    radial-gradient(1000px 700px at 110% -10%, #dcfce7 0, transparent 55%),
    radial-gradient(800px 600px at 50% 120%, #fff7ed 0, transparent 60%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.25;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  opacity: 0.35;
  z-index: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--primary);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: #e2e8f0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  background: rgba(14, 165, 233, 0.18);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.brand-sub {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.7);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(226, 232, 240, 0.85);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(14, 165, 233, 0.22);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-user {
  margin-top: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar .helper {
  color: rgba(226, 232, 240, 0.6);
}

.sidebar .button.secondary {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.sidebar .button.secondary:hover {
  background: rgba(148, 163, 184, 0.25);
}

.user-chip {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-name {
  font-weight: 600;
  color: #f8fafc;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.2);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.avatar.small {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.segmented {
  display: inline-flex;
  border-radius: 999px;
  background: #eef2f7;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 4px;
  gap: 4px;
}

.segmented-item {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.segmented-item.active {
  background: #0f172a;
  color: #fff;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
  font-size: 12px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px 80px;
  animation: fadeIn 0.5s ease;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  position: relative;
}

.section + .section {
  margin-top: 20px;
}

.card-accent {
  position: relative;
  overflow: hidden;
}

.card-accent::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  border: 1px solid rgba(14, 165, 233, 0.3);
  pointer-events: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-head--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.helper {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.18);
  color: #92400e;
}

.status-new { background: #f3f4f6; color: #4b5563; }
.status-not_reached { background: #ffedd5; color: #9a3412; }
.status-qualified { background: #dbeafe; color: #1d4ed8; }
.status-appointment { background: #ede9fe; color: #6d28d9; }
.status-proposal { background: #ede9fe; color: #6d28d9; }
.status-won { background: #dcfce7; color: #166534; }
.status-lost { background: #fee2e2; color: #b91c1c; }
.status-invalid { background: #fee2e2; color: #b91c1c; }

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.health-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.health-warn {
  background: rgba(245, 158, 11, 0.18);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.health-critical {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.client-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.client-card:focus {
  outline: 2px solid rgba(14, 165, 233, 0.6);
  outline-offset: 2px;
}

.client-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.client-name {
  font-weight: 600;
}

.client-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.12);
  color: #0f172a;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.client-avatar.small {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  font-size: 12px;
}

.client-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.kpi-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-weight: 700;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  background: #ecfeff;
  color: #0f766e;
  border: 1px solid rgba(14, 116, 144, 0.2);
}

.notice.error {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.2);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.table-body {
  max-height: 65vh;
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  color: var(--muted);
}

.table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  font-size: 14px;
  vertical-align: top;
  background: var(--panel);
}

.table tbody tr:hover td {
  background: #f8fafc;
}

.row-link {
  cursor: pointer;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.input, .select, textarea {
  width: 100%;
  border: 1px solid #d7dee8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.6);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

.checkbox {
  transform: scale(1.05);
}

.button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.25);
}

.button.secondary {
  background: #fff;
  border: 1px solid #d7dee8;
  color: var(--text);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.button.secondary:hover {
  background: #f8fafc;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.split-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
}

.settings-sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
}

.nav-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-pills .button {
  justify-content: flex-start;
}

.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.pagination-inner {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: var(--shadow-soft);
}

.pagination-pages {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination-item {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid transparent;
}

.pagination-item.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
  color: #0369a1;
}

.pagination-item.disabled {
  color: #9aa3b2;
}

.pagination-ellipsis {
  color: #9aa3b2;
  padding: 6px 8px;
}

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 380px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(0);
  transition: transform 0.25s ease;
  box-shadow: -16px 0 30px rgba(15, 23, 42, 0.12);
  z-index: 60;
}

.side-panel.is-hidden {
  transform: translateX(100%);
}

.side-panel__header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.side-panel__body {
  padding: 20px;
  overflow: auto;
  height: calc(100% - 64px);
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .sidebar-brand {
    padding: 0 8px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-user {
    margin-top: 0;
    width: 100%;
  }

  .settings-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 16px;
    height: auto;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .page-head--row {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    padding: 0 16px 64px;
  }

  .side-panel {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
