/* =========================
   GELATO STOCK — clickable demo shell
   Tokens copied 1:1 from the real app's app/globals.css
   (dark branch of each light-dark() pair). No backend,
   client-side only, but the same design system.
========================= */

:root {
  --background: #101214;
  --surface-subtle: #1b1f23;
  --foreground: #f0f2f4;
  --brand: #a8b0ba;
  --brand-dark: #6f7a86;
  --brand-soft: #283039;
  --line: #2d3339;
  --line-strong: #444c56;
  --muted: #a7afb7;
  --muted-light: #7d8790;
  --card: #171a1d;

  --emerald-bg: #102a21;
  --emerald-text: #86efac;
  --emerald-border: #286049;
  --amber-bg: #30240e;
  --amber-text: #fcd34d;
  --amber-border: #70551e;
  --rose-bg: #34171b;
  --rose-text: #fda4af;
  --rose-border: #73313b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
input, select, textarea { color: var(--foreground); }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ---- shell layout ---- */

.gsd-shell { display: flex; min-height: 100vh; }

.gsd-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.gsd-brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.1rem 0.4rem; }
.gsd-brand__icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: var(--brand);
  color: #101214;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gsd-brand strong { display: block; font-size: 0.9rem; letter-spacing: -0.01em; }
.gsd-brand small { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 0.1rem; }

.gsd-navlabel {
  margin: 1.6rem 0 0.5rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-light);
}

.gsd-nav { display: flex; flex-direction: column; gap: 0.25rem; }

.gsd-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.7rem;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  width: 100%;
}

.gsd-nav__item svg { flex-shrink: 0; opacity: 0.95; }
.gsd-nav__item:hover { background: var(--surface-subtle); color: var(--foreground); }

.gsd-nav__item.is-active {
  background: var(--brand-soft);
  color: var(--foreground);
}

.gsd-nav__bar {
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  opacity: 0;
}

.gsd-nav__item.is-active .gsd-nav__bar { opacity: 1; }

.gsd-dbcard {
  margin-top: auto;
  border-radius: 16px;
  padding: 0.9rem;
  border: 1px solid var(--amber-border);
  background: var(--amber-bg);
}

.gsd-dbcard__head { display: flex; align-items: center; gap: 0.5rem; color: var(--amber-text); font-size: 0.72rem; font-weight: 700; }
.gsd-dbcard p { margin-top: 0.5rem; font-size: 0.68rem; line-height: 1.5; color: var(--amber-text); opacity: 0.8; }

/* ---- main / topbar ---- */

.gsd-main { flex: 1; min-width: 0; }

.gsd-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  height: 72px;
  padding: 0 1.6rem;
  background: rgba(23, 26, 29, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.gsd-crumb { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--muted); }
.gsd-topbar__title { font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em; }

.gsd-demo-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--amber-text);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
}

.gsd-demo-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--amber-text); }

.gsd-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.gsd-content { max-width: 1180px; padding: 1.8rem 1.6rem 4rem; }

.gsd-view { display: none; }
.gsd-view.is-active { display: block; }

/* ---- page header (PageScaffold) ---- */

.gsd-eyebrow { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--brand); }
.gsd-h1 { margin-top: 0.4rem; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
.gsd-sub { margin-top: 0.5rem; max-width: 52ch; font-size: 0.87rem; line-height: 1.6; color: var(--muted); }

/* ---- shared card / stat / row / badge ---- */

.gsd-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-top: 1.8rem; }

.gsd-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
}

