@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #F0F4FA;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #F7F9FD;
  --bg-hover:      #EEF3FB;
  --border:        rgba(10,40,100,0.1);
  --border-strong: rgba(10,40,100,0.18);
  --border-focus:  rgba(0,102,204,0.45);

  --text-primary:   #0C1A2E;
  --text-secondary: #4A6480;
  --text-muted:     #94A9BF;

  --accent:       #0066CC;
  --accent-dim:   rgba(0,102,204,0.07);
  --accent-glow:  rgba(0,102,204,0.18);
  --accent-dark:  #0052A3;
  --accent-light: #E8F0FB;

  --amber:  #D97706;
  --red:    #DC2626;
  --green:  #059669;
  --blue:   #0066CC;
  --purple: #7C3AED;
  --yellow: var(--amber);

  --sidebar-width: 248px;
  --header-h:      54px;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 3px rgba(10,40,100,0.08), 0 4px 12px rgba(10,40,100,0.06);
  --shadow-lg:     0 8px 32px rgba(10,40,100,0.14), 0 2px 8px rgba(10,40,100,0.06);

  --font-ui:      'DM Sans', system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-heading: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── App root ────────────────────────────────────────────────────────────── */
#app { min-height: 100vh; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ── Mobile header ───────────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.btn-hamburger {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
}
.btn-hamburger:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-hamburger svg { width: 17px; height: 17px; }
.mobile-logo {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.05rem; color: var(--text-primary); letter-spacing: -0.01em;
}
.mobile-logo em { color: var(--accent); font-style: normal; }
.mobile-empresa {
  flex: 1; text-align: right; font-size: 0.72rem;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Sidebar overlay ─────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,30,60,0.4);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  z-index: 299;
}
.sidebar-overlay.show { display: block; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; z-index: 300;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.logo-wordmark { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 0.72rem;
  color: #fff; flex-shrink: 0;
}
.logo-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1rem; color: var(--text-primary); letter-spacing: -0.01em; line-height: 1;
}
.logo-name em { color: var(--accent); font-style: normal; }
.logo-version {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--text-muted); letter-spacing: 0.06em; margin-top: 3px;
}

.sidebar-filial {
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: var(--accent-light);
}
.sidebar-filial .sf-label {
  font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent); font-weight: 700;
}
.sidebar-filial .sf-nome {
  font-weight: 700; font-size: 0.84rem; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.sidebar-filial .sf-trocar {
  font-size: 0.7rem; color: var(--accent); background: none;
  border: none; padding: 0; margin-top: 3px; display: inline-block; opacity: 0.8;
}
.sidebar-filial .sf-trocar:hover { opacity: 1; text-decoration: underline; }

.sidebar-nav { flex: 1; padding: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary); border-radius: var(--radius);
  transition: all var(--transition); text-decoration: none; margin-bottom: 1px;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
.nav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 600; }
.nav-icon {
  width: 18px; height: 18px; display: flex;
  align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0; opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-info { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; flex-shrink: 0;
}
.user-name { font-size: 0.8rem; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  width: 100%; background: none; border: 1px solid var(--border);
  color: var(--text-secondary); padding: 7px 12px; border-radius: var(--radius);
  font-size: 0.78rem; transition: all var(--transition);
  font-family: inherit; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.logout-btn:hover { border-color: rgba(220,38,38,0.35); color: var(--red); background: rgba(220,38,38,0.05); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main { min-height: 100vh; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }
.page-content { flex: 1; display: flex; flex-direction: column; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  padding: 22px 28px 18px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; flex-shrink: 0;
}
.page-header h2 {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 800;
  color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.2;
}
.page-header .subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-body { padding: 24px 28px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-elevated);
}
.card-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.card-body  { padding: 20px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px; border-radius: var(--radius);
  font-size: 0.83rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap; line-height: 1; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); text-decoration: none; box-shadow: 0 0 0 3px var(--accent-glow); }

.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: rgba(10,40,100,0.28); text-decoration: none; }

.btn-danger { background: transparent; color: var(--red); border-color: rgba(220,38,38,0.3); }
.btn-danger:hover:not(:disabled) { background: rgba(220,38,38,0.07); border-color: var(--red); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }

