/* ============================================================
   Beyond Agent Portal — styles
   Brand: Beyond Sales Group
   Palette: cream #f4f3f2, navy #09205b, periwinkle #6f96d1,
            pale blue #d0e4fe
   Fonts: Cormorant Garamond (display, closest to "Jun"),
          Montserrat (body)
   ============================================================ */

:root {
  --cream: #f4f3f2;
  --navy: #09205b;
  --navy-deep: #071a4d;
  --peri: #6f96d1;
  --peri-dark: #547cb8;
  --pale: #d0e4fe;
  --card: #ffffff;
  --text: #232a45;
  --muted: #6b7280;
  --border: #e2e5ec;
  --danger: #c0392b;
  --radius: 10px;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, .sidebar-brand span {
  font-family: var(--font-display);
  color: var(--navy);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); font-size: 0.9rem; }

/* ---------- Login ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(600px 400px at 15% 20%, var(--pale), transparent 60%),
    radial-gradient(700px 500px at 85% 80%, #e8eefb, transparent 60%),
    var(--cream);
}
.login-card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(9, 32, 91, 0.14);
  text-align: center;
  border-top: 4px solid var(--navy);
}
.login-card h1 { margin: 0.75rem 0 0.25rem; font-size: 1.9rem; }
.login-card form { text-align: left; margin-top: 1.25rem; }

.login-logo {
  display: block;
  width: 220px;
  max-width: 80%;
  height: auto;
  margin: 0 auto;
}

/* ---------- App shell ---------- */
.app-view { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
  color: #e8eaf0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-brand span {
  font-size: 1.45rem;
  color: #fff;
}
.sidebar-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--cream);
  flex-shrink: 0;
}
.nav { display: flex; flex-direction: column; padding: 0.75rem; gap: 0.25rem; flex: 1; }
.nav-btn {
  background: none; border: none; cursor: pointer;
  color: #c9cede; text-align: left;
  padding: 0.7rem 0.9rem; border-radius: 8px;
  font-size: 0.95rem; font-family: var(--font-body);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-btn.active { background: var(--peri); color: #fff; font-weight: 600; }

.sidebar-user { padding: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.user-name { font-weight: 600; color: #fff; }
.user-role { font-size: 0.8rem; text-transform: capitalize; margin-bottom: 0.6rem; }

.main { flex: 1; padding: 2rem; max-width: 1100px; }
.main h2 { margin-top: 0; font-size: 1.9rem; }
.tab-panel { animation: fadein 0.15s ease-in; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.section-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 0.2rem; }

/* ---------- Cards & stats ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(9, 32, 91, 0.06);
}
.card h3 { margin-top: 0; font-size: 1.35rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.25rem;
}
.stat-card { margin-bottom: 0; border-top: 3px solid var(--peri); }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 700; color: var(--navy);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.rank-1 { color: var(--peri-dark); font-weight: 800; }
.rank-1 td:first-child::before { content: "★ "; }
.status-badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; background: var(--pale); color: var(--navy);
}
.status-Client { background: #e6f4ea; color: #1e7e34; }
.status-Lost { background: #fdecea; color: var(--danger); }
.status-Quoted { background: #fff4d6; color: #8a6d00; }

.live-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #2ecc71; margin-left: 0.4rem;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0.3rem; color: var(--navy); }
input, select, textarea {
  width: 100%; padding: 0.65rem 0.75rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 1rem; font-family: var(--font-body); background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--peri);
  box-shadow: 0 0 0 3px rgba(111, 150, 209, 0.22);
}
textarea { resize: vertical; }
.form-card { max-width: 560px; }

.btn {
  display: inline-block; border: none; cursor: pointer;
  padding: 0.65rem 1.25rem; border-radius: 8px;
  font-size: 1rem; font-weight: 600; font-family: var(--font-body);
  background: var(--navy); color: #fff;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--peri), var(--peri-dark));
  color: #fff;
}
.btn-ghost { background: transparent; color: inherit; border: 1px solid rgba(128,128,128,.4); }
.btn-danger { background: var(--danger); color: #fff; padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; margin-top: 1rem; }
.sidebar .btn-ghost { border-color: rgba(255,255,255,.25); color: #e8eaf0; }

/* ---------- Videos ---------- */
.video-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.video-card { overflow: hidden; }
.video-card video { width: 100%; border-radius: 8px; background: var(--navy-deep); max-height: 220px; }
.video-card h4 { margin: 0.6rem 0 0.25rem; font-family: var(--font-display); font-size: 1.2rem; color: var(--navy); }
.video-card p { margin: 0.25rem 0; font-size: 0.9rem; }
.video-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border);
}
.video-row:last-child { border-bottom: none; }

/* ---------- Resources ---------- */
.resource-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-bottom: 0.5rem;
}
.resource-card { margin-bottom: 0; }
.resource-card h4 { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 1.25rem; color: var(--navy); }
.resource-card h4 a { color: inherit; text-decoration: none; }
.resource-card h4 a:hover { text-decoration: underline; }
.resource-card p { margin: 0.25rem 0 0.5rem; font-size: 0.9rem; }
.resource-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.category-head {
  margin: 1.75rem 0 0.75rem; font-size: 1.3rem; color: var(--navy);
  font-family: var(--font-display);
}
.category-head:first-child { margin-top: 0.5rem; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(9, 32, 91, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: #fff; border-radius: var(--radius);
  padding: 1.5rem; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  border-top: 4px solid var(--navy);
}
.modal-card h3 { margin-top: 0; font-size: 1.4rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  padding: 0.8rem 1.4rem; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(9,32,91,.35); z-index: 100;
  font-size: 0.95rem;
}
.toast.error { background: var(--danger); }

/* ---------- Responsive: sidebar becomes top bar ---------- */
@media (max-width: 760px) {
  .app-view { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: column;
  }
  .sidebar-brand { padding: 0.8rem 1rem; }
  .nav {
    flex-direction: row; overflow-x: auto;
    padding: 0.5rem; gap: 0.4rem;
  }
  .nav-btn { white-space: nowrap; padding: 0.55rem 0.8rem; }
  .sidebar-user {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1rem;
  }
  .sidebar-user .btn { margin: 0; width: auto; padding: 0.45rem 0.9rem; }
  .user-role { margin-bottom: 0; }
  .main { padding: 1rem; }
  .login-card { padding: 1.75rem; }
  .login-logo { width: 180px; }
}

/* ---------- Team dashboard: goal bar, spotlight, metric tabs, badges ---------- */
.goal-card { border-top: 4px solid var(--peri); }
.goal-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; flex-wrap: wrap;
}
.goal-head h3 { margin: 0; }
.goal-numbers {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700; color: var(--navy);
  white-space: nowrap;
}
.goal-bar {
  height: 18px; background: var(--pale); border-radius: 999px;
  overflow: hidden; margin: 0.9rem 0 0.4rem;
}
.goal-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--peri), var(--navy));
  border-radius: 999px; transition: width 0.6s ease;
}
.goal-card .small { margin-bottom: 0; }

