/* ═══════════════════════════════════════════════════════
   CAJUPAR — Sistema Operacional
   app.css — Estilos Principais
   ═══════════════════════════════════════════════════════ */

/* ── VARIÁVEIS GLOBAIS ── */
:root {
  /* Cores da marca CAJUPAR */
  --brand-primary:   #E8501A;
  --brand-secondary: #F5A030;
  --brand-gradient:  linear-gradient(135deg, #F5A030 0%, #E8501A 100%);
  --brand-text:      #FFFFFF;

  /* Backgrounds */
  --bg-base:         #0D0D0F;
  --bg-surface:      #131316;
  --bg-card:         #1A1A1F;
  --bg-card-hover:   #202028;
  --bg-overlay:      rgba(13, 13, 15, 0.85);

  /* Textos */
  --text-primary:    #F2F0E8;
  --text-secondary:  #8A8880;
  --text-muted:      #4A4844;
  --text-link:       #E8A050;

  /* Bordas */
  --border:          rgba(255, 255, 255, 0.07);
  --border-hover:    rgba(255, 255, 255, 0.14);
  --border-focus:    var(--brand-primary);

  /* Alertas */
  --color-success:   #3A9B60;
  --color-danger:    #E04040;
  --color-warning:   #E09830;

  /* Cores dos setores */
  --setor-prod:      #3A9EBF;
  --setor-comida:    #E07840;
  --setor-bebida:    #7060D4;

  /* Layout */
  --topbar-h:        54px;
  --radius-sm:       6px;
  --radius:          10px;
  --radius-lg:       14px;
  --radius-xl:       20px;
  --sidebar-w:       240px;

  /* Tipografia */
  --font-head:       'Syne', system-ui, sans-serif;
  --font-body:       'DM Sans', system-ui, sans-serif;

  /* Sombras */
  --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:       0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.6);

  /* Transições */
  --ease:            cubic-bezier(0.16, 1, 0.3, 1);
  --ease-fast:       cubic-bezier(0.4, 0, 0.2, 1);
  --dur:             220ms;
}

/* ── RESET & BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

a { color: inherit; text-decoration: none; }


/* ═══════════════════════════════════════════════════════
   SISTEMA DE TELAS
   ═══════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg-base);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen[hidden] { display: none !important; }


/* ═══════════════════════════════════════════════════════
   TELA DE LOGIN
   ═══════════════════════════════════════════════════════ */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

