/* ================================================================
   ERP Confecção — Design System
   Premium tokens, typography & component overrides shared by
   every page. Page-specific styles live in each <style> block.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  /* Ink scale — Zinc-based off-blacks */
  --ink-1:#0a0a0a; --ink-2:#18181b; --ink-3:#27272a; --ink-4:#3f3f46;
  --ink-5:#52525b; --ink-6:#71717a; --ink-7:#a1a1aa; --ink-8:#d4d4d8;
  --ink-9:#e4e4e7; --ink-10:#f4f4f5; --ink-11:#fafafa;

  /* Paper / surfaces — page bg propositalmente mais grayish que cards
     pra dar contraste visível com o branco puro dos containers. */
  --paper-1:#f1f3f5;
  --paper-2:#ffffff;
  --paper-3:#fafafa;

  /* Single accent — deep electric blue */
  --accent:#1e40af;
  --accent-hi:#1d4ed8;
  --accent-soft:rgb(30 64 175 / 0.08);
  --accent-ring:rgb(30 64 175 / 0.18);

  /* Functional status (used semantically, not as accents) */
  --ok:#047857;
  --warn:#b45309;
  --err:#be123c;
  --info:#475569;

  /* Tinted shadows — fortes o suficiente pra cards ficarem visíveis
     contra o page-bg, mas sutis pra manter o feel premium. */
  --shadow-soft:0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-md:0 8px 24px -12px rgb(15 23 42 / 0.16), 0 2px 4px rgb(15 23 42 / 0.06);
  --shadow-lg:0 24px 48px -20px rgb(15 23 42 / 0.22), 0 4px 8px rgb(15 23 42 / 0.06);

  /* Radii */
  --r-sm:0.625rem;
  --r-md:1rem;
  --r-lg:1.5rem;
  --r-pill:999px;

  /* Easing */
  --ease-out:cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-width:245px;
  --sidebar-bg:#0c1018;
  --sidebar-hover:rgba(255, 255, 255, 0.06);
  --sidebar-active:var(--accent);
  --sidebar-text:#a1a1aa;
  --topbar-height:64px;
  --page-bg:var(--paper-1);

  /* Font stacks */
  --font-display:'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-display);
  background: var(--page-bg);
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

/* Numeric / monospaced contexts inherit the mono stack */
.font-mono, .num-mono, code, kbd, samp, pre { font-family: var(--font-mono); }

/* CEP loading spinner (preserved) */
input.cep-loading {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><circle cx='8' cy='8' r='6' fill='none' stroke='%231e40af' stroke-width='2' stroke-dasharray='28' stroke-dashoffset='10'><animateTransform attributeName='transform' type='rotate' from='0 8 8' to='360 8 8' dur='0.8s' repeatCount='indefinite'/></circle></svg>");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 16px 16px;
  padding-right: 2rem;
}

/* ----------------------------------------------------------------
   SIDEBAR
   ---------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid rgb(255 255 255 / 0.04);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 0.08) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgb(255 255 255 / 0.08); border-radius: 3px; }

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.05);
}
.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.sidebar-section-label,
.sidebar .nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #52525b;
  padding: 1.1rem 1.25rem 0.4rem;
  font-weight: 600;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sidebar-text);
  padding: 0.55rem 1rem;
  margin: 0.1rem 0.55rem;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.sidebar .nav-link i { font-size: 1rem; flex-shrink: 0; opacity: 0.85; }
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #f4f4f5; }
.sidebar .nav-link:active { transform: scale(0.98); }
.sidebar .nav-link.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgb(30 64 175 / 0.55);
}
.sidebar .nav-link.active i { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgb(255 255 255 / 0.05);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.2s var(--ease-out);
  text-decoration: none;
}
.sidebar-user:hover { background: var(--sidebar-hover); }

.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -4px rgb(30 64 175 / 0.5);
}

.user-nome { font-size: 0.8rem; font-weight: 600; color: #e4e4e7; line-height: 1.2; letter-spacing: -0.005em; }
.user-perfil { font-size: 0.68rem; color: var(--sidebar-text); text-transform: capitalize; }

/* ----------------------------------------------------------------
   MAIN CONTENT
   ---------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}

/* ----------------------------------------------------------------
   TOPBAR
   ---------------------------------------------------------------- */
.topbar {
  background: var(--paper-2);
  border-bottom: 1px solid var(--ink-9);
  padding: 0 1.75rem;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink-2);
}
.topbar-subtitle { font-size: 0.78rem; color: var(--ink-6); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-3);
  background: var(--ink-10);
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-9);
}
.user-chip i { color: var(--ink-5); }

