/* =========================================================
   Alpha-Shalimar School CRM — Operational UI
   ========================================================= */

:root {
  --bg: #F3F4F6;
  --panel: #FFFFFF;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --sidebar: #202B3D;
  --sidebar-2: #2A374A;
  --primary: #5B0A3D;
  --primary-hover: #74164F;
  --primary-soft: #F7EAF1;
  --accent: #D8B66A;
  --danger: #DC2626;
  --warn: #D97706;
  --success: #059669;
  --info: #2563EB;
  --sidebar-w: 256px;
  --sidebar-collapsed-w: 76px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
  --font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: #CBD5D1 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background-color: #CBD5D1;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: #9CAFA9;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

html { -webkit-text-size-adjust: 100%; }

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
p, h1, h2, h3 { margin: 0; }
svg { display: block; max-width: 100%; }

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---- Shell ---- */

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.24s var(--ease);
}

.ambient { display: none; }

.main { position: relative; z-index: 1; min-width: 0; }

/* ---- Sidebar ---- */

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: #F8FAFC;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: width 0.24s var(--ease);
}

.sidebar__top {
  padding: 0.9rem 0.85rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.brand-copy__name {
  font-size: 0.88rem;
  font-weight: 750;
  color: #fff;
  letter-spacing: 0.02em;
}

.brand-copy__tag {
  font-size: 0.68rem;
  color: #B7C0CD;
}

.sidebar__toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  background: var(--sidebar-2);
  color: #E2E8F0;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.sidebar__toggle:hover {
  background: #35435A;
  color: #fff;
}

.sidebar__toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 0.24s var(--ease);
}

.workspace-picker { position: relative; }

.workspace-switch {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: var(--sidebar-2);
  color: #F8FAFC;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.workspace-switch:hover {
  background: #35435A;
  border-color: rgba(255, 255, 255, 0.25);
}

.workspace-switch__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(216, 182, 106, 0.14);
  color: var(--accent);
  flex-shrink: 0;
}

.workspace-switch__icon svg {
  width: 15px;
  height: 15px;
}

.workspace-switch__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.workspace-switch__text strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.workspace-switch__text small {
  font-size: 0.68rem;
  color: #B7C0CD;
}

.workspace-switch__chev {
  width: 14px;
  height: 14px;
  color: #B7C0CD;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease);
}
.workspace-switch[aria-expanded="true"] .workspace-switch__chev { transform: rotate(180deg); }

.campus-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% - 0.25rem);
  right: 0;
  left: 0;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14);
}
.campus-menu[hidden] { display: none; }
.campus-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}
.campus-option:hover,
.campus-option[aria-selected="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}
.campus-option svg {
  width: 15px;
  height: 15px;
  opacity: 0;
}
.campus-option[aria-selected="true"] svg { opacity: 1; }
.campus-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: var(--sidebar-2);
}

.sidebar-search svg {
  width: 14px;
  height: 14px;
  color: #B7C0CD;
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.8rem;
  color: #F8FAFC;
}

.sidebar-search input::placeholder {
  color: #9CA3AF;
}

.sidebar__top,
.sidebar__footer {
  flex-shrink: 0;
}

.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.7rem 0.65rem;
  overscroll-behavior: contain;
}
.sidebar__nav {
  scrollbar-color: #746449 transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 7px; }
.sidebar__nav::-webkit-scrollbar-thumb { background-color: #746449; }
.sidebar__nav::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }

.nav-group + .nav-group {
  margin-top: 0.85rem;
}

.nav-group__label {
  margin: 0 0.55rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #AAB4C2;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 1px;
  border-radius: 8px;
  color: #D6DCE5;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link.is-active {
  background: rgba(216, 182, 106, 0.14);
  color: var(--accent);
  font-weight: 650;
}

.nav-link.is-active .nav-link__icon {
  color: var(--accent);
}

.nav-link.is-muted {
  color: #7F8998;
  cursor: default;
}

.nav-link.is-muted:hover {
  background: transparent;
  color: #7F8998;
}

.nav-link__icon {
  width: 18px;
  height: 18px;
  color: #AAB4C2;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.nav-link__icon svg {
  width: 17px;
  height: 17px;
}

.nav-link__label {
  flex: 1;
  font-size: 0.84rem;
  font-weight: 550;
}

.nav-link.is-active .nav-link__label {
  font-weight: 700;
}

.nav-link__badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 750;
  line-height: 18px;
  text-align: center;
  background: #FEE2E2;
  color: #B91C1C;
}

.sidebar__footer {
  padding: 0.7rem 0.75rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.user-chip:hover {
  background: var(--sidebar-2);
  border-color: rgba(255, 255, 255, 0.12);
}

.user-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 750;
  color: var(--accent);
  background: rgba(216, 182, 106, 0.14);
  flex-shrink: 0;
}

.user-chip__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-chip__meta strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip__meta small {
  font-size: 0.68rem;
  color: #B7C0CD;
}

.user-chip > svg {
  width: 14px;
  height: 14px;
  color: #AAB4C2;
  flex-shrink: 0;
}