.btn-sm   { padding: 5px 11px; font-size: 0.76rem; }
.btn-lg   { padding: 11px 22px; font-size: 0.9rem; }
.btn-icon { padding: 7px 9px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 0.69rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; font-family: var(--font-mono); white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-rascunho    { background: rgba(74,100,128,0.1);  color: var(--text-secondary); }
.badge-rascunho::before    { background: var(--text-muted); }
.badge-assinada    { background: rgba(0,102,204,0.1);   color: var(--accent); }
.badge-assinada::before    { background: var(--accent); }
.badge-enviada     { background: rgba(217,119,6,0.1);   color: var(--amber); }
.badge-enviada::before     { background: var(--amber); }
.badge-autorizada  { background: rgba(5,150,105,0.1);   color: var(--green); }
.badge-autorizada::before  { background: var(--green); }
.badge-rejeitada   { background: rgba(220,38,38,0.1);   color: var(--red); }
.badge-rejeitada::before   { background: var(--red); }
.badge-cancelada   { background: rgba(220,38,38,0.07);  color: rgba(220,38,38,0.65); }
.badge-cancelada::before   { background: rgba(220,38,38,0.45); }
.badge-inutilizada { background: rgba(74,100,128,0.08); color: var(--text-muted); }
.badge-inutilizada::before { background: var(--text-muted); }
.badge-denegada    { background: rgba(220,38,38,0.07);  color: rgba(220,38,38,0.65); }
.badge-denegada::before    { background: rgba(220,38,38,0.45); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  background: linear-gradient(145deg, #EEF4FF 0%, #F5F8FF 55%, #EDF6FF 100%);
}
.login-page::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,102,204,0.08) 0%, transparent 65%);
  top: -200px; right: -100px; pointer-events: none;
}
.login-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 42px 38px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); position: relative; z-index: 1;
  animation: fadeUp 0.35s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo .logo-mark {
  width: 42px; height: 42px; background: var(--accent); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 0.84rem; color: #fff;
}
.login-logo .logo-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.login-logo .logo-name em { color: var(--accent); font-style: normal; }
.login-title { font-family: var(--font-display); font-size: 1.65rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; margin-bottom: 5px; line-height: 1; }
.login-sub   { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 28px; }
.login-error { background: rgba(220,38,38,0.06); border: 1px solid rgba(220,38,38,0.2); border-radius: var(--radius); padding: 10px 13px; font-size: 0.82rem; color: var(--red); margin-bottom: 14px; }

/* ── Filial selector ─────────────────────────────────────────────────────── */
.filial-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(145deg, #EEF4FF 0%, #F5F8FF 55%, #EDF6FF 100%);
}
.filial-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 34px; width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg); animation: fadeUp 0.3s cubic-bezier(.4,0,.2,1);
}
.filial-card h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.filial-card p  { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 22px; }
.filial-list    { display: flex; flex-direction: column; gap: 8px; }
.filial-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer; transition: all var(--transition);
}
.filial-item:hover { border-color: var(--accent); background: var(--accent-dim); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,102,204,0.1); }
.filial-item .name  { font-weight: 700; font-size: 0.88rem; }
.filial-item .cnpj  { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.filial-item .amb   { font-family: var(--font-mono); font-size: 0.67rem; padding: 3px 8px; border-radius: 6px; font-weight: 600; flex-shrink: 0; }
.filial-item .amb.homolog { background: rgba(217,119,6,0.1); color: var(--amber); }
.filial-item .amb.prod    { background: rgba(5,150,105,0.1); color: var(--green); }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card  { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; transition: all var(--transition); box-shadow: var(--shadow); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(10,40,100,0.12); border-color: var(--border-strong); }
.stat-label    { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); font-weight: 700; margin-bottom: 10px; }
.stat-value    { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.stat-sublabel { font-size: 0.7rem; color: var(--text-muted); margin-top: 5px; font-family: var(--font-mono); }
.stat-auth  .stat-value { color: var(--green); }
.stat-ras   .stat-value { color: var(--text-secondary); }
.stat-env   .stat-value { color: var(--amber); }
.stat-rej   .stat-value { color: var(--red); }
.stat-total .stat-value { color: var(--accent); }

/* ── Loading / Spinner ───────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 48px; color: var(--text-muted); font-size: 0.85rem; }
.spinner { width: 20px; height: 20px; border: 2px solid rgba(0,102,204,0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────────────────────────────────────────────  */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.8rem; margin-bottom: 13px; opacity: 0.35; }
.empty-state p { font-size: 0.86rem; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 11px 14px; border-radius: var(--radius); font-size: 0.82rem; border: 1px solid; margin-bottom: 14px; }
.alert-warning { background: rgba(217,119,6,0.07); border-color: rgba(217,119,6,0.25); color: #92400E; }
.alert-error   { background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.2);  color: var(--red); }
.alert-success { background: rgba(5,150,105,0.07); border-color: rgba(5,150,105,0.2);  color: #065F46; }

/* ── Detail grid ─────────────────────────────────────────────────────────── */
.detail-grid { display: flex; flex-direction: column; }
.detail-row  { display: flex; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; min-width: 140px; flex-shrink: 0; font-weight: 600; }
.detail-value { font-size: 0.86rem; color: var(--text-primary); word-break: break-all; }
.detail-field .field-label { font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.detail-field .field-value { font-size: 0.87rem; color: var(--text-primary); font-weight: 500; }
.detail-field .field-value.mono { font-family: var(--font-mono); font-size: 0.8rem; }

/* ── Chave de acesso ──────────────────────────────────────────────────────  */
.chave-acesso { font-family: var(--font-mono); font-size: 0.77rem; color: var(--text-secondary); letter-spacing: 0.04em; word-break: break-all; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; transition: all var(--transition); }
.chave-acesso:hover { border-color: var(--accent); color: var(--text-primary); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; scrollbar-width: none; background: var(--bg-surface); }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { padding: 11px 16px; font-size: 0.83rem; font-weight: 500; font-family: inherit; background: none; border: none; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); white-space: nowrap; cursor: pointer; }
.tab-btn:hover  { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Action bar ──────────────────────────────────────────────────────────── */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; background: var(--bg-elevated); border-bottom: 1px solid var(--border); }

/* ── Config grid ───────────────────────────────────────────────────────── */
.config-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; min-width: 0; }
.config-grid > * { min-width: 0; }
.detail-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; min-width: 0; }
.detail-grid-2 > * { min-width: 0; }
@media (max-width: 900px) {
  .config-grid { grid-template-columns: 1fr; }
  .detail-grid-2 { grid-template-columns: 1fr; }
  .detail-row { flex-direction: column; gap: 4px; padding: 10px 0; }
  .detail-label { min-width: auto; }
  .detail-value { word-break: break-all; overflow-wrap: anywhere; }
}

