/* ============================================================
   Wheeler CRM — login + dashboard
   ============================================================ */

:root {
  --navy-900: #061a32;
  --navy-800: #0a2342;
  --navy-700: #12355b;
  --burgundy: #8e1b2c;
  --burgundy-dark: #701323;
  --burgundy-soft: rgba(142, 27, 44, 0.1);
  --white: #ffffff;
  --off: #f5f7fb;
  --ink: #0f1b2d;
  --muted: #5b6b80;
  --line: #dde4ee;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-logo: "Pacifico", "Segoe Script", cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--off);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
}

/* ------------------------------ Buttons ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, transform 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--navy {
  background: var(--navy-800);
  color: var(--white);
}

.btn--navy:hover {
  background: var(--burgundy);
}

.btn--burgundy {
  background: var(--burgundy);
  color: var(--white);
}

.btn--burgundy:hover {
  background: var(--burgundy-dark);
}

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
}

.btn--ghost:hover {
  background: var(--white);
  color: var(--navy-800);
}

/* ------------------------------ Brand ------------------------------ */
.crm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-family: var(--font-logo);
  font-size: 30px;
  line-height: 1;
}

.crm-brand span {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px 4px;
  border-radius: 7px;
  background: var(--burgundy);
  color: var(--white);
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.crm-brand--dark {
  color: var(--navy-800);
}

/* ------------------------------ Login ------------------------------ */
.login-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
  background:
    linear-gradient(120deg, rgba(6, 26, 50, 0.96) 0%, rgba(6, 26, 50, 0.78) 55%, rgba(6, 26, 50, 0.45) 100%),
    var(--navy-900) url("/assets/hero.jpg") center 40% / cover no-repeat;
}

.login-body::after {
  content: "";
  position: fixed;
  left: -140px;
  bottom: -140px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142, 27, 44, 0.28) 0%, rgba(6, 26, 50, 0) 70%);
  pointer-events: none;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.login-card {
  padding: 42px 38px 34px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.7);
}

.login-card h1 {
  margin-top: 28px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy-800);
}

.login-sub {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.login-error {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(142, 27, 44, 0.3);
  border-radius: 10px;
  background: var(--burgundy-soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--burgundy);
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.login-form label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--navy-800);
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  border-color: var(--navy-700);
  box-shadow: 0 0 0 4px rgba(18, 53, 91, 0.12);
}

.login-form .btn {
  margin-top: 18px;
  padding: 15px 24px;
  font-size: 13px;
}

.login-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------ Topbar ------------------------------ */
.crm-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy-900);
  box-shadow: 0 12px 34px -22px rgba(0, 0, 0, 0.8);
}

.crm-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1360px;
  min-height: 76px;
  margin: 0 auto;
  padding: 12px 32px;
}

.crm-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-actions form {
  margin: 0;
}

.crm-sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
}

.crm-sync::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #43b581;
  box-shadow: 0 0 0 3px rgba(67, 181, 129, 0.18);
}

.crm-sync.is-error::before {
  background: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(142, 27, 44, 0.25);
}

.crm-sync.is-loading::before {
  background: #e0b64a;
  box-shadow: 0 0 0 3px rgba(224, 182, 74, 0.2);
}

/* ------------------------------ Page ------------------------------ */
.crm-page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 38px 32px 60px;
}

.crm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.crm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--burgundy);
}

.crm-eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--burgundy);
}

.crm-head h1 {
  margin-top: 12px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy-800);
}

.crm-sub {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.crm-head__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.crm-counter {
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(10, 35, 66, 0.07);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--navy-800);
  white-space: nowrap;
}

.crm-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 22px 60px -40px rgba(6, 26, 50, 0.45);
  overflow: hidden;
}

.crm-table-wrap {
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
}

.crm-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 15px 18px;
  background: var(--off);
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.crm-table tbody td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.5;
  vertical-align: top;
}

.crm-table tbody tr:last-child td {
  border-bottom: 0;
}

.crm-table tbody tr:hover {
  background: rgba(10, 35, 66, 0.025);
}

.crm-cell-date {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12.5px !important;
}

.crm-cell-name {
  font-weight: 800;
  color: var(--navy-800);
  white-space: nowrap;
}

.crm-cell-phone a {
  font-weight: 700;
  color: var(--navy-700);
  white-space: nowrap;
}

.crm-cell-phone a:hover {
  color: var(--burgundy);
}

.crm-cell-comment {
  max-width: 340px;
  min-width: 220px;
  color: var(--muted);
}

.crm-cell-comment span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------ Manager select ------------------------------ */
.manager-select {
  width: 100%;
  min-width: 150px;
  padding: 9px 30px 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%230A2342' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.manager-select:hover {
  border-color: rgba(18, 53, 91, 0.35);
}

.manager-select:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(18, 53, 91, 0.12);
}

.manager-select.is-assigned {
  border-color: rgba(142, 27, 44, 0.45);
  background-color: rgba(142, 27, 44, 0.05);
  color: var(--burgundy);
  font-weight: 800;
}

.manager-select:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ------------------------------ Empty / hint ------------------------------ */
.crm-empty {
  padding: 64px 24px;
  text-align: center;
}

.crm-empty p:first-child {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-800);
}

.crm-empty p:last-child {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--muted);
}

.crm-hint {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ------------------------------ Responsive ------------------------------ */
@media (max-width: 760px) {
  .crm-topbar__inner {
    flex-wrap: wrap;
    padding: 14px 18px;
  }

  .crm-sync {
    display: none;
  }

  .crm-actions {
    gap: 8px;
  }

  .crm-page {
    padding: 26px 16px 44px;
  }

  .crm-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .crm-head__right {
    width: 100%;
    justify-content: space-between;
  }

  .btn {
    padding: 10px 16px;
    font-size: 11px;
  }

  .login-card {
    padding: 34px 24px 26px;
  }
}
