/* ============================================================
   Tri-Eagle Home — CRM Design System
   Brand: warm tan/bronze + cream + deep navy + bronze accent
   Type: DM Serif Display (display) + Inter (UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand palette — pulled directly from logo + website */
  --bronze:      #b39573;   /* logo background tan */
  --bronze-dk:   #8e6f4d;
  --bronze-lt:   #c7ad8e;
  --bronze-pale: #ece4d4;
  --cream:       #f6f1e7;
  --cream-2:     #faf6ed;
  --navy:        #1c2433;   /* deep hero navy */
  --navy-2:      #2a3247;
  --navy-3:      #3a435a;
  --ink:         #1a1f2c;
  --muted:       #7a7468;
  --muted-lt:    #b9b1a2;
  --border:      #e2d8c5;
  --border-lt:   #efe7d6;
  --white:       #fffdf8;
  --gold:        #c79152;
  --gold-lt:     #e3b884;

  /* Status colors (5-stage pipeline) */
  --stage-consult:   #e8effa;  --stage-consult-tx:   #1e3a78;
  --stage-design-p:  #fbf1dc;  --stage-design-p-tx:  #7a5717;
  --stage-design:    #f5e7d0;  --stage-design-tx:    #6b4413;
  --stage-constr-p:  #e0e7d8;  --stage-constr-p-tx:  #3d5418;
  --stage-constr:    #d8e5e4;  --stage-constr-tx:    #1c4a48;
  --stage-done:      #ede7dc;  --stage-done-tx:      #524437;
  --stage-lost:      #f5dcd9;  --stage-lost-tx:      #7c2b22;

  /* Shape / motion */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(28,36,51,.06);
  --shadow:    0 6px 20px rgba(28,36,51,.08);
  --shadow-lg: 0 16px 40px rgba(28,36,51,.12);

  --sidebar-w: 230px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

.serif { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }

a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--bronze-dk); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.te-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.te-sidebar__brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-align: center;
}
.te-sidebar__brand img {
  width: 78px; height: 78px; object-fit: contain;
  border-radius: 50%;
  background: var(--bronze);
  padding: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.te-sidebar__brand-name {
  font-family: 'DM Serif Display', serif;
  color: var(--cream);
  font-size: 18px;
  letter-spacing: 1.5px;
  margin-top: 10px;
}
.te-sidebar__brand-sub {
  color: var(--bronze-lt);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 2px;
}

.te-sidebar__nav { padding: 14px 10px; flex: 1; }
.te-sidebar__section {
  font-size: 10.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--bronze-lt);
  padding: 12px 14px 6px;
  opacity: .7;
}
.te-sidebar__link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  margin: 2px 0;
  color: #cfd4df;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.te-sidebar__link:hover { background: rgba(255,255,255,.04); color: var(--cream); }
.te-sidebar__link.is-active {
  background: linear-gradient(90deg, rgba(199,145,82,.18), rgba(199,145,82,.04));
  color: var(--cream);
  border-left: 3px solid var(--gold);
  padding-left: 11px;
}
.te-sidebar__link svg { width: 18px; height: 18px; opacity: .85; }

.te-sidebar__footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px;
  color: var(--muted-lt);
}

/* ── MAIN ─────────────────────────────────────────────────── */
.te-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 28px 36px 60px;
}

.te-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.te-page-head__title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--navy);
  line-height: 1.1;
  letter-spacing: -.3px;
}
.te-page-head__sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}
.te-page-head__actions { display: flex; gap: 10px; }

/* ── CARDS ────────────────────────────────────────────────── */
.te-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}
.te-card--padless { padding: 0; }
.te-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-lt);
}
.te-card__title {
  font-family: 'DM Serif Display', serif;
  font-size: 19px;
  color: var(--navy);
}
.te-card__body { padding: 18px 22px; }

/* ── METRIC TILES ─────────────────────────────────────────── */
.te-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 24px; }
.te-metric {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.te-metric::after {
  content: '';
  position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px;
  background: var(--bronze-pale);
  border-radius: 50%;
  opacity: .5;
}
.te-metric__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  font-weight: 600;
}
.te-metric__value {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  color: var(--navy);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.te-metric__hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.te-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
}
.te-btn--primary {
  background: var(--navy);
  color: var(--cream-2);
}
.te-btn--primary:hover { background: var(--navy-2); color: var(--white); }
.te-btn--gold {
  background: var(--gold);
  color: var(--white);
}
.te-btn--gold:hover { background: var(--bronze-dk); }
.te-btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--border);
}
.te-btn--ghost:hover { background: var(--cream-2); border-color: var(--bronze-lt); }
.te-btn--sm { padding: 7px 12px; font-size: 12.5px; }
.te-btn--danger {
  background: transparent; color: #8b2c1f; border-color: #e5c8c3;
}
.te-btn--danger:hover { background: #fbecea; }

/* ── FORMS ────────────────────────────────────────────────── */
.te-form { display: grid; gap: 14px; }
.te-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.te-field { display: flex; flex-direction: column; gap: 5px; }
.te-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .3px;
}
.te-field__input, .te-field__select, .te-field__textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.te-field__input:focus, .te-field__select:focus, .te-field__textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(199,145,82,.15);
}
.te-field__textarea { min-height: 90px; resize: vertical; }
.te-field__hint { font-size: 11.5px; color: var(--muted); }

