/* ==========================================================================
   Tendrly design system
   Pine-ink + emerald + premium gold. Calistoga display · system sans · mono.
   Plain CSS, no build step.
   ========================================================================== */

:root {
  /* Neutrals — cool paper, not cream */
  --paper:      #F5F6F4;
  --paper-2:    #EDEFEA;
  --surface:    #FFFFFF;
  --ink:        #12211F;   /* deep pine-black */
  --ink-2:      #1B2E2B;
  --muted:      #5E6B66;
  --faint:      #8A938E;
  --line:       #E2E4DE;
  --line-2:     #D3D7CF;

  /* Brand */
  --brand:      #0E7C66;   /* emerald-teal: go / trust */
  --brand-deep: #0A5B4A;
  --brand-soft: #E2EFEA;
  --gold:       #C7972F;   /* premium gold: price / paid, used sparingly */
  --gold-soft:  #F6EDD6;

  /* Semantic */
  --ok:         #1F8A54;
  --ok-soft:    #E4F3E9;
  --warn:       #B9791C;
  --danger:     #C4432E;
  --danger-soft:#FBEAE6;

  /* On-dark (ink sections) */
  --on-ink:     #EAF0EC;
  --on-ink-mut: #9DB0A9;
  --ink-line:   #294540;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow-sm:  0 1px 2px rgba(18,33,31,.06), 0 4px 14px rgba(18,33,31,.05);
  --shadow-md:  0 8px 30px rgba(18,33,31,.10);

  --font-display: "Calistoga", Georgia, "Times New Roman", serif;
  --font-brand: "Gabarito", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --maxw: 1120px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand-soft); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* Typography ---------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  line-height: 1.08; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(34px, 5.4vw, 58px); }
h2 { font-size: clamp(26px, 3.6vw, 40px); }
h3 { font-size: 20px; letter-spacing: 0; }
p  { margin: 0 0 1em; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); line-height: 1.55; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--brand); font-weight: 600; }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* Buttons ------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1;
  padding: 13px 20px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: #0a1614; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn-gold { background: var(--gold); color: #2a2008; }
.btn-gold:hover { filter: brightness(1.04); }
.btn-lg { padding: 16px 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* Nav ----------------------------------------------------------------------- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(245,246,244,.85);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; gap: 22px; height: 66px; }
/* Wordmark — the name is the logo (outlined Gabarito SVG, emerald, gold period) */
.brand-mark { display: inline-flex; align-items: center; color: var(--brand); text-decoration: none; }
.brand-mark:hover { text-decoration: none; }
.brand-mark svg { height: 24px; width: auto; display: block; }
/* Wordmark reversed on dark grounds (period stays gold via its own fill) */
.footer .brand-mark, .auth-aside .brand-mark, .section-ink .brand-mark { color: #fff; }
/* Decorative emerald mini-tile with a check (used in hero / alerts, not the logo) */
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.brand-dot svg { width: 13px; height: 13px; }
.nav-links { display: flex; gap: 24px; margin-left: 8px; }
.nav-links a { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav-right a { font-size: 14.5px; font-weight: 600; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* Sections & footer --------------------------------------------------------- */
.section { padding: 84px 0; }
.section-sm { padding: 56px 0; }
.section-ink { background: var(--ink); color: var(--on-ink); }
.section-ink h1, .section-ink h2, .section-ink h3 { color: #fff; }
.section-ink .lede { color: var(--on-ink-mut); }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

.footer { background: var(--ink); color: var(--on-ink-mut); padding: 56px 0 40px; }
.footer a { color: var(--on-ink-mut); font-size: 14px; }
.footer a:hover { color: #fff; }
.footer-top { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between;
  border-bottom: 1px solid var(--ink-line); padding-bottom: 28px; margin-bottom: 22px; }
.footer .brand-mark { color: #fff; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--on-ink-mut); margin: 0 0 12px; }
.footer-col a { display: block; margin-bottom: 8px; }

/* Cards --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.card-pad { padding: 26px; }

/* Badges & pills ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-deep); }
.badge-gold  { background: var(--gold-soft); color: #7a5b12; }
.badge-ok    { background: var(--ok-soft); color: #146b3f; }
.badge-muted { background: var(--paper-2); color: var(--muted); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* Toggle switch (checkbox in disguise) */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: #D4DAD6; border-radius: 999px; transition: background .18s ease; }
.switch .track::after { content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(18,33,31,.25); transition: transform .18s ease; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Forms --------------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.field .hint { font-weight: 400; color: var(--faint); font-size: 12.5px; }
.input, input[type=text], input[type=email], input[type=password],
input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px;
  font-family: var(--font-sans); font-size: 15px; background: var(--surface); color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field-error input, .field-error textarea, .field-error select { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inline-2 { display: grid; grid-template-columns: 118px 1fr; gap: 12px; }
@media (max-width: 560px) { .row2, .inline-2 { grid-template-columns: 1fr; } }

.alert { border-radius: 10px; padding: 12px 15px; font-size: 14px; margin-bottom: 20px; }
.alert-error { background: var(--danger-soft); border: 1px solid #EFC4BB; color: #7d2416; }
.alert-ok { background: var(--ok-soft); border: 1px solid #B7DEC6; color: #145c37; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* Grids --------------------------------------------------------------------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

/* Auth ---------------------------------------------------------------------- */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; }
.auth-shell { display: flex; align-items: center; justify-content: center; padding: 40px 24px 60px; }
.auth-aside { display: none; }
@media (min-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr 1fr; }
  .auth-aside { display: flex; flex-direction: column; justify-content: space-between;
    background: var(--ink); color: var(--on-ink); padding: 48px; }
}

/* App shell (dashboard) ----------------------------------------------------- */
.appbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.appbar-inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.appbar .nav-right { gap: 16px; }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; }
.app-main { padding: 40px 0 80px; }

/* Data table ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); }
/* While a row popover (passcode/email) is open, let it escape the scroll
   container instead of clipping and forcing the user to scroll inside it. */
.table-wrap:has(details[open]) { overflow: visible; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
table.data td { padding: 15px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FBFCFA; }
.t-actions { display: flex; gap: 8px; justify-content: flex-end; }
.link-quiet { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.link-quiet:hover { color: var(--brand-deep); }

/* Passcode popover (dashboard row) */
.pc-menu { position: relative; display: inline-flex; }
.pc-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.pc-menu > summary::-webkit-details-marker { display: none; }
.pc-pop { position: absolute; right: 0; top: 26px; z-index: 30; width: 234px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 14px; }
.pc-pop input { width: 100%; }

/* Empty state --------------------------------------------------------------- */
.empty { text-align: center; padding: 64px 24px; }
.empty .icon { width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-deep); display: flex; align-items: center; justify-content: center; }

/* Proposal body (client page & pdf-ish) ------------------------------------- */
.proposal-body h3 { font-family: var(--font-display); font-size: 19px; margin: 22px 0 8px; }
.proposal-body h3:first-child { margin-top: 0; }
.proposal-body p { margin: 0 0 12px; }
.proposal-body ul { margin: 0 0 12px; padding-left: 20px; }
.proposal-body li { margin-bottom: 5px; }

/* Utilities ----------------------------------------------------------------- */
.stack-6 > * + * { margin-top: 6px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-muted { color: var(--muted); } .text-center { text-align: center; }
.flex { display: flex; } .items-center { align-items: center; } .gap-3 { gap: 12px; }
.between { justify-content: space-between; } .wrap-gap { flex-wrap: wrap; gap: 14px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
