:root {
  --bg: #071210;
  --panel: rgba(19, 40, 36, 0.72);
  --line: rgba(143, 181, 170, 0.16);
  --text: #e8f2ef;
  --muted: #8fb5aa;
  --accent: #3ecf9a;
  --sun: #e8b86d;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(62, 207, 154, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(232, 184, 109, 0.08), transparent 50%),
    #071210;
  background-attachment: fixed;
}

.nav-link {
  display: block;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  color: #8fb5aa;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(36, 80, 72, 0.45); color: #e8f2ef; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(62,207,154,.18), rgba(36,80,72,.35));
  color: #3ecf9a;
  box-shadow: inset 0 0 0 1px rgba(62,207,154,.25);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
}
@media (min-width: 640px) {
  .card { padding: 1.25rem 1.35rem; }
}

.kpi {
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(62,207,154,.18), transparent 70%);
  pointer-events: none;
}

.btn-primary, .btn-ghost, .btn-danger, .btn-icon {
  border-radius: 0.7rem;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn-primary {
  background: linear-gradient(135deg, #22b87e, #189564);
  color: #04140f;
  padding: 0.65rem 1rem;
  border: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-ghost {
  background: rgba(26, 55, 49, 0.65);
  color: #e8f2ef;
  border: 1px solid var(--line);
  padding: 0.55rem 0.85rem;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,.35);
  padding: 0.55rem 0.85rem;
}
.btn-icon {
  width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(26,55,49,.7);
  border: 1px solid var(--line);
  color: #e8f2ef;
}

.field {
  width: 100%;
  background: rgba(7, 18, 16, 0.75);
  border: 1px solid var(--line);
  color: #e8f2ef;
  border-radius: 0.7rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
}
.field:focus {
  outline: none;
  border-color: rgba(62,207,154,.55);
  box-shadow: 0 0 0 3px rgba(62,207,154,.12);
}
label.lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 720px;
}
table.data th, table.data td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
table.data th {
  background: rgba(7,18,16,.85);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tr:hover td { background: rgba(62,207,154,.05); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(62,207,154,.12);
  color: #3ecf9a;
}

.insight {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 0.9rem;
  background: rgba(7,18,16,.45);
  border-radius: 0 0.8rem 0.8rem 0;
}
.insight.warn { border-left-color: var(--sun); }
.insight.down { border-left-color: #f87171; }
.insight.up { border-left-color: #3ecf9a; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.62);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1.25rem;
  }
}
.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: min(92vh, 860px);
  overflow-y: auto;
  background: #132824;
  border: 1px solid var(--line);
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 50px rgba(0,0,0,.4);
}
@media (min-width: 640px) {
  .modal-sheet {
    border-radius: 1.25rem;
    padding: 1.35rem;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  background: #1a3731;
  border: 1px solid rgba(62,207,154,.35);
  color: #e8f2ef;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  max-width: min(92vw, 420px);
  text-align: center;
}
@media (min-width: 1024px) {
  .toast { bottom: 1.5rem; }
}

.chart-box {
  position: relative;
  width: 100%;
  height: 220px;
}
@media (min-width: 640px) {
  .chart-box { height: 280px; }
}
@media (min-width: 1024px) {
  .chart-box { height: 320px; }
}

.safe-top { padding-top: max(0.75rem, env(safe-area-inset-top)); }
.safe-bottom { padding-bottom: max(0px, env(safe-area-inset-bottom)); }

/* Mobile card list alternative for pedidos */
.pedido-card {
  display: none;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: rgba(7,18,16,.4);
  margin-bottom: 0.55rem;
}
@media (max-width: 767px) {
  .desktop-table { display: none; }
  .pedido-card { display: block; }
}

.skeleton {
  background: linear-gradient(90deg, rgba(26,55,49,.4), rgba(62,207,154,.12), rgba(26,55,49,.4));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 0.6rem;
  min-height: 1rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
