/* Back office: one big frosted panel over the room, tabs along the top,
   page headers, dashboard, forms, charts. */

.office {
  height: calc(100% - 28px); margin: 14px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 32px; background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur); box-shadow: var(--shadow-lg);
}
.office-top { display: flex; align-items: center; gap: 12px; padding: 16px 22px 10px; flex: none; }
.brand-pill {
  display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 240px; height: 46px; padding: 0 16px 0 5px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--glass-border); color: var(--ink);
  font-weight: 650; letter-spacing: -0.01em;
}
.brand-pill:hover { text-decoration: none; background: var(--surface-hover); }
.brand-pill .logo-mark { width: 34px; height: 34px; }
.brand-pill .logo-mark .icon { width: 18px; height: 18px; }

/* The pill tab bar; the chosen tab is a black pill that slides (motion.js). */
.tabs-bar {
  display: flex; align-items: center; gap: 2px; margin-left: auto; padding: 4px; min-width: 0;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--glass-border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tabs-bar .tab {
  position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 999px; color: var(--ink-2); font-weight: 550; font-size: 13.5px; white-space: nowrap; text-decoration: none;
  transition: color 0.25s;
}
.tabs-bar .tab:hover { color: var(--ink); }
.tabs-bar .tab[aria-current='page'] { background: var(--surface-inverse); color: var(--ink-inverse); }
.tabs-bar .tab .badge { height: 18px; padding: 0 6px; font-size: 11px; }
.tabs-bar.has-pill { position: relative; }
.tabs-bar.has-pill .tab[aria-current='page'] { background: transparent; }
.nav-pill {
  position: absolute; top: 0; left: 0; z-index: 0; border-radius: 999px; pointer-events: none;
  background: var(--surface-inverse); box-shadow: var(--shadow-sm);
}
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top-actions .round-btn { width: 42px; height: 42px; background: var(--surface); }
.top-actions .till-btn { height: 42px; }
.office-back { width: 42px; height: 42px; background: var(--surface); }
.office-back .icon { width: 18px; height: 18px; }
.office-top .me {
  width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid var(--glass-border);
  background: var(--surface); display: grid; place-items: center;
}
.office-top .me .avatar { width: 34px; height: 34px; font-size: 12px; }

.office-content { flex: 1; min-height: 0; overflow: auto; padding: 14px 26px 40px; scroll-padding-top: 20px; }
.subnav { display: flex; gap: 8px; max-width: 1320px; margin: 0 auto 18px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav .chip { height: 36px; background: var(--surface-2); }
.subnav .chip[aria-current='page'] { background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--ink-inverse); }
.subnav .chip[aria-current='page'] .count { background: var(--bad); color: #fff; }
.subnav .chip:hover { text-decoration: none; }

@media (max-width: 1180px) {
  .office-top { flex-wrap: wrap; row-gap: 10px; }
  .tabs-bar { order: 3; flex: 1 0 100%; margin-left: 0; }
  .top-actions { margin-left: auto; }
}
@media (max-width: 860px) {
  .office { height: 100%; margin: 0; border-radius: 0; border: 0; }
  .office-top { padding: 10px 12px 8px; gap: 8px; }
  .brand-pill { height: 42px; flex: 0 1 auto; min-width: 42px; max-width: calc(100vw - 296px); }
  .page-head h1 { font-size: 26px; }
  .page-head .actions { margin-left: 0; }
  /* The sync status shrinks to its coloured dot; tapping it still explains. */
  .top-actions .pill { width: 42px; height: 42px; padding: 0; justify-content: center; font-size: 0; }
  .top-actions .pill .dot { width: 10px; height: 10px; }
  .top-actions .till-btn { width: 42px; padding: 0; }
  .top-actions .till-btn .till-label { display: none; }
  .top-actions .till-btn > .icon:first-child,
  .top-actions .btn.primary.till-btn:not(.icon-only):not(.charge) > .icon:first-child { margin: 0; width: 20px; height: 20px; padding: 0; background: none; color: inherit; }
  .office-content { padding: 10px 14px 32px; }
}

/* A small phone has room for the logo only, so all the buttons stay on one row. */
@media (max-width: 440px) {
  .brand-pill { width: 42px; max-width: 42px; padding: 0; justify-content: center; }
  .brand-pill .biz { display: none; }
  .top-actions { gap: 6px; }
  .office-top { gap: 6px; }
}

.page { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; font-weight: 400; letter-spacing: -0.035em; line-height: 1.15; }
.page-head .sub { margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .input-wrap { width: min(320px, 100%); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.grid-2e { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Dashboard header: a big light greeting, the payment mix as a row of
   pills, and the main figures in large light numbers. */
.welcome { display: flex; flex-direction: column; gap: 18px; }
.welcome-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.welcome-top h1 { font-size: 40px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; margin-right: auto; }
.welcome-row { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.figures { display: flex; gap: 30px; margin-left: auto; flex-wrap: wrap; }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure .v { display: flex; align-items: center; gap: 10px; font-size: 52px; font-weight: 300; letter-spacing: -0.045em; line-height: 1; }
.figure .v .icon {
  width: 30px; height: 30px; padding: 7px; border-radius: 50%; flex: none;
  background: var(--surface-hover); color: var(--ink);
}
.figure.main .v .icon { background: var(--brand); color: var(--on-brand); }
.figure .l { font-size: 12.5px; color: var(--ink-3); padding-left: 40px; }
.figure .trend { margin: 6px 0 0 40px; align-self: flex-start; }

/* Shares as a row of labelled pills: dark, accent, striped, light… */
.split { flex: 1 1 420px; display: flex; gap: 6px; min-width: 0; }
.split-part { display: flex; flex-direction: column; gap: 6px; min-width: 64px; }
.split-label { font-size: 12.5px; color: var(--ink-2); }
.split-bar {
  height: 40px; border-radius: 999px; display: flex; align-items: center; padding: 0 14px;
  font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden;
  transform-origin: left; border: 1px solid var(--glass-border);
}
.split-bar.s0 { background: var(--surface-inverse); color: var(--ink-inverse); border-color: transparent; }
.split-bar.s1 { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.split-bar.s2 { background: repeating-linear-gradient(-45deg, var(--tint) 0 2px, transparent 2px 8px), var(--surface-2); color: var(--ink); }
.split-bar.s3 { background: var(--surface-hover); color: var(--ink); }
.split-bar.none { background: var(--surface-2); color: var(--ink-3); font-weight: 500; }
@media (max-width: 860px) {
  .welcome-top h1 { font-size: 30px; }
  .figure .v { font-size: 38px; }
  .figures { margin-left: 0; gap: 22px; }
}

/* Change against the previous period. */
.trend {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px 3px 6px; border-radius: 999px;
  font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.trend .icon { width: 14px; height: 14px; }
.trend .vs { font-weight: 500; color: var(--ink-3); }
.trend.up { background: var(--good-soft); color: var(--good); }
.trend.down { background: var(--bad-soft); color: var(--bad); }
.trend.flat { padding-left: 8px; }

.kpis .stat .value { font-size: 34px; font-weight: 300; }
.kpis .stat .foot { margin-top: 8px; }
.card-head + .table-wrap { margin-top: 12px; }
.table.recent td, .table.recent th { padding-left: 20px; }
.table.recent th:last-child, .table.recent td:last-child { padding-right: 20px; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--surface-inverse); }
.list-row:first-child .meter > span { background: var(--brand); }

.alert-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--r-lg); border: 1px solid var(--glass-border); }
.alert-card { background: var(--surface-2); }
.alert-card > .icon { width: 34px; height: 34px; padding: 8px; border-radius: 50%; flex: none; }
.alert-card.warn > .icon { background: var(--brand); color: var(--on-brand); }
.alert-card.bad > .icon { background: var(--bad); color: #fff; }
.alert-card.info > .icon { background: var(--surface-inverse); color: var(--ink-inverse); }
.alert-card:hover { text-decoration: none; }
a.alert-card:hover { background: var(--surface); }
.alert-card .t { font-weight: 650; color: var(--ink); }
.alert-card .d { color: var(--ink-2); font-size: 13px; }

.checklist .step { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist .step:last-child { border-bottom: 0; }
.checklist .tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: transparent; }
.checklist .step.done .tick { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.checklist .step.done .what { color: var(--ink-3); text-decoration: line-through; }

/* charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity 0.15s; fill: var(--surface-inverse); }
.chart .bar.top { fill: var(--brand); }
.chart .track { fill: var(--surface-3); }
.chart .peak rect { fill: var(--brand); }
.chart .peak text { fill: var(--on-brand); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .bar.dim { opacity: 0.35; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px;
  padding: 8px 12px; border-radius: 14px; background: var(--surface-inverse); color: var(--ink-inverse);
  box-shadow: var(--shadow); font-size: 12.5px; transform: translate(-50%, calc(-100% - 10px));
}
.tooltip .v { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tooltip .k { opacity: 0.7; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--chart-surface); }
.stack > span { min-width: 3px; }
.stack > span:first-child { border-radius: 999px 0 0 999px; }
.stack > span:last-child { border-radius: 0 999px 999px 0; }

/* product editor */
.photo-drop {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2); border-radius: var(--r-lg);
  display: grid; place-items: center; text-align: center; color: var(--ink-3); cursor: pointer;
}
.photo-drop img, .photo-drop .thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.photo-drop:hover { border-color: var(--brand); }
.table .thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; font-size: 14px; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: 10px 14px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tabs a[aria-current='page'] { color: var(--ink); border-color: var(--surface-inverse); }

/* minmax(0, ...): a plain 1fr column grows to fit its widest content, and the
   page then spills sideways on a phone. */
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .grid-2e { grid-template-columns: minmax(0, 1fr); }
}

/* fingerprint enrollment */
.fingers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.finger {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
  border: 1px solid var(--glass-border); border-radius: var(--r); background: var(--surface); font-size: 12.5px; font-weight: 600; text-align: center;
}
.finger .icon { width: 22px; height: 22px; color: var(--ink-3); }
.finger.on .icon { color: var(--good); }
.finger[aria-pressed='true'] { border-color: var(--surface-inverse); background: var(--surface-inverse); color: var(--ink-inverse); }
.finger[aria-pressed='true'] .icon { color: var(--brand); }
.finger:disabled { opacity: 0.45; }
@media (max-width: 560px) { .fingers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.icon-tile {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand);
}
.icon-tile .icon { width: 22px; height: 22px; }

/* assistant */
.chat { display: flex; flex-direction: column; height: max(440px, calc(100vh - 300px)); overflow: hidden; }
.chat-log { flex: 1; min-height: 0; overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { margin: auto; max-width: 560px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chat-empty h3 { font-size: 28px; font-weight: 400; letter-spacing: -0.03em; }
.chat-empty .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.bubble { display: flex; gap: 10px; max-width: min(720px, 92%); }
.bubble.user { align-self: flex-end; }
.bubble-body { padding: 11px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--glass-border); min-width: 0; overflow-wrap: anywhere; }
.bubble.user .bubble-body { background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--ink-inverse); border-bottom-right-radius: 6px; }
.bubble.model .bubble-body { border-top-left-radius: 6px; }
.bubble.error .bubble-body { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.bubble-body p { margin: 0; line-height: 1.5; }
.bubble-body p + p, .bubble-body p + ul, .bubble-body ul + p { margin-top: 8px; }
.bubble-body ul { margin: 4px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }
.bubble-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand);
}
.looked { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.thinking .bubble-body { color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }
.chat-form { display: flex; gap: 10px; align-items: flex-end; padding: 14px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; min-height: 46px; max-height: 160px; resize: vertical; border-radius: 23px; padding: 12px 18px; }
.chat-form .btn { height: 46px; }
@media (max-width: 860px) {
  .chat { height: calc(100vh - 230px); }
  .chat-log { padding: 14px; }
}

/* Exports & backup */
.export-item { display: flex; align-items: center; gap: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.export-item .btn { flex: none; }
@media (max-width: 640px) {
  .export-item { flex-wrap: wrap; }
  .export-item .grow { flex: 1 1 calc(100% - 60px); }
  .export-item .btn { flex: 1 1 100%; }
}
/* A sheet waiting to be printed stays off the screen. */
@media screen { #print-root:has(.doc) { display: none; } }

/* On a phone, a table's rows become cards: the first cell as the title, the rest
   as "label: value" lines. dom.js stackTable() puts the labels on the cells. */
@media (max-width: 640px) {
  .table.phone-cards, .table.phone-cards tbody { display: block; }
  .table.phone-cards thead { display: none; }
  .table.phone-cards tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.phone-cards tr:last-child { border-bottom: 0; }
  .table.phone-cards td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 4px 0; border: 0; text-align: right; overflow-wrap: anywhere;
  }
  .table.phone-cards td::before {
    content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  }
  .table.phone-cards td[data-label='']::before { display: none; }
  .table.phone-cards td:empty { display: none; }
  .table.phone-cards td:first-child { display: block; padding-top: 0; text-align: left; font-weight: 600; }
  .table.phone-cards td:first-child::before { display: none; }
  .table.phone-cards td[colspan] { display: block; text-align: center; }
  .table.phone-cards td[colspan]::before { display: none; }
  .table.recent.phone-cards td, .table.recent.phone-cards td:last-child { padding-left: 0; padding-right: 0; }
}

.help-list { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
details summary { cursor: pointer; }
code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 0.92em; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); }

