@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f1f4f9;
  --surface: #ffffff;
  --sunk: #f6f8fc;
  --hover: #f3f6fc;
  --ink: #0d1a2e;
  --ink-2: #4a5870;
  --ink-3: #7c889c;
  --line: #e3e8f0;
  --line-2: #cdd5e2;
  --brand: #1a4fb4;
  --brand-tint: #e6edfb;
  --late: #b42318;
  --late-tint: #fdeceb;
  --ok: #13734a;
  --ok-tint: #e3f4eb;
  --warn: #8c5a00;
  --warn-tint: #fff1d1;
  --seg: #e6ebf3;
  --display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --text: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0a1220;
    --surface: #111b2e;
    --sunk: #0e182a;
    --hover: #162239;
    --ink: #e9eef8;
    --ink-2: #a7b3c8;
    --ink-3: #7d8aa2;
    --line: #223049;
    --line-2: #2f4160;
    --brand: #7aa7ff;
    --brand-tint: #16295199;
    --late: #ff8a80;
    --late-tint: #3b1a1a;
    --ok: #6fd6a0;
    --ok-tint: #13301f;
    --warn: #f2c46b;
    --warn-tint: #392c10;
    --seg: #0e182a;
  }
  /* The logo artwork has a white background; keep it intact on dark surfaces. */
  .logo {
    background: #fff;
    border-radius: 8px;
    padding: 3px 8px;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--brand);
}
h1,
h2 {
  font-family: var(--display);
  margin: 0;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  font-weight: 650;
  line-height: 1.15;
}
h2 {
  font-size: 1rem;
  font-weight: 650;
}
dl,
dd,
p {
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.icon {
  flex: none;
}
.muted-text,
small {
  color: var(--ink-2);
}

/* ---------- Shell: sidebar on desktop, top bar and bottom tabs on phones ---------- */
.shell {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
}
.side {
  display: contents;
}
.brand {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: block;
  height: 30px;
  width: auto;
}
.badges {
  display: flex;
  gap: 6px;
}
.tools {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 10px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.tools .who,
.tools .stamp,
.tools .lbl {
  display: none;
}
.btn.tool {
  width: 38px;
  height: 38px;
  padding: 0;
}
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  border-top: 2px solid transparent;
}
.nav-link.active {
  color: var(--brand);
  border-top-color: var(--brand);
}
.content {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  padding: 18px 14px calc(88px + env(safe-area-inset-bottom));
}

@media (min-width: 960px) {
  .shell {
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: 1fr;
  }
  .side {
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 22px 14px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    grid-column: 1;
    grid-row: 1;
  }
  .brand {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 0 8px;
    border: 0;
    background: none;
  }
  .logo {
    height: 38px;
  }
  .nav {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: none;
    border: 0;
    padding: 0;
  }
  .nav-link {
    flex-direction: row;
    gap: 12px;
    padding: 10px 12px;
    font-size: 15px;
    color: var(--ink-2);
    border: 0;
    border-radius: 9px;
  }
  .nav-link:hover {
    background: var(--hover);
  }
  .nav-link.active {
    background: var(--brand-tint);
    color: var(--brand);
  }
  .tools {
    position: static;
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 8px 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: none;
  }
  .tools .who {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ink-2);
  }
  .tools .stamp {
    display: block;
    font-size: 12.5px;
    color: var(--ink-3);
  }
  .tools .lbl {
    display: inline;
  }
  .btn.tool {
    width: auto;
    height: auto;
    padding: 8px 12px;
    justify-content: flex-start;
  }
  .content {
    grid-column: 2;
    grid-row: 1;
    padding: 40px clamp(24px, 4vw, 56px) 72px;
    max-width: 1280px;
  }
}

