:root {
  --paper: #f7f5ef;
  --paper-2: #f0ede5;
  --paper-3: #e7e3da;
  --card: #fbfaf6;
  --ink: #1c1b1f;
  --ink-2: #47454c;
  --muted: #8b877d;
  --line: #d8d4ca;
  --rule: #ebe8e0;
  --lip: #b6b2a9;
  --accent: #6b4de6;
  --accent-soft: #ece6fb;
  --hatch: repeating-linear-gradient(135deg, #b9a8f1 0 3px, #ece6fb 3px 7px);
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cap {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.muted { color: var(--muted); }
.px { display: block; flex: none; }

/* ---------- Sign-in gate ---------- */
/* The loading screen: shown while the session is checked and between pages. The page
   fades out behind it, and in again once it is ready. */
body { transition: opacity .24s ease; }
html.auth-pending body, html.is-leaving body { opacity: 0; pointer-events: none; }
html.is-leaving body { transition-duration: .16s; }
html.auth-pending::after, html.is-leaving::after {
  content: '';
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
  width: 94px;
  height: 10px;
  margin: -5px 0 0 -47px;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 10px 10px no-repeat,
    repeating-linear-gradient(90deg, var(--lip) 0 10px, transparent 10px 12px);
  opacity: 0;
  animation: lk-load .96s steps(8) infinite, lk-show .2s ease .18s forwards;
}
@keyframes lk-load { to { background-position: 96px 0, 0 0; } }
@keyframes lk-show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  html.auth-pending::after, html.is-leaving::after { animation: lk-show .01s .3s forwards; }
}
.auth-fatal { max-width: 420px; margin: 18vh auto; padding: 0 16px; font-size: 13px; color: var(--ink-2); }
.auth-fatal b { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.auth-fatal button { padding: 8px 14px; background: var(--ink); color: #fff; border: 0; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .06em;
  text-transform: none;
}
.user-chip:hover { border-color: var(--ink); }
.uc-av { display: grid; place-items: center; width: 22px; height: 22px; background: var(--ink); color: #fff; font-weight: 700; font-size: 9px; letter-spacing: .04em; }
.uc-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; font-family: var(--sans); font-size: 11.5px; font-weight: 600; }

/* account menu */
.user-menu { position: relative; }
button.user-chip { font: inherit; cursor: pointer; }
.uc-caret { width: 7px; height: 7px; margin: -3px 0 0 2px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); transition: transform .16s ease, margin .16s ease; }
.user-chip[aria-expanded="true"] { border-color: var(--ink); }
.user-chip[aria-expanded="true"] .uc-caret { margin-top: 3px; transform: rotate(225deg); }
.um-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2500;
  width: 300px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(28, 27, 31, .9);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease;
  text-transform: none;
  letter-spacing: 0;
}
.um-pop.is-open { opacity: 1; transform: none; }
.um-head { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--ink); color: #fff; border-bottom: 3px solid var(--accent); }
.um-av { display: grid; place-items: center; width: 42px; height: 42px; flex: none; background: var(--paper); box-shadow: 3px 3px 0 var(--accent); font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--ink); }
.um-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.um-who small { font-family: var(--mono); font-size: 7.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #8f8d96; }
.um-who b { overflow: hidden; font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.um-who > span { overflow: hidden; font-family: var(--mono); font-size: 10px; color: #b7b4c0; text-overflow: ellipsis; white-space: nowrap; }

.um-group { padding: 8px 6px 4px; border-bottom: 1px solid var(--line); }
.um-cap { display: flex; align-items: center; gap: 8px; padding: 0 8px 4px; font-family: var(--mono); font-size: 7.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.um-cap::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.um-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 2px;
  padding: 7px 8px;
  background: none;
  border: 1px solid transparent;
  color: var(--ink);
  font-family: var(--sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.um-ico { display: grid; place-items: center; width: 28px; height: 28px; flex: none; background: var(--card); border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: -.04em; color: var(--ink); }
.um-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.um-text span { font-size: 12.5px; font-weight: 600; }
.um-text small { overflow: hidden; font-size: 10.5px; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
.um-go { font-style: normal; font-size: 14px; color: var(--muted); transition: transform .12s ease; }
.um-tag { padding: 2px 6px; background: var(--paper-3); font-family: var(--mono); font-size: 8px; font-style: normal; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.um-tag.is-new { background: var(--accent); color: #fff; }
.um-item:hover, .um-item:focus-visible { background: var(--card); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); outline: none; }
.um-item:hover .um-ico, .um-item:focus-visible .um-ico { background: var(--ink); border-color: var(--ink); color: #fff; }
.um-item:hover .um-go { color: var(--ink); transform: translateX(2px); }
.um-item.is-here .um-ico { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); color: #fff; }

.um-out { width: auto; margin: 6px; }
.um-out .um-ico { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.um-out .um-text span { color: var(--accent); }
.um-out:hover, .um-out:focus-visible { border-color: var(--accent); box-shadow: 3px 3px 0 var(--accent); }
.um-out:hover .um-ico, .um-out:focus-visible .um-ico { background: var(--accent); border-color: var(--accent); color: #fff; }

.um-foot { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; background: var(--paper-2); border-top: 1px solid var(--line); }
.um-foot span { margin-left: auto; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--muted); }
.um-item.um-mini { width: auto; margin: 0; padding: 4px 6px; font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.um-item.um-mini:hover, .um-item.um-mini:focus-visible { box-shadow: none; color: var(--ink); }
@media (max-width: 760px) {
  .uc-name { display: none; }
  .um-pop { width: min(300px, calc(100vw - 24px)); }
}
@media (prefers-reduced-motion: reduce) { .um-pop, .uc-caret, .um-go { transition: none; } }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  grid-template-rows: 46px minmax(0, 1fr);
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.addr {
  flex: 0 1 560px;
  min-width: 0;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr b { color: var(--ink); font-weight: 600; }

/* breadcrumb: where you are, each step a link back up; the sync state at the end */
.crumbs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 120px;
  max-width: 640px;
  height: 30px;
  padding: 0 4px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.cr-trail { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
.cr-trail a, .cr-here { overflow: hidden; text-overflow: ellipsis; }
.cr-trail a { flex: 0 1 auto; min-width: 0; padding: 4px 2px; color: var(--ink-2); text-decoration: none; }
.cr-trail a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.cr-home { display: inline-flex; align-items: center; gap: 7px; flex: none !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink) !important; }
.cr-home:hover { text-decoration: none !important; }
.cr-logo { display: grid; place-items: center; width: 20px; height: 20px; background: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); font-size: 10px; color: #fff; letter-spacing: 0; }
.cr-home:hover .cr-logo { background: var(--accent); box-shadow: none; }
.cr-sep { flex: none; color: var(--lip); }
.cr-here { flex: 0 0 auto; max-width: 220px; padding: 3px 7px; background: var(--card); border: 1px solid var(--ink); font-weight: 700; color: var(--ink); }
.cr-status { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-left: auto; padding-left: 12px; border-left: 1px solid var(--line); font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cr-status:empty { display: none; }
@media (max-width: 1180px) { .cr-status { display: none; } }
@media (max-width: 1080px) { .topmeta > span { display: none; } }
@media (max-width: 960px) {
  .cr-word, .uc-name { display: none; }
  .tsearch { flex-basis: 220px; }
}
.cr-status::before { content: ''; width: 6px; height: 6px; background: var(--muted); }
.cr-status[data-state="synced"]::before { background: var(--ink); }
.cr-status[data-state="loading"]::before, .cr-status[data-state="saving"]::before { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.cr-status[data-state="offline"], .cr-status[data-state="error"], .cr-status[data-state="setup"] { color: var(--accent); }
.cr-status[data-state="offline"]::before, .cr-status[data-state="error"]::before, .cr-status[data-state="setup"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.topmeta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.topmeta .sep { width: 1px; height: 14px; background: var(--line); }
.reset-btn {
  margin-left: 6px;
  padding: 4px 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.reset-btn:hover { color: var(--ink); border-color: var(--ink); }

.side {
  position: relative;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.brand strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.brand small {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 30px;
}
.steps::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 9px;
  bottom: 9px;
  width: 1.5px;
  background: var(--ink);
}
.step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: left;
}
.step .dot {
  width: 18px;
  height: 18px;
  flex: none;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  transition: background .15s;
}
.step:hover .dot { background: var(--paper-3); }
.step.is-active { color: var(--ink); font-weight: 700; }
.step.is-active .dot { background: var(--ink); }
.step-badge {
  margin-left: -6px;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
}
.side-vert {
  position: absolute;
  right: 10px;
  bottom: 18px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.main {
  overflow: auto;
  padding: 0 18px 28px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 53px, var(--rule) 53px 54px);
  background-attachment: local;
}
.page { max-width: 1240px; }
.page.enter { animation: page-in .32s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .page.enter { animation: none; } }

/* ---------- motion: a section builds up when it opens ---------- */
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today) {
  animation: fx-rise .46s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--fx-i, 0) * 55ms + 70ms);
}
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today):nth-child(2) { --fx-i: 1; }
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today):nth-child(3) { --fx-i: 2; }
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today):nth-child(4) { --fx-i: 3; }
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today):nth-child(5) { --fx-i: 4; }
.page.enter :is(.metric, .acard, .gcard, .ccard, .tool, .panel, .set-actions, .today):nth-child(n + 6) { --fx-i: 5; }
@keyframes fx-rise { from { opacity: 0; transform: translateY(12px); } }
/* calendar days sweep in, cell bars fill cell by cell */
.page.enter .cal-day { animation: fx-pop-in .34s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(var(--fx-i, 0) * 12ms + 160ms); }
@keyframes fx-pop-in { from { opacity: 0; transform: scale(.7); } }
.page.enter .cellbar i.on { animation: fx-cell .24s ease-out both; animation-delay: calc(var(--i, 0) * 22ms + 260ms); }
@keyframes fx-cell { from { opacity: 0; transform: scaleY(.25); } }

/* a row that just arrived */
.fx-new { animation: fx-flash 1.6s ease-out; }
@keyframes fx-flash { 0%, 25% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } }
/* something worth celebrating */
.fx-pop { animation: fx-pop .62s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes fx-pop { 0% { transform: scale(.94); } 45% { transform: scale(1.045); box-shadow: 0 0 0 4px var(--accent-soft); } }
.fx-stamp .badge { animation: fx-stamp .55s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes fx-stamp { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 60% { transform: scale(.9) rotate(-3deg); opacity: 1; } }
/* pixel confetti (js/fx.js) */
.fx-layer { position: fixed; inset: 0; z-index: 4000; pointer-events: none; overflow: hidden; }
.fx-layer i { position: absolute; display: block; }
/* the bell count when something new arrives */
.tb-count.is-bump { animation: fx-bump .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes fx-bump { 40% { transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) {
  .page.enter *, .fx-new, .fx-pop, .fx-stamp .badge, .tb-count.is-bump { animation: none !important; }
}

/* ---------- Sub-page header ---------- */
.ph {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 0 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}
.ph h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.ph .route { margin-left: auto; }
.note { margin: 10px 0 0; font-size: 11px; color: var(--ink-2); }

.banner {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
}
.banner b { color: var(--accent); font-weight: 600; }
.banner.is-quiet { background: var(--paper-2); border-left-color: var(--ink); }

/* ---------- Plan ---------- */
.plan-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 14px 0 12px;
}
.plan-head h1 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.fill { display: flex; align-items: flex-end; gap: 14px; }
.fill-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-bottom: 6px; }
.fill-count { font-family: var(--mono); font-size: 11px; font-weight: 600; white-space: nowrap; }
.fill-big {
  padding: 12px 14px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--ink);
  color: var(--ink);
}

.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 14px;
  align-items: stretch;
}
.panel {
  padding: 12px 14px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.panel-head .muted { font-weight: 500; font-size: 8.5px; color: var(--ink-2); letter-spacing: .12em; }

.shelf { position: relative; margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.seam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.tier { position: relative; z-index: 1; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 6px; }
.tier-label { align-self: end; display: flex; flex-direction: column; gap: 3px; padding-bottom: 6px; color: var(--ink); }
.tier-slots { display: flex; gap: 3px; height: calc(var(--clear) * .28px); }

.slot { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.slot-box { position: relative; flex: 1; display: flex; align-items: flex-end; border-radius: 1px; }
.slot .lip { display: block; height: 3px; margin-top: 3px; background: var(--lip); }

.block {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--ink);
  border-radius: 1px;
  cursor: grab;
  touch-action: none;
}
.block::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 22%;
  right: 22%;
  height: 2px;
  background: #5c5a62;
}
.slot.is-over .block {
  height: calc(100% * var(--ratio));
  background: var(--hatch);
  border: 1.5px solid var(--accent);
}
.slot.is-over .block::before { display: none; }
.over-tag {
  position: absolute;
  z-index: 5;
  top: 18%;
  left: -40%;
  padding: 3px 7px;
  background: var(--card);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(-4deg);
  pointer-events: none;
  box-shadow: 0 3px 8px rgba(40, 30, 90, .12);
}

.slot.is-empty .slot-box,
.slot.is-held .slot-box {
  border: 1px dashed #9a968d;
  background: rgba(251, 250, 246, .55);
  cursor: pointer;
}
.slot.is-empty .slot-box:hover { background: var(--paper-3); }
.slot.is-held .slot-box { align-items: center; justify-content: center; }
.held-tag {
  padding: 3px 5px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}

.slot.t-ok .slot-box { border: 2px dashed var(--ink); background: var(--paper-3); }
.slot.t-bad .slot-box { border: 2px dashed var(--accent); background: var(--hatch); }
.slot.just-placed .block { animation: placed .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes placed { from { transform: scale(.82); opacity: .4; } to { transform: none; opacity: 1; } }
.flash .slot-box, .share-row.flash { animation: flash 1.6s ease-out 2; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 3px var(--accent); } }

.share-panel .panel-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 76px 40px;
  align-items: center;
  gap: 10px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
}
.share-row:last-child { border-bottom: 0; }
.share-name { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.cells { display: grid; grid-template-columns: repeat(7, 4px); gap: 2px 2px; }
.cells i { width: 4px; height: 9px; background: var(--ink); }
.valbox {
  display: flex;
  justify-content: center;
  padding: 6px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
}
.verdict { font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: .12em; color: var(--ink-2); }
.share-row.v-under .valbox,
.share-row.v-over .valbox { border: 1.5px solid var(--accent); color: var(--accent); box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3px var(--accent-soft); }
.share-row.v-under .verdict,
.share-row.v-over .verdict { color: var(--accent); }

.plan-foot {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 26px;
}
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.status-n {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0;
}
.hint { margin: 10px 0 0; font-size: 11px; line-height: 1.45; color: var(--ink-2); }
.hint.is-bad { padding-left: 9px; border-left: 2px solid var(--accent); color: var(--accent); font-family: var(--mono); font-size: 10px; }

.palette { padding: 4px; margin: -4px; border: 1px dashed transparent; }
.palette.t-return { border-color: var(--ink); background: var(--paper-3); }
.palette-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.palette-head .hint-r { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--ink-2); }
.palette-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

.sku-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--ink);
  user-select: none;
}
.sku-card b { font-size: 11.5px; font-weight: 600; }
.sku-card .cap { font-size: 8px; letter-spacing: .12em; }
.sku-card .dims { display: flex; align-items: flex-end; gap: 5px; margin-top: 5px; color: var(--ink); }
.sku-card .dims em { font-style: normal; font-family: var(--mono); font-size: 8px; color: var(--muted); line-height: 1; }
.palette .sku-card { cursor: grab; touch-action: none; transition: opacity .15s; }
.palette .sku-card:hover { border-color: var(--ink-2); border-bottom-color: var(--ink); }
.is-source { opacity: .3; }

/* ---------- Drag layer ---------- */
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
#drag-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.ghost { position: fixed; top: 0; left: 0; will-change: transform; }
.ghost .sku-card { box-shadow: 0 16px 34px rgba(28, 27, 31, .2), 0 2px 6px rgba(28, 27, 31, .12); border-color: var(--ink-2); }
.readout {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 18px rgba(28, 27, 31, .22);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  white-space: nowrap;
}
.readout.is-bad { background: var(--accent); }

/* ---------- Validate ---------- */
.v-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  margin-bottom: 10px;
  padding: 12px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.v-label { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.v-sub { display: block; margin-top: 2px; font-family: var(--mono); font-size: 9px; color: var(--ink-2); }
.v-desc { font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.v-desc b { font-weight: 600; color: var(--ink); }
.v-row.primary .v-label, .v-row.has-issue:hover .v-label { color: var(--accent); }
.v-row.is-clear { opacity: .6; }
.fix {
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.v-row.primary .fix, .v-row.has-issue:hover .fix, .fix:focus-visible { opacity: 1; }
.v-ok { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; color: var(--muted); }

/* ---------- SKU library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lib-grid .sku-card { padding: 10px 12px 8px; background: var(--paper-2); }
.lib-grid .sku-card.is-last { background: var(--accent-soft); border-color: var(--accent); border-bottom-color: var(--accent); }
.lib-grid .sku-card.is-off { opacity: .55; }

/* ---------- Terms ---------- */
.t-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 96px 40px;
  align-items: center;
  gap: 16px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.bar20 { display: flex; gap: 1.5px; }
.bar20 i { width: 6.5px; height: 13px; border: 1px solid var(--ink); background: var(--ink); }
.bar20 i.off { background: transparent; border-color: #bcb8af; }
.bar20 i.win { border-color: var(--accent); }
.t-row .valbox { justify-self: end; min-width: 76px; }

/* ---------- Stores ---------- */
.s-row {
  display: grid;
  grid-template-columns: 84px minmax(140px, 1fr) 40px 170px minmax(150px, 210px);
  align-items: center;
  gap: 18px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.s-row b { font-size: 11.5px; font-weight: 600; }
.plan-bar {
  height: 13px;
  border: 1px solid #c9c5bc;
  background: repeating-linear-gradient(135deg, #c9c5bc 0 2px, transparent 2px 5px);
}
.plan-bar span { display: block; height: 100%; background: var(--ink); }
.bar40 { display: flex; gap: 1px; }
.bar40 i { width: 3px; height: 15px; background: var(--ink); }
.bar40 i.off { background: transparent; outline: 1px dotted #a9a59c; outline-offset: -1px; }
.s-note { font-family: var(--mono); font-size: 9.5px; line-height: 1.5; color: var(--ink-2); }
.audit {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-left: 3px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

/* ---------- Task ---------- */
.task-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 4px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  color: var(--ink-2);
}
button.task { cursor: pointer; }
button.task:hover { background: var(--paper-2); }
.task b { font-weight: 600; color: var(--ink); }
.task.is-done { color: var(--ink); }
.check { width: 19px; height: 19px; border: 1.5px solid var(--ink); border-radius: 50%; display: grid; place-items: center; }
.task.is-done .check { background: var(--ink); }
.check svg { width: 11px; height: 11px; }
.task time { font-family: var(--mono); font-size: 10px; color: var(--ink); }

.t-count { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); }
.t-count strong { display: block; margin-bottom: 4px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.t-ready { margin-top: 14px; padding: 16px; background: var(--ink); color: #fff; }
.t-ready strong { display: block; font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.t-ready span { display: block; margin-top: 6px; font-family: var(--mono); font-size: 8.5px; line-height: 1.6; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.t-ready.is-blocked { background: var(--card); color: var(--ink); border: 1.5px dashed var(--accent); }
.t-ready.is-blocked strong { color: var(--accent); }
.t-back {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
}
.t-back:hover { background: var(--ink); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .plan-grid, .plan-foot, .task-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s-row { grid-template-columns: 84px minmax(0, 1fr) 40px; }
  .s-row .bar40, .s-row .s-note { grid-column: 2 / -1; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .topmeta > span { display: none; }
  .side { padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand, .side-vert { display: none; }
  .steps { flex-direction: row; gap: 14px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .steps::before { display: none; }
  .step .dot { width: 12px; height: 12px; }
  .main { padding: 0 16px 24px; }
  .plan-head { flex-direction: column; align-items: flex-start; }
  .palette-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-row { grid-template-columns: minmax(0, 1fr); }
  .fix { opacity: 1; justify-self: start; }
  .t-row { grid-template-columns: 100px minmax(0, 1fr) 80px; }
  .t-row .verdict { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- top bar: search (Ctrl/⌘ K) ---------- */
.tsearch { position: relative; flex: 0 1 340px; min-width: 0; }
.ts-field { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); cursor: text; }
.ts-field:hover { border-color: var(--lip); }
.tsearch.is-open .ts-field, .ts-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-field input { flex: 1; min-width: 0; height: 100%; padding: 0; background: none; border: 0; outline: none; font-family: var(--sans); font-size: 12px; color: var(--ink); }
.ts-field input::placeholder { color: var(--muted); }
.ts-field input::-webkit-search-cancel-button { display: none; }
.ts-field kbd { padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--paper-2); font-family: var(--mono); font-size: 9px; color: var(--muted); white-space: nowrap; }
.ts-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 2500;
  width: max(100%, 420px);
  max-height: min(460px, 70vh);
  overflow-y: auto;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(28, 27, 31, .9);
}
.ts-group { display: block; padding: 10px 14px 4px; font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.ts-item { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 8px 14px; color: var(--ink); text-decoration: none; }
.ts-item.is-active { background: var(--ink); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.ts-title { font-family: var(--sans); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-sub { flex: none; max-width: 55%; font-family: var(--mono); font-size: 10px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.ts-item.is-active .ts-sub { color: #b7b4c0; }
.ts-empty { margin: 0; padding: 16px 14px; font-family: var(--sans); font-size: 12px; line-height: 1.5; color: var(--ink-2); text-transform: none; letter-spacing: 0; }

/* ---------- top bar: notification bell ---------- */
.tbell { position: relative; }
.tb-btn { position: relative; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: var(--card); border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.tb-btn:hover, .tb-btn[aria-expanded="true"] { border-color: var(--ink); }
.tb-count { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 3px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 9px; font-weight: 700; line-height: 16px; letter-spacing: 0; text-align: center; }
.tb-btn.has-unread svg { animation: ring .6s ease 1; transform-origin: 50% 10%; }
@keyframes ring { 20% { transform: rotate(14deg); } 45% { transform: rotate(-10deg); } 70% { transform: rotate(5deg); } }
.tb-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 2500;
  width: 340px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(28, 27, 31, .9);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
}
.tb-pop.is-open { opacity: 1; transform: none; }
.tb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; border-bottom: 2px solid var(--ink); }
.tb-head b { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--ink); }
.tb-head span { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tb-link { padding: 0; background: none; border: 0; font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); cursor: pointer; }
.tb-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tb-list { max-height: min(420px, 65vh); overflow-y: auto; }
.tb-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tb-item:last-child { border-bottom: 0; }
.tb-item:hover, .tb-item:focus-visible { background: var(--paper-3); outline: none; }
.tb-dot { width: 8px; height: 8px; flex: none; margin-top: 5px; background: var(--ink); }
.tb-item.t-alert .tb-dot { background: var(--accent); }
.tb-item.t-warn .tb-dot { background: #a18ff0; }
.tb-item.t-info .tb-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.tb-item.t-good .tb-dot { background: var(--ink); }
.tb-ghead { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 7px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.tb-head .tb-unread { margin-left: auto; color: var(--accent); }
.tb-item.is-read { opacity: .55; }
.tb-item.is-read .tb-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--lip); }
.tb-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-family: var(--sans); }
.tb-tool { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tb-main b { font-size: 12.5px; font-weight: 600; }
.tb-text { font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.tb-empty { margin: 0; padding: 18px 14px; font-family: var(--sans); font-size: 12px; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .addr, .topbar .crumbs { display: none; }
  .tsearch { flex: 1 1 auto; }
  .ts-field kbd { display: none; }
  .ts-pop { width: calc(100vw - 24px); }
  .tb-pop { width: min(340px, calc(100vw - 24px)); right: -44px; }
}
@media (prefers-reduced-motion: reduce) { .tb-pop { transition: none; } .tb-btn.has-unread svg { animation: none; } }
