:root {
  --bg: #f7f6f3;
  --fg: #1a1f2b;
  --muted: #6b7280;
  --border: #e3e1dd;
  --accent: #1a1f2b;
  --accent-fg: #ffffff;
  --allow: #157f3c;
  --challenge: #a26a00;
  --deny: #b3261e;
  --trust: #1f4d8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

header.site-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}

nav.site-nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
  align-items: center;
}

nav.site-nav .user-pill {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 20px; margin: 32px 0 12px; }

.hero {
  border: 1px solid var(--border);
  background: #fff;
  padding: 48px;
  border-radius: 8px;
  margin-bottom: 32px;
}

.hero h1 { margin-bottom: 8px; }
.hero p { color: var(--muted); margin: 0; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card__thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #ece9e3, #d8d3ca);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #fff;
}

.product-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card__title { font-weight: 600; }
.product-card__price { color: var(--muted); }
.product-card__add {
  margin-top: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
}
.product-card__add:hover { background: #efece6; }

/* Forms */
.form-card {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
}

.form-card h1 { font-size: 22px; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row label {
  font-size: 13px;
  color: var(--muted);
}

.form-row input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.btn {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  padding: 12px 18px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

.btn:hover { opacity: 0.92; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.form-foot {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.form-error {
  background: #fdecea;
  border: 1px solid #f5b5b1;
  color: var(--deny);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Cart / checkout */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.cart-table th, .cart-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cart-table tfoot td {
  font-weight: 700;
  border-bottom: 0;
}

.checkout-actions { margin-top: 24px; }

.transfer-card select,
.transfer-card input[type="number"] {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.amount-row {
  display: flex;
  gap: 12px;
}

.amount-row .form-row { margin-bottom: 16px; }

.success-card {
  background: #e8f5ee;
  border: 1px solid #a3d4b6;
  border-radius: 8px;
  padding: 24px;
  margin-top: 24px;
  color: var(--allow);
}

/* Recommendation toast */
#rec-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-height: 70vh;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

#rec-panel.visible { display: flex; }

.rec-panel__head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.rec-panel__badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--muted);
  color: #fff;
}

.rec-panel__badge.ALLOW { background: var(--allow); }
.rec-panel__badge.CHALLENGE { background: var(--challenge); }
.rec-panel__badge.DENY { background: var(--deny); }
.rec-panel__badge.TRUST { background: var(--trust); }

.rec-panel__title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.rec-panel__close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

.rec-panel__body {
  padding: 12px 14px;
  overflow: auto;
  font-size: 12px;
}

.rec-panel__body pre {
  background: #f3f1ec;
  border-radius: 6px;
  padding: 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.rec-panel__error { color: var(--deny); }

.note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}