.login-bg-orb {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(232, 80, 26, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  animation: fadeScaleIn 0.4s var(--ease) both;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.logo-mark { flex-shrink: 0; }

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-name {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  line-height: 1;
}

.logo-tagline {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.login-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.login-footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}


/* ── FORMULÁRIOS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur) var(--ease-fast),
              box-shadow var(--dur) var(--ease-fast);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:hover { border-color: var(--border-hover); }

.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(232, 80, 26, 0.15);
}

.input-wrapper { position: relative; }

.input-wrapper .form-input { padding-right: 44px; }

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: color var(--dur);
  padding: 4px;
  border-radius: 4px;
}
.btn-toggle-pass:hover { color: var(--text-secondary); }


/* ── BOTÕES ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  background: var(--brand-gradient);
  border: none;
  border-radius: var(--radius);
  padding: 0 24px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity var(--dur), transform 100ms;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; pointer-events: none; }

.btn-full { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur) var(--ease-fast);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* Loader dentro do botão */
.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}


/* ── ALERTAS ── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error {
  background: rgba(224, 64, 64, 0.12);
  border: 1px solid rgba(224, 64, 64, 0.3);
  color: #F06060;
}


/* ═══════════════════════════════════════════════════════
   TOPBAR DO APP
   ═══════════════════════════════════════════════════════ */
#screen-app {
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(19, 19, 22, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity var(--dur);
}
.topbar-logo:hover { opacity: 0.8; }

.topbar-mark { flex-shrink: 0; }

.topbar-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.bc-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.bc-item:last-child {
  color: var(--text-primary);
  font-weight: 500;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bc-link {
  cursor: pointer;
  transition: color var(--dur);
}
.bc-link:hover { color: var(--text-primary); }

.bc-sep {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}

/* ── TOPBAR AÇÕES ── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
}
.role-badge[data-role="MASTER"] {
  background: rgba(232, 80, 26, 0.15);
  color: var(--brand-primary);
}
.role-badge[data-role="LOJA"] {
  background: rgba(58, 158, 191, 0.15);
  color: var(--setor-prod);
}
.role-badge[data-role="SETOR"] {
  background: rgba(112, 96, 212, 0.15);
  color: var(--setor-bebida);
}

/* ── USER MENU ── */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: border-color var(--dur);
  -webkit-user-select: none;
  user-select: none;
}
.user-menu:hover { border-color: var(--border-hover); }

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron {
  color: var(--text-muted);
  transition: transform var(--dur);
}
.user-menu.open .user-chevron { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  z-index: 200;
}
.user-menu.open .user-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-header {
  padding: 14px 16px 12px;
}
.dropdown-header .dh-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.dropdown-header .dh-tipo {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--dur), color var(--dur);
  cursor: pointer;
}
.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.dropdown-item-danger { color: #F06060; }
.dropdown-item-danger:hover {
  background: rgba(224, 64, 64, 0.1);
  color: #F06060;
}


/* ═══════════════════════════════════════════════════════
   CONTEÚDO PRINCIPAL — VIEWS
   ═══════════════════════════════════════════════════════ */
.main {
  flex: 1;
  padding: 28px 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.view { animation: fadeUp 0.25s var(--ease) both; }
.view[hidden] { display: none !important; }

/* ── VIEW HEADER ── */
.view-header { margin-bottom: 28px; }

.view-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── STATS ── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 120px;
}
.stat-val {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}


/* ── GRID DE LOJAS ── */
.grid-lojas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.loja-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease-fast),
              background var(--dur) var(--ease-fast),
              transform 150ms var(--ease);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loja-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--loja-cor, var(--brand-gradient));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}

.loja-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.loja-card:hover::before { transform: scaleX(1); }
.loja-card:active { transform: translateY(0); }

.loja-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.loja-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}

.loja-arrow {
  color: var(--text-muted);
  transition: transform var(--dur), color var(--dur);
  flex-shrink: 0;
  margin-top: 2px;
}
.loja-card:hover .loja-arrow {
  transform: translateX(4px);
  color: var(--text-secondary);
}

.loja-nome {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.loja-setores {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.setor-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
}
.chip-prod   { background: rgba(58, 158, 191, 0.12);  color: #3A9EBF; }
.chip-comida { background: rgba(224, 120, 64, 0.12); color: #E07840; }
.chip-bebida { background: rgba(112, 96, 212, 0.12);  color: #7060D4; }


/* ── GRID DE SETORES ── */
.grid-setores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.setor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 36px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease-fast),
              background var(--dur) var(--ease-fast),
              transform 150ms var(--ease);
  position: relative;
  overflow: hidden;
}

.setor-card:hover {
  border-color: var(--setor-cor, var(--brand-primary));
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.setor-card:active { transform: translateY(0); }

.setor-indicator {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--setor-cor);
  margin-bottom: 20px;
}

.setor-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.setor-nome {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
}

.setor-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.setor-arrow {
  position: absolute;
  right: 20px;
  bottom: 20px;
  color: var(--text-muted);
  transition: transform var(--dur), color var(--dur);
}
.setor-card:hover .setor-arrow {
  transform: translate(4px, -4px);
  color: var(--setor-cor);
}


/* ── LISTA DE ARQUIVOS ── */
.files-list { display: flex; flex-direction: column; gap: 3px; }

.files-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 12px 14px 6px;
}
.files-section-label:first-child { padding-top: 0; }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease-fast),
              border-color var(--dur) var(--ease-fast);
}
.file-row:hover {
  background: var(--bg-card);
  border-color: var(--border);
}
.file-row:active { background: var(--bg-card-hover); }