/* ---------- Basics ---------- */
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  background: var(--seg);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.warn {
  background: var(--warn-tint);
  color: var(--warn);
}
.chip.ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.chip.danger {
  background: var(--late-tint);
  color: var(--late);
}
.chip.muted {
  background: var(--seg);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  cursor: pointer;
}
.btn:hover {
  background: var(--hover);
}
.btn.ghost {
  color: var(--ink-2);
}
.btn.wide {
  width: 100%;
  margin: 0;
  border-radius: 0;
  border-width: 1px 0 0;
  padding: 12px;
  color: var(--brand);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--brand);
}
.icon-btn:hover {
  background: var(--brand-tint);
}
input[type="search"],
select {
  font: inherit;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 9px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--seg);
  border-radius: 10px;
}
.seg-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(13 26 46 / 14%);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.filters input[type="search"] {
  flex: 1 1 220px;
}
.page-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.sub-count {
  font-size: 13.5px;
  color: var(--ink-2);
}
.state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: var(--ink-2);
}
.state.error {
  flex-direction: column;
  align-items: flex-start;
  margin: 12px;
  border-radius: 10px;
  background: var(--late-tint);
  color: var(--late);
}
.row-actions {
  display: flex;
  gap: 8px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}
.center {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}
.center .logo {
  height: 52px;
}

/* ---------- Today ---------- */
.brief {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 48px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-2);
}
.today-date {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
}
.today-date .day {
  grid-row: 1 / span 2;
  font: 700 clamp(60px, 9vw, 96px) / 0.85 var(--display);
  letter-spacing: -0.045em;
}
.today-date .weekday {
  align-self: end;
  font: 650 clamp(20px, 2.4vw, 26px) / 1.1 var(--display);
}
.today-date .month {
  align-self: start;
  color: var(--ink-2);
}
.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 18px clamp(20px, 4vw, 48px);
}
.figures dt {
  font-size: 13px;
  color: var(--ink-2);
}
.figures dd {
  font: 650 clamp(26px, 3.2vw, 38px) / 1.15 var(--display);
  letter-spacing: -0.02em;
}
.figures dd a {
  color: inherit;
  text-decoration: none;
}
.figures dd a:hover {
  text-decoration: underline;
}
.figure {
  font: inherit;
}
.figures .late,
.late {
  color: var(--late);
}
.figures.compact {
  margin: 0 0 20px;
}
.figures.compact dd {
  font-size: 22px;
}
.cols {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 1100px) {
  .cols {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }
}