/* ── Utility ──────────────────────────────────────────────────────────────  */
.mono            { font-family: var(--font-mono); }
.text-muted      { color: var(--text-muted); }
.text-secondary  { color: var(--text-secondary); }
.text-accent     { color: var(--accent); }
.text-green      { color: var(--green); }
.text-red        { color: var(--red); }
.text-muted      { color: var(--text-muted); }
.text-center     { text-align: center; }
.text-sm         { font-size: 0.81rem; }
.text-xs         { font-size: 0.72rem; }
.uppercase       { text-transform: uppercase; }
.justify-end     { justify-content: flex-end; }
.min-w-130       { min-width: 130px; }
.min-w-180       { min-width: 180px; }
.min-w-200       { min-width: 200px; }
.max-w-400       { max-width: 400px; }
.w-45            { width: 45px; }
.w-55            { width: 55px; }
.w-70            { width: 70px; }
.w-80            { width: 80px; }
.w-90            { width: 90px; }
.mt-1            { margin-top: 4px; }
.mt-2            { margin-top: 8px; }
.mt-3            { margin-top: 12px; }
.mt-4            { margin-top: 16px; }
.mb-1            { margin-bottom: 4px; }
.mb-2            { margin-bottom: 8px; }
.mb-3            { margin-bottom: 12px; }
.mb-4            { margin-bottom: 16px; }
.pt-3            { padding-top: 12px; }
.border-t        { border-top: 1px solid var(--border); }
.d-none          { display: none; }
.loading-sm      { padding: 12px; }
.loading-screen   { height: 100vh; display: flex; align-items: center; justify-content: center; }
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.gap-4           { gap: 16px; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full          { width: 100%; }
.mt-1            { margin-top: 4px; }
.mt-2            { margin-top: 8px; }
.mt-3            { margin-top: 12px; }
.mt-4            { margin-top: 16px; }
.mb-1            { margin-bottom: 4px; }
.mb-2            { margin-bottom: 8px; }
.mb-3            { margin-bottom: 12px; }
.mb-4            { margin-bottom: 16px; }
.pt-3            { padding-top: 12px; }
.border-t        { border-top: 1px solid var(--border); }
.text-secondary  { color: var(--text-secondary); }
.text-sm         { font-size: 0.81rem; }
.text-xs         { font-size: 0.72rem; }
.text-warning    { color: var(--warning); }
.d-none          { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { display: flex; flex-direction: column; }
  .mobile-header { display: flex; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width); transform: translateX(-100%); transition: transform 0.26s cubic-bezier(.4,0,.2,1); z-index: 300; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(10,40,100,0.15); }
  .main { min-height: calc(100vh - var(--header-h)); }
  .page-header { padding: 16px 16px 14px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header h2 { font-size: 1.2rem; }
  .page-actions { width: 100%; }
  .page-actions .btn:first-child:last-child,
  .page-actions > a:first-child:last-child { width: 100%; justify-content: center; }
  .page-body { padding: 14px 14px 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-value { font-size: 1.7rem !important; }
  .card { border-radius: 10px; }
}
@media (max-width: 480px) {
  .login-card  { padding: 28px 20px; }
  .filial-card { padding: 24px 16px; }
  .page-body   { padding: 12px 12px 24px; }
}
