:root {
  --bg: #f4f7f9;
  --card: #ffffff;
  --text: #2f2e3b;
  --secondary: #5b6b7a;
  --line: rgba(60, 60, 67, 0.16);
  --accent: #13a5d4;
  --accent-ink: #0b1e2d;
  --link: #0b6e90;
  --fill: #e7eef3;
  --red: #ff3b30;
  --orange: #ff9500;
  --green: #248a3d;
  --gray: #8e8e93;
  --blue: #0b6e90;
  --danger: #ff3b30;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1e2d;
    --card: #13283a;
    --text: #f4f7f9;
    --secondary: #a8b6c2;
    --line: rgba(255, 255, 255, 0.12);
    --fill: #1c3448;
    --accent-ink: #041018;
    --green: #34c759;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #d5e2ea; color: var(--text); }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
img { max-width: 100%; }

.app {
  width: min(100%, 480px);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}
@media (min-width: 540px) {
  body { padding-top: 16px; }
  .app {
    min-height: calc(100dvh - 16px);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 0 0 1px rgba(11, 30, 45, 0.06), 0 18px 50px rgba(11, 30, 45, 0.16);
    overflow: clip;
  }
}
@media (prefers-color-scheme: dark) {
  html, body { background: #061018; }
}

.staff-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 0;
}
.staff-bar .staff-name { font-size: 17px; font-weight: 700; }
.staff-bar form { margin: 0; }
.staff-bar button {
  background: none;
  border: 0;
  color: var(--link);
  font-weight: 650;
  font-size: 17px;
  min-height: 44px;
  padding: 0 2px;
}
.large-title {
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin: 0;
  padding: calc(12px + env(safe-area-inset-top)) 16px 4px;
}
.large-title.under-bar { padding-top: 4px; }
.dateline { margin: 0 16px 8px; color: var(--secondary); font-size: 15px; }
.today-counts { margin: 10px 16px 0; color: var(--secondary); font-size: 13px; line-height: 1.4; }
.today-counts a { font-weight: 650; text-decoration: none; }

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 52px;
  padding: calc(4px + env(safe-area-inset-top)) 8px 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 0.5px solid var(--line);
}
.nav.under-bar { padding-top: 4px; }
.nav h1 { font-size: 17px; margin: 0; text-align: center; font-weight: 650; }
.back { color: var(--link); text-decoration: none; font-size: 17px; padding: 10px 8px; min-height: 44px; }

main.with-tabs { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
main.public { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  display: flex;
  z-index: 30;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  border-top: 0.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-decoration: none;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 600;
  padding-top: 4px;
}
.tabbar a.active { color: var(--link); }
.tabbar svg { width: 24px; height: 24px; }

.section-label {
  margin: 18px 20px 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--secondary);
}
.group {
  margin: 0 16px;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}