/* Native <select> in topbar (filiais-selector) */
.topbar select {
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--ink-9);
  border-radius: var(--r-sm);
  background-color: var(--paper-2);
  color: var(--ink-2);
  cursor: pointer;
}

/* ----------------------------------------------------------------
   PAGE BODY
   ---------------------------------------------------------------- */
.page-body { padding: 1.5rem 1.75rem 3rem; flex: 1; max-width: 1480px; }

/* ----------------------------------------------------------------
   STAT CARDS (legacy alias kept; refreshed visuals)
   ---------------------------------------------------------------- */
.stat-card {
  border: 1px solid var(--ink-9);
  border-radius: var(--r-md);
  border-left: 4px solid var(--ink-9);
  background: var(--paper-2);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-spring);
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--ink-8); box-shadow: var(--shadow-md); }
.stat-card.aguardando  { border-left-color: var(--warn); }
.stat-card.em_producao { border-left-color: var(--accent); }
.stat-card.concluida   { border-left-color: var(--ok); }
.stat-card.cancelada   { border-left-color: var(--err); }

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink-1);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--ink-6);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-icon { font-size: 2rem; opacity: 0.18; color: var(--ink-5); }

/* ----------------------------------------------------------------
   FILTERS BAR
   ---------------------------------------------------------------- */
.filters-bar {
  background: var(--paper-2);
  border: 1px solid var(--ink-9);
  border-radius: var(--r-md);
  padding: 0.875rem 1.25rem;
  box-shadow: var(--shadow-soft);
}

/* ----------------------------------------------------------------
   TABLE
   ---------------------------------------------------------------- */
.table-card {
  background: var(--paper-2);
  border: 1px solid var(--ink-9);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.table thead th {
  background: var(--ink-11);
  border-bottom: 1px solid var(--ink-9);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-6);
  padding: 0.85rem 1rem;
}
.table tbody td { padding: 0.9rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--ink-10); color: var(--ink-2); font-size: 0.85rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover-row { cursor: pointer; transition: background 0.2s var(--ease-out); }
.table-hover-row:hover { background: var(--paper-3) !important; }

/* ----------------------------------------------------------------
   BOOTSTRAP COMPONENT REFINEMENTS
   ---------------------------------------------------------------- */
.btn {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--r-sm);
  transition: all 0.2s var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px -4px rgb(30 64 175 / 0.4);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}
.btn-outline-secondary {
  border-color: var(--ink-9);
  color: var(--ink-4);
  background: var(--paper-2);
}
.btn-outline-secondary:hover {
  background: var(--paper-3);
  border-color: var(--ink-8);
  color: var(--ink-1);
}
.btn-outline-primary {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Reusable square icon button */
.btn-icon {
  background: var(--paper-2);
  border: 1px solid var(--ink-9);
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-4);
  transition: all 0.25s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}
.btn-icon:hover {
  border-color: var(--ink-8);
  color: var(--ink-1);
  background: var(--paper-3);
}
.btn-icon:active { transform: scale(0.96); }

/* Form controls */
.form-control, .form-select {
  font-family: var(--font-display);
  border: 1px solid var(--ink-9);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  background-color: var(--paper-2);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-control::placeholder { color: var(--ink-7); }

.form-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: -0.005em;
  margin-bottom: 0.4rem;
}

.input-group-text {
  background: var(--paper-3);
  border: 1px solid var(--ink-9);
  color: var(--ink-5);
}

/* Modal refinement */
.modal-content {
  border: 1px solid var(--ink-9);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom-color: var(--ink-10); padding: 1.1rem 1.4rem; }
.modal-body { padding: 1.25rem 1.4rem; }
.modal-footer { border-top-color: var(--ink-10); padding: 0.9rem 1.4rem; }
.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink-1);
}

/* Card refinement */
.card {
  border-color: var(--ink-9);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}

/* Bootstrap badges — premium pill style */
.badge {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--r-pill);
  letter-spacing: -0.005em;
}

/* Bootstrap nav-pills / nav-tabs */
.nav-tabs { border-bottom-color: var(--ink-9); }
.nav-tabs .nav-link {
  font-family: var(--font-display);
  color: var(--ink-5);
  border: none;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s var(--ease-out);
}
.nav-tabs .nav-link:hover { color: var(--ink-2); border-bottom-color: var(--ink-8); }
.nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* ----------------------------------------------------------------
   STATUS BADGE PALETTE (legacy classes refreshed)
   ---------------------------------------------------------------- */
