/* ===========================================================
   Flor do Cerrado · Base CSS
   Variáveis, fontes, resets e componentes compartilhados
   por todas as páginas do painel.
   =========================================================== */

:root {
  /* Tons base */
  --bg: #f4ede0;
  --bg-elev: #fbf6ec;
  --surface: #ffffff;
  --ink: #3a2414;
  --ink-soft: #6b513e;
  --ink-muted: #9a8775;
  --line: #e6dcc7;
  --line-strong: #d8caaf;

  /* Acentos da marca */
  --terracotta: #c75c2e;
  --terracotta-deep: #a3431c;
  --mustard: #d4a04a;
  --sage: #7a8c4f;
  --brown: #4a2e1a;

  /* Status */
  --st-recebido: #3b6fb0;
  --st-recebido-bg: #e6efff;
  --st-preparando: #c98a1a;
  --st-preparando-bg: #fdf1d6;
  --st-entrega: #4f8c5a;
  --st-entrega-bg: #e3f1e1;
  --st-entregue: #6c6256;
  --st-entregue-bg: #ece6da;
  --st-cancelado: #b53a2c;
  --st-cancelado-bg: #fce4df;

  /* Feedback */
  --danger: #b53a2c;
  --danger-bg: #fce4df;
  --warn: #c98a1a;
  --warn-bg: #fdf1d6;
  --ok: #4f8c5a;
  --ok-bg: #e3f1e1;

  /* Sistema */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(58, 36, 20, 0.06), 0 1px 1px rgba(58, 36, 20, 0.04);
  --shadow-md: 0 4px 14px rgba(58, 36, 20, 0.10), 0 2px 4px rgba(58, 36, 20, 0.05);
  --shadow-lg: 0 18px 40px rgba(58, 36, 20, 0.18);

  --ff-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ff-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--ff-ui);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

button, input, select, textarea {
  font-family: inherit;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--ff-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--terracotta); }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--terracotta); color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 -1px 0 rgba(0,0,0,0.10);
}
.btn--primary:hover { background: var(--terracotta-deep); }
.btn--ghost {
  background: var(--surface); color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: #fff; border-color: var(--ink-muted); }
.btn--danger {
  background: var(--danger); color: #fff;
}
.btn--danger:hover { background: #99291d; }

/* ============== Topbar ============== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 14px;
}
.brand__logo {
  width: 52px; height: 52px;
  border-radius: 12px;
  object-fit: contain;
}
.brand__text h1 {
  font-size: 22px;
  color: var(--brown);
  line-height: 1.05;
}
.brand__text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--ff-mono);
  letter-spacing: 0.02em;
}

.nav {
  display: flex; align-items: center; gap: 4px;
}
.nav-link {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-link.is-active {
  color: var(--terracotta);
  font-weight: 600;
  background: rgba(199,92,46,0.08);
}

.topbar__meta {
  display: flex; align-items: center; gap: 12px;
}
.metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 14px;
  border-right: 1px solid var(--line);
  min-width: 64px;
}
.metric:last-of-type { border-right: none; }
.metric__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  font-weight: 600;
}
.metric__value {
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--brown);
  line-height: 1;
}
.metric__value--warn { color: var(--danger); }

.clock {
  font-family: var(--ff-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
}

/* ============== Page shell ============== */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page__content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============== Modal ============== */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: modal-in .18s ease;
}
.modal[hidden] { display: none; }
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(58, 36, 20, 0.50);
  backdrop-filter: blur(2px);
}
.modal__card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modal-pop .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes modal-pop {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal__title {
  font-size: 20px;
  color: var(--brown);
  margin-bottom: 8px;
}
.modal__body {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 20px;
  line-height: 1.5;
}
.modal__body strong { color: var(--ink); font-weight: 600; }
.modal__actions {
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============== Tooltip ============== */
.tooltip {
  position: fixed;
  z-index: 200;
  max-width: 220px;
  padding: 8px 10px;
  background: var(--brown);
  color: #fbf6ec;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  font-family: var(--ff-ui);
}
.tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 16px;
  width: 10px; height: 10px;
  background: var(--brown);
  transform: rotate(45deg);
}
.tooltip[hidden] { display: none; }
.tooltip__label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mustard);
  margin-bottom: 2px;
}

/* ============== Utility ============== */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