.file-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}
.icon-folder { background: rgba(232, 160, 32, 0.12); }
.icon-file   { background: rgba(255, 255, 255, 0.05); }

.file-row-info { flex: 1; min-width: 0; }

.file-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-row-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-row-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--dur), color var(--dur);
}
.file-row:hover .file-row-chevron {
  transform: translateX(3px);
  color: var(--text-secondary);
}


/* ── LOADING VIEW ── */
.view-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 16px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}


/* ── ERRO VIEW ── */
.view-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 12px;
  text-align: center;
  padding: 40px;
}
.error-icon { color: var(--text-muted); margin-bottom: 8px; }
.error-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.error-msg { font-size: 13px; color: var(--text-secondary); max-width: 360px; }


/* ═══════════════════════════════════════════════════════
   TELA DE FICHA (TELA CHEIA)
   ═══════════════════════════════════════════════════════ */
.screen-ficha {
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.ficha-topbar {
  height: var(--topbar-h);
  background: rgba(19, 19, 22, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--dur);
  flex-shrink: 0;
}
.btn-back:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.ficha-topbar-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ficha-topbar-spacer { width: 80px; flex-shrink: 0; }

.ficha-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-base);
}

/* Estilos aplicados ao HTML das fichas */
.ficha-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.ficha-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 14px;
  padding: 40px;
  text-align: center;
}
.ficha-placeholder-icon { font-size: 52px; opacity: 0.35; }
.ficha-placeholder h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.ficha-placeholder p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 380px;
  line-height: 1.6;
}
.ficha-placeholder .ficha-setor-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(232, 80, 26, 0.12);
  color: var(--brand-primary);
  margin-bottom: 4px;
}


/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-primary);
  min-width: 200px;
  max-width: 340px;
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease) both;
}
.toast.removing { animation: toastOut 0.25s var(--ease) both; }
.toast-icon { flex-shrink: 0; }
.toast-success { border-color: rgba(58, 155, 96, 0.4); }
.toast-error   { border-color: rgba(224, 64, 64, 0.4); }
.toast-info    { border-color: rgba(58, 158, 191, 0.4); }


/* ═══════════════════════════════════════════════════════
   ANIMAÇÕES
   ═══════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}

/* staggered items */
.grid-lojas .loja-card:nth-child(1) { animation-delay: 0ms; }
.grid-lojas .loja-card:nth-child(2) { animation-delay: 40ms; }
.grid-lojas .loja-card:nth-child(3) { animation-delay: 80ms; }
.grid-lojas .loja-card:nth-child(4) { animation-delay: 120ms; }
.grid-lojas .loja-card:nth-child(5) { animation-delay: 160ms; }
.grid-lojas .loja-card:nth-child(6) { animation-delay: 200ms; }
.grid-lojas .loja-card:nth-child(7) { animation-delay: 240ms; }
.grid-lojas .loja-card:nth-child(8) { animation-delay: 280ms; }


/* ═══════════════════════════════════════════════════════
   RESPONSIVIDADE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-name { display: none; }
  .main { padding: 20px 14px; }
  .grid-setores { grid-template-columns: 1fr; }
  .grid-lojas { grid-template-columns: 1fr; }
  .view-title { font-size: 22px; }
  .login-box { padding: 28px 24px; }
  .user-name { display: none; }
  .role-badge { display: none; }
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
}

@media (max-width: 480px) {
  .stats-row { gap: 8px; }
  .stat-card { padding: 12px 14px; }
}

/* ── SAFE AREA (iPhone) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  #toast-container { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ── MODO ESCURO automático (já é dark, mas caso o SO force light) ── */
@media (prefers-color-scheme: light) {
  /* O sistema é forçadamente dark — sem alteração */
}