.badge-status-aguardando  { background: rgb(180 83 9 / 0.10); color: var(--warn); }
.badge-status-em_producao { background: var(--accent-soft); color: var(--accent); }
.badge-status-concluida   { background: rgb(4 120 87 / 0.10); color: var(--ok); }
.badge-status-cancelada   { background: rgb(190 18 60 / 0.10); color: var(--err); }
.badge-etapa-pendente     { background: var(--ink-10); color: var(--ink-5); }
.badge-etapa-em_andamento { background: var(--accent-soft); color: var(--accent); }
.badge-etapa-concluida    { background: rgb(4 120 87 / 0.10); color: var(--ok); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Reusable pill */
.pill {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.pill.pi-warn { color: var(--warn); background: rgb(180 83 9 / 0.07); border-color: rgb(180 83 9 / 0.18); }
.pill.pi-info { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-ring); }
.pill.pi-ok   { color: var(--ok); background: rgb(4 120 87 / 0.07); border-color: rgb(4 120 87 / 0.18); }
.pill.pi-mute { color: var(--ink-5); background: var(--ink-10); border-color: var(--ink-9); }
.pill.pi-err  { color: var(--err); background: rgb(190 18 60 / 0.07); border-color: rgb(190 18 60 / 0.18); }

/* ----------------------------------------------------------------
   ETAPAS PIPELINE (legacy)
   ---------------------------------------------------------------- */
.pipeline-container {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 0.5rem 0 1rem;
  scrollbar-width: thin;
}

.etapa-card {
  min-width: 155px;
  flex-shrink: 0;
  border: 1px solid var(--ink-9);
  border-radius: var(--r-md);
  padding: 1rem 0.875rem;
  text-align: center;
  background: var(--paper-2);
  transition: all 0.3s var(--ease-out);
}
.etapa-card.status-concluida { border-color: var(--ok); background: rgb(4 120 87 / 0.05); }
.etapa-card.status-em_andamento {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.etapa-card.status-pendente { border-color: var(--ink-9); background: var(--paper-3); }

.etapa-icon-wrap { font-size: 1.6rem; margin-bottom: 0.4rem; line-height: 1; }
.etapa-card.status-concluida .etapa-icon-wrap { color: var(--ok); }
.etapa-card.status-em_andamento .etapa-icon-wrap { color: var(--accent); }
.etapa-card.status-pendente .etapa-icon-wrap { color: var(--ink-7); }

.etapa-nome { font-size: 0.8rem; font-weight: 600; color: var(--ink-1); margin-bottom: 0.35rem; letter-spacing: -0.01em; }
.etapa-meta { font-size: 0.68rem; color: var(--ink-6); line-height: 1.5; }

.pipeline-seta {
  display: flex; align-items: center;
  padding: 0 0.4rem;
  color: var(--ink-8);
  font-size: 1.1rem;
  flex-shrink: 0;
  padding-top: 2rem;
}

/* ----------------------------------------------------------------
   DETAIL PANELS (drawer/modal)
   ---------------------------------------------------------------- */
.detalhe-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-6);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.detalhe-valor {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}

/* ----------------------------------------------------------------
   PANEL — generic premium container
   ---------------------------------------------------------------- */
.panel {
  background: var(--paper-2);
  border: 1px solid var(--ink-9);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.panel-head {
  padding: 1.15rem 1.4rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.panel-head .pi-ico {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--ink-10);
  color: var(--ink-4);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.panel-head .title {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink-1);
}
.panel-head .count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-5);
  background: var(--ink-10);
  padding: 0.18rem 0.6rem;
  border-radius: var(--r-pill);
}
.panel-head .link-more {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.3s var(--ease-out);
}
.panel-head .link-more:hover { gap: 0.5rem; }

/* ----------------------------------------------------------------
   LIVING ELEMENTS (pulse, shimmer, skeleton)
   ---------------------------------------------------------------- */
.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  box-shadow: 0 0 0 0 rgb(4 120 87 / 0.45);
  animation: pulse-ok 2.4s var(--ease-out) infinite;
  flex-shrink: 0;
}
@keyframes pulse-ok {
  0%, 100% { box-shadow: 0 0 0 0 rgb(4 120 87 / 0.45); }
  50%      { box-shadow: 0 0 0 8px rgb(4 120 87 / 0); }
}
.pulse-dot.warn { background: var(--warn); animation-name: pulse-warn; }
@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgb(180 83 9 / 0.45); }
  50%      { box-shadow: 0 0 0 8px rgb(180 83 9 / 0); }
}
.pulse-dot.err { background: var(--err); animation-name: pulse-err; }
@keyframes pulse-err {
  0%, 100% { box-shadow: 0 0 0 0 rgb(190 18 60 / 0.45); }
  50%      { box-shadow: 0 0 0 8px rgb(190 18 60 / 0); }
}