/* ---------- Panels and rows ---------- */
.panel {
  container-type: inline-size;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.panel + .panel {
  margin-top: 16px;
}
.cols .panel + .panel {
  margin-top: 0;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 16px 10px;
}
.count {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
.row {
  border-top: 1px solid var(--line);
}
.row > summary {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: start;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
}
.row > summary::-webkit-details-marker {
  display: none;
}
.row > summary:hover,
.row[open] > summary {
  background: var(--hover);
}
.row.plain {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 16px;
}
.row.is-done .title {
  color: var(--ink-2);
}
.main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.title {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.m.late {
  color: var(--late);
  font-weight: 650;
}
.m.focus {
  color: var(--brand);
  font-weight: 650;
}
.m.warn {
  color: var(--warn);
  font-weight: 650;
}
.m.ok {
  color: var(--ok);
}
.m.clip {
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due {
  padding-top: 2px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.due.late {
  color: var(--late);
  font-weight: 650;
}
.due.today {
  color: var(--brand);
  font-weight: 650;
}
.dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
}
.dot.doing {
  border-color: var(--brand);
  background: linear-gradient(90deg, var(--brand) 50%, transparent 50%);
}
.dot.pending {
  border-color: var(--warn);
}
.dot.done {
  border-color: var(--ok);
  background: var(--ok);
}
.dot.potential {
  border-style: dotted;
}
.detail {
  padding: 2px 16px 14px 42px;
  background: var(--hover);
  color: var(--ink-2);
}
.detail > * + * {
  margin-top: 8px;
}
.notes {
  white-space: pre-wrap;
  color: var(--ink);
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
}
.checklist li.done {
  color: var(--ink-3);
  text-decoration: line-through;
}
.group > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  background: var(--sunk);
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.group > summary::-webkit-details-marker {
  display: none;
}
.group > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  align-self: center;
}
.group[open] > summary::before {
  transform: rotate(45deg);
}
.hint {
  padding: 0 16px 12px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.task-groups .panel + .panel {
  margin-top: 16px;
}
.bucket.lewat .panel-head h2 {
  color: var(--late);
}

/* ---------- Customers: list and detail side by side ---------- */
.content.is-split {
  padding: 14px 14px calc(88px + env(safe-area-inset-bottom));
}
.split {
  display: block;
}
.pane-detail {
  display: none;
}
.split.has-selection .pane-list {
  display: none;
}
.split.has-selection .pane-detail {
  display: block;
}
.list-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.crows {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.crow {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 9px;
  color: inherit;
  text-decoration: none;
}
.crow:hover {
  background: var(--hover);
}
.crow[aria-current="true"] {
  background: var(--brand-tint);
}
.cat {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--seg);
  color: var(--ink-2);
  font: 700 12.5px var(--display);
}
.cat.big {
  width: 34px;
  height: 34px;
  font-size: 15px;
}
.bal {
  font-size: 13px;
  font-weight: 650;
  color: var(--late);
}
.crows .btn.wide {
  border-radius: 9px;
  border-width: 1px;
  margin-top: 8px;
}
.overview {
  max-width: 560px;
}
.overview h2 {
  margin-bottom: 16px;
  font-size: 1.15rem;
}
.overview .hint {
  padding: 0;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 10px;
  font-weight: 650;
  text-decoration: none;
}
.headline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.col .panel + .panel {
  margin-top: 0;
}
.facts {
  display: grid;
  gap: 10px;
  padding: 0 16px 14px;
}
.facts dt {
  font-size: 12.5px;
  color: var(--ink-3);
}
.facts dd {
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  gap: 6px;
  flex: none;
}

@media (min-width: 960px) {
  .content.is-split {
    max-width: none;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }
  .split,
  .split.has-selection {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    height: 100%;
  }
  .split .pane-list,
  .split.has-selection .pane-list {
    display: block;
    overflow: auto;
    padding: 32px 16px 40px;
    border-right: 1px solid var(--line);
  }
  .split .pane-detail,
  .split.has-selection .pane-detail {
    display: block;
    overflow: auto;
    padding: 32px clamp(20px, 3vw, 44px) 56px;
    container-type: inline-size;
  }
  .pane-list .page-head {
    padding: 0 10px;
  }
  .back {
    display: none;
  }
}
@container (min-width: 900px) {
  .detail-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

/* ---------- Sales ---------- */
.ledger {
  margin-bottom: 20px;
}
.meter {
  height: 8px;
  margin: 16px 0 8px;
  border-radius: 99px;
  background: var(--seg);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  background: var(--ok);
}
.ledger .hint {
  padding: 0;
}
.thead {
  display: none;
}
.sale-cols > summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}
.sale-cols > summary > .main {
  grid-column: 1 / 3;
  grid-row: 1;
}
.sale-cols > summary > .chip {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: start;
}
.sale-cols .n {
  grid-row: 2;
  font-weight: 650;
}
.sale-cols .n::before {
  content: attr(data-label);
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.sale .detail {
  padding-left: 16px;
}
@container (min-width: 640px) {
  .thead.sale-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px 110px 110px 104px;
    gap: 12px;
    padding: 6px 16px;
    border-top: 1px solid var(--line);
    background: var(--sunk);
    font-size: 12.5px;
    color: var(--ink-3);
  }
  .sale-cols > summary {
    grid-template-columns: minmax(0, 1fr) 110px 110px 110px 104px;
    align-items: center;
  }
  .sale-cols > summary > .main,
  .sale-cols > summary > .chip,
  .sale-cols .n {
    grid-column: auto;
    grid-row: auto;
  }
  .sale-cols .n::before {
    display: none;
  }
  .sale-cols .n,
  .thead .n {
    text-align: right;
  }
  .sale-cols > summary > .chip {
    justify-self: end;
  }
}
