/* AHBS Client Portal — stylesheet
 *
 * This extends the exact design tokens from the public marketing site
 * (index.html) so the portal reads as the same product, not a bolted-on
 * tool. Palette, type pairing (Cormorant Garamond display / Outfit body),
 * button shapes, card treatment, and form-field styling are all pulled
 * directly from the site's :root variables and component classes
 * (.pcard, .contact-form-card, .form-group, .btn-gold) rather than
 * reinvented. The portal's own signature move: status badges and the
 * message thread use the site's gold/green accent pairing the same way
 * the marketing pages use it to mark "featured" or "highlighted" — so a
 * client moving from the public site into the portal never feels a seam.
 */

:root {
  --navy:#0A1628;--navy-mid:#112240;--navy-light:#1A3554;
  --green:#0B6E4F;--green-mid:#0D8A63;--green-light:#10A876;
  --gold:#C8913A;--gold-light:#E8B04E;--gold-pale:#F5DEB3;
  --cream:#F9F6EF;--white:#FFFFFF;
  --gray:#64748B;--gray-light:#94A3B8;--gray-ultra:#F1EDE4;
  --text:#1A1A2E;--border:rgba(200,145,58,0.18);
  --r-sm:8px;--r-md:14px;--r-lg:22px;--r-xl:32px;
  --shadow:0 4px 32px rgba(10,22,40,0.12);
  --shadow-lg:0 16px 64px rgba(10,22,40,0.18);
  --danger:#A8362A;--danger-bg:#FBEAE6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  background: var(--cream);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-mid); text-decoration: underline; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ── TOPBAR (portal equivalent of the site's <nav>) ── */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(10,22,40,0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(200,145,58,0.12);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 5%;
  height: 76px; display: flex; align-items: center; gap: 36px;
}
.brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px; font-weight: 700; color: var(--white); letter-spacing: 0.05em;
}
.brand span { color: var(--gold); }
.topnav { display: flex; align-items: center; gap: 6px; flex: 1; }
.topnav a {
  color: rgba(255,255,255,0.65); text-decoration: none;
  font-size: 13px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 8px 14px; border-radius: var(--r-sm); transition: all 0.2s;
}
.topnav a:hover { color: var(--gold); text-decoration: none; background: rgba(255,255,255,0.05); }
.topbar-user {
  display: flex; align-items: center; gap: 16px;
  font-size: 13px; color: rgba(255,255,255,0.55);
}
.link-button {
  background: none; border: none; color: rgba(255,255,255,0.55);
  font-size: 13px; font-family: inherit; cursor: pointer; padding: 0;
  letter-spacing: 0.03em; text-transform: uppercase; font-weight: 500;
}
.link-button:hover { color: var(--gold); text-decoration: underline; }
.inline-form { display: inline; }

/* ── LAYOUT ── */
.content { max-width: 1200px; margin: 0 auto; padding: 48px 5% 80px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.page-head h1 {
  font-family: 'Cormorant Garamond', serif; font-size: clamp(28px,3vw,40px);
  font-weight: 700; color: var(--navy); margin: 0; line-height: 1.1;
}
.page-head .sub { color: var(--gray); font-size: 14px; margin-top: 6px; max-width: 520px; }
.sub { color: var(--gray); font-size: 14px; }

.card {
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 18px; }
.card h3 {
  font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 700;
  color: var(--navy); margin: 0 0 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── STAT TILES (dark, echoing .pcard treatment) ── */
.stat-tile {
  background: var(--navy);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.stat-tile::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 80% 0%, rgba(200,145,58,0.14) 0%, transparent 70%);
  pointer-events: none;
}
.stat-tile .label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.5); position: relative;
}
.stat-tile .value {
  font-family: 'Cormorant Garamond', serif; font-size: 40px; font-weight: 700;
  color: var(--gold); margin-top: 8px; position: relative;
}
.stat-tile a { color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 600; position: relative; }
.stat-tile a:hover { color: var(--gold); }

