/* ============================================================
   BRANDGLIDER — Billing & Quotation Suite
   Design System  ·  brand-accurate, production-grade
   Palette taken from the Brandglider landing pages: azure primary,
   cool white surfaces, deep space-navy feature panels, and the
   signature blue → green → amber → coral spectrum for emphasis.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Brand — Brandglider azure */
  --brand:        #2A7BFB;
  --brand-bright: #4F97FF;
  --brand-deep:   #1550D8;
  --brand-ink:    #0E3AA8;
  --brand-tint:   #D2E3FE;
  --brand-soft:   #9CC6FE;   /* mid tone for charts/donuts — tint is too pale on white */
  --brand-wash:   #EEF4FE;

  /* Secondary accents lifted from the landing spectrum */
  --cyan:      #1FC5DA;
  --cyan-soft: #8CEDF6;
  --violet:    #7A5CFF;
  --lime:      #A6D93C;
  --gold:      #F5B301;
  --coral:     #EA5B4A;

  /* Signature gradients */
  --grad-spectrum: linear-gradient(96deg, #2A7BFB 0%, #4F97FF 16%, #57C08A 42%, #F5B301 70%, #EA5B4A 100%);
  --grad-brand:    linear-gradient(135deg, #4F97FF, #1550D8);
  --grad-glider:   linear-gradient(140deg, #6FC2FF 0%, #2A7BFB 46%, #1235BE 100%);

  /* Neutrals — cool, to match the brand's white/space-navy duality */
  --ink:      #0B1220;
  --ink-soft: #47566B;
  --ink-mute: #8492A6;
  --charcoal: #05070E;
  --charcoal-2:#0C1322;
  --canvas:   #F3F6FC;
  --surface:  #FFFFFF;
  --surface-2:#F8FAFD;
  --line:     #E2E8F2;
  --line-2:   #EDF1F8;

  /* Status — info shifted to indigo so it never reads as the brand azure */
  --green:   #0FA36B;
  --green-bg:#E3F7EE;
  --red:     #E14B3F;
  --red-bg:  #FDEAE7;
  --blue:    #6357E0;
  --blue-bg: #EEEDFD;
  --amber:   #C88A05;
  --amber-bg:#FCF2D8;
  --slate:   #64748B;
  --slate-bg:#EEF1F6;
  /* Tinted borders for outline buttons that carry a status colour */
  --red-line:   #F6C7C2;
  --amber-line: #EDDCA8;
  --green-line: #BFE6D4;

  /* Debt-aging ramp. A sequential scale, NOT the status colours: every overdue
     bucket is a problem, so green must never appear here — only the severity
     climbs. --age-0 is "not yet due", which is neutral rather than good. */
  --age-0: #64748B;
  --age-1: #F5B301;
  --age-2: #EF8A2B;
  --age-3: #EA5B4A;
  --age-4: #C42B1F;

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(11,18,32,.06);
  --sh-sm: 0 2px 8px rgba(11,18,32,.06);
  --sh-md: 0 8px 24px rgba(11,18,32,.08);
  --sh-lg: 0 18px 48px rgba(11,18,32,.12);
  --sh-brand: 0 10px 26px rgba(42,123,251,.30);

  --maxw: 1280px;
}

/* ---------- Reset / base ---------- */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
::selection { background: var(--brand-tint); color: var(--brand-deep); }

/* ---------- Reusable atoms ---------- */
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--brand); display: inline-flex;
  align-items: center; gap: 8px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; background: var(--brand); border-radius: 2px;
}
.muted { color: var(--ink-mute); }
.soft { color: var(--ink-soft); }

/* Brand logo lockup (glider mark + wordmark) */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.brand-mark svg { width: 100%; height: 100%; overflow: visible; }
.brand-word { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -.035em; }
.brand-word b { font-weight: 800; color: var(--ink); }
.brand-word span { color: var(--ink); }

