/* ServiceCRM design system.
   Subject: an operations CRM for home-service crews whose hook is AI renderings.
   Palette: deep pine primary, amber "lights" accent, warm-biased neutrals.
   Both themes are first-class; dark is the default working surface. */

:root {
  --pine: #1f7a58;
  --pine-deep: #145038;
  --amber: #e39a2d;
  --amber-soft: #f4c66a;
  --ink: #16130f;

  /* warm neutrals — greys biased slightly toward the amber accent */
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efeae2;
  --border: #e0d8cc;
  --text: #23201b;
  --muted: #6f685d;
  --accent: var(--pine);
  --accent-ink: #ffffff;

  --good: #2f8f5b;
  --warn: #c9871f;
  --crit: #c0492f;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20,16,10,.06), 0 6px 20px -8px rgba(20,16,10,.18);
  --font: "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
  --maxw: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --surface: #1d1a16;
    --surface-2: #262019;
    --border: #332c23;
    --text: #ece6dc;
    --muted: #9c9284;
    --accent: #2f9d72;
    --accent-ink: #06130d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="light"] {
  --bg: #f6f3ee; --surface: #fff; --surface-2: #efeae2; --border: #e0d8cc;
  --text: #23201b; --muted: #6f685d; --accent: var(--pine); --accent-ink: #fff;
  --shadow: 0 1px 2px rgba(20,16,10,.06), 0 6px 20px -8px rgba(20,16,10,.18);
}
:root[data-theme="dark"] {
  --bg: #14120f; --surface: #1d1a16; --surface-2: #262019; --border: #332c23;
  --text: #ece6dc; --muted: #9c9284; --accent: #2f9d72; --accent-ink: #06130d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 750; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 1em; }
small { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45em; cursor: pointer;
  font: inherit; font-weight: 600; padding: .55em 1em; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); border-color: transparent; }
.btn-amber { background: var(--amber); color: #241a06; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35em .7em; font-size: .85rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---- forms ---- */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3em; }
input, select, textarea {
  width: 100%; font: inherit; padding: .6em .7em; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 74px; }
.field { margin-bottom: .9em; }
.row { display: flex; gap: .8em; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }

/* ---- pills / badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: .35em; font-size: .72rem; font-weight: 650;
  padding: .2em .6em; border-radius: 999px; background: var(--surface-2); color: var(--muted);
  letter-spacing: .02em; text-transform: capitalize; white-space: nowrap;
}
.pill-lead     { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.pill-photos   { background: color-mix(in srgb, #6a8fc4 25%, transparent); color: #6a8fc4; }
.pill-rendering{ background: color-mix(in srgb, var(--amber) 25%, transparent); color: var(--warn); }
.pill-shared   { background: color-mix(in srgb, #7b74d8 25%, transparent); color: #8a83e0; }
.pill-approved { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.pill-estimate { background: color-mix(in srgb, var(--amber) 25%, transparent); color: var(--warn); }
.pill-won      { background: var(--accent); color: var(--accent-ink); }
.pill-lost     { background: color-mix(in srgb, var(--crit) 20%, transparent); color: var(--crit); }

/* ---- app shell ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; padding: .3rem .5rem 1rem; letter-spacing: -.02em; }
.brand .dot { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--pine), var(--amber)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 25%, transparent); }
.nav a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 550; font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.nav .ico { width: 17px; text-align: center; opacity: .85; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid var(--border); padding-top: .7rem; font-size: .85rem; }
.userbox .name { font-weight: 650; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.4rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent);
  position: sticky; top: 0; backdrop-filter: blur(8px); z-index: 5;
}
.content { padding: 1.5rem 1.4rem 4rem; max-width: var(--maxw); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }

/* ---- cards / stats ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.1rem 1.2rem; }
.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat .k { font-size: .78rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.stat .v { font-size: 1.9rem; font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .v .cur { font-size: 1rem; color: var(--muted); font-weight: 600; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
.data td { padding: .7rem .7rem; border-bottom: 1px solid var(--border); }
.data tr:hover td { background: var(--surface-2); }

/* ---- kanban board ---- */
.board { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .8rem; }
.col { flex: 0 0 220px; background: var(--surface-2); border-radius: var(--radius); padding: .6rem; }
.col h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; }
.col .count { color: var(--muted); }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; margin-bottom: .5rem; display: block; color: var(--text); }
.pcard:hover { text-decoration: none; border-color: var(--muted); }
.pcard .t { font-weight: 640; font-size: .9rem; }
.pcard .c { color: var(--muted); font-size: .8rem; }

/* ---- rendering gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.tile img { width: 100%; aspect-ratio: 16/11; object-fit: cover; display: block; background: var(--surface-2); }
.tile .meta { padding: .55rem .7rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tile.chosen { outline: 3px solid var(--accent); }

/* ---- timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .7rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.timeline .when { color: var(--muted); font-size: .8rem; white-space: nowrap; min-width: 84px; }
.timeline .verb { font-weight: 650; }

/* ---- layout helpers ---- */
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.2rem; align-items: start; }
/* Grid/flex children default to min-width:auto, which lets wide content
   (reference carousels, tables) blow the column out past the viewport.
   Forcing min-width:0 keeps overflow INSIDE scrollable strips. */