.gsd-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.gsd-card__icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.gsd-card__icon--brand { background: var(--brand-soft); color: var(--brand); }
.gsd-card__icon--green { background: var(--emerald-bg); color: var(--emerald-text); }
.gsd-card__icon--amber { background: var(--amber-bg); color: var(--amber-text); }
.gsd-card__icon--red { background: var(--rose-bg); color: var(--rose-text); }
.gsd-card__num { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
.gsd-card__label { margin-top: 1rem; font-size: 0.85rem; font-weight: 600; }
.gsd-card__detail { margin-top: 0.2rem; font-size: 0.72rem; color: var(--muted); }

.gsd-banner {
  margin-top: 0.9rem;
  border-radius: 16px;
  padding: 1.1rem 1.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.gsd-banner--amber { background: var(--amber-bg); border: 1px solid var(--amber-border); }
.gsd-banner--green { background: var(--emerald-bg); border: 1px solid var(--emerald-border); }
.gsd-banner__row { display: flex; align-items: flex-start; gap: 0.7rem; }
.gsd-banner__icon { width: 36px; height: 36px; border-radius: 11px; background: var(--card); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gsd-banner--amber .gsd-banner__icon { color: var(--amber-text); }
.gsd-banner--green .gsd-banner__icon { color: var(--emerald-text); }
.gsd-banner h2 { font-size: 0.92rem; font-weight: 600; }
.gsd-banner p { margin-top: 0.2rem; font-size: 0.8rem; opacity: 0.85; }

.gsd-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-top: 0.9rem; }
.gsd-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.gsd-panel__eyebrow { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand); }
.gsd-panel__title { margin-top: 0.15rem; font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
.gsd-panel__count { background: var(--surface-subtle); color: var(--muted); font-size: 0.72rem; font-weight: 600; padding: 0.35rem 0.7rem; border-radius: 999px; }
.gsd-panel__body { padding: 0.2rem 0; }

.gsd-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 1.2rem;
  padding: 0.95rem 1.3rem;
  border-top: 1px solid var(--line);
}

.gsd-row:first-child { border-top: none; }
.gsd-row__name { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; font-weight: 600; min-width: 0; }
.gsd-row__name small { display: block; margin-top: 0.15rem; padding-left: 0.85rem; font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.gsd-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.gsd-dot--amber { background: var(--amber-text); }
.gsd-dot--red { background: var(--rose-text); }

.gsd-meta { display: flex; gap: 1.4rem; font-size: 0.72rem; }
.gsd-meta div { text-align: left; }
.gsd-meta span { display: block; color: var(--muted); }
.gsd-meta strong { color: var(--foreground); }
.gsd-meta strong.amber { color: var(--amber-text); }
.gsd-meta strong.red { color: var(--rose-text); }

.gsd-buy { background: var(--surface-subtle); border-radius: 12px; padding: 0.55rem 0.9rem; font-size: 0.72rem; }
.gsd-buy span { color: var(--muted); }

.gsd-actions { display: flex; gap: 0.5rem; }

.gsd-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  background: var(--brand);
  color: #101214;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 0.9rem;
  border-radius: 10px;
  white-space: nowrap;
}

.gsd-btn--ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--foreground); }
.gsd-btn--sm { min-height: 32px; font-size: 0.72rem; padding: 0 0.7rem; }
.gsd-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.gsd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.gsd-badge--green { background: var(--emerald-bg); color: var(--emerald-text); }
.gsd-badge--amber { background: var(--amber-bg); color: var(--amber-text); }
.gsd-badge--red { background: var(--rose-bg); color: var(--rose-text); }

.gsd-flow {
  margin-top: 0.9rem;
  background: var(--brand-dark);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.gsd-flow__row { display: flex; align-items: flex-start; gap: 0.7rem; }
.gsd-flow h2 { font-size: 0.92rem; font-weight: 600; color: #fff; }
.gsd-flow p { margin-top: 0.2rem; font-size: 0.8rem; color: rgba(255,255,255,0.72); max-width: 40ch; }
.gsd-flow__eyebrow { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--emerald-text); }
.gsd-flow__pill { background: rgba(255,255,255,0.12); color: var(--emerald-text); font-size: 0.72rem; font-weight: 600; padding: 0.4rem 0.8rem; border-radius: 999px; white-space: nowrap; }

/* ---- table (Estoque / Histórico) ---- */

.gsd-table-wrap { overflow-x: auto; }
.gsd-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.gsd-table th { text-align: left; font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.9rem 1rem; background: var(--surface-subtle); font-weight: 600; }
.gsd-table th.num, .gsd-table td.num { text-align: right; }
.gsd-table td { padding: 0.85rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.gsd-table tr:first-child td { border-top: none; }
.gsd-table small { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 400; margin-top: 0.1rem; }

.gsd-entry { color: var(--emerald-text); font-weight: 600; }
.gsd-exit-t { color: var(--rose-text); font-weight: 600; }

/* ---- tiles (Compras) ---- */

.gsd-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-top: 1.8rem; }
.gsd-tile { border-radius: 16px; padding: 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.gsd-tile__num { font-size: 1.7rem; font-weight: 700; }
.gsd-tile__label { font-size: 0.78rem; }
.gsd-tile--amber { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber-text); }
.gsd-tile--green { background: var(--emerald-bg); border: 1px solid var(--emerald-border); color: var(--emerald-text); }
.gsd-tile--red { background: var(--rose-bg); border: 1px solid var(--rose-border); color: var(--rose-text); }

/* ---- form (Recebimentos / Receitas) ---- */

.gsd-formgrid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.1rem; align-items: start; margin-top: 1.8rem; }
.gsd-field { padding: 1.1rem 1.3rem 0; }
.gsd-field:last-of-type { padding-bottom: 1.1rem; }
.gsd-field label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.4rem; }
.gsd-field input, .gsd-field select {
  width: 100%;
  min-height: 42px;
  background: var(--background);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 0.8rem;
  font-size: 0.82rem;
}
.gsd-panelfooter { padding: 0 1.3rem 1.3rem; }
.gsd-empty { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2.4rem 1.3rem; }
.gsd-empty svg { margin: 0 auto 0.7rem; opacity: 0.6; }