/* Spectrum-gradient text — the brand's hero emphasis device */
.grad-text {
  background: var(--grad-spectrum);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
/* Light chip so an uploaded logo stays visible on dark surfaces */
.logo-chip { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 6px 12px; box-shadow: var(--sh-xs); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-pill); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: .18s ease; white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--sh-brand); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--sh-xs); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-deep); }
/* Destructive. It existed only as an inline override on `.btn-primary` in one view, which meant
   the second screen that needed it would have invented its own. One class, one look. */
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(225,75,63,.28); }
.btn-danger:hover { background: #C63A2F; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; width: 38px; height: 38px; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 7px;
}
.label .req { color: var(--brand); }
.label .opt { color: var(--ink-mute); font-weight: 600; text-transform: none; letter-spacing: 0; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md); transition: .16s ease;
  font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(42,123,251,.15);
}
.input::placeholder { color: var(--ink-mute); }
.textarea { min-height: 92px; resize: vertical; }
.input-group { position: relative; }
.input-group .prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-mute); font-weight: 600; pointer-events: none;
}
.input-group .prefix ~ .input { padding-left: 30px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 16px; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600; line-height: 1.4;
}
.badge::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-slate { background: var(--slate-bg); color: var(--slate); }
.badge-brand { background: var(--brand-wash); color: var(--brand-deep); }
/* The rest of the board palette (pack 7D). A lead rating and a board column pick from the
   same eleven colours, so a badge has to be able to render all eleven — without these five
   a rating coloured cyan or violet fell back to grey on every list. Values match
   Board::COLORS exactly. */
.badge-cyan   { background: #E4FAFD; color: #0E7C8A; }
.badge-violet { background: #EFEBFF; color: #5B3FD6; }
.badge-lime   { background: #F1F8DF; color: #5C7A11; }
.badge-gold   { background: #FDF6DC; color: #96700A; }
.badge-coral  { background: #FDEDEA; color: #C0492F; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-mute); padding: 12px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr:last-child td, table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
table.data th.num { text-align: right; }   /* keep numeric headers over their right-aligned values */

/* ---------- Utilities ---------- */
.row { display: flex; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid { display: grid; gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500;
}
.divider { height: 1px; background: var(--line-2); border: none; margin: 18px 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-wash); color: var(--brand-deep); font-weight: 700; font-size: 14px; flex: none;
}
.grid-bg {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .5;
}
.scroll { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ============================================================================
   PROFILE PHOTOS — pack 12F.

   `partials/avatar.php` renders either a photo or the initials, so every avatar in the app is the
   same shape and a photo appears everywhere the moment it is uploaded. These rules only add the
   PHOTO case — the initials keep whatever styling the caller's own class gives them.
   ============================================================================ */
.av-photo { overflow: hidden; padding: 0; position: relative; }
.av-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
/* A photo carries its own contrast, so the initial-tinted background must not show through. */
.av-photo { background: var(--surface-2) !important; color: transparent !important; }

.av-lg { width: 72px; height: 72px; border-radius: 999px; flex: none;
         display: grid; place-items: center;
         background: var(--brand-tint); color: var(--brand-deep);
         font-size: 22px; font-weight: 800; font-family: var(--font-display); }

.av-card { display: flex; flex-direction: column; gap: 16px; }
.av-now { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.av-copy h3 { font-size: 15px; margin: 0 0 4px; }
.av-copy p { font-size: 13px; line-height: 1.55; margin: 0; max-width: 52ch; }
.av-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-acts form { display: flex; align-items: center; gap: 8px; margin: 0; }
.av-file { width: auto; max-width: 280px; padding: 8px 10px; font-size: 13px; }

/* ---------- the reminder picker (pack 62) ----------
   On the calendar form and both follow-up forms. `rmd-` is used by nothing else — this file
   loads on every screen (§11 #242). */
.rmd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rmd-chip { position: relative; display: inline-flex; cursor: pointer; margin: 0; }
.rmd-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rmd-chip span {
  display: inline-flex; align-items: center; padding: 6px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.rmd-chip:hover span { border-color: var(--brand-tint); color: var(--brand-deep); }
.rmd-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.rmd-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(42,123,251,.25); }
.rmd-chip.is-off { cursor: not-allowed; }
.rmd-chip.is-off span { opacity: .45; }
.rmd-chip.is-off:hover span { border-color: var(--line); color: var(--ink-soft); }
.rmd-note { font-size: 12px; margin: 6px 0 0; }
@media (prefers-reduced-motion: reduce) { .rmd-chip span { transition: none; } }
