/* CafeDeck Console v2.0 - cloud-console layer: grouped navigation, top bar, command palette, dark mode, charts */
.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.content .main {
  width: 100%;
  max-width: 1400px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tb-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  text-align: left;
  min-height: 38px;
}
.tb-search:hover {
  border-color: var(--accent);
}
.tb-search svg {
  width: 17px;
  height: 17px;
  flex: none;
}
.tb-search span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
kbd {
  font:
    600 11px ui-monospace,
    Menlo,
    Consolas,
    monospace;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
}
.tb-r {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tb-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink2);
  border: 1.5px solid transparent;
}
.tb-btn:hover {
  background: var(--bg);
  text-decoration: none;
}
.tb-btn svg {
  width: 19px;
  height: 19px;
}
.tb-btn b {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
}
.nav-g {
  margin: 14px 10px 4px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #6f77a0;
}
.nav-g:first-child {
  margin-top: 2px;
}
.nav a {
  position: relative;
}
.nav a em.nb {
  margin-left: auto;
  font-style: normal;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: #3a4263;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 19px;
}
.nav a em.nb:empty {
  display: none;
}
.nav a em.nb.hot {
  background: var(--red);
}
.side {
  overflow-y: auto;
}
.side .foot a {
  color: #cfd4ea;
}

