:root {
  color-scheme: light;
  --wine: #721f28;
  --cream: #f5ecdf;
  --paper: #fffdf9;
  --ink: #271d19;
  --muted: #776b64;
  --line: #eadfce;
  --green: #177245;
  --green-soft: #e6f4eb;
  --red: #bd2d2d;
  --red-soft: #fdeaea;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--cream); }
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 12px max(18px, calc((100vw - 940px) / 2));
  background: rgba(255, 253, 249, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 64px; height: 52px; object-fit: contain; background: #222; border-radius: 13px; }
.brand p { margin: 0 0 2px; color: var(--wine); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.brand h1 { margin: 0; font-family: Georgia, serif; font-size: 25px; letter-spacing: -.02em; }
.icon-button { width: 44px; height: 44px; color: var(--wine); background: #f7ead6; border: 0; border-radius: 14px; font-size: 24px; font-weight: 800; }

.shell { width: min(100% - 30px, 940px); margin: 0 auto; padding: 26px 0 50px; }
.bot-card, .branch-card, .products-section, .pin-card { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 14px 38px rgba(80, 21, 28, .08); }
.bot-card, .branch-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px 28px; border-radius: 24px; }
.bot-card { margin-bottom: 14px; border-color: #dcc8a7; background: #fffaf1; }
.bot-card h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; }
.bot-card p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.branch-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px 28px; border-radius: 24px; }
.section-label { display: block; margin-bottom: 5px; color: var(--wine); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.branch-card h2, .section-heading h2 { margin: 0; font-family: Georgia, serif; letter-spacing: -.02em; }
.branch-card h2 { font-size: 30px; }

.status-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 11px; padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.status-pill span { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-pill.open { color: var(--green); background: var(--green-soft); }
.status-pill.closed { color: var(--red); background: var(--red-soft); }
.status-pill.human { color: #9a5a00; background: #fff0cf; }
.status-pill.loading { color: var(--muted); background: #f0ece6; }

.switch { position: relative; display: inline-flex; flex: 0 0 auto; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.slider { position: relative; display: block; width: 54px; height: 32px; background: #c8bdb3; border-radius: 999px; transition: .18s ease; }
.slider::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; background: white; border-radius: 50%; box-shadow: 0 2px 7px rgba(0,0,0,.2); transition: .18s ease; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 3px solid #e6ad43; outline-offset: 3px; }
.branch-switch .slider { width: 68px; height: 40px; }
.branch-switch .slider::after { width: 30px; height: 30px; top: 5px; left: 5px; }
.branch-switch input:checked + .slider::after { transform: translateX(28px); }

.pin-card { margin-top: 14px; padding: 18px 20px; border-radius: 18px; }
.pin-card label { display: block; margin-bottom: 8px; font-weight: 800; }
.pin-card div { display: flex; gap: 8px; }
.pin-card input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.pin-card button { padding: 0 18px; color: white; background: var(--wine); border: 0; border-radius: 12px; font-weight: 800; }

.products-section { margin-top: 18px; padding: 26px; border-radius: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.section-heading h2 { font-size: 28px; }
.count-pill { padding: 7px 10px; color: var(--muted); background: #f2ede5; border-radius: 999px; font-size: 12px; font-weight: 800; }
.search-box { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 0 15px; background: #f7f3ed; border: 1px solid var(--line); border-radius: 14px; }
.search-box span { color: var(--muted); font-size: 23px; }
.search-box input { width: 100%; padding: 14px 0; color: var(--ink); background: transparent; border: 0; outline: 0; }

.category-tabs { display: flex; gap: 8px; margin: 16px -2px 12px; padding: 2px 2px 7px; overflow-x: auto; scrollbar-width: thin; }
.category-tabs button { flex: 0 0 auto; padding: 9px 12px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 750; }
.category-tabs button.active { color: white; background: var(--wine); border-color: var(--wine); }

.product-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 76px; padding: 14px 15px; background: white; border: 1px solid var(--line); border-radius: 16px; transition: opacity .18s ease, background .18s ease; }
.product-row.unavailable { background: #f7f4ef; opacity: .7; }
.product-copy { min-width: 0; }
.product-copy h3 { margin: 0 0 5px; font-size: 15px; line-height: 1.25; }
.product-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 5px; }
.product-title h3 { margin: 0; }
.sold-out-badge { padding: 3px 7px; color: white; background: var(--red); border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.product-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.empty-state { grid-column: 1 / -1; padding: 36px; color: var(--muted); text-align: center; }
.message { position: sticky; bottom: 15px; width: fit-content; min-height: 20px; margin: 14px auto 0; padding: 9px 14px; color: var(--wine); background: rgba(255, 253, 249, .96); border-radius: 999px; font-size: 13px; font-weight: 800; box-shadow: 0 8px 22px rgba(80,21,28,.1); }
.message:empty { visibility: hidden; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

dialog { width: min(calc(100% - 30px), 420px); padding: 28px; color: var(--ink); background: var(--paper); border: 0; border-radius: 24px; box-shadow: 0 28px 90px rgba(37,28,24,.3); }
dialog::backdrop { background: rgba(37,28,24,.55); backdrop-filter: blur(3px); }
.dialog-icon { font-size: 32px; }
dialog h2 { margin: 12px 0 8px; font-family: Georgia, serif; font-size: 26px; }
dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.dialog-actions button { min-height: 48px; padding: 12px; border: 0; border-radius: 14px; font-weight: 800; }
.secondary-button { color: var(--ink); background: #eee7dc; }
.confirm-button { color: white; background: var(--wine); }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 940px); padding-top: 14px; }
  .topbar { min-height: 72px; padding: 10px 14px; }
  .brand-logo { width: 54px; height: 44px; }
  .brand h1 { font-size: 22px; }
  .bot-card, .branch-card, .products-section { border-radius: 20px; }
  .bot-card, .branch-card { padding: 20px; }
  .products-section { padding: 20px 14px; }
  .product-list { grid-template-columns: 1fr; }
  .section-heading { padding: 0 4px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
