:root {
  --ink: #17212b;
  --muted: #657485;
  --line: #d9e0e7;
  --panel: #ffffff;
  --bg: #f5f7fa;
  --nav: #10202a;
  --nav-soft: #1b3341;
  --teal: #087f8c;
  --green: #25835d;
  --amber: #b36b00;
  --red: #b63f43;
  --blue: #2f65a7;
  --violet: #7751a8;
  --shadow: 0 10px 30px rgba(21, 34, 45, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

body.auth-locked {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  background: var(--nav);
  color: #f8fbfd;
  padding: 22px 18px;
  overflow-y: auto;
  z-index: 20;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f2b84b;
  color: #18232b;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.auth-panel h2,
.auth-copy,
.auth-error {
  margin: 0;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: #eef3f7;
  padding: 20px;
  z-index: 100;
}

.auth-locked .auth-screen {
  display: grid;
}

.auth-panel {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form.hidden {
  display: none;
}

.auth-form h2 {
  font-size: 26px;
}

.auth-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  color: #aab8c4;
  font-size: 13px;
  margin-top: 2px;
}

.profile-switcher {
  padding: 14px;
  background: var(--nav-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 18px;
}

.profile-switcher label {
  display: block;
  font-size: 12px;
  color: #b9c8d2;
  margin-bottom: 8px;
}

.profile-switcher select,
.search input,
.filter-row select,
.filter-row input,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.profile-switcher select {
  background: #f8fbfd;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  color: #d8e4eb;
  background: transparent;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: #244554;
}

.nav span {
  width: 22px;
  text-align: center;
}

.shell {
  margin-left: 280px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(245, 247, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 16px 26px;
}

.eyebrow {
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.topbar h2 {
  font-size: 24px;
}

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

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(340px, 38vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
}

.search input {
  border: 0;
  padding-left: 0;
}

.content {
  padding: 24px 26px 36px;
}

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

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

.two-col {
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  align-items: start;
}

.three-col {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.card,
.table-wrap,
.work-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 17px;
}

.add-lead-card {
  margin-bottom: 16px;
}

.add-lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.student-lookup {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.lookup-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
}

.lookup-hit h4 {
  margin: 12px 0 6px;
  font-size: 18px;
}

.lookup-hit p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.lookup-courses {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.lookup-courses > strong {
  display: block;
  margin-bottom: 8px;
}

.lookup-courses ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lookup-courses li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
  padding: 10px;
}

.lookup-courses li strong,
.lookup-courses li span {
  display: block;
}

.lookup-courses li span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 112px;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.metric span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
}

.metric:nth-child(2) span {
  background: var(--blue);
}

.metric:nth-child(3) span {
  background: var(--green);
}

.metric:nth-child(4) span {
  background: var(--amber);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 2px 0;
}

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

.pagination-actions select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 800;
}

.pagination-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-row button,
.link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.tab-row button {
  padding: 10px 14px;
}

.tab-row button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.link-button {
  padding: 8px 10px;
  text-align: left;
  max-width: 240px;
}

.link-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfd;
}

td {
  font-size: 14px;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status small {
  display: block;
  width: 100%;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1;
  opacity: 0.85;
}

.status.status-detail {
  flex-direction: column;
  align-items: flex-start;
  border-radius: 8px;
  line-height: 1.1;
}

.status.new {
  color: #245476;
  background: #e5f0f9;
}

.status.hot {
  color: #8d3b00;
  background: #fff0d9;
}

.status.won {
  color: #176244;
  background: #def4e9;
}

.status.lost {
  color: #933437;
  background: #fde5e5;
}

.status.follow {
  color: #62468d;
  background: #eee7fa;
}

.tag {
  color: #374657;
  background: #eef2f6;
}

.phone-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.phone-link:hover {
  color: var(--teal);
}

.tag.phone-link {
  display: inline-flex;
}

code,
pre {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.code-block {
  display: block;
  width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #21313f;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.priority-high {
  color: var(--red);
  font-weight: 800;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--teal);
}

.ghost-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

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

.icon-button {
  width: 42px;
  padding: 0;
  display: none;
  background: #fff;
  border-color: var(--line);
}

.work-panel {
  padding: 18px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.queue-panel {
  min-width: 0;
}

.workspace-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.workspace-summary div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: var(--shadow);
}

.workspace-summary strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.workspace-summary span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workspace-title {
  margin-top: 0;
}

.lead-focus {
  display: grid;
  gap: 12px;
}

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

.lead-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.lead-head p,
.timeline p,
.mini-stat p {
  margin: 0;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.call-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.call-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
  text-decoration: none;
}

.call-form {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.call-form h3 {
  margin: 0;
  font-size: 18px;
}

.call-form p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.call-update-grid {
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
}

.check-field input {
  width: 18px;
  height: 18px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-card {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.timeline-item {
  border-left: 3px solid var(--teal);
  padding-left: 11px;
  background: #fbfcfd;
  border-radius: 0 8px 8px 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

.timeline-item strong {
  display: block;
  margin-bottom: 3px;
}

.timeline-item time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.mini-stat {
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.mini-stat strong {
  display: block;
  font-size: 21px;
  margin-bottom: 3px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workspace-pipeline {
  grid-template-columns: repeat(6, minmax(190px, 1fr));
}

.stage {
  min-height: 340px;
  max-height: calc(100vh - 310px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stage h4 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 12px;
}

.lead-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfcfd;
  cursor: pointer;
}

.lead-card:hover {
  border-color: var(--teal);
  background: #fff;
}

.lead-card strong {
  display: block;
  margin-bottom: 5px;
}

.lead-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 86px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5df;
  position: relative;
  flex: 0 0 auto;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s;
}

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

.import-form input[type="file"] {
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 22, 30, 0.48);
  z-index: 120;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, 86vh);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.toggle.on {
  background: var(--green);
}

.toggle.on::after {
  left: 23px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 60;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 96px;
  color: var(--muted);
  background: #f7f9fb;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  font-weight: 700;
}

.mobile-scrim {
  display: none;
}

@media (max-width: 1180px) {
  .metrics,
  .three-col,
  .two-col,
  .workspace-shell,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-row {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .mobile-scrim.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 20, 0.5);
    z-index: 15;
  }

  .shell {
    margin-left: 0;
  }

  .topbar {
    align-items: flex-start;
    padding: 14px;
  }

  .menu-button {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search {
    width: 100%;
  }

  .content {
    padding: 16px 14px 28px;
  }

  .metrics,
  .three-col,
  .two-col,
  .workspace-shell,
  .workspace-summary,
  .add-lead-layout,
  .permission-grid,
  .form-grid,
  .filter-row {
    grid-template-columns: 1fr;
  }

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

  .stage {
    max-height: none;
  }

  .topbar {
    display: grid;
    grid-template-columns: 42px 1fr;
  }

  .top-actions {
    grid-column: 1 / -1;
  }
}