/* Skeleton shimmer utility */
.sk {
  background: linear-gradient(90deg, var(--ink-10) 0%, var(--ink-9) 50%, var(--ink-10) 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  display: inline-block;
  min-width: 80px;
  height: 1em;
}
.sk-block {
  background: linear-gradient(90deg, var(--ink-10) 0%, var(--ink-9) 50%, var(--ink-10) 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
  height: 14px;
  margin: 8px 0;
}
@keyframes sk-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Stagger reveal helper — set --i on each child.
   Uses fill-mode 'backwards' so if the animation fails to run (reduced motion,
   parse error, etc) the element stays at its default opacity:1 instead of being
   stuck invisible. The 'from' state only applies during the delay window. */
.rise-in {
  --i: 0;
  animation: rise 0.7s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 70ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   LOADING OVERLAY
   ---------------------------------------------------------------- */
#loadingOverlay {
  position: fixed; inset: 0;
  background: rgb(250 250 249 / 0.78);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
}

/* ----------------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------------- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s var(--ease-out); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  /* Overlay NAO eh forcado a `block` aqui — controlado pelo JS via abrirSidebar/fecharSidebar.
     Forcar `display:block !important` deixava a tela inteira escurecida no mobile. */
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.45);
  z-index: 999;
  backdrop-filter: blur(2px);
}

@media (max-width: 575px) {
  .page-body { padding: 1.25rem 1rem 2rem; }
  .topbar { padding: 0.5rem 1rem; gap: 0.5rem; }
  /* Em tela bem estreita o subtitle some pra nao esmagar o title.
     A "topbar" mantem so o titulo + acoes. */
  .topbar-subtitle { display: none; }
  .topbar-title { font-size: 0.95rem; line-height: 1.2; }
}

/* Nav-tabs em telas medias e pequenas: scroll horizontal em vez de quebrar
   visualmente quando ha muitas abas (>4-5). Evita sobreposicao. */
@media (max-width: 991px) {
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* gradiente sutil nas pontas pra dar dica de "tem mais conteudo" */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .nav-tabs::-webkit-scrollbar { height: 3px; }
  .nav-tabs::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 2px; }
  .nav-tabs .nav-item { flex-shrink: 0; }
  .nav-tabs .nav-link { white-space: nowrap; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------
   MISC
   ---------------------------------------------------------------- */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--ink-6);
}
.empty-state i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
  color: var(--ink-7);
}
.empty-state p {
  font-family: var(--font-display);
  font-size: 0.88rem;
  margin: 0;
  letter-spacing: -0.005em;
}

.progress-thin { height: 5px; border-radius: var(--r-pill); }
.progress { background: var(--ink-10); border-radius: var(--r-pill); }
.progress-bar { background: var(--accent); }

.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.75rem; }

.modal-xl { max-width: 960px; }

/* Bootstrap text-* / bg-* swaps to harmonize with palette */
.text-primary { color: var(--accent) !important; }
.text-muted   { color: var(--ink-6) !important; }
.text-success { color: var(--ok) !important; }
.text-danger  { color: var(--err) !important; }
.text-warning { color: var(--warn) !important; }
.bg-success   { background-color: var(--ok) !important; }
.bg-danger    { background-color: var(--err) !important; }
.bg-warning   { background-color: var(--warn) !important; }
.bg-primary   { background-color: var(--accent) !important; }

/* ================================================================
   GRID PAGINATION — paginacao client-side reutilizavel
   Usada via assets/js/grid-pagination.js com .grid-pagination layout.
   ================================================================ */
.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.grid-pagination .info { color: #64748b; }
.grid-pagination .nav-pages { display: flex; align-items: center; gap: 0.25rem; }
.grid-pagination .nav-pages button {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  cursor: pointer;
  min-width: 2rem;
  transition: all 0.12s ease;
  font-size: 0.85rem;
}
.grid-pagination .nav-pages button:not(:disabled):hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.grid-pagination .nav-pages button.active {
  background: var(--bs-primary, #2563eb);
  border-color: var(--bs-primary, #2563eb);
  color: #fff;
  font-weight: 600;
}
.grid-pagination .nav-pages button:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  background: #fff;
}
.grid-pagination .nav-pages .ellipsis {
  padding: 0 0.4rem;
  color: #94a3b8;
}
.grid-pagination .size-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grid-pagination .size-control select {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  background: #fff;
}