/* =========================================================================
   Chameleon Partner Portal — visual demo
   Rebuilt from the WordPress/Bricks export as a static Cloudflare Pages site.
   Brand: navy #192857 + green #61a60e (from the Chameleon logo).
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* brand */
  --navy:        #192857;
  --navy-700:    #131f43;
  --navy-800:    #0e1730;
  --green:       #61a60e;
  --green-600:   #538f0c;
  --green-700:   #457708;
  --green-soft:  #cceec6;

  /* neutrals (light theme) */
  --bg:          #f4f6fa;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --border:      #e5e9f2;
  --text:        #1b2333;
  --muted:       #6b7488;
  --muted-2:     #98a1b3;

  /* stage colors */
  --stage-set-bg:      #e7effe;  --stage-set-fg:      #2563c9;
  --stage-follow-bg:   #fff2d9;  --stage-follow-fg:   #b7791f;
  --stage-agree-bg:    #ede7fb;  --stage-agree-fg:    #6d45c8;
  --stage-won-bg:      #cceec6;  --stage-won-fg:      #2f6b12;

  /* shape */
  --radius-l: 16px;
  --radius-m: 11px;
  --radius-s: 7px;
  --shadow-card: rgba(0,0,0,.05) 0 6px 24px 0, rgba(0,0,0,.02) 0 0 0 1px;
  --shadow-pop:  rgba(16,24,40,.14) 0 12px 40px -8px;

  --sidebar-w: 262px;
  --topbar-h: 66px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg:        #0e1424;
  --surface:   #161d31;
  --surface-2: #1b2338;
  --border:    #26304a;
  --text:      #e7ebf3;
  --muted:     #9aa4bb;
  --muted-2:   #6c768f;
  --shadow-card: rgba(0,0,0,.30) 0 6px 24px 0, rgba(255,255,255,.03) 0 0 0 1px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
img, svg { display: block; }

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  z-index: 30;
}
.sidebar__logo { padding: 6px 10px 26px; }
.sidebar__logo img { width: 168px; height: auto; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__label {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: rgba(255,255,255,.42); padding: 12px 12px 6px;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-m);
  color: rgba(255,255,255,.78); font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav__item.is-active { background: var(--green); color: #fff; box-shadow: 0 6px 16px -6px rgba(97,166,14,.7); }
.nav__item svg { width: 19px; height: 19px; flex: 0 0 19px; }
.nav__chev { margin-left: auto; width: 16px; height: 16px; transition: transform .2s; opacity: .8; }

.nav__group.is-open > .nav__item .nav__chev { transform: rotate(90deg); }
.nav__sub {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .22s ease;
}
.nav__group.is-open .nav__sub { grid-template-rows: 1fr; }
.nav__sub-inner { overflow: hidden; }
.nav__subitem {
  display: block; padding: 9px 12px 9px 44px; margin-top: 2px;
  border-radius: var(--radius-s); color: rgba(255,255,255,.62);
  font-size: 14px; font-weight: 500;
}
.nav__subitem:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav__subitem.is-active { color: #fff; background: rgba(97,166,14,.22); }

.sidebar__foot { margin-top: auto; padding-top: 16px; }
.sidebar__user {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-m);
  background: rgba(255,255,255,.05);
}
.sidebar__avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar__user-meta { min-width: 0; }
.sidebar__user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-mail { font-size: 11px; color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main ------------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 30px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar__burger { display: none; background: none; border: 0; cursor: pointer; color: var(--text); }
.topbar__title { font-size: 18px; font-weight: 700; }
.topbar__spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-m);
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted-2); }
.icon-btn svg { width: 18px; height: 18px; }
.chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 6px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 500;
}
.chip .sidebar__avatar { width: 28px; height: 28px; flex: 0 0 28px; font-size: 11px; }

