/* ============================================================
   GUSS DELIVERY — Base & shared components
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: 0; color: var(--ink); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .95rem; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
button:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: var(--r-sm); }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: .92rem; color: var(--ink); }

.muted { color: var(--muted); }
.price { color: var(--coral); font-weight: 700; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: .85em; margin-left: 6px; }
.closed { color: var(--red); font-weight: 600; }

/* ── Layout helpers ── */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.card-header p { font-size: .85rem; }
.card-body { padding: var(--sp-4) var(--sp-5); }

/* ── Buttons ── */
.btn, .primary, .ghost, .dark, .danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r);
  min-height: 38px;
  padding: 9px 16px;
  font-weight: 600; font-size: .9rem;
  transition: transform var(--t-fast), background var(--t), box-shadow var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}
.btn:active, .primary:active, .ghost:active, .dark:active, .danger:active { transform: scale(.98); }
.primary { background: var(--coral); color: #fff; box-shadow: 0 6px 16px rgba(232,89,58,.30); }
.primary:hover { filter: brightness(1.06); }
.primary:disabled { background: var(--coral-tint-2); color: #C9A99C; box-shadow: none; cursor: not-allowed; }
.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.ghost:hover { background: var(--bg-2); color: var(--ink); }
.dark { background: var(--ink); color: #fff; }
.dark:hover { background: var(--coral); }
.dark:disabled { background: var(--line-2); color: var(--muted); cursor: not-allowed; }
.danger { background: var(--red-tint); color: var(--red); }
.danger:hover { background: #F7D6D1; }
.btn-block { width: 100%; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-2); color: var(--ink-2);
  border-radius: var(--r-pill);
  padding: 3px 11px; font-size: .76rem; font-weight: 600;
}
.badge.green { background: var(--green-tint); color: var(--green); }
.badge.amber { background: var(--amber-tint); color: var(--amber); }
.badge.red   { background: var(--red-tint);   color: var(--red); }
.badge.blue  { background: var(--blue-tint);  color: var(--blue); }
.badge.coral { background: var(--coral-tint);  color: var(--coral); }

/* trend chip (▲ 22.1%) */
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); }
.trend.up   { background: var(--green-tint); color: var(--green); }
.trend.down { background: var(--red-tint);   color: var(--red); }

/* ── Search field ── */
.search {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px;
  background: color-mix(in srgb, var(--bg-2) 70%, white);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 8px 13px;
  color: var(--muted);
}
.search input { border: none; background: transparent; outline: none; width: 100%; color: var(--ink); }
.search:focus-within { border-color: rgba(232,93,58,.35); background: var(--surface); box-shadow: 0 0 0 3px rgba(232,93,58,.08); }

/* ── Form fields ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(232,93,58,.55); background: #fff; box-shadow: 0 0 0 3px rgba(232,93,58,.08); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid .span-2 { grid-column: 1 / -1; }

.money-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 8px 10px; background: var(--surface-2); outline: none; text-align: right; font-weight: 600;
}
.money-input:focus { border-color: var(--coral); background: #fff; }

/* ── Toggle ── */
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--line-2); position: relative; cursor: pointer; transition: background var(--t); flex: none; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t); }
.toggle input:checked { background: var(--coral); }
.toggle input:checked::after { transform: translateX(16px); }

/* ── Avatar ── */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--coral-tint); color: var(--coral); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar.lg { width: 46px; height: 46px; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(42,35,32,.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 80; animation: fade .2s var(--ease); }
.modal { background: var(--surface); border-radius: var(--r-xl); width: 480px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .26s var(--ease); }

/* ── Scrollbar ── */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--coral-400); background-clip: padding-box; }

/* ── Animations ── */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rise { animation: riseIn .4s var(--ease) both; }
