:root {
  color-scheme: light;
  --page: #f5f2ec;
  --panel: #fffdf8;
  --ink: #171715;
  --muted: #69675f;
  --line: #d9d5cc;
  --mint: #acd5bc;
  --blue: #b4ccdf;
  --blush: #e8b0b8;
  --butter: #f0d98f;
  --peach: #edb291;
  --lilac: #c7b4d8;
  --danger: #b7555f;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell { max-width: 1180px; min-height: 100vh; margin: 0 auto; padding: 20px 24px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; }
.brand img { width: 36px; height: 36px; object-fit: cover; }
.connection { font-size: 12px; font-weight: 700; color: var(--muted); }
.connection.live::before, .connection.offline::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: var(--mint); }
.connection.offline::before { background: var(--butter); }

.setup-view { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 440px); gap: 48px; align-items: center; min-height: calc(100vh - 140px); }
.setup-copy h1, .workspace-head h1 { margin: 0; font-size: 52px; line-height: 1.02; font-weight: 900; }
.setup-copy > p:last-child { max-width: 600px; color: var(--muted); font-size: 19px; line-height: 1.5; }
.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); }

.auth-panel { display: grid; gap: 14px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--mint); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
#codeFields { display: grid; gap: 14px; }
.form-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 13px; }

.primary, .secondary, .danger, .icon-button, .queue-actions button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font-weight: 800; }
.primary { background: var(--mint); }
.secondary { background: var(--blue); }
.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.icon-button { background: var(--blue); }
button:disabled { opacity: .45; cursor: default; }
.notice { padding: 11px 12px; background: rgba(240, 217, 143, .35); border-left: 4px solid var(--butter); color: var(--muted); font-size: 13px; font-weight: 650; }

.workspace { padding-top: 34px; }
.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding-bottom: 26px; }
.workspace-selectors { display: flex; gap: 10px; width: min(100%, 440px); }
.workspace-selectors label { flex: 1; }
.receipt-capture { display: flex; min-height: 46px; align-items: center; justify-content: center; align-self: end; padding: 9px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--mint); color: var(--ink); cursor: pointer; }
.receipt-capture input { display: none; }

.tabs { display: flex; overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
.tab { flex: 0 0 auto; min-height: 48px; padding: 0 18px; border: 0; border-right: 1px solid var(--line); border-bottom: 4px solid transparent; background: transparent; color: var(--ink); font-weight: 800; }
.tab span { margin-left: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab.active { background: rgba(232, 176, 184, .36); border-bottom-color: var(--ink); }

.panel { padding: 28px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.section-heading h2, .account-band h2 { margin: 0; font-size: 26px; }
.queue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.queue-item { position: relative; min-height: 210px; margin: 0; background: var(--panel); border: 1px solid var(--line); }
.queue-accent { position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--blue); }
.queue-content { display: flex; flex-direction: column; min-height: 210px; padding: 16px 16px 14px 20px; }
.queue-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 14px; font-size: 10px; font-weight: 900; text-transform: uppercase; color: var(--muted); }
.queue-meta .kind { padding: 5px 7px; background: rgba(180, 204, 223, .4); }
.queue-item h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.2; }
.set-name, .detail { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.detail { margin-top: 10px; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 14px; }
.queue-actions button { min-height: 36px; padding: 7px 10px; background: var(--mint); font-size: 12px; }
.queue-actions button.quiet { background: rgba(180, 204, 223, .45); }

.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.set-card { min-height: 150px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--mint); }
.set-card h3 { margin: 0 0 6px; font-size: 20px; }
.set-card p { margin: 0; color: var(--muted); font-size: 13px; }
.set-card .set-code { margin-bottom: 28px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.empty { grid-column: 1 / -1; padding: 26px; border-left: 4px solid var(--blue); background: rgba(180, 204, 223, .14); color: var(--muted); }

.account-band { display: flex; align-items: center; gap: 18px; max-width: 720px; padding: 18px; margin-bottom: 18px; border-left: 5px solid var(--lilac); background: rgba(199, 180, 216, .15); }
.account-band img { width: 72px; height: 72px; }
.account-band p:last-child { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }

@media (max-width: 760px) {
  .app-shell { padding: 12px 14px 48px; }
  .topbar { min-height: 50px; }
  .setup-view { grid-template-columns: 1fr; gap: 26px; align-content: center; min-height: calc(100vh - 90px); padding: 30px 0; }
  .setup-copy h1, .workspace-head h1 { font-size: 36px; }
  .setup-copy > p:last-child { font-size: 16px; }
  .auth-panel { padding: 18px; }
  .workspace { padding-top: 22px; }
  .workspace-head { display: grid; align-items: start; gap: 18px; }
  .workspace-selectors { width: 100%; }
  .workspace-selectors { display: grid; grid-template-columns: 1fr 1fr; }
  .receipt-capture { grid-column: 1 / -1; }
  .panel { padding-top: 22px; }
  .queue-grid { grid-template-columns: 1fr; }
  .queue-item, .queue-content { min-height: 190px; }
  .account-band { align-items: flex-start; }
  .account-band img { width: 54px; height: 54px; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: transform 120ms ease, background-color 120ms ease; }
  button:active { transform: translateY(1px); }
}
