/* Peak Planner - clean, airy, monochrome. Navy + orange are the only
   highlights (PeakCMS brand); client colors appear as small dots only. */

:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --line: #e4e4e7;
  --line-soft: #f1f1f3;
  --ink: #0f0f10;
  --muted: #52525b;
  --faint: #8e8e96;
  --navy: #18181b;
  --navy-mid: #1e3a8a;
  --navy-soft: #eef1f7;
  --orange: #cc0000;
  --orange-deep: #a80000;
  --orange-soft: #fbeaea;
  --danger: #cc0000;

  /* Task types are intentionally neutral now */
  --t-seo: var(--muted);
  --t-website: var(--muted);
  --t-social: var(--muted);
  --t-content: var(--muted);
  --t-ads: var(--muted);
  --t-email: var(--muted);
  --t-other: var(--muted);

  --display: "Poppins", "Segoe UI", -apple-system, sans-serif;
  --body: "Lato", "Segoe UI", -apple-system, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 35, 59, .04), 0 4px 16px -8px rgba(23, 35, 59, .08);
  --shadow-lift: 0 2px 6px rgba(23, 35, 59, .06), 0 16px 40px -16px rgba(23, 35, 59, .2);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--navy-mid); }
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.sw { display: none; } /* old per-type swatches */

h1, h2, h3, .page-title, .brand, .sheet h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }

/* ---------- Boot / login ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 1rem; text-align: center; color: var(--muted); }
.boot-mark { width: 44px; height: 44px; margin: 0 auto; border-radius: 12px; background: var(--navy); position: relative; overflow: hidden; }
.boot-mark::after {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 11px; height: 16px;
  background: var(--orange); clip-path: polygon(0 100%, 35% 0, 55% 55%, 70% 30%, 100% 100%);
  animation: rise .9s ease-in-out infinite alternate;
}
@keyframes rise { from { transform: translateY(6px); } to { transform: translateY(-2px); } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: min(380px, 100%); background: var(--card); border-radius: 18px; padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lift); border: 1px solid var(--line);
  animation: pop .45s cubic-bezier(.2,.9,.3,1.1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.login-card h1 { font-size: 1.6rem; }
.login-card p { color: var(--muted); margin: .25rem 0 1.5rem; }
.login-card .notice { margin-bottom: 1rem; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(.7rem + env(safe-area-inset-top, 0px)) 1.1rem .7rem;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.brand-mark svg { width: 100%; height: 100%; }
.save-state { font-size: .76rem; color: rgba(255,255,255,.7); display: flex; align-items: center; gap: .4rem; }
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.55); transition: background .2s; }
.save-state.saving .dot { background: var(--orange); animation: blink .7s infinite alternate; }
.save-state.error .dot { background: #ef4444; }
.save-state.offline .dot { background: rgba(255,255,255,.3); }
@keyframes blink { to { opacity: .3; } }
.save-state button { color: #fff; text-decoration: underline; font-size: .76rem; }

.main { flex: 1; padding: 1.25rem 1.1rem calc(var(--tabbar-h) + var(--safe-b) + 1.5rem); max-width: 880px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr) auto;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--display); font-size: .66rem; font-weight: 500; color: var(--faint); letter-spacing: .04em; text-transform: uppercase;
  transition: color .15s; text-decoration: none;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--navy); }
.tab.active svg { stroke: var(--orange); }
.tab-add {
  align-self: center; margin: 0 .9rem 0 .4rem; width: 46px; height: 46px; border-radius: 50%;
  background: var(--orange); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 14px -4px rgba(204,0,0,.3);
  transition: transform .15s, background .15s;
}
.tab-add:hover { background: var(--orange-deep); }
.tab-add:active { transform: scale(.94); }
.tab-add svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; }

.sidebar { display: none; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; height: 100vh;
    width: 224px; flex-shrink: 0; padding: 1.5rem 1rem; background: var(--navy); color: #fff;
  }
  .sidebar .brand { font-size: 1.2rem; padding: 0 .5rem 1.5rem; }
  .sidebar .tab {
    flex-direction: row; justify-content: flex-start; gap: .7rem; padding: .65rem .8rem; border-radius: 9px;
    font-size: .88rem; text-transform: none; letter-spacing: 0; color: rgba(255,255,255,.6);
  }
  .sidebar .tab.active { background: rgba(255,255,255,.08); color: #fff; }
  .sidebar .tab-add { align-self: stretch; width: auto; height: auto; border-radius: 9px; margin: .75rem 0 0; padding: .7rem; font-family: var(--display); font-weight: 500; font-size: .9rem; display: flex; gap: .5rem; justify-content: center; box-shadow: none; }
  .sidebar .tab-add svg { width: 18px; height: 18px; }
  .sidebar .save-state { margin-top: auto; padding: 0 .8rem; }
  .main { padding: 2.5rem 3rem 4rem; }
}

/* ---------- Page headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-title { font-size: 1.7rem; line-height: 1.15; }
.page-title small { display: block; font-family: var(--body); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin-bottom: .35rem; }
.eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 700; }

/* Month navigation */
.month-nav { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.month-nav .page-title { flex: 1; font-size: 1.9rem; }
.month-nav .page-title .year { font-family: var(--body); font-size: 1rem; font-weight: 400; color: var(--faint); margin-left: .45rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); transition: background .15s, transform .1s;
}
.icon-btn:hover { background: var(--line-soft); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.progress { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.1rem; font-size: .82rem; color: var(--muted); }
.progress .bar { flex: 1; height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--navy); border-radius: 99px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.progress strong { color: var(--ink); font-weight: 700; }

/* Filter chips */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip {
  padding: .3rem .75rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
  font-size: .76rem; font-weight: 700; color: var(--muted); white-space: nowrap; transition: all .15s;
}
.chip:hover { border-color: var(--faint); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Client blocks (month view) ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.block {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  overflow: hidden; animation: fade .3s ease both;
}
.block:nth-child(2) { animation-delay: .03s; } .block:nth-child(3) { animation-delay: .06s; } .block:nth-child(4) { animation-delay: .09s; } .block:nth-child(5) { animation-delay: .12s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.block-head { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem .7rem; }
.block-head::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--navy)); flex-shrink: 0; }
.block-head .name { font-family: var(--display); font-weight: 600; font-size: 1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block-head .name button { font: inherit; color: inherit; text-align: left; }
.block-head .name button:hover { color: var(--navy-mid); }
.block-head .count { font-size: .72rem; color: var(--muted); font-weight: 700; background: var(--line-soft); padding: .15rem .55rem; border-radius: 99px; }
.block.quiet { background: transparent; box-shadow: none; border-style: dashed; }
.block.quiet .block-head::before { opacity: .5; }
.block.quiet .name { color: var(--muted); font-weight: 500; }
.block-empty { padding: 0 1rem .9rem; display: flex; gap: .45rem; flex-wrap: wrap; }

.btn-sm {
  font-size: .76rem; font-weight: 700; padding: .38rem .75rem; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); transition: all .15s;
  display: inline-flex; align-items: center; gap: .3rem;
}
.btn-sm:hover { border-color: var(--faint); background: var(--line-soft); }
.btn-sm.accent { background: var(--orange-soft); border-color: transparent; color: var(--orange-deep); }
.btn-sm.accent:hover { background: #f6d5d5; }
.btn-sm svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }

/* Task rows */
.tasks { list-style: none; }
.task {
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: .75rem;
  padding: .75rem 1rem; border-top: 1px solid var(--line-soft); cursor: pointer; transition: background .12s;
}
.task:hover { background: #fafbfc; }
.task.done .title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--line); }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); margin-top: 2px;
  display: grid; place-items: center; transition: all .15s; flex-shrink: 0; background: var(--card);
}
.check svg { width: 13px; height: 13px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.5); transition: all .18s cubic-bezier(.2,.9,.3,1.3); }
.task.done .check { background: var(--navy); border-color: var(--navy); }
.task.done .check svg { opacity: 1; transform: scale(1); }
.check:hover { border-color: var(--navy); }
.task-body { min-width: 0; }
.task .title { font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
.task .meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .2rem; font-size: .74rem; color: var(--muted); }
.type { display: inline-flex; align-items: center; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .64rem; color: var(--faint); }
.type::before { display: none; }
.due { font-weight: 700; }
.due.late { color: var(--orange-deep); }
.note-flag { display: inline-flex; align-items: center; gap: .2rem; }
.note-flag svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.task .client-tag { font-size: .72rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .4rem; }
.task .client-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.task-right { font-size: .72rem; color: var(--faint); padding-top: .25rem; white-space: nowrap; }

/* ---------- Agenda ---------- */
.section { margin-bottom: 1.75rem; }
.section-title { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .6rem; }
.section-title h2 { font-size: 1.05rem; }
.section-title .n { font-size: .76rem; color: var(--faint); font-weight: 700; }
.section-title.late h2 { color: var(--orange-deep); }
.section .block .task:first-child { border-top: 0; }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; font-family: var(--display); font-size: 1.05rem; color: var(--ink); font-weight: 600; margin-bottom: .2rem; }