/* ── FORMS (extends .form-group / .contact-form-card from the site) ── */
.field { margin-bottom: 20px; }
label {
  display: block; font-size: 12px; font-weight: 700; color: var(--navy);
  margin-bottom: 8px; letter-spacing: 0.04em; text-transform: uppercase;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], textarea, select {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: var(--r-sm);
  font-family: 'Outfit', sans-serif; font-size: 14px; color: var(--navy);
  background: var(--cream); outline: none; transition: border-color 0.2s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); }
textarea { resize: vertical; min-height: 100px; }

/* ── BUTTONS (matches site's .btn system) ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 26px; border-radius: var(--r-sm);
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.25s; border: none; text-decoration: none;
  letter-spacing: 0.02em; background: var(--gold); color: var(--navy);
}
.btn:hover { background: var(--gold-light); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(200,145,58,0.3); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--navy); border: 1.5px solid rgba(0,0,0,0.1); }
.btn-secondary:hover { background: var(--cream); transform: none; box-shadow: none; }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { background: var(--green-mid); }

/* ── ALERTS ── */
.error-banner {
  background: var(--danger-bg); border: 1px solid #E7B3A3; color: var(--danger);
  padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 18px;
}
.success-banner {
  background: #ECF3EE; border: 1px solid #B9D2C2; color: var(--green);
  padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 18px;
}

/* ── TABLES ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; color: var(--gray); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 12px;
  border-bottom: 1.5px solid var(--gray-ultra);
}
td { padding: 14px 12px; border-bottom: 1px solid var(--gray-ultra); vertical-align: top; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 4px 11px; border-radius: 100px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.badge-open { background: var(--gray-ultra); color: var(--gray); }
.badge-in_progress { background: var(--gold-pale); color: #8A6320; }
.badge-blocked { background: var(--danger-bg); color: var(--danger); }
.badge-done { background: #ECF3EE; color: var(--green); }
.badge-cancelled { background: var(--gray-ultra); color: var(--gray); }
.badge-paid { background: #ECF3EE; color: var(--green); }
.badge-overdue { background: var(--danger-bg); color: var(--danger); }
.badge-sent { background: var(--gold-pale); color: #8A6320; }
.badge-draft { background: var(--gray-ultra); color: var(--gray); }
.badge-void { background: var(--gray-ultra); color: var(--gray); }

/* ── MESSAGE THREAD ── */
.thread { display: flex; flex-direction: column; gap: 14px; max-height: 58vh; overflow-y: auto; padding-right: 6px; }
.msg {
  max-width: 70%; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--cream); border: 1px solid rgba(0,0,0,0.05);
}
.msg-mine { align-self: flex-end; background: var(--gold-pale); border-color: rgba(200,145,58,0.25); }
.msg-meta { font-size: 11px; font-weight: 600; color: var(--gray); margin-bottom: 5px; letter-spacing: 0.02em; }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 56px 20px; color: var(--gray); }
.empty-state h3 { font-family: 'Cormorant Garamond', serif; color: var(--navy); font-size: 22px; margin-bottom: 8px; }

.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-meta { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* ── AUTH (login page) ── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy); padding: 20px; position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 55% 60% at 75% 45%, rgba(11,110,79,0.18) 0%, transparent 65%),
    radial-gradient(ellipse 45% 55% at 15% 75%, rgba(200,145,58,0.10) 0%, transparent 60%);
  pointer-events: none;
}
.auth-card { width: 100%; max-width: 400px; position: relative; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .brand { font-size: 30px; }
.auth-brand .tagline {
  font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 500; margin-top: 4px;
}
.auth-wrap .card { background: var(--white); border-radius: var(--r-lg); padding: 36px; }
.auth-wrap .btn { width: 100%; justify-content: center; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 28px; color: var(--gray); font-size: 13px; background: var(--white); border-top: 1px solid var(--gray-ultra); }
.footer a { color: var(--green); }
