/* Country Club Collective — client portal (matches countryclubcollective.com) */

:root {
  --navy-900: #141f33;
  --navy-800: #1a2740;
  --navy-700: #22324f;
  --gold: #a8875a;
  --gold-light: #c4a678;
  --cream: #f4f1ea;
  --ivory: #faf8f3;
  --ink: #1a2740;
  --muted: #5c6577;
  --line: #e4ded2;
  --danger: #9b2c2c;
  --success: #2f6b4f;

  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --max: 1100px;
  --gutter: clamp(16px, 4vw, 48px);
}

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ivory);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

h1 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.5rem;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.75rem;
}

.rule { width: 80px; height: 1px; background: var(--gold); border: 0; margin: 1.25rem auto 2rem; }
.muted { color: var(--muted); }
.d-block { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn--gold { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.btn--gold:hover { background: var(--navy-800); border-color: var(--navy-800); color: var(--cream); }
.btn--outline { background: transparent; border-color: var(--gold); color: inherit; }
.btn--outline:hover { background: var(--gold); color: var(--navy-900); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.68rem; }
.btn--block { width: 100%; }

/* ---------- Header / footer ---------- */

.site-header {
  background: var(--navy-800);
  color: var(--cream);
  border-bottom: 1px solid rgba(168, 135, 90, 0.5);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 76px; }

.brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: var(--cream); min-width: 0; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand span { font-size: 0.85rem; letter-spacing: 0.25em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-menu__name { text-align: right; font-size: 0.9rem; line-height: 1.3; }
.user-menu__name small { display: block; font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-light); }

.page { flex: 1; padding: clamp(2rem, 5vw, 3.5rem) 0 4rem; }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; font-size: 0.8rem; color: var(--muted); }

@media (max-width: 640px) {
  .brand span { display: none; }
  .user-menu__name { font-size: 0.8rem; }
}

/* ---------- Login ---------- */

.login-page {
  background:
    radial-gradient(ellipse at top, rgba(168, 135, 90, 0.18), transparent 60%),
    linear-gradient(160deg, var(--navy-700) 0%, var(--navy-800) 45%, var(--navy-900) 100%);
  color: var(--cream);
}

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 16px;
}

.login__card {
  width: 100%;
  max-width: 420px;
  background: var(--ivory);
  color: var(--ink);
  border-top: 3px solid var(--gold);
  padding: clamp(2rem, 6vw, 3rem);
  text-align: center;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
}

.login__brand { display: inline-flex; flex-direction: column; align-items: center; gap: 0.75rem; text-decoration: none; margin-bottom: 2rem; }
.login__brand img {
  width: 64px; height: 64px;
  background: var(--navy-800);
  border-radius: 50%;
  padding: 10px;
}
.login__brand span { font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--navy-800); }

.login .form { text-align: left; }
.login__help { font-size: 0.82rem; color: var(--muted); margin: 1.75rem 0 0; }
.login__intro { font-size: 0.92rem; color: var(--muted); margin: 0 0 1.5rem; }
.login .alert { text-align: left; }
.login__back { margin-top: 2rem; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--gold-light); text-decoration: none; }
.login__back:hover { color: var(--cream); }

/* ---------- Forms ---------- */

.form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.4rem; align-content: start; }
.field label, .roles legend {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .filters input, .filters select {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(168, 135, 90, 0.2);
}
.field__hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.field__link { font-size: 0.8rem; color: var(--gold); text-decoration: none; }
.field__link:hover { color: var(--navy-800); text-decoration: underline; }
.field__error { margin: 0; font-size: 0.82rem; color: var(--danger); }

.checkbox { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--gold); }

.form-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.roles { border: 0; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.roles legend { margin-bottom: 0.6rem; }
.role-option {
  display: flex; gap: 0.8rem; align-items: flex-start;
  border: 1px solid var(--line); background: #fff;
  padding: 0.9rem 1rem; cursor: pointer;
}
.role-option:has(input:checked) { border-color: var(--gold); background: rgba(196, 166, 120, 0.08); }
.role-option input { margin-top: 0.25rem; accent-color: var(--gold); }
.role-option small { display: block; color: var(--muted); }

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; flex-wrap: wrap; }

.panel { background: #fff; border: 1px solid var(--line); padding: clamp(1.25rem, 4vw, 2rem); }
.panel .field input, .panel .role-option { background: var(--ivory); }

.danger-zone {
  margin-top: 2rem;
  border: 1px solid rgba(155, 44, 44, 0.3);
  padding: 1.25rem clamp(1.25rem, 4vw, 2rem);
  display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.danger-zone p { margin: 0.25rem 0 0; font-size: 0.85rem; }

.alert { padding: 0.8rem 1rem; font-size: 0.9rem; border-left: 3px solid; margin-bottom: 1.5rem; }
.form .alert { margin: 0; }
.alert--error { background: rgba(155, 44, 44, 0.08); border-color: var(--danger); color: var(--danger); }
.alert--success { background: rgba(47, 107, 79, 0.08); border-color: var(--success); color: var(--success); }

/* ---------- Dashboard ---------- */

.crumbs { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.5rem; }
.crumbs a { color: var(--gold); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.page-head { margin-bottom: 2rem; }
.page-head--split { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.lede { color: var(--muted); margin: 0; }

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

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
}

.app-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.app-card:hover, .app-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px -24px rgba(20, 31, 51, 0.45);
  outline: none;
}
.app-card__icon {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--navy-800);
  color: var(--gold-light);
}
.app-card__icon svg { width: 22px; height: 22px; }
.app-card__body { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.app-card__title { font-family: var(--serif); font-size: 1rem; line-height: 1.3; }
.app-card__desc { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.app-card .badge {
  position: absolute;
  top: -0.7rem;
  right: 0.9rem;
  background: var(--ivory);
  font-size: 0.58rem;
  padding: 0.15rem 0.5rem;
}

.badge, .pill {
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  white-space: nowrap;
}
.pill--admin { background: var(--navy-800); border-color: var(--navy-800); color: var(--cream); }
.pill--agent { background: var(--gold); color: var(--navy-900); }

.empty { text-align: center; background: #fff; border: 1px dashed var(--gold); padding: 3rem 1.5rem; }
.empty__title { font-family: var(--serif); font-size: 1.4rem; margin: 0; }

/* ---------- Accounts table ---------- */

.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filters input { flex: 1 1 240px; width: auto; }
.filters select { flex: 0 1 180px; width: auto; }

.table-wrap { background: #fff; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; font-weight: 500;
  font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); padding: 0.9rem 1rem; border-bottom: 1px solid var(--line);
}
.table td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table__actions { text-align: right; }
.table__actions a { color: var(--gold); font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; text-decoration: none; }

@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 0.2rem 0; display: flex; justify-content: space-between; gap: 1rem; }
  .table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.68rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted);
  }
  .table td[data-label="Name"] { display: block; font-family: var(--serif); font-size: 1.05rem; }
  .table td[data-label="Name"]::before { content: none; }
  .table__actions { text-align: left; padding-top: 0.5rem !important; }
}

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; font-size: 0.85rem; }
.pager a { color: var(--gold); text-decoration: none; }