/* ---------- Clients ---------- */
.client-grid { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.client-card {
  text-align: left; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 1.1rem 1.1rem 1rem; transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; gap: .35rem;
}
.client-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: #d9dce3; }
.client-card .name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.client-card .name::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.client-card .site { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card .stats { display: flex; gap: .9rem; margin-top: .35rem; font-size: .76rem; color: var(--muted); }
.client-card .stats b { color: var(--ink); font-weight: 700; }
.client-card.inactive { opacity: .55; }
.services { display: flex; gap: .55rem; flex-wrap: wrap; }

/* Client detail */
.client-hero {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 1.35rem 1.35rem 1.2rem; margin-bottom: 1.5rem;
}
.client-hero .page-title { font-size: 1.5rem; }
.client-hero .page-title::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--c); margin-right: .55rem; vertical-align: middle; position: relative; top: -2px; }
.client-hero .page-title .eyebrow { margin-left: .5rem; }
.client-hero .notes { margin-top: .7rem; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.client-hero .actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; align-items: center; }
.client-hero .services { margin-top: .6rem; }
.contact { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .35rem; font-size: .88rem; }
.contact a { color: var(--navy-mid); text-decoration: none; }
.contact a:hover { text-decoration: underline; }
.contact span { color: var(--muted); }
.plan-summary { margin-top: .9rem; background: var(--bg); border-radius: var(--radius-sm); padding: .8rem .95rem; font-size: .88rem; }
.plan-summary .plan-title { display: flex; align-items: baseline; gap: .6rem; }
.plan-summary .plan-title b { font-family: var(--display); font-size: .95rem; font-weight: 600; }
.plan-summary .price { color: var(--orange-deep); font-weight: 700; margin-left: auto; }
.plan-summary p { margin-top: .3rem; color: var(--muted); white-space: pre-wrap; }
.plan-summary ul { list-style: none; margin-top: .4rem; display: flex; flex-direction: column; gap: .3rem; }
.plan-summary li { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.plan-summary li .t { flex: 1 1 140px; }
.plan-summary .day { margin-left: auto; font-size: .74rem; color: var(--faint); white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-weight: 700; font-size: .82rem; margin-bottom: 1rem; text-decoration: none; }
.back:hover { color: var(--navy-mid); }
.back svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.timeline { position: relative; padding-left: 1.4rem; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.tl-month { position: relative; margin-bottom: 1.25rem; }
.tl-month::before { content: ""; position: absolute; left: -1.4rem; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); }
.tl-month.current::before { background: var(--orange); border-color: var(--orange); }
.tl-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.tl-head h3 { font-size: 1rem; }
.tl-head .n { font-size: .74rem; color: var(--faint); font-weight: 700; }
.tl-head .btn-sm { margin-left: auto; }
.result { margin-top: .35rem; font-size: .82rem; color: var(--muted); background: var(--bg); padding: .45rem .65rem; border-radius: 8px; white-space: pre-wrap; }
.result.plan { color: var(--faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.15rem;
  border-radius: 10px; font-family: var(--display); font-weight: 500; font-size: .9rem; background: var(--navy); color: #fff; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--navy-mid); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--orange); }
.btn.primary:hover { background: var(--orange-deep); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line-soft); }
.btn.danger { background: transparent; color: var(--muted); }
.btn.danger:hover { color: var(--danger); background: #fdf1ec; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sheets ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(10, 20, 40, .4); z-index: 40; animation: dim .2s ease both; }
@keyframes dim { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0; padding: .5rem 1.2rem calc(1.25rem + var(--safe-b));
  box-shadow: 0 -10px 40px -10px rgba(10,20,40,.35);
  animation: up .26s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 36px; height: 4px; border-radius: 99px; background: var(--line); margin: .35rem auto 1rem; }
.sheet h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.sheet h2 small { display: block; font-family: var(--body); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 700; margin-bottom: .25rem; }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 94vw); border-radius: 18px; padding: 1.25rem 1.75rem 1.75rem; max-height: 90vh; animation: popc .26s cubic-bezier(.2,.9,.3,1.05) both; }
  @keyframes popc { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }
  .sheet-grip { display: none; }
}

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin-bottom: .4rem; }
.field input[type=text], .field input[type=url], .field input[type=date], .field input[type=password], .field input[type=number], .field select, .field textarea {
  width: 100%; padding: .7rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s, box-shadow .15s; font-size: 1rem; -webkit-appearance: none; appearance: none;
}
.field select, .plan-row select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }
.field input:focus, .field select:focus, .field textarea:focus, .plan-row input:focus, .plan-row select:focus { outline: none; border-color: var(--navy-mid); box-shadow: 0 0 0 3px var(--navy-soft); }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field .hint { font-size: .76rem; color: var(--faint); margin-top: .4rem; line-height: 1.45; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.seg { display: flex; gap: .35rem; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; padding: .4rem .8rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: .8rem; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; color: var(--muted); margin: 0; transition: all .12s; }
.seg label:hover { border-color: var(--faint); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg input:checked + label { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg input:focus-visible + label { outline: 2px solid var(--orange); outline-offset: 2px; }

.status-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.status-toggle label { text-align: center; padding: .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; margin: 0; color: var(--muted); transition: all .15s; }
.status-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.status-toggle input:checked + label { background: var(--navy); color: #fff; border-color: var(--navy); }

.swatches { display: flex; gap: .45rem; flex-wrap: wrap; }
.swatches label { width: 26px; height: 26px; border-radius: 50%; background: var(--c); cursor: pointer; margin: 0; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); transition: transform .12s; }
.swatches input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatches input:checked + label { border-color: #fff; box-shadow: 0 0 0 2px var(--ink); transform: scale(1.1); }

.plan-box, .done-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem .95rem .1rem; margin-bottom: 1rem; }
.plan-row {
  display: grid; grid-template-columns: 96px 1fr 32px; grid-template-areas: "type title remove" "every every day";
  gap: .4rem; margin-bottom: .5rem; padding: .5rem; border-radius: 10px; background: var(--card); border: 1px solid var(--line); align-items: center;
}
.plan-row.yearly { grid-template-areas: "type title remove" "every month day"; }
.plan-row .pr-type { grid-area: type; } .plan-row .pr-title { grid-area: title; } .plan-row .pr-remove { grid-area: remove; }
.plan-row .pr-every { grid-area: every; } .plan-row .pr-month { grid-area: month; } .plan-row .pr-day { grid-area: day; width: 100%; }
.plan-row select, .plan-row input { width: 100%; padding: .5rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: .88rem; -webkit-appearance: none; appearance: none; }
.plan-row select { background-position: right .5rem center; padding-right: 1.6rem; }
.plan-row input[type=number] { -moz-appearance: textfield; text-align: center; padding-left: .3rem; padding-right: .3rem; }
.plan-row input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.icon-btn.small { width: 32px; height: 32px; font-size: 1.1rem; color: var(--muted); border-color: transparent; background: transparent; }
.icon-btn.small:hover { background: var(--line-soft); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; background: var(--orange-soft); border-radius: var(--radius-sm); padding: .65rem .9rem; margin-bottom: 1.1rem; font-size: .84rem; color: var(--orange-deep); font-weight: 700; }

.sheet-actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.sheet-actions .btn.primary { flex: 1; min-width: 140px; }
.sheet-actions .spacer { flex: 1; }
.link-row { display: flex; gap: 1rem; margin-top: .7rem; font-size: .82rem; }
.link-row button { color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.link-row button:hover { color: var(--navy-mid); }

.notice { background: #fdf1ec; color: var(--danger); padding: .6rem .85rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 700; }
.notice.ok { background: var(--navy-soft); color: var(--navy-mid); font-weight: 400; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 99px; font-size: .84rem; font-weight: 700;
  z-index: 50; box-shadow: var(--shadow-lift); animation: toast 2.6s ease both; display: flex; gap: .8rem; align-items: center; white-space: nowrap; max-width: 92vw;
}
.toast button { color: var(--orange); font-weight: 700; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Report ---------- */
.report { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 1.75rem 1.6rem; box-shadow: var(--shadow); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.report-head h1 { font-size: 1.4rem; }
.report-head .range { color: var(--muted); font-size: .9rem; }
.report-head .by { text-align: right; font-size: .8rem; color: var(--muted); }
.report-head .by b { display: block; color: var(--ink); font-size: .95rem; font-family: var(--display); font-weight: 600; }
.report-month { margin-bottom: 1.4rem; break-inside: avoid; }
.report-month h2 { font-size: 1rem; margin-bottom: .4rem; display: flex; align-items: baseline; gap: .5rem; }
.report-month h2 .n { font-family: var(--body); font-size: .74rem; color: var(--faint); font-weight: 700; }
.report-item { display: grid; grid-template-columns: 80px 1fr; gap: .8rem; padding: .55rem 0; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.report-item .type { padding-top: .2rem; }
.report-item .what { color: var(--muted); font-size: .84rem; margin-top: .2rem; white-space: pre-wrap; }
.report-item .when { color: var(--faint); font-size: .74rem; margin-top: .15rem; }
.report-item.open .t { color: var(--muted); }
.report-item.open .t::after { content: " (planned)"; font-size: .75rem; color: var(--faint); }
.report-summary { display: flex; gap: 1.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.report-summary div { font-size: .78rem; color: var(--muted); }
.report-summary b { display: block; font-family: var(--display); font-size: 1.5rem; color: var(--ink); font-weight: 600; line-height: 1.1; }
.report-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.report-tools .field { margin: 0; min-width: 130px; }
.report-tools .field select { padding: .55rem .7rem; padding-right: 2rem; font-size: .9rem; }
.report-tools .check-opt { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; padding-bottom: .55rem; }

@media print {
  .topbar, .tabbar, .sidebar, .back, .report-tools, .toast, .backdrop, .sheet { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .report { border: 0; box-shadow: none; padding: 0; }
}

/* ---------- Social calendar ---------- */
.tabbar { grid-template-columns: repeat(4, 1fr) auto; }
.social-tools { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.social-tools .btn { padding: .55rem 1rem; font-size: .85rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wd { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; text-align: center; padding: .2rem 0 .3rem; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-height: 104px; padding: .4rem .45rem; display: flex; flex-direction: column; gap: .3rem; }
.cal-day.blank { background: transparent; border: 0; }
.cal-day.past { background: #fbfbfc; }
.cal-day .d { font-size: .74rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.cal-day .d .wd { display: none; }
.cal-day .d .add { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; color: var(--faint); font-size: 1rem; line-height: 1; opacity: 0; transition: opacity .12s, background .12s; }
.cal-day:hover .d .add { opacity: 1; }
.cal-day .d .add:hover { background: var(--line-soft); color: var(--ink); }
.cal-day.today .d > span:first-child { background: var(--orange); color: #fff; border-radius: 99px; padding: 0 .45rem; }
.cal-day .pills { display: flex; flex-direction: column; gap: 4px; }
.pill { text-align: left; font-size: .7rem; line-height: 1.25; padding: .3rem .4rem; border-radius: 6px; background: var(--navy-soft); color: var(--navy); display: flex; gap: .35rem; align-items: baseline; width: 100%; transition: background .12s; }
.pill:hover { background: #e2e9f7; }
.pill .t { color: var(--navy-mid); font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.pill .ttl { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pill.posted { background: var(--line-soft); color: var(--muted); }
.pill.posted .t { color: var(--faint); }
.pill.posted .ttl::before { content: "✓ "; }
.pill.skipped { opacity: .5; }
.pill.failed { background: #fdf1ec; color: var(--danger); }
.pill.failed .t { color: var(--danger); }
@media (max-width: 639px) {
  .cal { grid-template-columns: 1fr; gap: 8px; }
  .cal-wd, .cal-day.blank, .cal-day.empty { display: none; }
  .cal-day { min-height: 0; flex-direction: row; align-items: flex-start; padding: .6rem .7rem; gap: .7rem; }
  .cal-day .d { flex-direction: column; align-items: center; width: 40px; flex-shrink: 0; gap: 0; }
  .cal-day .d > span:first-child { font-size: 1.05rem; color: var(--ink); }
  .cal-day .d .wd { display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; }
  .cal-day .d .add { display: none; }
  .cal-day .pills { flex: 1; }
  .pill { font-size: .8rem; padding: .4rem .55rem; }
  .pill .ttl { white-space: normal; }
}

.setup-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.25rem; margin-bottom: 1.1rem; }
.setup-card h2 { font-size: 1.05rem; margin-bottom: .35rem; }
.setup-card > .hint, .page-head + .hint { font-size: .82rem; color: var(--muted); margin-bottom: .9rem; line-height: 1.5; }
.setup-card .hint code, .page-head + .hint code { font-size: .78rem; background: var(--bg); padding: .05rem .35rem; border-radius: 4px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .35rem; }
.setup-head h2 { margin: 0; }
.setup-card form.row .field { margin-bottom: .75rem; }
.rows { display: flex; flex-direction: column; }
.row-item { display: grid; grid-template-columns: 110px 1fr auto; gap: .8rem; align-items: center; text-align: left; padding: .7rem .25rem; border-top: 1px solid var(--line-soft); width: 100%; transition: background .12s; border-radius: 6px; }
.row-item:hover { background: #fafbfc; }
.row-item.off { opacity: .5; }
.row-item .when { font-size: .78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-item .what { min-width: 0; }
.row-item .what b { display: block; font-weight: 700; }
.row-item .what .sub { display: block; font-size: .76rem; color: var(--faint); }
.row-item .what .sub em { color: var(--orange-deep); font-style: normal; }
.pfs { display: flex; gap: .25rem; }
.pf { font-size: .58rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); background: var(--line-soft); border-radius: 4px; padding: .12rem .3rem; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.25rem; }
.lib-month .eyebrow { margin-bottom: .35rem; }
.lib-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; font-size: .86rem; cursor: pointer; }
.lib-row input { accent-color: var(--navy); width: 15px; height: 15px; }
.lib-row .ttl { flex: 1; }
.lib-row .sub { font-size: .72rem; color: var(--faint); white-space: nowrap; }
.code-row { display: flex; gap: .5rem; align-items: center; }
.code { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .76rem; background: var(--bg); padding: .55rem .7rem; border-radius: 8px; overflow-x: auto; white-space: nowrap; border: 1px solid var(--line); }
.img-preview { margin-top: .5rem; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); max-height: 180px; display: flex; align-items: center; justify-content: center; }
.img-preview img { max-height: 180px; max-width: 100%; object-fit: contain; display: block; }
.img-preview.broken { padding: .6rem; font-size: .78rem; color: var(--danger); }
.img-preview.broken img { display: none; }
.img-preview.broken::after { content: "Image didn't load. Check the URL."; }
a.btn-sm, a.btn, a.client-card { text-decoration: none; color: inherit; }

/* ---------- Library picker & post types ---------- */
.type-fields .tf { display: none; }
.type-fields[data-type="library"] .tf-library, .type-fields[data-type="custom"] .tf-custom,
.type-fields[data-type="roundup"] .tf-roundup, .type-fields[data-type="service"] .tf-service, .type-fields[data-type="holiday"] .tf-holiday,
.type-fields .tf-caption { display: block; }
.type-fields[data-type="roundup"] .tf-caption, .type-fields[data-type="service"] .tf-caption, .type-fields[data-type="holiday"] .tf-caption { display: none; }
.code-row input[type=text] { flex: 1; min-width: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); font-size: 1rem; }
.code-row input[type=text]:focus { outline: none; border-color: var(--navy-mid); box-shadow: 0 0 0 3px var(--navy-soft); }
.lib-preview img { max-height: 220px; }
.pill .th { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0; align-self: center; }
@media (max-width: 639px) { .pill .th { width: 36px; height: 36px; border-radius: 6px; } }

.picker { padding-bottom: .5rem; }
.picker h2 { margin-bottom: .6rem; }
.picker-bar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: .6rem; }
.picker-bar .field { margin: 0; min-width: 120px; }
.picker-bar .field input { padding: .5rem .65rem; font-size: .9rem; }
.picker .chips { margin-bottom: .8rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.gcard { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s, border-color .12s; }
.gcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--navy-mid); }
.gcard img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); display: block; }
.gcard .gmeta { padding: .45rem .55rem .55rem; display: flex; flex-direction: column; gap: .15rem; }
.gcard .gcat { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.gcard .gcap { font-size: .76rem; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard .gused { font-size: .66rem; color: var(--orange-deep); font-weight: 700; }
.gcard.used img { opacity: .55; }
@media (min-width: 640px) { .sheet:has(.picker) { width: min(960px, 96vw); } }
.pill.noimg { background: var(--orange-soft); color: var(--orange-deep); }
.pill.noimg .t { color: var(--orange-deep); }
.dealer-hero { padding: 1.1rem 1.25rem 1rem; margin-bottom: 1.1rem; }
.dealer-hero .page-title { font-size: 1.35rem; }
.dealer-hero .contact b { color: var(--ink); }
.dealer-hero .actions { margin-top: .7rem; }

/* ---------- Admin dashboard layer ---------- */
.tabbar { grid-template-columns: repeat(4, 1fr) auto; }
.tabbar .tab-desktop { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; padding: 0 .8rem; }
.side-foot .who { font-family: var(--display); font-weight: 500; font-size: .88rem; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.side-foot .who button { color: rgba(255,255,255,.55); font-size: .74rem; }
.side-foot .who button:hover { color: #fff; }
.side-foot .save-state { padding: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .1rem; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.kpi b { font-family: var(--display); font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.kpi span { font-size: .78rem; color: var(--muted); font-weight: 700; }
.kpi small { font-size: .72rem; color: var(--faint); }
.home-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 1fr 1fr; } }
.home-grid .setup-card { margin-bottom: 0; }
.attn, .dates, .activity, .today-posts { list-style: none; display: flex; flex-direction: column; }
.attn li a, .attn li button { display: flex; flex-direction: column; gap: .05rem; width: 100%; text-align: left; padding: .55rem .25rem; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; border-radius: 6px; }
.attn li:first-child a, .attn li:first-child button { border-top: 0; }
.attn li a:hover, .attn li button:hover { background: #fafbfc; }
.attn .t { font-weight: 700; font-size: .9rem; display: flex; align-items: center; gap: .45rem; }
.attn .t::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.attn li.late .t::before { background: var(--orange); }
.attn li.soon .t::before { background: var(--navy-mid); }
.attn .s { font-size: .76rem; color: var(--muted); padding-left: 1rem; }
.dates li a { display: grid; grid-template-columns: 62px 1fr; gap: .1rem .7rem; padding: .5rem .25rem; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.dates li:first-child a { border-top: 0; }
.dates .d { font-size: .76rem; font-weight: 700; color: var(--muted); grid-row: span 2; align-self: center; }
.dates .d.hot { color: var(--orange-deep); }
.dates .t { font-weight: 700; font-size: .9rem; }
.dates .s { font-size: .76rem; color: var(--muted); }
.activity li { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; padding: .45rem .25rem; border-top: 1px solid var(--line-soft); font-size: .84rem; align-items: baseline; }
.activity li:first-child { border-top: 0; }
.activity .who { font-weight: 700; color: var(--navy); white-space: nowrap; }
.activity .msg { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.activity .msg a { color: var(--navy-mid); text-decoration: none; font-weight: 700; }
.activity .when { color: var(--faint); font-size: .72rem; white-space: nowrap; }
.today-posts li a { display: grid; grid-template-columns: 46px 1fr auto; gap: .2rem .6rem; padding: .45rem .25rem; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; font-size: .86rem; align-items: center; }
.today-posts li:first-child a { border-top: 0; }
.today-posts .t { font-weight: 700; color: var(--navy-mid); font-variant-numeric: tabular-nums; grid-row: span 2; }
.today-posts .who { font-size: .72rem; color: var(--muted); font-weight: 700; grid-column: 2; }
.today-posts .ttl { grid-column: 2; }
.today-posts .st { grid-column: 3; grid-row: span 2; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--faint); }
.today-posts .st.posted { color: var(--navy-mid); }
.today-posts .st.failed { color: var(--danger); }
.section-h { font-size: 1.05rem; margin: 1.4rem 0 .7rem; }
.searchbar { display: flex; align-items: center; gap: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: .3rem .5rem .3rem .9rem; margin-bottom: .8rem; }
.searchbar svg { width: 18px; height: 18px; stroke: var(--faint); fill: none; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.searchbar input { flex: 1; border: 0; background: transparent; padding: .45rem 0; font-size: 1rem; min-width: 0; }
.searchbar input:focus { outline: none; }
.badges { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.roles { display: inline-flex; gap: .25rem; }
.rb { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--navy); background: var(--navy-soft); border-radius: 4px; padding: .12rem .4rem; }
.pill-status { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-radius: 4px; padding: .12rem .4rem; background: var(--line-soft); color: var(--muted); }
.pill-status.active { background: var(--navy-soft); color: var(--navy-mid); }
.pill-status.onboarding, .pill-status.lead, .pill-status.paused { background: var(--orange-soft); color: var(--orange-deep); }
.pill-status.churned { background: #fdf1ec; color: var(--danger); }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag { font-size: .7rem; color: var(--muted); background: var(--line-soft); border-radius: 99px; padding: .1rem .5rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1.5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); }
.fact-group .eyebrow { margin-bottom: .35rem; }
.fact { display: grid; grid-template-columns: 92px 1fr; gap: .5rem; font-size: .86rem; padding: .2rem 0; }
.fact .fl { color: var(--faint); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .15rem; }
.fact .fv { min-width: 0; overflow-wrap: anywhere; }
.fact .fv a { color: var(--navy-mid); text-decoration: none; }
.fact .fv a:hover { text-decoration: underline; }
.contact-row { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .86rem; padding: .25rem 0; align-items: baseline; }
.contact-row .role { color: var(--faint); font-size: .76rem; }
.contact-row a { color: var(--navy-mid); text-decoration: none; }
.fgroup { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .8rem; background: var(--card); }
.fgroup summary { cursor: pointer; padding: .7rem .9rem; font-family: var(--display); font-weight: 500; font-size: .92rem; list-style: none; display: flex; align-items: center; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 1.1rem; }
.fgroup[open] summary::after { content: "\2013"; }
.fgroup > :not(summary) { padding: 0 .9rem; }
.fgroup[open] { padding-bottom: .4rem; }
.rep-row { display: grid; gap: .4rem; margin-bottom: .4rem; align-items: center; }
.rep-row.contact { grid-template-columns: 1fr 1fr 32px; }
@media (min-width: 640px) { .rep-row.contact { grid-template-columns: 1.1fr .8fr 1.2fr 1fr 32px; } }
.rep-row.date { grid-template-columns: 1fr 150px 32px; }
.rep-row input { width: 100%; padding: .5rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: .9rem; -webkit-appearance: none; appearance: none; }
.rep-row input:focus { outline: none; border-color: var(--navy-mid); box-shadow: 0 0 0 3px var(--navy-soft); }
.choose { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choose { grid-template-columns: 1fr 1fr; } }
.choice { text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; background: var(--card); display: flex; flex-direction: column; gap: .25rem; transition: border-color .12s, box-shadow .12s; }
.choice:hover { border-color: var(--navy-mid); box-shadow: var(--shadow-lift); }
.choice b { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.choice span { font-size: .82rem; color: var(--muted); }

/* ---------- Rank tracking ---------- */
.rk-summary { display: grid; grid-template-columns: 1fr; gap: .7rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .rk-summary { grid-template-columns: 1fr 1.2fr 1fr; } .rk-summary.two { grid-template-columns: 1fr 1fr; } }
.rk-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.rk-card .big { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.15; }
.rk-card small { font-size: .76rem; color: var(--faint); }
.rk-card .kwname { font-family: var(--display); font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.rk-card .tag { align-self: flex-start; }
.rk-card .vol { margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line-soft); }
.rk-card .rk-url { font-size: .8rem; color: var(--navy-mid); text-decoration: none; overflow-wrap: anywhere; margin-top: .2rem; }
.dist { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; font-size: .84rem; padding: .16rem 0; border-top: 1px solid var(--line-soft); }
.dist:first-of-type { border-top: 0; }
.dist span:first-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moves { display: flex; gap: 1.6rem; margin: .1rem 0 .3rem; }
.moves b { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.1; display: block; }
.moves small { color: var(--muted); }
.up { color: #1a7f37; } .down { color: var(--orange); }
.mv { font-weight: 700; font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mv.up { color: #1a7f37; } .mv.down { color: var(--orange); } .mv.flat { color: var(--faint); font-weight: 400; }
.rk-controls { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; justify-content: flex-end; }
.rk-controls select, .rk-tools select { padding: .5rem 2rem .5rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2352525b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .65rem center; font-size: .86rem; -webkit-appearance: none; appearance: none; }
.segbtn { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.segbtn button { padding: .5rem .8rem; font-size: .82rem; font-weight: 700; color: var(--muted); border-left: 1px solid var(--line); }
.segbtn button:first-child { border-left: 0; }
.segbtn button.on { background: var(--navy); color: #fff; }
.chart-card { padding: 1rem .8rem .7rem; }
.rkchart { width: 100%; height: auto; display: block; }
.rkchart .grid { stroke: var(--line); stroke-width: 1; }
.rkchart .ax { font: 11px var(--body); fill: var(--faint); }
.rkchart .line { fill: none; stroke: var(--navy-mid); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rkchart circle { fill: var(--navy-mid); }
.rkchart .mark line { stroke: var(--orange); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.rkchart .mark circle { fill: var(--orange); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; padding: .4rem .4rem 0; font-size: .76rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; background: var(--navy-mid); }
.lg.mark::before { background: var(--orange); }
.rk-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 1.1rem 0 .7rem; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.rk-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
.rk-table th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: #fafafa; white-space: nowrap; }
.rk-table th button { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.rk-table th button:hover { color: var(--ink); }
.rk-table td { padding: .65rem .9rem; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.rk-table tbody tr { cursor: pointer; transition: background .1s; }
.rk-table tbody tr:hover { background: #fafafa; }
.rk-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rk-table th.num { text-align: right; }
.rk-table .kw { display: block; font-weight: 700; color: var(--navy-mid); }
.rk-table .tag { display: inline-block; margin-top: .2rem; }
.rk-table .url { color: var(--muted); font-size: .8rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-table .none { text-align: center; color: var(--muted); padding: 1.5rem; }
.linkish { color: var(--navy-mid); text-decoration: underline; font-size: inherit; }
.find-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.find-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: .7rem; align-items: center; padding: .5rem .7rem; border-top: 1px solid var(--line-soft); font-size: .86rem; cursor: pointer; }
.find-row:first-child { border-top: 0; }
.find-row input { accent-color: var(--navy); width: 16px; height: 16px; }
.find-row .m { color: var(--faint); font-size: .76rem; white-space: nowrap; }
.jdate { font-size: .74rem; font-weight: 700; color: var(--orange); white-space: nowrap; padding-top: .2rem; min-width: 48px; }
.rep-row.member { grid-template-columns: 1fr 1.4fr auto 32px; }
.check-opt { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; white-space: nowrap; }
.setup-head .section-h { margin: 1.4rem 0 .7rem; }
.link-row a { color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media print { .no-print, .rk-controls, .rk-tools { display: none !important; } .table-wrap { border: 0; } .chart-card { border: 0; box-shadow: none; } }
.rep-row input[type=checkbox] { -webkit-appearance: auto; appearance: auto; width: 16px; height: 16px; padding: 0; accent-color: var(--navy); }

/* ---------- Flat white theme (Nov 2026): white page, white sidebar, fewer boxes ---------- */
:root { --shadow: none; --shadow-lift: 0 1px 3px rgba(0, 0, 0, .08); --radius: 10px; --radius-sm: 8px; --bg: #f6f6f7; --line: #e6e6e9; }
body { background: #fff; }
.topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.save-state { color: var(--muted); }
.save-state .dot { background: #b4b4bb; }
.save-state.offline .dot { background: #d4d4d8; }
.save-state button { color: var(--navy-mid); }
.tabbar { background: rgba(255, 255, 255, .97); }
.tab.active svg { stroke: var(--navy-mid); }
@media (min-width: 900px) {
  .sidebar { background: #fff; color: var(--ink); border-right: 1px solid var(--line); width: 232px; }
  .sidebar .tab { color: var(--muted); font-weight: 500; }
  .sidebar .tab:hover { background: var(--line-soft); color: var(--ink); }
  .sidebar .tab.active { background: var(--line-soft); color: var(--ink); font-weight: 600; }
  .side-foot .who { color: var(--ink); }
  .side-foot .who button { color: var(--faint); }
  .side-foot .who button:hover { color: var(--ink); }
  .main { max-width: 1040px; }
}
/* cards: thin border only, no lift */
.block, .setup-card, .client-card, .kpi, .rk-card, .report, .table-wrap, .cal-day { box-shadow: none; }
.client-card:hover, .kpi:hover { transform: none; box-shadow: none; border-color: #c9c9cf; }
.kpi { padding: .8rem .95rem; }
.kpi b, .rk-card .big, .moves b { font-size: 1.6rem; }
/* unbox the things that don't need a box */
.client-hero { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 0 0 1.2rem; background: transparent; }
.dealer-hero { padding: 0 0 1rem; }
.block.quiet { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; }
.block.quiet .block-head { padding-left: 0; } .block.quiet .block-empty { padding-left: 0; }
.home-grid .setup-card, .chart-card { border-color: var(--line); }
.setup-card h2, .section-h, .section-title h2 { font-size: 1rem; }
.page-title { font-size: 1.5rem; } .month-nav .page-title { font-size: 1.6rem; }
.searchbar { border-radius: var(--radius-sm); }
.rk-table th { background: #fff; }
.task:hover, .rk-table tbody tr:hover, .row-item:hover, .attn li a:hover, .attn li button:hover { background: var(--line-soft); }
.sheet { box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .25); }
.btn, .btn-sm, .chip, .seg label { box-shadow: none; }
.btn-sm, .chip, .seg label, .tag { border-radius: 7px; }
.tab-add { box-shadow: none; }
.login-card { box-shadow: none; }
.field input[type=email] { width: 100%; padding: .7rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); font-size: 1rem; -webkit-appearance: none; appearance: none; }
.login-card p { margin: .4rem 0 1.2rem; }

/* ---------- CRM layer ---------- */
@media (min-width: 900px) {
  .sidebar { overflow-y: auto; gap: .1rem; }
  .sidebar .tab { padding: .5rem .8rem; font-size: .86rem; }
  .sidebar .tab-add { margin-top: 1rem; }
  .side-foot { padding-top: 1rem; }
}
.nav-h { font-size: .64rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--faint); padding: 1rem .8rem .3rem; }
.menu-h { margin: 1.1rem 0 .2rem; }
.menu-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .2rem; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.menu-row svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.menu-row b { display: block; font-weight: 700; } .menu-row small { color: var(--muted); font-size: .78rem; }
.cust-table { min-width: 0; }
.cust-table td { vertical-align: top; }
.cust-table tr.off { opacity: .55; }
.cname { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); }
.cname i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cust-table .sub, .row-item .sub { display: block; font-size: .78rem; color: var(--muted); }
.cust-table td:first-child .sub { padding-left: 1.05rem; }
.sub.ink { color: var(--ink) !important; }
.cust-table tfoot td { border-top: 1px solid var(--line); background: #fafafa; }
.tagrow { align-items: center; margin-top: -.6rem; }
.tagrow .eyebrow { margin-right: .2rem; }
.tagsug { margin: .45rem 0 0; } .tagsug .chip { font-size: .7rem; padding: .15rem .5rem; }
@media (max-width: 699px) { .hide-sm { display: none; } }
@media (max-width: 1099px) { .hide-md { display: none; } }
.ctabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); margin: 0 0 1.2rem; overflow-x: auto; }
.ctabs a { padding: .7rem 0 .6rem; font-family: var(--display); font-weight: 500; font-size: .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ctabs a.on { color: var(--ink); border-bottom-color: var(--orange); }
.ctabs a span { font-family: var(--body); font-size: .68rem; font-weight: 700; color: var(--muted); background: var(--line-soft); border-radius: 99px; padding: .05rem .4rem; margin-left: .35rem; }
.client-hero { border-bottom: 0; padding-bottom: .4rem; margin-bottom: .6rem; }
.plain .facts { border-top: 0; padding-top: 0; margin-top: 0; margin-bottom: .6rem; }
.note-form { margin-bottom: 1rem; }
.note-form textarea { width: 100%; min-height: 76px; padding: .7rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; resize: vertical; line-height: 1.45; }
.note-form textarea:focus { outline: none; border-color: var(--navy-mid); box-shadow: 0 0 0 3px var(--navy-soft); }
.note-form > div { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; }
.note-form .btn { padding: .5rem 1rem; }
.note { padding: .8rem 0; border-top: 1px solid var(--line-soft); }
.note-meta { display: flex; gap: .7rem; align-items: baseline; font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.note-meta b { color: var(--ink); } .note-meta button { margin-left: auto; font-size: .72rem; color: var(--faint); text-decoration: none; opacity: 0; }
.note:hover .note-meta button { opacity: 1; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.row-item.setup-row, .row-item.tool-row { grid-template-columns: 150px 1fr auto; align-items: start; }
.row-item.setup-row .when, .row-item.tool-row .when { color: var(--ink); font-size: .9rem; }
form[data-kind="other"] .car-only { display: none; }
.formpage { max-width: 860px; }
.formpage .sheet-grip { display: none; }
.formpage h2 { font-size: 1.5rem; margin-bottom: 1.2rem; }
.formpage h2 small { display: block; font-family: var(--body); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 700; margin-bottom: .25rem; }
.formpage .sheet-actions { position: sticky; bottom: 0; background: #fff; padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1.2rem; z-index: 5; }
@media (max-width: 899px) { .formpage .sheet-actions { bottom: calc(var(--tabbar-h) + var(--safe-b)); } }

/* ---------- Customer page layout ---------- */
.cust-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cust-head .page-title { font-size: 1.6rem; }
.cust-head .page-title::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: .55rem; vertical-align: middle; position: relative; top: -2px; }
.ch-badges { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .45rem; }
.cust-head .contact { margin-top: .5rem; gap: .2rem 1.1rem; }
.ch-actions { display: flex; gap: .5rem; }
.ch-actions .btn { padding: .55rem 1rem; }
.ov-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1000px) { .ov-grid { grid-template-columns: minmax(0, 1.55fr) minmax(250px, 1fr); gap: 2.5rem; } .ov-side { border-left: 1px solid var(--line); padding-left: 2rem; } }
.ov-main > .setup-head:first-child .section-h { margin-top: 0; }
.side-sec { padding: 0 0 1.1rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line-soft); }
.side-sec:last-child { border-bottom: 0; }
.side-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .45rem; }
.side-h .linkish { font-size: .74rem; text-decoration: none; color: var(--faint); }
.side-h .linkish:hover { color: var(--navy-mid); }
.side-p { font-size: .88rem; color: var(--ink); } .side-p.muted { color: var(--muted); }
.side-sub { font-size: .74rem; color: var(--muted); font-weight: 700; margin: .6rem 0 .2rem; }
.side-list { list-style: none; font-size: .88rem; } .side-list li { padding: .18rem 0; display: flex; justify-content: space-between; gap: .6rem; } .side-list li span { color: var(--faint); font-size: .78rem; }
.side-sec .fact { grid-template-columns: 72px 1fr; }
.person { font-size: .88rem; padding: .3rem 0; } .person .role { color: var(--faint); font-size: .76rem; margin-left: .45rem; }
.person div { display: flex; flex-direction: column; } .person a, .side-links a { color: var(--navy-mid); text-decoration: none; overflow-wrap: anywhere; }
.side-links { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.task.pushed .check { background: #fff; border-color: var(--line); } .task.pushed .check svg { opacity: 0; }
.task.pushed .title { text-decoration: none; color: var(--faint); font-style: italic; }
.plan-row:not(.yearly) .pr-day { visibility: hidden; }
.bill-form { max-width: 720px; }
.side-h a.linkish { font-size: .74rem; text-decoration: none; color: var(--faint); }
.per { color: var(--faint); font-size: .76rem; font-weight: 400; margin-left: .15rem; }
.rkchart .line.soft { stroke: #c4c4cc; stroke-width: 1.5; }
.lg.soft::before { background: #c4c4cc; }
@media (min-width: 700px) { .rk-summary.four { grid-template-columns: repeat(4, 1fr); } }
.tag.vtag { background: var(--navy-soft); color: var(--navy-mid); margin-left: .3rem; }
.login-foot { font-size: .78rem !important; color: var(--faint) !important; margin: 1.3rem 0 0 !important; text-align: center; line-height: 1.5; }
.login-foot a { color: var(--muted); }
