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

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e6e8ec;
  --line-soft: #f0f1f4;
  --ink: #17233b;
  --muted: #6b7280;
  --faint: #9ca3af;
  --navy: #0a2149;
  --navy-mid: #1a44a0;
  --navy-soft: #eef2fa;
  --orange: #fb7a15;
  --orange-deep: #e5620a;
  --orange-soft: #fff1e6;
  --danger: #c2410c;

  /* 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(251,122,21,.5);
  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: #ffe4cc; }
.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; }
