:root {
  color-scheme: light dark;
  --bg: #f2f6f2;
  --card-bg: #ffffff;
  --fg: #14231a;
  --muted: #5c6b62;
  --border: #dfe7e0;
  --silpo-orange: #f5821f;
  --silpo-orange-dark: #d4650a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1512;
    --card-bg: #171f1a;
    --fg: #eef3ee;
    --muted: #9db1a4;
    --border: #26332b;
  }
}

* { box-sizing: border-box; }

/* `button.ghost` (and similar class rules) set their own `display`, which
   outranks the browser default `[hidden] { display: none }` by specificity
   — without this, `hidden` stops working on anything styled by a class
   selector (e.g. #logout-button before login). */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--silpo-orange-dark);
  color: white;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}
.brand-logo { display: block; border-radius: 7px; position: relative; z-index: 1; }
.brand-wordmark { display: block; height: 22px; width: auto; }

.brand-logo-wrap {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-logo-wrap::before,
.brand-logo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  animation: brand-wave 2.4s ease-out infinite;
  pointer-events: none;
}
.brand-logo-wrap::after { animation-delay: 1.2s; }

@keyframes brand-wave {
  from { transform: scale(1); opacity: 0.65; }
  to { transform: scale(2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo-wrap::before,
  .brand-logo-wrap::after { animation: none; content: none; }
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.hero-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 16px;
}

.brand-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 16px;
}
.brand-quote {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

h1 { margin: 0 0 6px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 17px; }
.subtitle { color: var(--muted); margin: 0 0 16px; }
.subtitle-en { color: var(--muted); font-size: 14px; margin: -10px 0 16px; }

.hackathon-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--silpo-orange) 15%, transparent);
  color: var(--silpo-orange-dark);
  font-size: 12px;
  font-weight: 600;
}

.example-prompts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.example-prompts li {
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--silpo-orange) 10%, transparent);
  font-size: 14px;
  font-style: italic;
  color: var(--fg);
}

.features-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.features-list li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.features-list li:last-child { border-bottom: none; padding-bottom: 0; }
.feature-icon { font-size: 22px; line-height: 1.3; flex-shrink: 0; }
.features-list strong { display: block; margin-bottom: 2px; }
.features-list p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer a { color: var(--silpo-orange-dark); }
.footnote-en { color: var(--muted); font-size: 12px; margin: 10px 0 0; text-align: center; }

button {
  display: block;
  width: 100%;
  padding: 14px 22px;
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--silpo-orange), var(--silpo-orange-dark));
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--silpo-orange) 35%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
button:first-of-type { margin-top: 0; }
button:disabled { opacity: 0.55; cursor: default; box-shadow: none; transform: none; }
button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--silpo-orange) 45%, transparent);
}
button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--silpo-orange) 35%, transparent);
}

button.ghost {
  width: auto;
  display: inline-block;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: white;
  box-shadow: none;
}
button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  transform: none;
  box-shadow: none;
}
button.ghost:active:not(:disabled) { transform: none; box-shadow: none; }

.account-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--silpo-orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.account-name { margin: 0; font-weight: 600; }
.account-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.cart-delivery {
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.delivery-line { margin: 4px 0; font-size: 14px; color: var(--muted); }

.cart-summary { margin: 0 0 8px; font-size: 15px; font-weight: 600; }

.cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cart-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.cart-items li:last-child { border-bottom: none; }
.cart-item-image {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
}
.cart-item-name { color: var(--fg); flex: 1; min-width: 0; overflow-wrap: break-word; }
.cart-item-price { color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.cart-item-delivery .cart-item-name,
.cart-item-delivery .cart-item-price {
  color: var(--muted);
  font-style: italic;
}

.checkout-button {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--silpo-orange), var(--silpo-orange-dark));
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--silpo-orange) 35%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.checkout-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--silpo-orange) 45%, transparent);
}
.checkout-button:active { transform: translateY(0); box-shadow: 0 2px 6px color-mix(in srgb, var(--silpo-orange) 35%, transparent); }

