/* ==========================================================================
   99learn CRM — design system
   Written by hand: no build step, no framework, no CDN. Everything a browser
   needs is in this one file, which also means the CRM loads on the kind of
   connection a sales floor actually has.
   ========================================================================== */

:root {
  /* Brand */
  --brand-900: #14213d;
  --brand-800: #1b2b4d;
  --brand-700: #24365f;
  --brand-600: #2f4676;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;

  /* Surfaces */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --text-invert: #ffffff;

  /* Status */
  --green: #059669;
  --green-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --cyan: #0891b2;
  --cyan-soft: #cffafe;
  --slate-soft: #e2e8f0;

  /* Shape */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --sidebar-width: 244px;
  --topbar-height: 60px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The `hidden` attribute must win over any component's own display rule —
   several toggled panels below are display:flex/grid when visible. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }

p { margin: 0 0 10px; }

small { font-size: 12px; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--brand-900);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.sidebar__name {
  display: block;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
}

.sidebar__tagline {
  display: block;
  font-size: 11px;
  color: #7f8ea8;
  line-height: 1.3;
}

.sidebar__nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar__section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #64748b;
  padding: 14px 10px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #b6c2d6;
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  text-decoration: none;
}

.nav-item.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar__footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
}

.sidebar__user:hover {
  background: rgba(255, 255, 255, 0.07);
  text-decoration: none;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__title {
  font-size: 16px;
  font-weight: 650;
  margin-right: auto;
}

.content {
  padding: 22px;
  flex: 1;
  max-width: 1560px;
  width: 100%;
}

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

.page-header__sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards & grids
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card__title {
  font-size: 14px;
  font-weight: 650;
}

.card__body {
  padding: 16px;
}

.card__body--flush {
  padding: 0;
}

.card__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius) var(--radius);
}

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

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid--main { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.row--between {
  justify-content: space-between;
}

.row--tight { gap: 6px; }

/* ==========================================================================
   Stat tiles
   ========================================================================== */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.stat__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat__value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
  line-height: 1.1;
}

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

.stat--accent { border-left: 3px solid var(--accent); }
.stat--green { border-left: 3px solid var(--green); }
.stat--amber { border-left: 3px solid var(--amber); }
.stat--red { border-left: 3px solid var(--red); }
.stat--purple { border-left: 3px solid var(--purple); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 650;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #f9fbff;
}

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

.table--compact td { padding: 7px 12px; }

.table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table__empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--text-muted);
}

.table a.strong {
  font-weight: 600;
  color: var(--text);
}

.table a.strong:hover { color: var(--accent); }

/* ==========================================================================
   Badges & pills
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--slate-soft);
  color: var(--text-muted);
  line-height: 1.6;
}

.badge.is-new { background: var(--accent-soft); color: var(--accent-dark); }
.badge.is-contacted { background: var(--cyan-soft); color: #0e7490; }
.badge.is-qualified { background: var(--purple-soft); color: #6d28d9; }
.badge.is-counselling { background: #fce7f3; color: #be185d; }
.badge.is-negotiation { background: var(--amber-soft); color: #b45309; }
.badge.is-won { background: var(--green-soft); color: #047857; }
.badge.is-lost { background: var(--red-soft); color: #b91c1c; }
.badge.is-junk { background: #f1f5f9; color: #64748b; }

.badge.is-hot { background: var(--red-soft); color: #b91c1c; }
.badge.is-warm { background: var(--amber-soft); color: #b45309; }
.badge.is-cold { background: #e0f2fe; color: #0369a1; }

.badge--green { background: var(--green-soft); color: #047857; }
.badge--red { background: var(--red-soft); color: #b91c1c; }
.badge--amber { background: var(--amber-soft); color: #b45309; }
.badge--accent { background: var(--accent-soft); color: var(--accent-dark); }
.badge--purple { background: var(--purple-soft); color: #6d28d9; }
.badge--outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: var(--slate-soft);
  color: var(--text-muted);
}

.score-pill.is-high { background: var(--green-soft); color: #047857; }
.score-pill.is-mid { background: var(--amber-soft); color: #b45309; }
.score-pill.is-low { background: #f1f5f9; color: #64748b; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-700);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar--lg { width: 46px; height: 46px; font-size: 16px; }
.avatar--sm { width: 22px; height: 22px; font-size: 9.5px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}

.btn:hover {
  background: var(--surface-alt);
  text-decoration: none;
  border-color: var(--text-soft);
}

.btn:active { transform: translateY(1px); }

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn--danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn--danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn--success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn--success:hover { background: #047857; border-color: #047857; color: #fff; }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--block { width: 100%; }

.btn svg { width: 15px; height: 15px; }

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.btn-group .btn {
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
}

.btn-group .btn:last-child { border-right: none; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  min-width: 0;
}

.field > label,
.label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.field__help {
  font-size: 12px;
  color: var(--text-muted);
}

.field__error {
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea { resize: vertical; min-height: 62px; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 28px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}

.checkbox-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: contents;
}

.checkbox-grid li label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

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

.form-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}

.form-section__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

/* ==========================================================================
   Filter bar
   ========================================================================== */

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

.filters .field {
  margin-bottom: 0;
  min-width: 130px;
}

.filters .field--grow { flex: 1; min-width: 200px; }

.search-input {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input svg {
  position: absolute;
  left: 9px;
  width: 15px;
  height: 15px;
  color: var(--text-soft);
  pointer-events: none;
}

.search-input input { padding-left: 30px; }

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.chip__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  font-size: 11.5px;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
}