.content { padding: 30px; flex: 1; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 25px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

/* ---- Cards & KPI ------------------------------------------------------ */
.card {
  background: var(--surface); border-radius: var(--radius-l);
  box-shadow: var(--shadow-card); padding: 22px;
}
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px;
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__icon {
  width: 40px; height: 40px; border-radius: var(--radius-m);
  display: flex; align-items: center; justify-content: center;
}
.stat__icon svg { width: 20px; height: 20px; }
.stat__val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.stat__label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat__delta { font-size: 12px; font-weight: 600; }
.tint-green  { background: var(--green-soft); color: var(--green-700); }
.tint-blue   { background: var(--stage-set-bg); color: var(--stage-set-fg); }
.tint-amber  { background: var(--stage-follow-bg); color: var(--stage-follow-fg); }
.tint-violet { background: var(--stage-agree-bg); color: var(--stage-agree-fg); }
.up { color: var(--green-600); } .down { color: #d24848; }

/* ---- Toolbar / filters ------------------------------------------------ */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.search {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 220px; max-width: 380px;
  padding: 10px 15px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px;
}
.search svg { width: 17px; height: 17px; color: var(--muted-2); flex: 0 0 17px; }
.search input { border: 0; outline: 0; background: none; color: var(--text); font: inherit; width: 100%; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 9px 16px; border-radius: 100px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.pill:hover { color: var(--text); }
.pill.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- Table ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-l); box-shadow: var(--shadow-card); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  text-align: left; padding: 15px 20px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data tbody td { padding: 16px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.product-tag {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 600;
}
.product-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--green); }
.product-dot.time { background: #2563c9; }
.product-dot.parts { background: #b7791f; }
.product-dot.labor { background: #6d45c8; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 100px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.set    { background: var(--stage-set-bg);    color: var(--stage-set-fg); }
.badge.follow { background: var(--stage-follow-bg); color: var(--stage-follow-fg); }
.badge.agree  { background: var(--stage-agree-bg);  color: var(--stage-agree-fg); }
.badge.won    { background: var(--stage-won-bg);    color: var(--stage-won-fg); }

.when { display: flex; flex-direction: column; gap: 2px; }
.when b { font-weight: 600; }
.when span { color: var(--muted); font-size: 12.5px; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-m); font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-600); }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: var(--navy-700); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--muted-2); }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--link { background: none; color: var(--green-600); padding: 0; font-weight: 600; }
.btn--link:hover { color: var(--green-700); text-decoration: underline; }
.btn svg { width: 16px; height: 16px; }

/* ---- Forms ------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.col-span { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .req { color: var(--green-600); }
.field input, .field select, .field textarea {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface-2); color: var(--text); font: inherit; outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px rgba(97,166,14,.14);
}
.field textarea { resize: vertical; min-height: 96px; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-section { margin-bottom: 26px; }
.form-section h3 { font-size: 15px; margin-bottom: 4px; }
.form-section p.desc { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.legend {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--green-700); background: var(--green-soft); padding: 5px 11px; border-radius: 100px; margin-bottom: 14px;
}

/* ---- Alert / note ----------------------------------------------------- */
.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-m);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; color: var(--muted);
}
.note.important { background: #fff6e9; border-color: #f3dcae; color: #8a5a12; }
[data-theme="dark"] .note.important { background: #2a2110; border-color: #4a3a17; color: #e6c67e; }
.note svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.note b { color: inherit; }

/* ---- Calendly frame --------------------------------------------------- */
.calendly-inline-widget { min-width: 320px; height: 660px; border-radius: var(--radius-l); overflow: hidden; }

/* ---- Modal (mock) ----------------------------------------------------- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.modal-scrim.is-open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-pop);
  width: 100%; max-width: 520px; padding: 26px; max-height: 88vh; overflow: auto;
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.modal__head h3 { font-size: 18px; }
.modal__close { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }

/* ---- Misc ------------------------------------------------------------- */
.demo-banner {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  background: var(--navy-800); color: rgba(255,255,255,.85); font-size: 12.5px; font-weight: 500;
  padding: 7px 16px; text-align: center;
}
.demo-banner b { color: var(--green); }
.pageblock { max-width: 860px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: start; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content:""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  .topbar__burger { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .chip__mail { display: none; }
}