.cart-total {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  text-align: right;
}

.secondary-button {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.secondary-button:hover {
  border-color: var(--silpo-orange);
  background: color-mix(in srgb, var(--silpo-orange) 6%, transparent);
  transform: translateY(-1px);
}
.secondary-button:active { transform: translateY(0); }

.danger-button {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  background: #c0392b;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(192, 57, 43, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.danger-button:hover {
  background: #a93226;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(192, 57, 43, 0.4);
}
.danger-button:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(192, 57, 43, 0.3); }

.agent-wave {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 32px;
  margin: 4px 0 0;
}
.agent-wave:not([hidden]) { display: flex; }
.agent-wave span {
  width: 5px;
  border-radius: 3px;
  height: 6px;
  background: var(--border);
  transition: background 0.2s ease;
}
.agent-wave[data-state="listening"] span { background: var(--muted); opacity: 0.5; }
.agent-wave[data-state="thinking"] span {
  background: var(--muted);
  animation: wave-pulse 1.1s ease-in-out infinite;
}
.agent-wave[data-state="speaking"] span {
  background: var(--silpo-orange);
  animation: wave-bounce 0.7s ease-in-out infinite;
}
.agent-wave span:nth-child(2) { animation-delay: 0.1s; }
.agent-wave span:nth-child(3) { animation-delay: 0.2s; }
.agent-wave span:nth-child(4) { animation-delay: 0.3s; }
.agent-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-bounce {
  0%, 100% { height: 6px; }
  50% { height: 26px; }
}
@keyframes wave-pulse {
  0%, 100% { height: 6px; opacity: 0.4; }
  50% { height: 14px; opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-wave span { animation: none !important; }
}

/* Wave and its label ("Слухає" / "Говорить") sit on one line, so the state
   reads as one indicator instead of two things far apart. */
.agent-status-row { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; }
.agent-status-row .agent-wave { margin: 0; justify-content: flex-start; }
#status { color: var(--muted); margin: 0; font-weight: 600; }

#transcript {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 160px;
  max-height: 50vh;
  overflow-y: auto;
  margin-top: 12px;
}
#transcript p { margin: 6px 0; }

.speaker-tag {
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 6px;
}
.speaker-tag.speaker-user { background: var(--border); color: var(--fg); }
.speaker-tag.speaker-agent { background: var(--silpo-orange); color: white; }

#audio-container { display: none; }

/* Signals: what the agent is working from (agent/signals.py) */
.signals-heading {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.signals-note { margin: -4px 0 4px; font-size: 13px; color: var(--muted); }
.signals-list { list-style: none; margin: 0; padding: 0; }
.signals-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.signals-list li:last-child { border-bottom: none; }
.signal-main { font-weight: 600; }
.signal-sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.signal-when { flex-shrink: 0; text-align: right; font-size: 13px; color: var(--muted); }
.signal-when.urgent { color: var(--silpo-orange-dark); font-weight: 600; }
.signal-event-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: color-mix(in srgb, var(--silpo-orange) 15%, transparent);
  color: var(--silpo-orange-dark);
}

.signals-stock { margin-top: 14px; }
.signals-stock summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.stock-bars { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.stock-bars li {
  display: grid;
  grid-template-columns: minmax(96px, 30%) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.stock-track { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.stock-fill { height: 100%; border-radius: 999px; background: var(--muted); }
.stock-bars li.low .stock-fill { background: var(--silpo-orange); }
.stock-qty { color: var(--muted); font-variant-numeric: tabular-nums; }

.agent-activity { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.agent-activity li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.activity-source {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--muted);
}
.activity-source.silpo {
  border-color: var(--silpo-orange);
  color: var(--silpo-orange-dark);
}
.agent-activity li.failed { color: var(--muted); text-decoration: line-through; }

.reauth-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: color-mix(in srgb, var(--silpo-orange) 12%, transparent);
  color: var(--silpo-orange-dark);
}