.alert--success { background: var(--green-soft); color: #065f46; border-color: #a7f3d0; }
.alert--error { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.alert--warning { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }
.alert--info { background: var(--accent-soft); color: #1e40af; border-color: #bfdbfe; }

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ==========================================================================
   Timeline
   ========================================================================== */

.timeline {
  position: relative;
  padding-left: 26px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  padding-bottom: 18px;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
  position: absolute;
  left: -26px;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.timeline__dot svg { width: 12px; height: 12px; }

.timeline__dot.is-call { border-color: var(--accent); color: var(--accent); }
.timeline__dot.is-status { border-color: var(--purple); color: var(--purple); }
.timeline__dot.is-assign { border-color: var(--amber); color: var(--amber); }
.timeline__dot.is-payment { border-color: var(--green); color: var(--green); }

.timeline__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.timeline__actor { font-weight: 650; }

.timeline__time { color: var(--text-soft); font-size: 12px; }

.timeline__body {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   Charts (pure CSS/SVG — no JS chart library)
   ========================================================================== */

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.bar-row__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 4px;
}

.bar-row__label { font-weight: 550; }

.bar-row__value {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12.5px;
}

.bar-track {
  height: 7px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bar-fill--green { background: var(--green); }
.bar-fill--amber { background: var(--amber); }
.bar-fill--red { background: var(--red); }
.bar-fill--purple { background: var(--purple); }

.funnel {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.funnel__label {
  width: 118px;
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 550;
  text-align: right;
  color: var(--text-muted);
}

.funnel__bar {
  height: 32px;
  background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #fff;
  font-weight: 650;
  font-size: 12.5px;
  min-width: 44px;
  transition: width 0.3s ease;
}

.funnel__meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart__line--alt { stroke: var(--green); }
.chart__area { fill: rgba(37, 99, 235, 0.09); }

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.legend__key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.legend__swatch--green { background: var(--green); }

/* ==========================================================================
   Misc components
   ========================================================================== */

.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.strong { font-weight: 650; }
.nums { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.nowrap { white-space: nowrap; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.definition-list {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 8px 14px;
  font-size: 13px;
  align-items: baseline;
}

.definition-list dt {
  color: var(--text-muted);
  font-weight: 500;
}

.definition-list dd {
  margin: 0;
  font-weight: 550;
  min-width: 0;
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.empty-state__title {
  font-weight: 650;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}

.pagination__pages {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pagination__link {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  display: inline-grid;
  place-items: center;
  color: var(--text);
  font-weight: 550;
  font-size: 12.5px;
}

.pagination__link:hover { background: var(--surface-alt); text-decoration: none; }

.pagination__link.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination__link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Dropdown (CSS-only via <details>) */
.dropdown { position: relative; display: inline-block; }

.dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.dropdown > summary::-webkit-details-marker { display: none; }

.dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  max-height: 340px;
  overflow-y: auto;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.dropdown__item:hover { background: var(--surface-alt); text-decoration: none; }

.dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

.dropdown__label {
  padding: 6px 9px 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  font-weight: 700;
}

/* Bulk action bar */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--brand-900);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.bulk-bar select,
.bulk-bar input[type="text"] {
  width: auto;
  min-width: 150px;
  padding: 5px 9px;
  font-size: 13px;
}

.bulk-bar__count {
  font-weight: 650;
  font-size: 13px;
}

/* Progress ring/meter */
.meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meter__track {
  flex: 1;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}

.meter__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.meter__fill.is-over { background: var(--red); }
.meter__fill.is-good { background: var(--green); }
.meter__fill.is-warn { background: var(--amber); }

.meter__value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 42px;
  text-align: right;
}

/* Score breakdown */
.score-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row {
  display: grid;
  grid-template-columns: 116px 1fr 38px;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
}

.score-row__label { color: var(--text-muted); }
.score-row__value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Login */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(150deg, var(--brand-900) 0%, var(--brand-600) 100%);
}

.auth__card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px;
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.auth__title { font-size: 19px; margin-bottom: 4px; }

.auth__sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.auth__footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Error page */
.error-page {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.error-page__code {
  font-size: 60px;
  font-weight: 800;
  color: var(--border-strong);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Notification bell */
.bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.bell:hover { background: var(--surface-alt); color: var(--text); }

.bell__dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.notification-item {
  display: flex;
  gap: 9px;
  padding: 9px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.notification-item:hover { background: var(--surface-alt); text-decoration: none; }

.notification-item__title { font-weight: 600; font-size: 13px; }
.notification-item__body { font-size: 12px; color: var(--text-muted); }
.notification-item__time { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

/* Code block for API docs */
.code-block {
  background: var(--brand-900);
  color: #cbd5e1;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre;
}

.copy-field {
  display: flex;
  gap: 6px;
  align-items: center;
}

.copy-field input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--surface-alt);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover { color: var(--text); text-decoration: none; }

.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
  .grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--main, .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

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

  .main { margin-left: 0; }

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

  .content { padding: 16px; }

  .sidebar-toggle { display: inline-grid !important; }
}

@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4, .grid--5 { grid-template-columns: minmax(0, 1fr); }
  .funnel__label { width: 84px; font-size: 11.5px; }
  .topbar { padding: 0 14px; }
  .score-row { grid-template-columns: 96px 1fr 34px; }
}

.sidebar-toggle { display: none; }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 35;
}

.scrim.is-open { display: block; }

@media (min-width: 901px) {
  .scrim { display: none !important; }
}

@media print {
  .sidebar, .topbar, .page-actions, .filters, .bulk-bar { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; border-color: #ddd; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