.two-col > * { min-width: 0; }
.card { min-width: 0; }
.refstrip { max-width: 100%; }
.refitem { max-width: 100%; overflow: hidden; }
.flex { display: flex; gap: .6rem; align-items: center; }
.between { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt { margin-top: 1.1rem; } .mb { margin-bottom: 1.1rem; }
.hidden { display: none; }
.notice { border: 1px solid color-mix(in srgb, var(--good) 45%, var(--border)); background: color-mix(in srgb, var(--good) 12%, transparent); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: 1rem; }
.error { border: 1px solid color-mix(in srgb, var(--crit) 45%, var(--border)); background: color-mix(in srgb, var(--crit) 12%, transparent); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: 1rem; }

/* ---- marketing ---- */
.mk-nav { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; }
.hero { max-width: var(--maxw); margin: 0 auto; padding: 3.5rem 1.4rem 2rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw + .9rem, 2.9rem); font-weight: 820; letter-spacing: -.03em; }
.hero .pill { white-space: normal; line-height: 1.5; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 34ch; }
.hero-art { aspect-ratio: 4/3; border-radius: 16px; background:
  radial-gradient(120px 80px at 30% 30%, color-mix(in srgb, var(--amber) 55%, transparent), transparent),
  linear-gradient(160deg, var(--pine-deep), #0c2c1f);
  border: 1px solid var(--border); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-art .lights { position: absolute; inset: 0; }
.img-credit { font-size: .7rem; color: var(--muted); text-align: right; margin-top: .4rem; }
.img-credit a { color: inherit; }
.product-card { overflow: hidden; }
.product-card .cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--surface-2); }

/* before/after reveal slider (drag anywhere; range input drives --pos) */
.ba { position: relative; aspect-ratio: 3/2; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); --pos: 50%; background: var(--surface-2); }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ba .after { clip-path: inset(0 0 0 var(--pos)); }
.ba .ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; box-shadow: 0 0 10px rgba(0,0,0,.55); pointer-events: none; }
.ba .ba-knob { position: absolute; top: 50%; left: var(--pos); transform: translate(-50%,-50%); width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #1c2822; display: grid; place-items: center; font-size: .85rem; font-weight: 800; box-shadow: 0 2px 10px rgba(0,0,0,.4); pointer-events: none; }
.ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; touch-action: pan-y; }
.ba input[type=range]:focus-visible ~ .ba-knob { outline: 3px solid var(--accent); outline-offset: 2px; }
.ba .tag { position: absolute; bottom: .6rem; padding: .22rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .03em; background: rgba(10,14,12,.62); color: #fff; pointer-events: none; }
.ba .tag-l { left: .6rem; } .ba .tag-r { right: .6rem; }

/* numbered workflow rows (media + copy, alternating) */
.step-row { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; align-items: center; margin-top: 2.4rem; }
.step-row .media > img { width: 100%; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); display: block; }
.step-row.rev .media { order: 2; }
.step-row .flex h3 { margin: 0; }
.step-row .media .between { flex-wrap: wrap; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }

/* paired render figures */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.duo figure { margin: 0; }
.duo img { width: 100%; border-radius: 14px; display: block; border: 1px solid var(--border); box-shadow: var(--shadow); }
.duo figcaption { font-size: .82rem; color: var(--muted); margin-top: .45rem; text-align: center; }

/* full-width photo CTA band */
.cta-band { position: relative; border-radius: 20px; overflow: hidden; max-width: var(--maxw); width: calc(100% - 2.8rem); margin: 2rem auto; }
.cta-band > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cta-band .inner { position: relative; padding: 4rem 2rem; text-align: center; color: #fff; background: linear-gradient(rgba(6,18,13,.5), rgba(6,18,13,.78)); }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.85); }

@media (max-width: 860px) {
  .step-row { grid-template-columns: 1fr; gap: 1rem; }
  .step-row.rev .media { order: 0; }
  .duo { grid-template-columns: 1fr; }
  .cta-band .inner { padding: 2.6rem 1.2rem; }
  .hero { padding: 2rem 1.4rem 1.2rem; gap: 1.4rem; }
  .section { padding: 1.8rem 1.4rem; }
}
.section { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.4rem; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature .ic { font-size: 1.4rem; }
.price-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.plan { display: flex; flex-direction: column; }
.plan .amt { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; }
.plan .amt small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: .8rem 0 1.2rem; font-size: .9rem; }
.plan li { padding: .28rem 0; border-bottom: 1px dashed var(--border); }
.plan.feat { outline: 2px solid var(--accent); }
.center { text-align: center; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; }
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.footer .inner { max-width: var(--maxw); margin: 0 auto; padding: 1.4rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* iPad is the primary viewing target: portrait (~820px) collapses to one
   column so carousels get the full width; landscape (~1024+) keeps two
   columns. Touch scrolling on strips is momentum-smooth with a thin bar. */
@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
}
.refstrip, .board, .table-wrap {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.refthumb { touch-action: pan-x; }
@media (pointer: coarse) {
  /* bigger touch targets on tablets */
  .btn { padding: .7em 1.15em; }
  .refitem input[type=checkbox] { width: 20px; height: 20px; }
  .nav a { padding: .65rem .7rem; }
}

/* ---- mobile nav: hamburger + slide-in drawer ---- */
.mobilebar {
  display: none; position: sticky; top: 0; z-index: 55;
  align-items: center; gap: .7rem; padding: .6rem .9rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.hamburger {
  font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: .35rem .6rem;
}
.navbk { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 58; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .mobilebar { display: flex; }
  .topbar { display: none; }               /* mobilebar replaces it */
  /* Sidebar becomes a slide-in drawer. */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; width: 264px;
    z-index: 60; flex-direction: column; transform: translateX(-102%);
    transition: transform .18s ease; box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .navbk { display: block; }
  .sidebar .spacer { display: block; }
  .hero { grid-template-columns: 1fr; }
  .content { padding: 1rem .9rem 4rem; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