.gsd-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gsd-chip { background: var(--background); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.4rem 0.7rem; font-size: 0.76rem; }

/* ---- Produção (simulator) ---- */

.gsd-simform { display: grid; grid-template-columns: minmax(0,1fr) 160px auto; gap: 1rem; align-items: end; margin-top: 1.1rem; }
.gsd-simform label { display: block; font-size: 0.72rem; font-weight: 600; margin-bottom: 0.4rem; }
.gsd-simform select, .gsd-simform input {
  width: 100%;
  min-height: 42px;
  background: var(--background);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 0.8rem;
  font-size: 0.85rem;
}
.gsd-sim-desc { margin-top: 1rem; background: var(--surface-subtle); border-radius: 11px; padding: 0.8rem 1rem; font-size: 0.76rem; color: var(--muted); line-height: 1.5; }

.gsd-sim-waiting { margin-top: 1.1rem; border: 1px dashed var(--line-strong); border-radius: 16px; padding: 2.4rem 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; }
.gsd-sim-waiting svg { margin: 0 auto 0.8rem; opacity: 0.6; }

.gsd-sim-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-top: 1.1rem; }
.gsd-sim-stat { border-radius: 16px; padding: 1.1rem; border: 1px solid; }
.gsd-sim-stat--green { background: var(--emerald-bg); border-color: var(--emerald-border); color: var(--emerald-text); }
.gsd-sim-stat--amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); }
.gsd-sim-stat--red { background: var(--rose-bg); border-color: var(--rose-border); color: var(--rose-text); }
.gsd-sim-stat__top { display: flex; align-items: center; justify-content: space-between; }
.gsd-sim-stat strong { font-size: 1.6rem; }
.gsd-sim-stat p { margin-top: 0.8rem; font-size: 0.8rem; font-weight: 600; color: var(--foreground); }

.gsd-sim-result { margin-top: 1.1rem; }
.gsd-sim-result__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.gsd-sim-result__title { font-size: 0.98rem; font-weight: 600; margin-top: 0.15rem; }

.gsd-sim-table td, .gsd-sim-table th { white-space: normal; }
.gsd-sim-table .shortage { display: block; margin-top: 0.3rem; font-size: 0.66rem; font-weight: 700; color: var(--rose-text); }
.gsd-sim-table .suggested { display: block; margin-top: 0.2rem; font-size: 0.66rem; color: var(--muted); }

.gsd-sim-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.9rem 1.3rem; background: var(--surface-subtle); font-size: 0.74rem; color: var(--muted); }
.gsd-sim-footer a { color: var(--brand); font-weight: 600; }

/* ---- toast ---- */

.gsd-toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 12px);
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--foreground);
  font-size: 0.8rem;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  max-width: 90vw;
}

.gsd-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .gsd-shell { flex-direction: column; }
  .gsd-sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 0.8rem; gap: 1rem; }
  .gsd-brand { flex-shrink: 0; }
  .gsd-navlabel { display: none; }
  .gsd-nav { flex-direction: row; }
  .gsd-nav__item { white-space: nowrap; }
  .gsd-dbcard { display: none; }
  .gsd-content { padding: 1.3rem 1rem 3rem; }
  .gsd-cards { grid-template-columns: repeat(2, 1fr); }
  .gsd-tiles, .gsd-sim-stats { grid-template-columns: 1fr; }
  .gsd-formgrid { grid-template-columns: 1fr; }
  .gsd-simform { grid-template-columns: 1fr; }
  .gsd-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .gsd-meta { gap: 1.6rem; }
  .gsd-flow { flex-direction: column; align-items: flex-start; }
}