@media (min-width: 981px) {
  .app-shell.is-nav-collapsed:not(.is-nav-peek) {
    grid-template-columns: var(--sidebar-collapsed-w) 1fr;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar {
    width: var(--sidebar-collapsed-w);
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__top {
    padding: 0.55rem 0.35rem 0.65rem;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__brand {
    justify-content: center;
    gap: 0.2rem;
    margin-bottom: 0;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .brand-copy,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .workspace-picker,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar-search,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .nav-group__label,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .nav-link__label,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .nav-link__badge,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .user-chip__meta,
  .app-shell.is-nav-collapsed:not(.is-nav-peek) .user-chip > svg {
    display: none;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__toggle {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__toggle svg {
    transform: rotate(180deg);
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__nav {
    padding: 0.65rem 0.4rem;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .nav-group + .nav-group {
    margin-top: 0.45rem;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .nav-link {
    justify-content: center;
    padding: 0.55rem;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .sidebar__footer {
    padding: 0.55rem 0.35rem;
  }

  .app-shell.is-nav-collapsed:not(.is-nav-peek) .user-chip {
    justify-content: center;
    padding: 0.4rem 0;
  }
}

/* ---- Main / Topbar ---- */

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.icon-btn.topbar__menu { display: none; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.breadcrumb__sep { opacity: 0.5; }

.topbar__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: min(280px, 28vw);
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #F9FAFB;
}
.search-field svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.search-field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
}
.search-field input::placeholder { color: #9CA3AF; }
.search-field kbd {
  font-size: 0.65rem;
  font-family: inherit;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.select-sm {
  height: 32px;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
}

.icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 15px; height: 15px; margin: 0; }
.icon-btn:hover { background: #F9FAFB; }
.icon-btn--ghost {
  border-color: transparent;
  background: transparent;
}
.icon-btn__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  color: #fff;
  background: var(--danger);
}

.notification-menu,
.profile-menu { position: relative; }

.notification-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.65rem);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.16);
}
.notification-panel[hidden] { display: none; }
.profile-menu__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.2rem 0.35rem 0.2rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.profile-menu__toggle:hover,
.profile-menu__toggle[aria-expanded="true"] { border-color: var(--line); background: #F9FAFB; }
.profile-menu__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(91, 10, 61, 0.1);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 750;
}
.profile-menu__identity {
  display: grid;
  min-width: 0;
  gap: 0.04rem;
}
.profile-menu__identity strong {
  max-width: 112px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu__identity small {
  max-width: 112px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu__chevron { width: 14px; height: 14px; flex: 0 0 14px; color: var(--muted); }
.profile-menu__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.65rem);
  right: 0;
  width: min(270px, calc(100vw - 1.5rem));
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.16);
}
.profile-menu__panel[hidden] { display: none; }
.profile-menu__summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
}
.profile-menu__summary > span:last-child { display: grid; min-width: 0; gap: 0.1rem; }
.profile-menu__summary strong { overflow: hidden; color: var(--ink); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu__summary small { overflow: hidden; color: var(--muted); font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu__links { display: grid; gap: 0.15rem; padding: 0.45rem 0; }
.profile-menu__links a,
.profile-menu__sign-out {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 38px;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 0.74rem;
  font-weight: 600;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.profile-menu__links a:hover { background: #F3F4F6; color: var(--ink); }
.profile-menu__links svg,
.profile-menu__sign-out svg { width: 16px; height: 16px; flex: 0 0 16px; }
.profile-menu__sign-out {
  border-top: 1px solid var(--line);
  border-radius: 0 0 7px 7px;
  color: var(--danger);
}
.profile-menu__sign-out:hover { background: #FEF2F2; color: #B91C1C; }
.notification-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.notification-panel__header h2 { font-size: 0.95rem; }
.notification-panel__header p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.notification-panel__read {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.15s ease;
}
.notification-item:hover,
.notification-item.is-unread { background: #F8FAFC; }
.notification-item__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
}
.notification-item__icon--lead { color: #1D4ED8; background: #DBEAFE; }
.notification-item__icon--application { color: #7C3AED; background: #EDE9FE; }
.notification-item__icon--visit { color: #047857; background: #D1FAE5; }
.notification-item__icon--message { color: #B45309; background: #FEF3C7; }
.notification-item__icon--offer { color: #BE123C; background: #FFE4E6; }
.notification-item__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 0.08rem;
}
.notification-item__body strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-item__body > span,
.notification-item__body time {
  color: var(--muted);
  font-size: 0.68rem;
}
.notification-item__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--primary);
}
.notification-panel__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 650;
}
.notification-panel__footer:hover { background: #F9FAFB; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 32px;
  padding: 0 0.75rem;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn--sm { height: 32px; }
.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn--secondary:hover { background: #F9FAFB; }
.btn--secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 650;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.content {
  padding: 1rem 1.15rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ---- Metrics ---- */

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 0.85rem;
}

.metric__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.metric__row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.metric__row strong {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}

.metric__sub {
  font-size: 0.7rem;
  color: #9CA3AF;
}

.delta {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}
.delta--up { color: #047857; background: #D1FAE5; }
.delta--down { color: #B91C1C; background: #FEE2E2; }
.delta--warn { color: #B45309; background: #FEF3C7; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}
.badge--success { background: #D1FAE5; color: #047857; }

/* ---- Cards / Grid ---- */

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr 1fr;
  gap: 0.75rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  min-width: 0;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card__head p {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.card__head--table {
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

/* Funnel */

.funnel { display: grid; gap: 0.55rem; }

.funnel__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}
.funnel__meta span { color: var(--ink-2); }
.funnel__meta strong { font-variant-numeric: tabular-nums; }

.funnel__track {
  height: 8px;
  border-radius: 999px;
  background: #F3F4F6;
  overflow: hidden;
}
.funnel__track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Sources */

.sources { display: grid; gap: 0.7rem; }

.source-row__top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.28rem;
  font-size: 0.78rem;
}
.source-row__top strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-row__label { color: var(--ink-2); }
.source-row__bar {
  height: 6px;
  border-radius: 999px;
  background: #F3F4F6;
  overflow: hidden;
}
.source-row__bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

/* Tasks */

.task-list { display: grid; gap: 0.2rem; }

.task-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.task-item:last-child { border-bottom: 0; }

.task-check {
  position: relative;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  cursor: pointer;
}
.task-check input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.task-check__box {
  display: block;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-2);
  border-radius: 4px;
  background: #fff;
}
.task-check input:checked + .task-check__box {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px #fff;
}

.task-item__body { min-width: 0; }
.task-item__body strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  margin-bottom: 0.1rem;
}
.task-item__body span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-due {
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 2px;
}
.task-due--high { color: var(--danger); }
.task-due--med { color: var(--warn); }
.task-due--low { color: var(--muted); }

/* Table */

.card--table { padding: 0.85rem 0.85rem 0.55rem; }

.table-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #F9FAFB;
}
.tabs__btn {
  height: 28px;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.75rem;
  cursor: pointer;
}
.tabs__btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #F9FAFB;
  white-space: nowrap;
}

.data-table tbody tr:hover { background: #F9FAFB; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.person {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.person__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}
.person strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
}
.person span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #F3F4F6;
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.stage {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
}

.muted { color: var(--muted); font-size: 0.78rem; }

.prio {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}
.prio--hot { background: #FEE2E2; color: #B91C1C; }
.prio--warm { background: #FEF3C7; color: #B45309; }
.prio--cold { background: #E0E7FF; color: #4338CA; }
.prio--new { background: #D1FAE5; color: #047857; }

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.15rem 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.pager { display: flex; gap: 0.35rem; }

/* Overlay */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(17, 24, 39, 0.45);
}

.record-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(17, 24, 39, 0.4);
  cursor: default;
}
.record-drawer-backdrop[hidden] { display: none; }
.record-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 81;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  height: 100%;
  background: #fff;
  box-shadow: -12px 0 36px rgba(17, 24, 39, 0.16);
  transform: translateX(0);
  animation: record-drawer-in 0.2s var(--ease);
}
.record-drawer[hidden] { display: none; }
@keyframes record-drawer-in {
  from { transform: translateX(24px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}
.record-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.record-drawer__eyebrow {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.record-drawer__header h2 {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.record-drawer__content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.record-drawer__fields {
  display: grid;
  gap: 0.15rem;
  margin: 0;
}
.record-drawer__fields > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #F3F4F6;
}
.record-drawer__fields dt {
  color: var(--muted);
  font-size: 0.76rem;
}
.record-drawer__fields dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.record-drawer__empty {
  color: var(--muted);
  font-size: 0.82rem;
}
.record-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border-top: 1px solid var(--line);
}
.record-drawer__full-view { margin-right: auto; }
.record-drawer__full-view[hidden],
.record-drawer__save[hidden],
.record-drawer__edit[hidden] { display: none; }
.record-drawer--lead { width: min(500px, 100vw); }
.record-drawer--full { width: min(1120px, calc(100vw - 250px)); }
.record-drawer--lead .record-drawer__header { align-items: center; }
.record-drawer--lead .record-drawer__content { padding: 1rem 1.25rem 1.25rem; }
.lead-detail { display: grid; gap: 0.9rem; }
.lead-detail__hero {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.lead-detail__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 750;
}
.lead-detail__identity { display: grid; gap: 0.12rem; min-width: 0; flex: 1; }
.lead-detail__identity strong { font-size: 0.95rem; overflow-wrap: anywhere; }
.lead-detail__identity span,
.lead-detail__section-meta { color: var(--muted); font-size: 0.7rem; }
.lead-detail__stagebar {
  display: flex;
  gap: 0.2rem;
  margin: 0;
  padding: 0 0 0.35rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}
.lead-detail__stage {
  min-width: 72px;
  flex: 1;
  padding-top: 0.35rem;
  border-top: 3px solid var(--line);
  color: var(--muted);
}
.lead-detail__stage span { display: block; font-size: 0.6rem; white-space: nowrap; }
.lead-detail__stage.is-complete { border-color: var(--success); color: var(--ink-2); }
.lead-detail__stage.is-current { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.lead-detail__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lead-detail__actions .is-disabled { opacity: 0.48; pointer-events: none; }
.lead-detail__layout { display: grid; gap: 1rem; }
.lead-detail--full .lead-detail__layout { grid-template-columns: minmax(270px, 0.82fr) minmax(0, 1.5fr); align-items: start; }
.lead-detail__profile,
.lead-detail__section {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.lead-detail__profile > h3,
.lead-detail__section h3,
.lead-detail__source h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 750;
}
.lead-detail__form { margin-top: 0.65rem; }
.lead-detail__form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
.lead-detail__field { display: grid; gap: 0.25rem; min-width: 0; }
.lead-detail__field > span { color: var(--ink-2); font-size: 0.69rem; font-weight: 600; }
.lead-detail__field .input,
.lead-detail__field .select-sm {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
  font-size: 0.75rem;
}
.lead-detail__field textarea.input { min-height: 66px; resize: vertical; }
.lead-detail__field .input:focus,
.lead-detail__field .select-sm:focus { outline: 2px solid rgba(91, 10, 61, 0.16); border-color: var(--primary); }
.lead-detail__field--wide { grid-column: 1 / -1; }
.lead-detail__workspace { display: grid; gap: 0.8rem; min-width: 0; }
.lead-detail__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.lead-detail__timeline-host { min-width: 0; }
.lead-detail__timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lead-detail__timeline-item { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 0.55rem; min-height: 48px; }
.lead-detail__timeline-dot {
  position: relative;
  width: 9px;
  height: 9px;
  margin: 0.28rem 0 0 2px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: #fff;
}
.lead-detail__timeline-item:not(:last-child) .lead-detail__timeline-dot::after {
  position: absolute;
  top: 7px;
  left: 1px;
  width: 2px;
  height: 39px;
  background: #E8CAD9;
  content: "";
}
.lead-detail__timeline-copy { display: grid; gap: 0.12rem; padding-bottom: 0.55rem; }
.lead-detail__timeline-copy strong { font-size: 0.73rem; font-weight: 650; overflow-wrap: anywhere; }
.lead-detail__timeline-copy span { color: var(--muted); font-size: 0.65rem; }
.lead-detail__composer { display: grid; gap: 0.45rem; margin-top: 0.4rem; padding-top: 0.7rem; border-top: 1px solid var(--line); }
.lead-detail__composer .btn { justify-self: end; }
.lead-detail__task-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 0.7fr) auto; gap: 0.45rem; align-items: end; margin-top: 0.55rem; }
.lead-detail__task-form .lead-detail__field > span { font-size: 0.64rem; }
.lead-detail__task-form .input { min-height: 34px; }
.lead-detail__tasks { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.lead-detail__task { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.lead-detail__task-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}
.lead-detail__task-check[aria-pressed="true"] { border-color: var(--success); background: var(--success); }
.lead-detail__task-check[aria-pressed="true"]::after { width: 8px; height: 4px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; content: ""; transform: rotate(-45deg) translateY(-1px); }
.lead-detail__task-copy { display: grid; gap: 0.08rem; min-width: 0; }
.lead-detail__task-copy strong { font-size: 0.71rem; font-weight: 600; overflow-wrap: anywhere; }
.lead-detail__task-copy small { color: var(--muted); font-size: 0.63rem; }
.lead-detail__task.is-done .lead-detail__task-copy strong { color: var(--muted); text-decoration: line-through; }
.lead-detail__source .record-drawer__fields > div { grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1.2fr); padding: 0.45rem 0; }

/* Responsive */

@media (max-width: 1280px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .card--tasks { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  body { overflow: auto; }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
    min-height: 100vh;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 88vw);
    height: 100vh;
    max-height: 100vh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
  }

  .app-shell,
  .sidebar {
    transition-duration: 0.25s;
  }

  .app-shell.is-nav-open .sidebar { transform: translateX(0); }
  .app-shell.is-nav-open .sidebar-overlay { display: block; }
  .sidebar__toggle { display: none; }
  .icon-btn.topbar__menu { display: grid; }

  .search-field { display: none; }
  .toolbar-group .select-sm { display: none; }
}

@media (max-width: 720px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .content { padding: 0.85rem; }
  .topbar { padding: 0.7rem 0.85rem; }
  .toolbar-group .btn--secondary { display: none; }
  .profile-menu__identity,
  .profile-menu__chevron { display: none; }
  .profile-menu__toggle { padding: 0; }
}

/* ---- Inbox ---- */

.main--inbox {
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.main--inbox .topbar {
  flex-shrink: 0;
}

.inbox-channel-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 62px;
  padding: 0.55rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: none;
}
.inbox-channel-nav::-webkit-scrollbar { display: none; }
.inbox-channel-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0.4rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.inbox-channel-tab:hover { background: #F9FAFB; }
.inbox-channel-tab.is-active {
  border-color: #D8E9F7;
  background: #EFF7FC;
  color: #0876C9;
}
.inbox-channel-tab__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
}
.inbox-channel-tab__icon svg { width: 14px; height: 14px; }
.inbox-channel-tab__icon--all { background: #E8F0FE; color: #5B61F6; }
.inbox-channel-tab__icon--whatsapp { background: #DDF7E9; color: #16834A; }
.inbox-channel-tab__icon--messenger { background: #E2EEFF; color: #1877F2; }
.inbox-channel-tab__icon--instagram { background: #FCE4F0; color: #D62976; }
.inbox-channel-tab__label { font-size: 0.78rem; font-weight: 600; }
.inbox-channel-tab__status {
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: #E7F7EE;
  color: #16834A;
  font-size: 0.61rem;
  font-weight: 700;
}
.inbox-channel-tab__count {
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 0.27rem;
  border-radius: 999px;
  background: #FFF1CC;
  color: #A96800;
  font-size: 0.61rem;
  font-weight: 750;
}
.inbox-channel-tab.is-active .inbox-channel-tab__count {
  background: #1686D9;
  color: #fff;
}

.inbox {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.inbox-list,
.inbox-thread,
.inbox-context {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.inbox-list {
  border-right: 1px solid var(--line);
  background: #FCFCFD;
}

.inbox-list__head {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
}

.inbox-tabs {
  display: flex;
  gap: 0.2rem;
  overflow: auto;
}

.inbox-tabs__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.inbox-tabs__btn span {
  display: inline-block;
  margin-left: 0.2rem;
  color: #9CA3AF;
}

.inbox-tabs__btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.inbox-tabs__btn.is-active span { color: var(--primary); }

.inbox-filters {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.inbox-filters .select-sm { flex: 1; min-width: 0; }

.thread-list {
  overflow: auto;
  flex: 1;
}
.thread-list .thread-item[hidden] { display: none; }
.thread-list__empty {
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.thread-list__empty[hidden] { display: none; }

.thread-item {
  width: 100%;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.thread-item:hover { background: #F3F4F6; }

.thread-item.is-active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.thread-item.is-unread .thread-item__top strong {
  font-weight: 750;
}

.thread-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 750;
  flex-shrink: 0;
  color: var(--primary);
  background: var(--primary-soft);
}

.channel-wa { background: #D1FAE5; color: #047857; }
.channel-meta { background: #DBEAFE; color: #1D4ED8; }
.channel-web { background: #E0E7FF; color: #4338CA; }
.channel-walk { background: #FEF3C7; color: #B45309; }
.channel-google { background: #FEE2E2; color: #B91C1C; }
.channel-phone { background: #E5E7EB; color: #374151; }

.thread-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.thread-item__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.thread-item__top strong {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ink);
}

.thread-item__top time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.thread-item__preview {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item__meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.thread-item__assignee {
  font-size: 0.68rem;
  color: #9CA3AF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item__count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 750;
  line-height: 18px;
  text-align: center;
}

.chip--wa { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.chip--meta { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.chip--web { background: #EEF2FF; color: #4338CA; border-color: #C7D2FE; }
.chip--walk { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.chip--google { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.chip--phone { background: #F3F4F6; color: #374151; border-color: #E5E7EB; }

.inbox-thread {
  background: #fff;
  border-right: 1px solid var(--line);
}

.inbox-thread__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.inbox-thread__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.message-stream {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(180deg, #F9FAFB 0%, #FFFFFF 40%);
}

.message-day {
  display: flex;
  justify-content: center;
  margin: 0.25rem 0 0.9rem;
}

.message-day span {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
  background: #F3F4F6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.msg {
  max-width: min(520px, 88%);
  margin-bottom: 0.85rem;
}

.msg--them { margin-right: auto; }
.msg--agent,
.msg--bot { margin-left: auto; }

.msg__meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
  padding: 0 0.2rem;
}

.msg__meta strong {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
}

.msg__meta time {
  font-size: 0.68rem;
  color: #9CA3AF;
}

.msg--agent .msg__meta,
.msg--bot .msg__meta {
  justify-content: flex-end;
}

.msg__bubble {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.msg--them .msg__bubble {
  border-radius: 12px 12px 12px 4px;
}

.msg--agent .msg__bubble {
  background: var(--primary-soft);
  border-color: #E8CAD9;
  border-radius: 12px 12px 4px 12px;
}

.msg--bot .msg__bubble {
  background: #F8FAFC;
  border-style: dashed;
  color: var(--ink-2);
  border-radius: 12px 12px 4px 12px;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0.9rem 0.85rem;
  background: #fff;
  flex-shrink: 0;
}

.composer__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.composer__tool {
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.composer__tool:hover { background: #fff; }

.composer__box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FCFCFD;
  padding: 0.55rem 0.65rem;
}

.composer__box textarea {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  min-height: 44px;
}

.composer__send {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.inbox-context {
  overflow: auto;
  background: #FCFCFD;
  padding: 0.75rem;
  gap: 0.65rem;
}

.context-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.context-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.context-card__head h2 {
  font-size: 0.82rem;
}

.context-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.context-profile__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 0.75rem;
  color: var(--primary);
  background: var(--primary-soft);
}

.context-profile strong {
  display: block;
  font-size: 0.88rem;
}

.context-profile span {
  font-size: 0.74rem;
  color: var(--muted);
}

.context-fields {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.context-fields > div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 0.4rem;
  align-items: start;
}

.context-fields dt {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 650;
}

.context-fields dd {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

.context-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.context-actions .btn {
  width: 100%;
  height: auto;
  min-height: 32px;
  white-space: normal;
  padding: 0.45rem 0.5rem;
  font-size: 0.74rem;
}

.context-timeline {
  display: grid;
  gap: 0.65rem;
}

.context-timeline li {
  padding-left: 0.75rem;
  border-left: 2px solid #E8CAD9;
}

.context-timeline strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.1rem;
}

.context-timeline span {
  font-size: 0.7rem;
  color: var(--muted);
}

.note-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
  background: #F9FAFB;
  outline: none;
}

.note-box:focus {
  border-color: var(--primary);
  background: #fff;
}

@media (max-width: 1180px) {
  .inbox {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .inbox-context { display: none; }
}

@media (max-width: 820px) {
  .main--inbox {
    max-height: none;
    overflow: auto;
  }
  .inbox {
    grid-template-columns: 1fr;
    min-height: 70vh;
  }
  .inbox-list {
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .inbox-thread__actions .btn--secondary { display: none; }
}

/* ---- Leads ---- */

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

.leads-panel {
  padding-bottom: 0.55rem;
}

.lead-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #F9FAFB;
}

.lead-view-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 29px;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  cursor: pointer;
}

.lead-view-switch__btn svg {
  width: 14px;
  height: 14px;
}

.lead-view-switch__btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.leads-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.leads-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(260px, 100%);
  flex: 1;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #F9FAFB;
}

.leads-search svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.leads-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--primary-soft);
  border: 1px solid #E8CAD9;
  font-size: 0.8rem;
}

.bulk-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cell-stack strong {
  font-size: 0.82rem;
  font-weight: 650;
}

.cell-stack span {
  font-size: 0.7rem;
  color: var(--muted);
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  background: #F3F4F6;
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.score {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 72px;
}

.score__bar {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: #E5E7EB;
  overflow: hidden;
}

.score__bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #94A3B8;
}

.score--high .score__bar > i { background: var(--primary); }
.score--mid .score__bar > i { background: #D97706; }
.score--low .score__bar > i { background: #DC2626; }

.score strong {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  min-width: 1.4rem;
}

.owner-empty {
  color: #B45309;
  font-weight: 650;
  font-size: 0.78rem;
}

.sla {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.sla--ok { background: #D1FAE5; color: #047857; }
.sla--warn { background: #FEF3C7; color: #B45309; }
.sla--bad { background: #FEE2E2; color: #B91C1C; }
.sla--muted { background: #F3F4F6; color: #6B7280; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.data-table--leads {
  min-width: 1080px;
}

.lead-board,
.lead-table-view {
  min-width: 0;
}

.lead-kanban {
  grid-auto-columns: minmax(238px, 270px);
  gap: 0.65rem;
  padding: 0.15rem 0.1rem 0.65rem;
}

.lead-kanban__column {
  min-height: 470px;
}

.lead-kanban__body {
  min-height: 420px;
  align-content: start;
  transition: background 0.15s var(--ease), outline-color 0.15s var(--ease);
}

.lead-pipeline-card {
  min-width: 0;
  padding: 0.7rem;
  cursor: grab;
}

.lead-pipeline-card:active { cursor: grabbing; }
.lead-pipeline-card.is-dragging { opacity: 0.55; }

.lead-pipeline-card__id {
  overflow-wrap: anywhere;
  font-size: 0.68rem !important;
}

.lead-pipeline-card > p:not(.lead-pipeline-card__id) {
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
}

.lead-pipeline-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}

.lead-pipeline-card .deal-card__foot {
  padding-top: 0.4rem;
  border-top: 1px solid #F1F5F9;
}

.lead-stage-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.lead-stage-select {
  min-width: 0;
  max-width: 68%;
  padding: 0.28rem 1.3rem 0.28rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #fff;
  color: var(--ink-2);
  font: inherit;
}

.lead-kanban__body.is-drop {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: #FCF8ED;
}

.lead-board[hidden],
.lead-table-view[hidden],
.lead-board-empty[hidden],
.lead-table-empty[hidden],
.data-table tr[hidden] {
  display: none !important;
}

.lead-board-empty,
.lead-table-empty {
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 1280px) {
  .metrics--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .leads-panel .card__head--table {
    align-items: flex-start;
  }
  .leads-panel .table-tools {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }
  .lead-kanban {
    grid-auto-columns: minmax(230px, 82vw);
  }
  .leads-filters .select-sm:nth-child(n+4) {
    display: none;
  }
}

.bulk-bar[hidden] {
  display: none !important;
}

/* ---- Families ---- */

.families-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.15fr);
  gap: 0.75rem;
  align-items: start;
}

.families-list-panel {
  padding-bottom: 0.4rem;
  min-width: 0;
}

.family-list {
  max-height: calc(100vh - 320px);
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}

.family-item {
  width: 100%;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.family-item:hover {
  background: #F9FAFB;
  border-color: var(--line-2);
}

.family-item.is-active {
  background: var(--primary-soft);
  border-color: #E8CAD9;
  box-shadow: 0 0 0 1px rgba(91, 10, 61, 0.12);
}

.family-item__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}

.family-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.family-item__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.family-item__top strong {
  font-size: 0.86rem;
  font-weight: 700;
}

.family-item__top time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.family-item__meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.family-item__kids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.kid-chip {
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #F3F4F6;
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.family-item__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.family-detail {
  min-width: 0;
  position: sticky;
  top: 4.5rem;
}

.family-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.family-detail__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.family-detail__grid {
  display: grid;
  gap: 0.75rem;
}

.detail-block {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FCFCFD;
}

.detail-block h3 {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
}

.detail-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.detail-block__head h3 {
  margin: 0;
}

.sibling-list,
.doc-list {
  display: grid;
  gap: 0.45rem;
}

.sibling-item,
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.sibling-item__avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 750;
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}

.sibling-item__body {
  flex: 1;
  min-width: 0;
}

.sibling-item__body strong {
  display: block;
  font-size: 0.8rem;
}

.sibling-item__body span {
  font-size: 0.7rem;
  color: var(--muted);
}

.doc-item > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.doc-item strong {
  font-size: 0.8rem;
}

.doc-status {
  font-size: 0.68rem;
  font-weight: 700;
}

.doc-status--ok { color: #047857; }
.doc-status--mid { color: #2563EB; }
.doc-status--warn { color: #B45309; }
.doc-status--bad { color: #B91C1C; }

.family-detail__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .families-layout {
    grid-template-columns: 1fr;
  }
  .family-detail {
    position: static;
  }
  .family-list {
    max-height: 48vh;
  }
}

/* ---- Pipeline / Kanban ---- */

.pipeline-board-wrap { overflow: hidden; }

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.kanban-col {
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.kanban-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.kanban-col__head strong {
  font-size: 0.8rem;
}

.kanban-col__head span {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #E2E8F0;
  color: var(--ink-2);
  font-size: 0.68rem;
  font-weight: 750;
  display: grid;
  place-items: center;
}

.kanban-col__body {
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
  align-content: start;
  flex: 1;
}

.deal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.65rem 0.7rem;
  box-shadow: var(--shadow);
  cursor: grab;
}

.deal-card:active { cursor: grabbing; }
.deal-card.is-dragging { opacity: 0.55; }

.deal-card__top {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.deal-card__top strong { font-size: 0.82rem; }
.deal-card p {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.deal-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--muted);
}

/* ---- Visits / Apps / Auto / ERP / Settings ---- */

.visits-layout,
.auto-layout,
.erp-layout {
  display: grid;
  grid-template-columns: 1.5fr 0.85fr;
  gap: 0.75rem;
  align-items: start;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.slot-card {
  padding: 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #FCF8ED;
}

.slot-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.slot-card span {
  font-size: 0.72rem;
  color: var(--muted);
}

.slot-card.is-full {
  background: #F3F4F6;
  opacity: 0.75;
}

.visits-calendar { padding-top: 0.25rem; }
.visits-calendar[hidden] { display: none; }
.visits-calendar__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0 0.75rem;
}
.visits-calendar__month-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.visits-calendar__month-nav .icon-btn { width: 30px; height: 30px; }
.visits-calendar__month-nav .icon-btn svg { width: 14px; height: 14px; }
.visits-calendar__month-nav h3 {
  min-width: 140px;
  font-size: 0.9rem;
  text-align: center;
}
.visits-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.visits-calendar__weekday {
  padding: 0.55rem 0.35rem;
  background: #F9FAFB;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.visits-calendar__day {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  min-height: 100px;
  padding: 0.35rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.visits-calendar__day:nth-child(7n) { border-right: 0; }
.visits-calendar__day:nth-last-child(-n + 7) { border-bottom: 0; }
.visits-calendar__day.is-outside-month { background: #FAFBFC; }
.visits-calendar__day.is-outside-month .visits-calendar__date { color: #B8C0CA; }
.visits-calendar__date {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 0.72rem;
}
.visits-calendar__day.is-today .visits-calendar__date {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.visits-calendar__event {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  width: 100%;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  border: 0;
  border-left: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  text-align: left;
  cursor: pointer;
}
.visits-calendar__event:hover { filter: brightness(0.97); }
.visits-calendar__event.is-pending {
  border-left-color: #D97706;
  background: #FEF3C7;
  color: #92400E;
}
.visits-calendar__event.is-risk {
  border-left-color: #DC2626;
  background: #FEE2E2;
  color: #991B1B;
}
.visits-calendar__event-time {
  font-size: 0.6rem;
  font-weight: 600;
}
.visits-calendar__event strong {
  overflow: hidden;
  font-size: 0.64rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-pill--ok {
  background: #D1FAE5;
  color: #047857;
  border-color: #A7F3D0;
}

.stage-pill--warn {
  background: #FEF3C7;
  color: #B45309;
  border-color: #FDE68A;
}

.stage-pill--muted {
  background: #F3F4F6;
  color: #6B7280;
}

.template-list,
.settings-list,
.map-list {
  display: grid;
  gap: 0.45rem;
}

.template-item,
.settings-list li,
.map-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.template-item strong,
.settings-list strong {
  display: block;
  font-size: 0.82rem;
}

.template-item span,
.settings-list span:not(.sla) {
  font-size: 0.7rem;
  color: var(--muted);
}

.map-item {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
}

.map-item code {
  font-size: 0.72rem;
  background: #F3F4F6;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.switch span::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s var(--ease);
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.settings-card--profile { grid-column: 1 / -1; scroll-margin-top: 1rem; }
.profile-form { display: grid; gap: 1rem; }
.profile-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #F9FAFB;
}
.profile-summary__avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 750;
}
.profile-summary > div { display: grid; gap: 0.1rem; }
.profile-summary strong { font-size: 0.88rem; }
.profile-summary span:not(.profile-summary__avatar) { color: var(--muted); font-size: 0.74rem; }
.profile-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.profile-form__footer p { color: var(--muted); font-size: 0.7rem; }

.profile-page { display: grid; gap: 1rem; max-width: 1180px; margin: 0 auto; }
.profile-page__intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0 0.25rem;
}
.profile-page__intro h2 { margin-top: 0.18rem; font-size: 1.28rem; }
.profile-page__intro p { margin-top: 0.25rem; color: var(--muted); font-size: 0.8rem; }
.profile-page__eyebrow { color: var(--primary); font-size: 0.65rem; font-weight: 750; letter-spacing: 0.09em; }
.profile-page__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); gap: 0.8rem; align-items: start; }
.profile-page__details,
.profile-security,
.profile-account-card { min-width: 0; padding: 1rem; }
.profile-page__side { display: grid; gap: 0.8rem; }
.profile-page .card__head { margin-bottom: 1rem; }
.profile-page .card__head h2 { font-size: 0.92rem; }
.profile-page .card__head p { margin-top: 0.18rem; color: var(--muted); font-size: 0.72rem; }
.profile-page .settings-form { gap: 0.9rem; }
.profile-password-form { display: grid; gap: 0.75rem; }
.profile-password-form__input { position: relative; display: flex; align-items: center; }
.profile-password-form__input input {
  width: 100%;
  height: 38px;
  padding: 0 3.5rem 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 500;
}
.profile-password-form__toggle {
  position: absolute;
  right: 0.55rem;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}
.profile-password-form__hint { margin-top: -0.5rem; color: var(--muted); font-size: 0.67rem; }
.profile-security__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}
.profile-security__icon svg { width: 18px; height: 18px; }
.profile-security__notice {
  margin-bottom: 0.9rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  background: #FFFBEB;
  color: #92400E;
  font-size: 0.69rem;
  line-height: 1.5;
}
.profile-password-form__feedback {
  padding: 0.65rem 0.7rem;
  border: 1px solid #FECACA;
  border-radius: 8px;
  background: #FEF2F2;
  color: #991B1B;
  font-size: 0.7rem;
  line-height: 1.5;
}
.profile-password-form__footer { display: flex; justify-content: flex-end; padding-top: 0.25rem; }
.profile-account-list { display: grid; gap: 0; margin: 0; }
.profile-account-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}
.profile-account-list dt { color: var(--muted); }
.profile-account-list dd { margin: 0; color: var(--ink-2); font-weight: 650; text-align: right; }

.create-modal {
  width: min(660px, calc(100vw - 2rem));
  max-width: none;
  max-height: min(88dvh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
}
.create-modal::backdrop { background: rgba(17, 24, 39, 0.48); backdrop-filter: blur(2px); }
.create-modal__form { display: grid; max-height: min(88dvh, 760px); grid-template-rows: auto minmax(0, 1fr) auto auto; }
.create-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.create-modal__header h2 { margin-top: 0.2rem; font-size: 1.05rem; }
.create-modal__header p { margin-top: 0.2rem; color: var(--muted); font-size: 0.73rem; }
.create-modal__eyebrow { color: var(--primary); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; }
.create-modal__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; padding: 1rem 1.25rem; overflow: auto; }
.create-modal__fields .field { min-width: 0; }
.create-modal__fields .field--wide { grid-column: 1 / -1; }
.create-modal__fields .field input,
.create-modal__fields .field select,
.create-modal__fields .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
}
.create-modal__fields .field textarea { min-height: 78px; resize: vertical; }
.create-modal__note { padding: 0 1.25rem 0.75rem; color: var(--muted); font-size: 0.67rem; }
.create-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border-top: 1px solid var(--line);
  background: #FAFAFB;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-2);
}

.field input,
.field select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.65rem;
  background: #fff;
  font-weight: 500;
}

@media (max-width: 1100px) {
  .visits-layout,
  .auto-layout,
  .erp-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .profile-page__grid { grid-template-columns: 1fr; }
  .profile-page__side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .settings-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .profile-page__intro { align-items: flex-start; flex-direction: column; }
  .profile-page__side { grid-template-columns: 1fr; }
  .profile-page__details,
  .profile-security,
  .profile-account-card { padding: 0.85rem; }
  .profile-page .settings-form { grid-template-columns: 1fr; }
  .create-modal { width: calc(100vw - 1rem); max-height: 92dvh; border-radius: 12px; }
  .create-modal__form { max-height: 92dvh; }
  .create-modal__header { padding: 0.9rem; }
  .create-modal__fields { grid-template-columns: 1fr; gap: 0.7rem; padding: 0.85rem 0.9rem; }
  .create-modal__fields .field--wide { grid-column: auto; }
  .create-modal__note { padding: 0 0.9rem 0.65rem; }
  .create-modal__footer { padding: 0.7rem 0.9rem; }
  .record-drawer--full { width: 100vw; }
  .lead-detail--full .lead-detail__layout { grid-template-columns: 1fr; }
  .lead-detail__task-form { grid-template-columns: 1fr 1fr; }
  .lead-detail__task-form .btn { grid-column: 1 / -1; justify-self: end; }
  .profile-form__footer { align-items: flex-start; flex-direction: column; }
  .profile-form__footer .btn { align-self: flex-end; }
}

.kanban-col__body.is-drop {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: #FCF8ED;
}

.settings-page { display: grid; gap: 1rem; }
.topbar--settings .topbar__titles { display: none; }
.settings-heading { display: grid; gap: 0.3rem; }
.settings-heading h2,
.settings-record-heading h2 { margin: 0; font-size: 1.08rem; }
.settings-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; color: var(--muted); font-size: 0.72rem; }
.settings-breadcrumb a { color: var(--primary); text-decoration: none; }
.settings-breadcrumb strong { color: var(--ink); font-weight: 600; }
.settings-category { display: grid; gap: 0.35rem; }
.settings-category__heading h3 { margin: 0; font-size: 0.78rem; font-weight: 650; }
.settings-category__heading p { margin: 0; color: var(--muted); font-size: 0.68rem; }
.settings-category__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.15rem 0.55rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.settings-tile {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: 7px;
  color: inherit;
  text-decoration: none;
  transition: background 0.16s ease, transform 0.16s ease;
}
.settings-tile:hover { background: #F7F9FC; transform: translateY(-1px); }
.settings-tile__icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 7px;
  background: #F1F3F6;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}
.settings-tile__copy { display: grid; min-width: 0; gap: 0.12rem; }
.settings-tile__copy strong { color: var(--ink); font-size: 0.72rem; font-weight: 650; }
.settings-tile__copy small { color: var(--muted); font-size: 0.59rem; line-height: 1.35; }
.settings-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
}
.settings-record-heading > div { display: grid; gap: 0.45rem; }
.settings-record-heading .btn { flex: 0 0 auto; }
.settings-list-card { overflow: hidden; }
.settings-list-toolbar {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.settings-search {
  display: flex;
  width: min(230px, 42vw);
  height: 36px;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.settings-search svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); }
.settings-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 0.76rem; }
.settings-list-toolbar__page { display: flex; align-items: center; gap: 0.45rem; margin-left: auto; color: var(--muted); font-size: 0.7rem; }
.settings-list-toolbar__page select { height: 32px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
.settings-list-toolbar__page button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--ink-2); font-size: 1.25rem; }
.settings-list-toolbar__page button:disabled { color: #B8C0CA; }
.settings-record-table { min-width: 680px; }
.settings-record-table th { background: #F9FAFB; font-weight: 550; }
.settings-record-table__actions { white-space: nowrap; text-align: right; }
.settings-record-table__actions a,
.settings-record-table__actions button { display: inline-grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--ink-2); cursor: pointer; }
.settings-record-table__actions a:hover,
.settings-record-table__actions button:hover { background: #F1F3F6; color: var(--primary); }
.settings-record-table__actions svg { width: 17px; height: 17px; }
.settings-record-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 360px); align-items: start; gap: 0.75rem; }
.settings-record-form__main { min-width: 0; }
.settings-permissions-card { min-height: 430px; padding: 0.9rem; }
.settings-permission-type { display: grid; gap: 0.4rem; }
.settings-permission-type b,
.settings-general-card b { color: #B42318; }
.permission-tree { display: grid; gap: 0.05rem; padding: 0.45rem 0.15rem; }
.permission-tree__module { padding: 0.05rem 0; }
.permission-tree__module summary { display: flex; min-height: 32px; align-items: center; gap: 0.55rem; list-style: none; cursor: pointer; }
.permission-tree__module summary::-webkit-details-marker { display: none; }
.permission-tree__module summary::before { width: 12px; color: var(--muted); content: "›"; font-size: 1rem; }
.permission-tree__module[open] summary::before { content: "⌄"; }
.permission-tree__module summary strong { flex: 1; font-size: 0.78rem; font-weight: 550; }
.permission-tree__folder,
.permission-tree__file { width: 16px; height: 13px; border: 1.5px solid var(--primary); border-radius: 3px; }
.permission-tree__folder { position: relative; }
.permission-tree__folder::before { position: absolute; top: -4px; left: 1px; width: 7px; height: 3px; border: 1.4px solid var(--primary); border-bottom: 0; border-radius: 2px 2px 0 0; content: ""; }
.permission-tree__children { display: grid; gap: 0.05rem; padding-left: 2rem; }
.permission-tree__item { display: flex; min-height: 31px; align-items: center; gap: 0.55rem; color: var(--ink-2); font-size: 0.75rem; }
.permission-tree__item input,
.permission-tree__module summary input { width: 15px; height: 15px; accent-color: var(--primary); }
.permission-tree__file { width: 13px; height: 15px; border-radius: 2px; }
.settings-general-card { display: grid; gap: 0.8rem; padding: 0.9rem; }
.settings-general-card .card__head { margin: -0.15rem 0 0.1rem; padding: 0; border: 0; }
.settings-general-card .card__head h3 { margin: 0; font-size: 0.88rem; }
.settings-general-card .card__head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.68rem; }
.settings-general-card .field { display: grid; gap: 0.35rem; }
.settings-form-section { padding: 0.25rem; }
.settings-form-section h3 { margin: 0 0 0.3rem; font-size: 0.9rem; }
.settings-form-section > p { margin: 0 0 1rem; color: var(--muted); font-size: 0.74rem; }
.settings-form--single { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .settings-category__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-record-form { grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); }
}
@media (max-width: 760px) {
  .settings-category__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-record-form { grid-template-columns: 1fr; }
  .settings-record-heading { align-items: flex-start; }
  .settings-record-heading .btn { padding: 0.5rem 0.65rem; font-size: 0.7rem; }
  .settings-list-toolbar { flex-wrap: wrap; }
  .settings-list-toolbar__page { width: 100%; justify-content: flex-end; }
}
@media (max-width: 480px) {
  .settings-category__grid { grid-template-columns: 1fr; }
  .settings-form--single { grid-template-columns: 1fr; }
  .settings-record-heading { flex-direction: column; }
  .settings-record-heading .btn { align-self: flex-end; }
}

.zaris-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 650;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.zaris-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.journey-strip { margin-top: 0.15rem; }
.journey-pills {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}
.journey-pill {
  padding: 0.7rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #F8FAFC;
  text-align: center;
}
.journey-pill__num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 750;
  margin-bottom: 0.35rem;
}
.journey-pill strong {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}
.journey-pill small {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .journey-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Sign in ---- */

.login-page {
  min-height: 100vh;
  height: auto;
  overflow: auto;
  background: #fff;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(440px, 0.96fr);
  min-height: 100vh;
}

.login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem) clamp(2rem, 6vw, 6.25rem);
  background:
    radial-gradient(ellipse at 12% 92%, rgba(216, 182, 106, 0.2), transparent 34%),
    linear-gradient(145deg, #202B3D 0%, #28364B 52%, #5B0A3D 100%);
  color: #fff;
}

.login-brand,
.login-mobile-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  width: fit-content;
}

.login-brand__mark {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  background: #5B0A3D;
  box-shadow: 0 0 0 2px rgba(216, 182, 106, 0.5);
}

.login-brand > span:last-child,
.login-mobile-brand > span:last-child {
  display: grid;
  gap: 0.05rem;
}
.login-brand strong,
.login-mobile-brand strong {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.login-brand small,
.login-mobile-brand small {
  font-size: 0.68rem;
  opacity: 0.72;
}

.login-brand-panel__content {
  position: relative;
  z-index: 1;
  width: min(100%, 590px);
  margin: auto;
  padding: 3.5rem 0 2.25rem;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #F2E0B5;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.login-eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(216, 182, 106, 0.16);
}

.login-brand-panel h1 {
  max-width: 540px;
  margin-top: 1.2rem;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.08;
}
.login-brand-panel h1 em {
  color: var(--accent);
  font-style: normal;
}
.login-brand-panel__content > p {
  max-width: 445px;
  margin-top: 1rem;
  color: rgba(236, 253, 250, 0.76);
  font-size: 0.94rem;
  line-height: 1.7;
}

.login-preview {
  position: relative;
  margin-top: 2rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(250, 255, 254, 0.97);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(5, 25, 27, 0.24);
  transform: perspective(1000px) rotateY(-2deg);
}
.login-preview__top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #E8EFED;
}
.login-preview__dots { display: flex; gap: 3px; }
.login-preview__dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #C6D4D0;
}
.login-preview__caption { flex: 1; font-size: 0.65rem; font-weight: 700; }
.login-preview__period { color: var(--muted); font-size: 0.58rem; }
.login-preview__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  padding: 0.85rem 0 0.75rem;
}
.login-preview__metrics > div {
  display: grid;
  gap: 0.17rem;
  padding: 0.55rem;
  border: 1px solid #E8EFED;
  border-radius: 8px;
}
.login-preview__metrics span { color: var(--muted); font-size: 0.56rem; }
.login-preview__metrics strong { font-size: 1.1rem; letter-spacing: -0.04em; }
.login-preview__metrics i { color: var(--success); font-size: 0.55rem; font-style: normal; font-weight: 650; }
.login-preview__chart {
  padding: 0.7rem 0.65rem 0.45rem;
  border: 1px solid #E8EFED;
  border-radius: 8px;
}
.login-preview__chart-label,
.login-preview__months {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.55rem;
}
.login-preview__chart-label span:first-child { color: var(--ink-2); font-weight: 700; }
.login-preview__bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  height: 72px;
  margin-top: 0.45rem;
  padding: 0 0.15rem;
  border-bottom: 1px solid #E8EFED;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 23px, #EDF2F0 24px);
}
.login-preview__bars i {
  width: 5.5%;
  height: var(--bar);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}
.login-preview__months { padding-top: 0.35rem; }
.login-preview__note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.7rem;
}
.login-preview__note > span:first-child {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
}
.login-preview__note > span:last-child { display: grid; gap: 0.06rem; }
.login-preview__note strong { font-size: 0.62rem; }
.login-preview__note small { color: var(--muted); font-size: 0.55rem; }

.login-brand-panel__footer {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.68rem;
}
.login-orbit {
  position: absolute;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  pointer-events: none;
}
.login-orbit--one { top: -225px; right: -210px; }
.login-orbit--two { top: -175px; right: -160px; }

.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 3rem clamp(2rem, 6vw, 6.5rem);
  background: #fff;
}
.login-form-wrap {
  width: min(100%, 410px);
  margin: auto;
}
.login-mobile-brand { display: none; }
.login-welcome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.05rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}
.login-welcome__icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--primary-soft);
}
.login-welcome__icon svg { width: 15px; height: 15px; }
.login-form-panel h2 {
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}
.login-subtitle {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.login-form {
  display: grid;
  gap: 1.05rem;
  margin-top: 2rem;
}
.login-field {
  display: grid;
  gap: 0.45rem;
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 650;
}
.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  height: 47px;
  padding: 0 0.8rem;
  border: 1px solid #DDE4E2;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 10, 61, 0.1);
}
.login-input-wrap > svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #8A9894;
}
.login-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.8rem;
}
.login-input-wrap input::placeholder { color: #A0AAA7; }
.login-password-toggle {
  padding: 0.3rem 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.login-form__options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: -0.15rem;
}
.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: 0.71rem;
  cursor: pointer;
}
.login-remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}
.login-forgot {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.71rem;
  font-weight: 650;
  cursor: pointer;
}
.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 47px;
  margin-top: 0.2rem;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(100deg, #5B0A3D, #792052);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(91, 10, 61, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.login-submit:hover {
  background: linear-gradient(100deg, #4B082F, #5B0A3D);
  box-shadow: 0 7px 16px rgba(91, 10, 61, 0.24);
  transform: translateY(-1px);
}
.login-submit svg { width: 16px; height: 16px; }
.login-feedback {
  padding: 0.7rem 0.75rem;
  border: 1px solid #E8CAD9;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.73rem;
}
.login-feedback[hidden] { display: none; }
.login-feedback.is-error {
  border-color: #FECACA;
  background: #FEF2F2;
  color: #991B1B;
}
.login-security-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.65rem;
  padding: 0.8rem;
  border: 1px solid #E8EFED;
  border-radius: 8px;
  background: #F9FBFA;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}
.login-security-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--primary);
}
.login-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(100%, 560px);
  margin: 2rem auto 0;
  color: #929C99;
  font-size: 0.63rem;
}

@media (max-width: 1050px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(390px, 0.9fr); }
  .login-brand-panel { padding-right: 2.25rem; padding-left: 2.25rem; }
  .login-form-panel { padding-right: 2.25rem; padding-left: 2.25rem; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel {
    min-height: 0;
    padding: 1.25rem 1.5rem 1.5rem;
  }
  .login-brand-panel > .login-brand,
  .login-brand-panel__footer,
  .login-preview,
  .login-orbit { display: none; }
  .login-brand-panel__content {
    width: min(100%, 560px);
    margin: 0 auto;
    padding: 0;
  }
  .login-brand-panel h1 { margin-top: 0.75rem; font-size: 1.7rem; }
  .login-brand-panel__content > p { margin-top: 0.45rem; font-size: 0.78rem; }
  .login-form-panel { min-height: 0; padding: 2rem 1.5rem; }
  .login-form-wrap { width: min(100%, 460px); }
  .login-mobile-brand { display: inline-flex; margin-bottom: 2rem; }
  .login-mobile-brand strong { color: var(--ink); }
  .login-mobile-brand small { color: var(--muted); opacity: 1; }
}

@media (max-width: 480px) {
  .login-brand-panel { padding: 1rem 1.1rem 1.2rem; }
  .login-form-panel { padding: 1.5rem 1.1rem; }
  .login-mobile-brand { margin-bottom: 1.5rem; }
  .login-form { margin-top: 1.5rem; }
  .login-footer { flex-direction: column; margin-top: 1.5rem; }
}