/* ── TABLE ────────────────────────────────────────────────── */
.te-table { width: 100%; border-collapse: collapse; }
.te-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--cream-2);
}
.te-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-lt);
  font-size: 14px;
  vertical-align: middle;
}
.te-table tbody tr:hover td { background: var(--cream-2); }
.te-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── STAGE BADGES ─────────────────────────────────────────── */
.te-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: .2px;
}
.te-badge--consult   { background: var(--stage-consult);   color: var(--stage-consult-tx); }
.te-badge--design-p  { background: var(--stage-design-p);  color: var(--stage-design-p-tx); }
.te-badge--design    { background: var(--stage-design);    color: var(--stage-design-tx); }
.te-badge--constr-p  { background: var(--stage-constr-p);  color: var(--stage-constr-p-tx); }
.te-badge--constr    { background: var(--stage-constr);    color: var(--stage-constr-tx); }
.te-badge--done      { background: var(--stage-done);      color: var(--stage-done-tx); }
.te-badge--lost      { background: var(--stage-lost);      color: var(--stage-lost-tx); }
.te-badge--sub       { background: #fff0e0; color: #8a4a14; }

/* ── PIPELINE BOARD ───────────────────────────────────────── */
.te-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 14px;
}
.te-board__col {
  background: var(--cream-2);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
  min-height: 320px;
}
.te-board__col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 12px;
}
.te-board__col-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--navy);
}
.te-board__col-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}
.te-board__card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 13px;
  margin-bottom: 8px;
  display: block;
  color: var(--ink);
  transition: box-shadow .15s, transform .15s;
}
.te-board__card:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.te-board__card-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; color: var(--navy); }
.te-board__card-client { font-size: 12.5px; color: var(--muted); }
.te-board__card-amt { font-size: 13px; color: var(--bronze-dk); font-weight: 600; margin-top: 6px; }

/* ── ALERTS ───────────────────────────────────────────────── */
.te-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid;
}
.te-alert--info { background: #ecf2fa; border-color: #cfd9eb; color: #1f3a64; }
.te-alert--warn { background: #fbf3d8; border-color: #ecdfa3; color: #6b5310; }
.te-alert--ok   { background: #e7f1e0; border-color: #c5d9b1; color: #345c20; }
.te-alert--err  { background: #fbe5e2; border-color: #ecc4be; color: #7c2b22; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.te-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.te-empty__title { font-family: 'DM Serif Display', serif; font-size: 22px; color: var(--navy); margin-bottom: 6px; }

/* ── UTIL ─────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.mb-3  { margin-bottom: 24px; }
.mt-2  { margin-top: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.tnum  { font-variant-numeric: tabular-nums; }

/* ── MOBILE TOP BAR (hidden on desktop) ───────────────────────── */
.te-topbar { display: none; }
.te-nav-backdrop { display: none; }

/* ── RESPONSIVE (phones / small tablets) ──────────────────────── */
@media (max-width: 820px) {

  /* Top bar with hamburger — replaces the fixed sidebar on small screens */
  .te-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 90;
    background: var(--navy);
    padding: 10px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
  }
  .te-topbar__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; padding: 0;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 9px;
    color: var(--cream);
    cursor: pointer;
  }
  .te-topbar__toggle:active { background: rgba(255,255,255,.16); }
  .te-topbar__toggle svg { width: 22px; height: 22px; }
  .te-topbar__brand {
    font-family: 'DM Serif Display', serif;
    color: var(--cream);
    font-size: 17px; letter-spacing: 1.5px;
  }

  /* Sidebar slides in from the left (off-canvas) */
  .te-sidebar {
    width: min(82vw, 300px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  body.te-nav-open .te-sidebar { transform: translateX(0); }

  /* Dark backdrop behind the open menu */
  .te-nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10,14,22,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
    z-index: 99;                 /* below sidebar (100), above content */
  }
  body.te-nav-open .te-nav-backdrop { opacity: 1; pointer-events: auto; }

  /* Content spans full width */
  .te-main { margin-left: 0; padding: 18px 16px 48px; }

  /* Page header stacks; actions go full width */
  .te-page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .te-page-head__title { font-size: 26px; }
  .te-page-head__actions { width: 100%; flex-wrap: wrap; }

  /* Two-up form rows collapse to a single column */
  .te-form__row { grid-template-columns: 1fr; }

  /* Card headers wrap instead of overflowing */
  .te-card__head { flex-wrap: wrap; gap: 8px; }

  /* Wide tables scroll inside their card instead of squishing */
  .te-card { overflow-x: auto; }
  .te-table { min-width: 460px; }

  /* Pipeline board: one column at a time, swipe sideways */
  .te-board {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
  }
}