.spotlight {
  background: linear-gradient(135deg, var(--navy), var(--peri-dark));
  border: none; text-align: center; color: #fff;
}
.spotlight .muted, .spotlight-kicker { color: #c9cede; }
.spotlight-kicker { letter-spacing: 0.12em; font-weight: 600; }
.spotlight-name {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700; color: #fff;
  margin: 0.25rem 0;
}
.spotlight-amount {
  font-family: var(--font-display);
  font-size: 2.6rem; font-weight: 700; color: #fff;
  line-height: 1.1;
}

.metric-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.metric-tab {
  border: 1px solid var(--border); background: #fff;
  border-radius: 999px; padding: 0.5rem 1.1rem;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  color: var(--navy); cursor: pointer;
}
.metric-tab:hover { border-color: var(--peri); }
.metric-tab.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}

.medal { font-size: 1.15rem; }
.badge-chip {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  background: #fff4d6; color: #8a6d00; border: 1px solid #eed88f;
  margin: 0.1rem 0.2rem 0.1rem 0;
}

/* ---------- Auth toggle + pending approval ---------- */
.auth-toggle { text-align: center; margin-top: 1rem; }
.auth-toggle a { color: var(--peri-dark); font-weight: 600; }

/* ---------- Agent hub (Start Here / Scripts / Carriers / Underwriting / Comp Plan / FAQ) ---------- */
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-bottom: 0.5rem;
}
.hub-card { margin-bottom: 0; }
.hub-card h4 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display); font-size: 1.25rem; color: var(--navy);
}
.hub-toggle {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 0; text-align: left;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  color: var(--navy);
}
.toggle-icon {
  font-family: var(--font-body); font-size: 1.5rem; font-weight: 400;
  color: var(--peri-dark); flex-shrink: 0; margin-left: 0.75rem;
}
.hub-body { padding-top: 0.5rem; }
.carrier-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.checklist { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.check-item {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.65rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; margin: 0;
  font-weight: 400; color: var(--text);
}
.check-item:hover { border-color: var(--peri); background: #fbfcff; }
.check-box {
  width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; padding: 0;
  flex-shrink: 0; accent-color: var(--peri-dark); cursor: pointer;
}
.check-item strong { color: var(--navy); }
.coming-soon {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  background: var(--pale); color: var(--navy);
  margin-left: 0.5rem; vertical-align: middle;
  font-family: var(--font-body);
}

/* ---------- CRM tab (tiers + licensed states) ---------- */
.tier-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem; margin-bottom: 0.5rem;
}
.tier-card { margin-bottom: 0; border-top: 3px solid var(--peri); }
.tier-featured { border-top-color: var(--navy); }
.tier-card h4 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display); font-size: 1.4rem; color: var(--navy);
}
.tier-price {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700; color: var(--navy);
  margin-bottom: 0.5rem;
}
.tier-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.tier-list li {
  position: relative; padding: 0.3rem 0 0.3rem 1.5rem;
  font-size: 0.95rem;
}
.tier-list li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--peri-dark); font-weight: 700;
}
.states-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem; margin: 0.75rem 0 1rem;
}
.state-check {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; margin: 0;
  font-weight: 400; font-size: 0.9rem; color: var(--text);
}
.state-check:hover { border-color: var(--peri); background: #fbfcff; }
.state-box {
  width: 1rem; height: 1rem; padding: 0; margin: 0;
  flex-shrink: 0; accent-color: var(--peri-dark); cursor: pointer;
}