/* score chip + health */
.score {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.score.g-A {
  background: var(--green-l);
  color: #14703b;
}
.score.g-B {
  background: var(--blue-l);
  color: #243a8f;
}
.score.g-C {
  background: var(--amber-l);
  color: #8a5a07;
}
.score.g-D {
  background: var(--red-l);
  color: #9a2020;
}
.score.g-X {
  background: var(--bg);
  color: var(--muted);
}
.ring {
  width: 84px;
  height: 84px;
  flex: none;
}
.ring text {
  font:
    800 24px system-ui,
    sans-serif;
  fill: var(--ink);
}
.ring .bg {
  stroke: var(--line);
}
.factors {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.factors li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.factors li:last-child {
  border: 0;
}
.factors b {
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.pill.ring-canary {
  background: #fff1d6;
  color: #8a5a07;
}
.pill.ring-early {
  background: var(--blue-l);
  color: #243a8f;
}
.pill.ring-stable {
  background: var(--bg);
  color: var(--ink2);
}

/* charts */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.charts .card {
  margin: 0 !important;
}
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.donut {
  width: 130px;
  height: 130px;
  flex: none;
}
.donut text {
  font:
    800 22px system-ui,
    sans-serif;
  fill: var(--ink);
}
.donut .sub {
  font:
    600 10px system-ui,
    sans-serif;
  fill: var(--muted);
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 8px;
}
.legend b {
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.hbar {
  display: grid;
  grid-template-columns: 90px 1fr 34px;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.hbar .track {
  height: 12px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.hbar .track i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.hbar .n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cols {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  padding-top: 8px;
}
.cols .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.cols .col i {
  display: block;
  width: 100%;
  max-width: 46px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
}
.cols .col b {
  color: var(--ink);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.spark {
  width: 100%;
  height: 38px;
}

/* bulk bar */
.bulk {
  position: sticky;
  top: 58px;
  z-index: 15;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 10px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(10, 12, 30, 0.25);
}
.bulk select {
  width: auto;
  background: #fff;
  color: #1b2036;
  min-height: 32px;
  padding: 3px 8px;
}
.bulk .btn {
  min-height: 32px;
  padding: 3px 11px;
  font-size: 12.5px;
}
.bulk b {
  margin-right: 4px;
}
td.sel,
th.sel {
  width: 34px;
  padding-right: 0;
}
td.sel input,
th.sel input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

/* command palette */
.pal-back {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 18, 38, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 14px 14px;
}
.pal {
  width: min(620px, 100%);
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(5, 8, 25, 0.5);
  overflow: hidden;
}
.pal input {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 18px;
  font-size: 16px;
  background: transparent;
}
.pal input:focus {
  outline: none;
}
.pal-list {
  max-height: 52vh;
  overflow: auto;
  padding: 6px;
}
.pal-i {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
}
.pal-i small {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pal-i.on {
  background: var(--accent);
  color: #fff;
}
.pal-i.on small {
  color: #d6f6f0;
}
.pal-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* tickets, incidents, invoices */
.pill.p-urgent {
  background: var(--red);
  color: #fff;
}
.pill.p-high {
  background: var(--red-l);
  color: #9a2020;
}
.pill.p-normal {
  background: var(--blue-l);
  color: #243a8f;
}
.pill.p-low {
  background: var(--bg);
  color: var(--muted);
}
.seg {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.seg button {
  padding: 6px 14px;
  font-weight: 650;
  color: var(--muted);
  font-size: 13px;
}
.seg button.on {
  background: var(--ink);
  color: #fff;
}
.thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  max-height: 260px;
  overflow: auto;
}
.thread .msg {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 12px;
}
.thread .msg small {
  color: var(--muted);
  display: block;
}
.inv-sheet {
  background: #fff;
  color: #1b2036;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 28px;
}
.inv-sheet h1 {
  font-size: 24px;
  letter-spacing: 0.02em;
}
.inv-sheet table {
  margin: 18px 0;
}
.inv-sheet th {
  background: #fafbfe;
  color: #7a819c;
}
.inv-sheet td,
.inv-sheet th {
  color: #1b2036;
  border-bottom: 1px solid #eef0f7;
}
.inv-sheet .tot {
  font-size: 20px;
  font-weight: 800;
  text-align: right;
}
.inv-sheet .stamp {
  display: inline-block;
  border: 2.5px solid var(--green);
  color: var(--green);
  font-weight: 800;
  padding: 2px 12px;
  border-radius: 8px;
  transform: rotate(-6deg);
  letter-spacing: 0.08em;
}
.tok {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px dashed var(--accent);
}
pre.code {
  background: #11152a;
  color: #cfe3ff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.kpi .sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.kpi.link {
  cursor: pointer;
}
.kpi.link:hover {
  border-color: var(--accent);
}

/* dark mode */
[data-theme='dark'] {
  --ink: #e8ebf8;
  --ink2: #c3c9e2;
  --muted: #8e96b8;
  --line: #2a3152;
  --bg: #0e1222;
  --card: #161b31;
  --nav: #0a0d1b;
  --nav2: #1a2040;
  --accent-l: #123d3a;
  --blue: #7d93f5;
  --blue-l: #1d2754;
  --amber-l: #3a2d0f;
  --red-l: #3d1a1d;
  --green-l: #12362a;
  color-scheme: dark;
}
[data-theme='dark'] body {
  background: var(--bg);
}
[data-theme='dark'] .btn,
[data-theme='dark'] input,
[data-theme='dark'] select,
[data-theme='dark'] textarea,
[data-theme='dark'] .tbl-wrap,
[data-theme='dark'] .modal,
[data-theme='dark'] input[type='search'] {
  background: var(--card);
  color: var(--ink);
}
[data-theme='dark'] .btn:hover {
  border-color: var(--accent);
}
[data-theme='dark'] .btn.dark {
  background: #2a3152;
  border-color: #2a3152;
}
[data-theme='dark'] .btn.danger {
  border-color: #6a2b30;
}
[data-theme='dark'] th {
  background: #1a2040;
}
[data-theme='dark'] td {
  border-bottom-color: var(--line);
}
[data-theme='dark'] tr.click:hover td {
  background: #1a2040;
}
[data-theme='dark'] .banner {
  color: #f3d9a4;
}
[data-theme='dark'] .banner.info {
  color: #b8c5ff;
}
[data-theme='dark'] .banner.bad {
  color: #ffb4b4;
}
[data-theme='dark'] .banner.good {
  color: #9fe8c0;
}
[data-theme='dark'] .pill.good {
  color: #7ee2a8;
}
[data-theme='dark'] .pill.warn {
  color: #f3c26b;
}
[data-theme='dark'] .pill.bad {
  color: #ff9c9c;
}
[data-theme='dark'] .pill.info {
  color: #a8b8ff;
}
[data-theme='dark'] .score.g-A {
  color: #7ee2a8;
}
[data-theme='dark'] .score.g-B {
  color: #a8b8ff;
}
[data-theme='dark'] .score.g-C {
  color: #f3c26b;
}
[data-theme='dark'] .score.g-D {
  color: #ff9c9c;
}
[data-theme='dark'] pre.stack {
  background: #0e1222;
}
[data-theme='dark'] .login .box {
  background: var(--card);
}
[data-theme='dark'] .qrbox {
  background: #fff;
}
[data-theme='dark'] .attn-row {
  border-top-color: var(--line);
}
[data-theme='dark'] .sw {
  border-bottom-color: var(--line);
}
[data-theme='dark'] .prog {
  background: #232a4a;
}
[data-theme='dark'] .bulk select {
  background: #fff;
  color: #1b2036;
}
[data-theme='dark'] .seg button.on {
  background: var(--accent);
}
[data-theme='dark'] .thread .msg {
  background: #1a2040;
}
[data-theme='dark'] .tok {
  background: #1a2040;
}
[data-theme='dark'] .tb-search {
  background: var(--bg);
}
[data-theme='dark'] .pill.ring-canary {
  background: #3a2d0f;
  color: #f3c26b;
}
[data-theme='dark'] .pill.ring-early {
  background: #1d2754;
  color: #a8b8ff;
}
[data-theme='dark'] .pill.ring-stable {
  background: #232a4a;
  color: #c3c9e2;
}
[data-theme='dark'] .pill.p-high {
  color: #ff9c9c;
}
[data-theme='dark'] .pill.p-normal {
  color: #a8b8ff;
}
[data-theme='dark'] .pill.off {
  color: var(--muted);
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .side,
  .content {
    min-width: 0;
    max-width: 100vw;
  }
  .topbar {
    padding: 8px 12px;
    position: static;
  }
  .tb-search kbd {
    display: none;
  }
  .nav-g {
    display: none;
  }
  .side {
    overflow: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
  }
  .side .brand {
    padding: 0 8px 0 0;
  }
  .side .foot {
    order: 2;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    text-align: right;
  }
  .side .foot br {
    display: none;
  }
  .side .nav {
    order: 3;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav a {
    flex: none;
    white-space: nowrap;
    padding: 8px 11px;
  }
  .bulk {
    top: 0;
  }
  .content .main {
    padding: 18px 14px 50px;
  }
  .hbar {
    grid-template-columns: 70px 1fr 30px;
  }
}

/* printing an invoice: only the invoice sheet */
@media print {
  body {
    background: #fff;
  }
  #app,
  #toast-root {
    display: none !important;
  }
  .modal-back {
    position: static;
    background: none;
    padding: 0;
    display: block;
  }
  .modal {
    box-shadow: none;
    width: 100%;
    max-height: none;
    padding: 0;
    background: #fff;
    color: #000;
  }
  .modal > *:not(.inv-sheet) {
    display: none !important;
  }
  .inv-sheet {
    border: 0;
    padding: 0;
  }
}
/* v2.1 */
.onb {
  list-style: none;
  margin: 0;
  padding: 0;
}
.onb li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.onb li:last-child {
  border-bottom: 0;
}
.onb label {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}
.onb input[disabled] + span {
  opacity: 0.85;
}
.card.mb {
  margin-bottom: 14px;
}

/* v3.2: ticket conversation, notes, POS settings, audit detail */
.thread2 {
  max-height: 38vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.bub {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.bub .bub-h {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 3px;
}
.bub .bub-h small {
  color: var(--muted);
}
.bub .bub-b {
  white-space: pre-line;
  word-break: break-word;
}
.bub.cafe {
  align-self: flex-start;
  background: #fff;
}
.bub.staff {
  align-self: flex-end;
  background: #e6f7f4;
  border-color: #b9e5dd;
}
.bub.internal {
  align-self: center;
  max-width: 94%;
  background: #fff8e1;
  border-color: #f0dfa0;
  border-style: dashed;
}
.composer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.note {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 8px;
  background: #fff;
}
.note.pin {
  background: #fff8e1;
  border-color: #f0dfa0;
}
.ps-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
}
.ps-row small,
.field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 12px;
  margin: 10px 0;
}
.kv dt {
  color: var(--muted);
  font-weight: 650;
}
.kv dd {
  margin: 0;
  word-break: break-word;
}
tr.click {
  cursor: pointer;
}
tr.click:hover td {
  background: var(--bg);
}
[data-theme='dark'] .bub,
[data-theme='dark'] .note {
  background: #20263f;
  border-color: #343c60;
}
[data-theme='dark'] .bub.staff {
  background: #123b36;
  border-color: #1f6b60;
}
[data-theme='dark'] .bub.internal,
[data-theme='dark'] .note.pin {
  background: #3a3417;
  border-color: #6b5f22;
}
