/* App styles on top of Pico; no inline styles (CSP: default-src 'self').
   A minimal look close to Silpo's site (light page, white rounded cards, orange accent),
   approximated by hand: no Silpo logo, fonts or images, and "неофіційний" always visible. */
:root[data-theme="light"] {
  --accent: #ff6b00;
  --accent-hover: #e55f00;
  --accent-soft: #fff1e6;
  --page: #f4f4f5;
  --card: #ffffff;
  --ink: #1f1f1f;
  --muted: #6b6b70;
  --line: #e7e7ea;
  --pico-font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-border: var(--accent);
  --pico-primary-hover: var(--accent-hover);
  --pico-primary-hover-background: var(--accent-hover);
  --pico-primary-hover-border: var(--accent-hover);
  --pico-primary-focus: rgba(255, 107, 0, 0.25);
  --pico-primary-inverse: #ffffff;
  --pico-background-color: var(--page);
  --pico-color: var(--ink);
  --pico-muted-color: var(--muted);
  --pico-border-radius: 12px;
  --pico-card-background-color: var(--card);
  --pico-card-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --pico-mark-background-color: var(--accent-soft);
}
body { background: var(--page); }
article { border-radius: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }

/* Header: white bar, brand, the "unofficial" pill */
.app-header { background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.header-row { display: flex; align-items: center; justify-content: space-between; padding-block: 0.75rem; }
.brand { font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--accent); display: inline-block; }
.unofficial { font-size: 0.8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.6rem; }
.app-footer { padding-block: 1rem; color: var(--muted); }

button, [role="button"], input, select { min-height: 44px; }
.muted { color: var(--muted); }
.error { color: #c62828; }
.notice { color: var(--muted); font-size: 0.9rem; }
.big { font-size: 1.05rem; padding: 0.8rem 1.4rem; font-weight: 600; }
.small { padding: 0.2rem 0.6rem; font-size: 0.9rem; min-height: 36px; }
.entry { max-width: 36rem; margin-inline: auto; }

/* Wizard */
.steps { display: flex; gap: 0.5rem; list-style: none; padding: 0; flex-wrap: wrap; }
.steps li { color: var(--muted); font-size: 0.9rem; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--page); }
.steps li.current { color: #fff; background: var(--accent); font-weight: 600; }
.steps li.done { color: var(--ink); }
.steps li.done::before { content: "✓ "; color: var(--accent); }
.choice { width: 100%; text-align: left; margin-bottom: 0.5rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.choice:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.5rem; }
.slot { width: 100%; }

/* Main screen: chat on the left, cart on the right */
.app-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(19rem, 2fr); gap: 1.5rem; }
.chat { background: var(--card); border-radius: 16px; padding: 1rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.messages { display: flex; flex-direction: column; gap: 0.75rem; min-height: 50vh; }
.bubble { padding: 0.75rem 1rem; border-radius: 16px; max-width: 90%; white-space: pre-wrap; line-height: 1.45; }
.bubble.user { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--page); border-bottom-left-radius: 4px; }
.bubble.error { align-self: flex-start; border: 1px solid #c62828; background: #fff5f5; }
.hello { font-size: 1.35rem; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { width: auto; border-radius: 999px; border-color: var(--accent); color: var(--accent); background: var(--card); }
.chip:hover { background: var(--accent-soft); color: var(--accent); }
.status { min-height: 1.6rem; color: var(--muted); padding-top: 0.5rem; }
.chat-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.chat-form input { flex: 1; margin: 0; border-radius: 999px; }
.chat-form button { width: auto; margin: 0; border-radius: 999px; padding-inline: 1.2rem; }
.new-chat { margin-top: 0.5rem; }
.confirm-card { border: 2px solid var(--accent); background: var(--card); }
.confirm-card .actions { display: flex; gap: 0.5rem; }
.confirm-card .actions button { width: auto; }

/* Cart: like Silpo's cart rows (name, stepper pill, bold price) */
.cart-panel { position: sticky; top: 1rem; align-self: start; background: var(--card); border-radius: 16px;
  padding: 1rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.delivery-line { display: flex; justify-content: space-between; gap: 0.5rem; padding-bottom: 0.75rem;
  margin-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.delivery-line a { color: var(--accent); }
.lines { list-style: none; padding: 0; margin: 0; }
.lines li { list-style: none; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.75rem; padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line); border-radius: 8px; }
.line.changed { background: var(--accent-soft); }
.line.unavailable .line-name { color: var(--muted); }
.line-controls { display: inline-flex; align-items: center; gap: 0.15rem; background: var(--page); border-radius: 999px; padding: 0.15rem; }
.line-controls button { width: auto; margin: 0; border: none; background: transparent; color: var(--ink); min-height: 32px; }
.line-controls button:hover { color: var(--accent); background: transparent; }
.qty { min-width: 3.5rem; text-align: center; font-weight: 600; }
.line-total { grid-column: 2; text-align: right; font-weight: 700; }
.badge { font-size: 0.75rem; font-weight: 700; color: #c62828; background: #fdecec; border-radius: 999px; padding: 0.05rem 0.5rem; }
.total { font-size: 1.2rem; display: flex; justify-content: space-between; margin-top: 0.75rem; }

/* Checkout: one button per device. `a.` beats Pico's `a[role=button]{display:inline-block}`. */
.cart-panel a.checkout { display: block; width: 100%; text-align: center; }
.cart-panel a.only-mobile { display: none; }
.cart-bar, .sheet-close { display: none; }

/* Phone: chat full screen; the cart opens from a fixed bottom bar (no JS: :target) */
@media (max-width: 768px) {
  .app-grid { grid-template-columns: 1fr; }
  .cart-panel { display: none; }
  .cart-panel:target { display: block; position: fixed; inset: 20vh 0 0 0; overflow-y: auto;
    padding: 1rem; border-radius: 16px 16px 0 0; box-shadow: 0 -0.5rem 2rem rgba(0, 0, 0, 0.2); z-index: 10; }
  .cart-panel:target .sheet-close { display: block; text-align: right; color: var(--accent); }
  .cart-bar { display: block; position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; padding: 0.9rem;
    text-align: center; background: var(--accent); color: #fff; font-weight: 700; border-radius: 999px;
    text-decoration: none; box-shadow: 0 0.25rem 1rem rgba(255, 107, 0, 0.35); z-index: 5; }
  main { padding-bottom: 5rem; }
  .cart-panel a.only-desktop { display: none; }
  .cart-panel a.only-mobile { display: block; }
}