.group form, .group > a, .group > .row, .group > button { border-bottom: 0.5px solid var(--line); }
.group form:last-child, .group > :last-child { border-bottom: 0; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex: 0 0 36px;
  border: 1px solid var(--line);
}
.row, .button-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
}
.row.stacked { flex-direction: column; align-items: flex-start; gap: 2px; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-size: 17px; font-weight: 600; line-height: 1.25; }
.row-title:has(.row-who) { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-who {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 450; color: var(--secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub { font-size: 13px; color: var(--secondary); display: flex; align-items: center; gap: 6px; }
.row-empty, .empty { margin: 0; padding: 18px 16px; color: var(--secondary); }
.chevron { margin-left: auto; color: #c7c7cc; font-size: 22px; font-weight: 400; line-height: 1; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--tone, var(--accent)); display: inline-block; }
.bubble {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 16%, var(--card));
}
.bubble.lg { width: 52px; height: 52px; font-size: 28px; border-radius: 16px; }
.tone-red { --tone: var(--red); }
.tone-orange { --tone: var(--orange); }
.tone-green { --tone: var(--green); }
.tone-gray { --tone: var(--gray); }
.tone-blue { --tone: var(--blue); }
.tone-text-red { color: var(--red); }
.tone-text-orange { color: var(--orange); }
.tone-text-green { color: var(--green); }
.tone-text-gray { color: var(--secondary); }
.tone-text-blue { color: var(--link); }

.action-row { display: flex; gap: 8px; padding: 8px 16px 0; }
.action-row .btn { flex: 1; min-width: 0; }
.btn.with-icon { gap: 6px; font-size: 15px; padding: 10px 8px; }
.btn.with-icon svg { width: 18px; height: 18px; flex: 0 0 auto; }
.search { margin: 8px 16px 12px; position: relative; }
.search-row { display: flex; align-items: center; gap: 8px; }
.search-row label { margin: 0; flex: 0 0 auto; }
.search-row input { flex: 1; min-width: 0; width: auto; }
.search input, label input, label textarea, label select, .reply input, .pad-form input, .pad-form textarea, .pad-form select {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--fill);
  padding: 12px 14px;
  font-size: 17px;
}
.search input { border-radius: 12px; }
form.search-row input { flex: 1; min-width: 0; width: auto; }
label { display: block; font-size: 13px; font-weight: 650; color: var(--secondary); margin-bottom: 12px; }
label input, label textarea, label select { margin-top: 6px; font-weight: 500; color: var(--text); }
textarea { min-height: 96px; resize: vertical; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.stack { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 0; }
.stack.tight { padding: 0 0 8px; }
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 650; padding: 12px 16px;
  text-decoration: none; background: var(--fill); color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger-text { background: transparent; color: var(--danger); min-height: 44px; }
.btn.xl { min-height: 56px; font-size: 20px; }
.btn:disabled { opacity: 0.45; }

.notice {
  margin: 8px 16px;
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  line-height: 1.35;
}
.notice.bad { background: color-mix(in srgb, var(--danger) 14%, var(--card)); }
.hint { color: var(--secondary); font-size: 14px; line-height: 1.4; margin: 6px 0; }
.pad-inline { padding: 0 16px; }
.fine { color: var(--secondary); font-size: 13px; text-align: center; padding: 18px 20px 8px; }
.app:has(.print-scale) { width: min(100%, 8.5in); background: #fff; color: #000; }
.print-doc { background: #fff; color: #000; padding-bottom: 24px; }
.print-toolbar { display: flex; align-items: center; gap: 12px; margin: 12px 16px; }
.ios-back { color: #007aff; text-decoration: none; font-weight: 600; font-size: 17px; }
.ios-print {
  appearance: none; border: 0; width: auto; background: #007aff; color: #fff;
  border-radius: 12px; font-size: 17px; font-weight: 600; min-height: 44px; padding: 10px 18px;
}
.print-scale { container-type: inline-size; width: 100%; overflow: hidden; }
.print-sheet {
  width: 8.5in; min-height: 11in; box-sizing: border-box; padding: 0.6in;
  background: #fff; color: #000; font-size: 14pt; line-height: 1.35;
  transform-origin: top left;
}
.print-sheet h1 { margin: 0 0 10px; font-size: 18pt; font-weight: 700; }
.print-shop { font-size: 22pt; font-weight: 700; margin: 0 0 4px; line-height: 1.15; }
.print-shop-block p { margin: 0; }
.print-party { margin-top: 22pt; }
.print-party p { margin: 0; }
.print-sheet p { margin: 4px 0; }
.print-sheet table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14pt; }
.print-sheet th, .print-sheet td { border-bottom: 1px solid #000; text-align: left; padding: 6px 4px; color: #000; background: #fff; }
.print-sheet .num, .print-sheet th.num { text-align: right; }
@container (max-width: 8.49in) {
  .print-scale { height: calc(11in * 100cqw / 8.5in); }
  .print-sheet { transform: scale(calc(100cqw / 8.5in)); }
}
@page { size: letter; margin: 0.6in; }
@media print {
  body, .app, .print-doc { background: #fff; color: #000; }
  .app, .app:has(.print-scale) { width: auto; min-height: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .print-scale { height: auto !important; overflow: visible; }
  .print-sheet { transform: none !important; width: auto; min-height: 0; padding: 0; }
  .no-print { display: none !important; }
}
@media (min-width: 540px) {
  .app:has(.print-scale) { overflow: visible; border-radius: 0; box-shadow: none; }
}

.hero { padding: 8px 16px 4px; }
.hero-top { display: flex; gap: 12px; align-items: center; }
.status-name { margin: 0; font-size: 15px; font-weight: 700; }
.hero-car { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.who { margin: 10px 0 0; font-size: 17px; }
.who-sub, .meta { margin: 2px 0; color: var(--secondary); font-size: 14px; }
.hero-carline { display: flex; align-items: center; gap: 12px; margin: 8px 0 0; font-size: 17px; font-weight: 700; }
.hero-status { margin: 8px 0 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.icon-btn { border: 0; background: none; color: var(--link); padding: 4px; min-height: 0; display: inline-flex; }
.icon-btn svg { width: 18px; height: 18px; }
.text-link { background: none; border: 0; color: #007aff; font-weight: 650; font-size: 17px; padding: 8px 0; min-height: 0; }
.line-split { margin-left: auto; font-size: 12px; color: var(--secondary); white-space: nowrap; }
.copy-text {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.who .copy-status { display: inline; padding: 0 0 0 8px; }
.who .copy-status[hidden] { display: none; }
.pad { padding: 12px 14px; }
.line { display: grid; grid-template-columns: 1fr 84px 84px 28px; gap: 8px; align-items: center; }
.line-remove { border: 0; background: none; color: #ff3b30; font-size: 22px; line-height: 1; padding: 0; min-height: 0; }
.line-labels { font-size: 12px; font-weight: 650; color: var(--secondary); padding: 0 0 4px; }
.status-menu-wrap { padding: 8px 16px 0; }
.status-menu {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6b7a' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.line input { margin: 0; }
.total { font-weight: 700; margin: 4px 0 10px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--fill); }
.photo-card { margin: 0; }
.photo-card .btn { min-height: 36px; margin-top: 4px; font-size: 13px; padding: 6px 8px; }
.copy-status { margin: 0; padding: 0 14px 10px; color: var(--link); font-weight: 650; }
.history-row { padding: 10px 14px; border-bottom: 0.5px solid var(--line); }
.history-row summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.history-row summary::-webkit-details-marker { display: none; }
.history-row .summary-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fold-chevron {
  margin-left: auto; width: 8px; height: 8px; flex: 0 0 auto;
  border-right: 2px solid var(--secondary); border-bottom: 2px solid var(--secondary);
  transform: rotate(-45deg);
}
details[open] > summary .fold-chevron { transform: rotate(45deg); }
.history-row p { margin: 8px 0 0; white-space: pre-wrap; }
.copy-status[hidden] { display: none; }
.history-body { white-space: pre-wrap; font-size: 15px; font-weight: 450; line-height: 1.35; }
.price { font-weight: 700; margin-left: auto; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 12px; scrollbar-width: none; }
.chip {
  flex: 0 0 auto; text-decoration: none; color: var(--text);
  background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 650;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }

.thread { display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 16px; }
.bubble-msg { border-radius: 18px; padding: 10px 12px; max-width: 100%; }
.bubble-msg.out { background: var(--accent); color: var(--accent-ink); margin-left: 28px; }
.bubble-msg.in { background: var(--card); margin-right: 28px; }
.bubble-msg.staff { background: var(--fill); margin-left: 0; margin-right: 0; }
.bubble-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; font-size: 16px; line-height: 1.35; }
.bubble-meta, .bubble-foot { margin: 0; font-size: 12px; opacity: 0.75; overflow-wrap: anywhere; }
.reply { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.reply input { flex: 1; min-width: 0; width: auto; min-height: 44px; }
.reply .btn { width: auto; flex: 0 0 auto; min-height: 44px; margin-top: 0; padding: 0 14px; }
.bubble-msg > form .btn { min-height: 44px; margin-top: 8px; }

.welcome { padding: 28px 20px 12px; text-align: center; }
.bolt { width: 54px; height: 54px; }
.brand { font-size: 28px; font-weight: 750; letter-spacing: -0.4px; margin: 8px 0 4px; }
.lede { color: var(--secondary); font-size: 17px; line-height: 1.4; }
.step { margin: 0 16px 8px; color: var(--secondary); font-size: 13px; font-weight: 700; }
.pad-form { padding: 0 16px 16px; }
.inline-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-actions .btn { flex: 1; }
.colors { border: 0; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.colors legend { font-size: 13px; font-weight: 650; color: var(--secondary); padding: 0 0 6px; width: 100%; }
.color-choice {
  display: flex; align-items: center; gap: 6px; margin: 0;
  background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 15px; font-weight: 650; color: var(--text);
}
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); font-weight: 600; }
.turnstile { margin: 8px 0 12px; min-height: 65px; }
.check input { width: auto; min-height: 0; }
.scan-panel video { width: 100%; border-radius: 12px; background: #000; max-height: 240px; object-fit: cover; }
.link-box { font-size: 13px; word-break: break-all; background: var(--fill); border-radius: 8px; padding: 8px; margin: 6px 0; }
.now { margin-left: auto; color: var(--secondary); font-size: 13px; font-weight: 700; }
.cust-status { margin: 8px 16px; background: var(--card); border-radius: 16px; padding: 18px 16px; text-align: left; }
.progress-line { margin: 6px 16px; font-size: 16px; }
.page-line { margin: 8px 16px; font-size: 16px; }
.status-line { display: flex; align-items: center; gap: 8px; }
.cust-emoji { font-size: 48px; line-height: 1; }
.sheet-root { display: none; position: fixed; inset: 0; z-index: 50; }
.sheet-root.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); border: 0; width: 100%; }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 480px); max-height: min(88dvh, 760px); overflow: auto;
  background: var(--bg); border-radius: 16px 16px 0 0;
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 4px 16px 4px; font-size: 22px; }
.sheet-sub { margin: 0 16px 8px; color: var(--secondary); }
.grabber { width: 36px; height: 5px; border-radius: 99px; background: var(--line); margin: 6px auto 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
