/* ═══════════════════════════════════════════════════════
   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 */
}


/* ═══════════════════════════════════════════════════════
   PAINEL FIXO DE SINCRONIZAÇÃO
   ═══════════════════════════════════════════════════════ */
.sync-progress-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  color: #fff;
  backdrop-filter: blur(14px);
}

.sync-progress-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sync-progress-spinner {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.sync-progress-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.sync-progress-detail {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
}

.sync-progress-bar {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.sync-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.9);
  transition: width 240ms ease;
}

.sync-progress-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.66);
}

.sync-progress-result-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
}

.sync-progress-done {
  border-color: rgba(34, 197, 94, 0.45);
}

.sync-progress-error {
  border-color: rgba(239, 68, 68, 0.45);
}

.sync-progress-close {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: #111827;
  background: #fff;
  font-weight: 700;
}

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

@media (max-width: 768px) {
  .sync-progress-panel {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}


/* ═══════════════════════════════════════════════════════
   BUSCA GLOBAL DE FICHAS
   ═══════════════════════════════════════════════════════ */
.files-search {
  margin-top: 14px;
  width: min(520px, 100%);
}

.files-search-input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 14px;
  outline: none;
}

.files-search-input:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.09);
}

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

.file-row-preloaded .file-row-meta::after {
  content: ' · pré-carregada';
  color: var(--text-muted);
}

.sync-progress-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.sync-progress-metric {
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sync-progress-metric strong {
  display: block;
  font-size: 13px;
}

.sync-progress-metric span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
}

/* ═══════════════════════════════════════════════════════
   MELHORIAS PRO — LOGS, RETRY E MODO COZINHA/TABLET
   ═══════════════════════════════════════════════════════ */
.sync-progress-retry {
  margin-top: 10px;
  margin-right: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: rgba(224, 152, 48, 0.14);
  color: var(--color-warning);
  border: 1px solid rgba(224, 152, 48, 0.28);
  font-weight: 700;
}

.sync-logs-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sync-logs-modal {
  width: min(860px, 100%);
  max-height: min(760px, 92vh);
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
}

.sync-logs-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px;
  border-bottom: 1px solid var(--border);
}

.sync-logs-head h2 {
  font-family: var(--font-head);
  font-size: 22px;
  margin-bottom: 4px;
}

.sync-logs-head p {
  color: var(--text-secondary);
  font-size: 13px;
}

.sync-logs-head button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
}

.sync-logs-body {
  max-height: 620px;
  overflow: auto;
  padding: 16px;
}

.sync-log-row {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 10px;
}

.sync-log-row p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.sync-log-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sync-log-main strong {
  font-size: 14px;
}

.sync-log-main span {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.sync-log-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.sync-log-grid span {
  display: block;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

.sync-log-concluido {
  border-color: rgba(58, 155, 96, 0.28);
}

.sync-log-erro {
  border-color: rgba(224, 64, 64, 0.35);
}

.sync-log-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.file-row-preloaded .file-row-meta::after {
  content: ' · pronta';
  color: var(--color-success);
}

body.modo-cozinha {
  font-size: 17px;
}

body.modo-cozinha .topbar {
  min-height: 68px;
}

body.modo-cozinha .main {
  padding-bottom: 32px;
}

body.modo-cozinha .loja-card,
body.modo-cozinha .setor-card,
body.modo-cozinha .file-row {
  min-height: 92px;
  border-radius: 18px;
}

body.modo-cozinha .file-row {
  padding: 22px;
}

body.modo-cozinha .file-row-name {
  font-size: 18px;
}

body.modo-cozinha .file-row-meta {
  font-size: 14px;
}

body.modo-cozinha .files-search-input {
  min-height: 54px;
  font-size: 17px;
}

body.modo-cozinha .btn-back {
  min-height: 52px;
  padding-inline: 18px;
}

@media (max-width: 720px) {
  .sync-log-main,
  .sync-progress-header {
    align-items: flex-start;
  }

  .sync-log-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ETA e acompanhamento detalhado da sincronização */
.sync-progress-eta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.sync-progress-current {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.07);
}

.sync-progress-warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.20);
}


.sync-progress-cancel {
  margin-top: 10px;
  margin-right: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.32);
  font-weight: 800;
  cursor: pointer;
}

.sync-progress-cancel:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.sync-progress-cancelled {
  border-color: rgba(224, 152, 48, 0.42);
}


/* ═══════════════════════════════════════════════════════
   MELHORIAS OPERACIONAIS v2
   ═══════════════════════════════════════════════════════ */

/* ── Badge "pronto" nas fichas cacheadas ── */
.cached-badge {
  color: var(--color-success);
  font-size: 11px;
  font-weight: 600;
}

/* ── Empty state ── */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ── Breadcrumb ativo ── */
.bc-active {
  color: var(--text-primary) !important;
  font-weight: 500;
}

/* ── Touch targets maiores no mobile ── */
@media (max-width: 768px) {
  .file-row {
    padding: 14px 14px;
    min-height: 56px;
  }
  .loja-card {
    padding: 18px;
    min-height: 100px;
  }
  .setor-card {
    padding: 20px 18px 28px;
  }
  /* Botão voltar maior na tela de ficha */
  .btn-back {
    height: 42px;
    padding: 0 16px;
    font-size: 14px;
  }
  /* Título da ficha menor no mobile */
  .ficha-topbar-title {
    font-size: 13px;
  }
  /* Grid de setores em mobile: 1 coluna mas maior */
  .grid-setores {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ── Ficha: iframe ocupa tela cheia ── */
.ficha-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff; /* fundo branco para fichas HTML */
  display: flex;
  flex-direction: column;
}

.ficha-content iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

/* ── Loading dentro da ficha ── */
.ficha-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  padding: 40px;
  text-align: center;
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Setor card: touch feedback ── */
.setor-card:active,
.loja-card:active,
.file-row:active {
  opacity: 0.75;
  transform: scale(0.99);
}

/* ── Sync panel: melhor posicionamento mobile ── */
@media (max-width: 600px) {
  .sync-progress-panel {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    max-width: none !important;
  }
}

/* ── Topbar: logo sempre visível no mobile ── */
@media (max-width: 420px) {
  .topbar-name { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .main { padding: 16px 12px; }
}


/* ═══════════════════════════════════════════════════════
   NOVOS RECURSOS v3
   ═══════════════════════════════════════════════════════ */

/* ── SPLASH SCREEN ── */
#splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  transition: opacity 0.4s ease, visibility 0.4s;
}
#splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
  display: flex; align-items: center; gap: 14px;
  animation: fadeUp 0.5s var(--ease) 0.1s both;
}
.splash-logo span {
  font-family: var(--font-head); font-size: 28px; font-weight: 800;
  letter-spacing: 0.06em; color: var(--text-primary);
}


/* ── BANNERS GLOBAIS ── */
.global-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 20px; font-size: 13px; font-weight: 500;
  transition: transform 0.3s var(--ease);
}
.banner-offline {
  background: rgba(160,60,20,0.95); color: #FFD0B0;
  backdrop-filter: blur(8px);
}
.banner-update {
  background: rgba(40,80,160,0.95); color: #B0D0FF;
  backdrop-filter: blur(8px);
}
.banner-btn {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px; padding: 3px 12px; font-size: 12px; font-weight: 600;
  color: #fff; cursor: pointer; font-family: var(--font-body);
  transition: background 0.2s;
}
.banner-btn:hover { background: rgba(255,255,255,0.3); }


/* ── BOTÃO ÍCONE NA TOPBAR ── */
.topbar-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  transition: all var(--dur) var(--ease-fast); flex-shrink: 0;
}
.topbar-icon-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.topbar-icon-btn.active {
  background: rgba(232,80,26,0.12); border-color: rgba(232,80,26,0.3);
  color: var(--brand-primary);
}


/* ── BARRA DE BUSCA GLOBAL ── */
.search-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: var(--topbar-h); z-index: 40;
  animation: fadeDown 0.2s var(--ease) both;
}
.search-bar-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; max-width: 1100px; margin: 0 auto;
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-bar-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font-body); font-size: 15px; color: var(--text-primary);
}
.search-bar-input::placeholder { color: var(--text-muted); }
.search-bar-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 16px; cursor: pointer; padding: 4px; border-radius: 4px;
  transition: color var(--dur); flex-shrink: 0;
}
.search-bar-close:hover { color: var(--text-primary); }
.search-results {
  border-top: 1px solid var(--border);
  max-height: 360px; overflow-y: auto;
  max-width: 1100px; margin: 0 auto;
}
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer;
  transition: background var(--dur);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-icon { font-size: 16px; flex-shrink: 0; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-nome {
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-result-path { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.search-empty {
  padding: 24px 20px; text-align: center; font-size: 13px; color: var(--text-muted);
}
.search-loading {
  padding: 20px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
}


/* ── FAVORITOS & RECENTES ── */
.quick-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-muted);
  margin-bottom: 10px; margin-top: 4px;
}
.quick-list {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 28px;
}
.quick-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius);
  cursor: pointer; border: 1px solid transparent;
  transition: background var(--dur), border-color var(--dur);
}
.quick-item:hover { background: var(--bg-card); border-color: var(--border); }
.quick-item-icon { font-size: 15px; flex-shrink: 0; }
.quick-item-info { flex: 1; min-width: 0; }
.quick-item-nome {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quick-item-path { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.quick-item-remove {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; cursor: pointer; padding: 4px; border-radius: 4px;
  opacity: 0; transition: opacity var(--dur), color var(--dur);
  flex-shrink: 0;
}
.quick-item:hover .quick-item-remove { opacity: 1; }
.quick-item-remove:hover { color: var(--color-danger); }


/* ── FILTRO LOCAL NA VIEW DE ARQUIVOS ── */
.files-filter { margin-top: 10px; }
.files-filter-input {
  width: 100%; height: 38px; background: var(--bg-card);
  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);
}
.files-filter-input::placeholder { color: var(--text-muted); }
.files-filter-input:focus { border-color: var(--brand-primary); }


/* ── FICHA TOPBAR — BOTÕES DE AÇÃO ── */
.ficha-topbar-actions {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.ficha-action-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  transition: all var(--dur) var(--ease-fast);
}
.ficha-action-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.ficha-action-btn.favorito-ativo {
  background: rgba(232,160,32,0.15); border-color: rgba(232,160,32,0.4);
  color: #E8A020;
}
.ficha-topbar-spacer { display: none; } /* removido — substituído por ações */


/* ── PAINEL ADMIN ── */
.screen-modal {
  display: flex; flex-direction: column; background: var(--bg-base);
  z-index: 90;
}
.modal-topbar {
  height: var(--topbar-h); background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 14px;
  position: sticky; top: 0; z-index: 10;
}
.modal-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 700;
  color: var(--text-primary); flex: 1;
}
.modal-content { flex: 1; padding: 24px; max-width: 860px; margin: 0 auto; width: 100%; overflow-y: auto; }

.admin-user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; transition: border-color var(--dur);
}
.admin-user-row:hover { border-color: var(--border-hover); }
.admin-user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-gradient); display: flex; align-items: center;
  justify-content: center; font-family: var(--font-head); font-size: 14px;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.admin-user-avatar.inativo { background: var(--bg-hover); color: var(--text-muted); }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-nome { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.admin-user-login { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono, monospace); margin-top: 2px; }
.admin-user-meta { display: flex; gap: 6px; margin-top: 4px; }
.admin-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 7px; border-radius: 5px;
}
.admin-badge-master { background: rgba(232,80,26,0.12); color: var(--brand-primary); }
.admin-badge-loja   { background: rgba(58,158,191,0.12); color: #3A9EBF; }
.admin-badge-setor  { background: rgba(112,96,212,0.12); color: #7060D4; }
.admin-badge-inativo { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.admin-user-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-admin-edit {
  height: 32px; padding: 0 12px; font-size: 12px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-secondary); cursor: pointer;
  font-family: var(--font-body); transition: all var(--dur);
}
.btn-admin-edit:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* Inner modal (form de edição) */
.inner-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
/* BUG FIX: CSS display:flex sobrescreve [hidden] do browser — forçar none */
.inner-modal[hidden] { display: none !important; }
.inner-modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  animation: fadeScaleIn 0.25s var(--ease) both;
}
.inner-modal-title {
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  margin-bottom: 20px; color: var(--text-primary);
}


/* ── ANIMAÇÕES ADICIONAIS ── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── AJUSTES MOBILE PARA NOVOS ELEMENTOS ── */
@media (max-width: 600px) {
  .ficha-topbar-actions { gap: 2px; }
  .ficha-action-btn { width: 32px; height: 32px; }
  .search-bar-inner { padding: 10px 14px; }
  .modal-content { padding: 16px; }
  .inner-modal-box { padding: 20px; }
  .admin-user-actions { flex-direction: column; gap: 4px; }
}


/* v6-20260508-1148 — Correção definitiva de banners/PWA */
#banner-offline,
#banner-update,
.banner-offline,
.banner-update {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}
body { padding-top: 0 !important; }


/* ── MODO DA FICHA ── */
.ficha-mode-select {
  height: 36px; min-width: 148px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0 10px; font-size: 13px;
  outline: none; cursor: pointer;
}
.ficha-mode-select:hover { border-color: var(--border-hover); }
.inner-modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.inner-modal-close { width:32px; height:32px; border-radius:8px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); font-size:22px; line-height:1; cursor:pointer; }
.inner-modal-close:hover { color:var(--text-primary); border-color:var(--border-hover); }

/* ── STATUS DE SINCRONIZAÇÃO ── */
.sync-content { max-width: 980px; }
.sync-status-card, .sync-log-row {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; color: var(--text-primary);
}
.sync-status-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:12px; }
.sync-status-title { font-weight:700; font-size:16px; margin-bottom:4px; }
.sync-status-sub { color:var(--text-secondary); font-size:13px; }
.sync-status-badge { border-radius:999px; padding:5px 10px; font-size:11px; font-weight:800; text-transform:uppercase; border:1px solid var(--border); color:var(--text-secondary); }
.sync-status-badge.rodando, .sync-status-badge.cancelando { color:#F5A030; border-color:rgba(245,160,48,.35); background:rgba(245,160,48,.1); }
.sync-status-badge.concluido { color:#41c77a; border-color:rgba(65,199,122,.35); background:rgba(65,199,122,.1); }
.sync-status-badge.erro, .sync-status-badge.cancelado { color:var(--color-danger); border-color:rgba(255,80,80,.35); background:rgba(255,80,80,.1); }
.sync-progress { height:10px; border-radius:999px; background:rgba(255,255,255,.08); overflow:hidden; margin:12px 0; }
.sync-progress-bar { height:100%; border-radius:999px; background:linear-gradient(90deg, #F5A030, #E8501A); transition:width .25s ease; }
.sync-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:12px; }
.sync-kpi { background:rgba(255,255,255,.035); border:1px solid var(--border); border-radius:10px; padding:10px; }
.sync-kpi-label { color:var(--text-muted); font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
.sync-kpi-value { margin-top:4px; font-weight:800; font-size:15px; }
.sync-section-title { font-size:14px; font-weight:800; margin:24px 0 10px; color:var(--text-primary); }
.sync-logs-list { display:flex; flex-direction:column; gap:8px; }
.sync-log-row { display:grid; grid-template-columns:150px 120px 1fr; gap:10px; align-items:start; font-size:13px; }
.sync-log-date { color:var(--text-muted); }
.sync-log-status { font-weight:800; text-transform:uppercase; }
.sync-log-msg { color:var(--text-secondary); }
@media(max-width:720px){ .sync-grid{grid-template-columns:1fr 1fr}.sync-log-row{grid-template-columns:1fr}.ficha-mode-select{min-width:112px;font-size:12px} }

/* Ajustes profissionais — usuários e sync */
.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.admin-filter-search,
.admin-filter-select { height: 38px; font-size: 13px; }
.admin-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.btn-admin-danger {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  background: rgba(255,80,80,0.08);
  border: 1px solid rgba(255,80,80,0.22);
  border-radius: var(--radius);
  color: var(--color-danger);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--dur);
}
.btn-admin-danger:hover { border-color: rgba(255,80,80,0.42); background: rgba(255,80,80,0.13); }
.sync-current-item {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
}
.sync-error-details {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,80,80,.06);
  border: 1px solid rgba(255,80,80,.22);
  color: var(--text-secondary);
  font-size: 12px;
}
.sync-error-details summary { cursor: pointer; color: var(--color-danger); font-weight: 700; margin-bottom: 8px; }
.sync-log-detail { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.35; }
@media(max-width:980px){ .admin-toolbar{grid-template-columns:1fr 1fr;} }
@media(max-width:640px){ .admin-toolbar{grid-template-columns:1fr;} }


/* Sync flutuante profissional */
.sync-floating-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  width: min(420px, calc(100vw - 32px));
  background: rgba(28, 28, 32, 0.98);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding: 16px;
  color: #fff;
}
.sync-float-title { font-weight: 800; font-size: 15px; padding-right: 28px; }
.sync-float-sub, .sync-float-meta { color: rgba(255,255,255,.68); font-size: 12px; margin-top: 6px; }
.sync-float-bar { height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.10); margin-top: 12px; }
.sync-float-bar > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff9824, #ff5a1f); transition: width .25s ease; }
.sync-float-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sync-float-actions button { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; font-weight: 700; }
.sync-float-close { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border: 0; background: transparent; color: rgba(255,255,255,.7); font-size: 22px; cursor: pointer; }
.sync-warning { border-color: rgba(255,152,36,.35) !important; color: #ffb15d !important; }


/* ═══════════════════════════════════════════════════════
   ADMIN PANEL — CLASSES FALTANTES
   ═══════════════════════════════════════════════════════ */

/* Botão de perigo (desativar usuário) */
.btn-admin-danger {
  height: 32px; padding: 0 12px; font-size: 12px;
  background: rgba(224,64,64,0.08); border: 1px solid rgba(224,64,64,0.25);
  border-radius: var(--radius); color: #E06060; cursor: pointer;
  font-family: var(--font-body); transition: all var(--dur);
}
.btn-admin-danger:hover { background: rgba(224,64,64,0.15); border-color: rgba(224,64,64,0.5); }

/* Toolbar de filtros */
.admin-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-filter-search {
  flex: 1; min-width: 180px; height: 38px !important;
}
.admin-filter-select {
  height: 38px !important; min-width: 140px; flex-shrink: 0;
}

/* Estado vazio */
.admin-empty {
  padding: 40px 20px; text-align: center;
  font-size: 14px; color: var(--text-muted);
}

/* Cabeçalho do inner-modal */
.inner-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.inner-modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 2px 6px;
  border-radius: 4px; transition: color var(--dur);
}
.inner-modal-close:hover { color: var(--text-primary); }

/* Confirm inline no row */
.admin-confirm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(224,64,64,0.08);
  border: 1px solid rgba(224,64,64,0.2); border-radius: var(--radius);
  margin-bottom: 8px; font-size: 13px; color: var(--text-primary);
}
.admin-confirm-row p { flex: 1; }
.admin-confirm-yes {
  height: 30px; padding: 0 12px; font-size: 12px;
  background: rgba(224,64,64,0.15); border: 1px solid rgba(224,64,64,0.4);
  border-radius: var(--radius); color: #E06060; cursor: pointer;
  font-family: var(--font-body); font-weight: 600;
}
.admin-confirm-no {
  height: 30px; padding: 0 12px; font-size: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-secondary); cursor: pointer;
  font-family: var(--font-body);
}

/* Inner-modal-title agora dentro do head */
.inner-modal-head .inner-modal-title { margin-bottom: 0; }

/* Divisor no inner modal */
.inner-modal-divider {
  height: 1px; background: var(--border); margin: 16px 0;
}

/* Botões de ação do admin responsivos */
@media (max-width: 500px) {
  .admin-toolbar { gap: 8px; }
  .admin-filter-search { min-width: 100%; }
  .admin-filter-select { min-width: calc(50% - 4px); flex: 1; }
}

/* Nome da ficha atual no painel mini de sync */
.sync-float-ficha {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-style: italic;
}


/* ═══════════════════════════════════════════════════════
   SYNC PANEL — Painel de controle de sincronização v11
   ═══════════════════════════════════════════════════════ */

.sync-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}

.sync-action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 80ms;
  color: var(--text-primary);
}
.sync-action-btn:active { transform: scale(0.97); }
.sync-action-btn:hover  { background: var(--bg-card-hover); border-color: var(--border-hover); }

.sync-action-btn svg { flex-shrink: 0; opacity: .85; }

.sync-action-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}
.sync-action-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* cores por tipo */
.sync-action-primary svg { color: var(--brand-primary); }
.sync-action-brand   svg { color: #7060D4; }
.sync-action-step    svg { color: #3A9EBF; }
.sync-action-runner  svg { color: #F5A030; }
.sync-action-runner.running { background: rgba(245,160,48,.08); border-color: rgba(245,160,48,.3); }
.sync-action-runner.running svg { color: var(--color-danger, #E04040); }
.sync-action-retry   svg { color: #E07840; }
.sync-action-stop    svg { color: var(--color-danger, #E04040); }
.sync-action-reset   svg { color: var(--color-warning, #E09830); }
.sync-action-refresh svg { color: var(--text-secondary); }

/* resposta da etapa */
.sync-step-response {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 20px;
  overflow: hidden;
}
.sync-step-response-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.sync-step-response-body {
  padding: 12px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}
.sync-step-response-body .ok    { color: #3A9B60; }
.sync-step-response-body .erro  { color: var(--color-danger, #E04040); }


/* ═══════════════════════════════════════════════════════
   DESIGN v11 — MELHORIAS COMPLETAS
   ═══════════════════════════════════════════════════════ */

/* ── ACESSO RÁPIDO — pills horizontais, altura fixa ── */
.quick-access-wrap {
  margin-bottom: 22px;
  transition: all 280ms var(--ease);
  overflow: hidden;
}

.quick-access-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quick-access-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
}

.quick-toggle-btn {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all var(--dur);
  font-family: var(--font-body);
}
.quick-toggle-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }

/* Quando recolhido: oculta o body, mantém apenas o cabeçalho */
.quick-collapsed .quick-access-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-bottom: 0;
}
.quick-access-body {
  max-height: 120px;
  opacity: 1;
  transition: max-height 280ms var(--ease), opacity 220ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Faixa de pills com scroll horizontal — sem quebra de linha */
.quick-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.quick-pills-row::-webkit-scrollbar { display: none; }
.quick-pills-recentes:empty { display: none; }

/* Pill individual */
.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 34px;
  padding: 0 12px 0 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--dur), border-color var(--dur), transform 80ms;
  white-space: nowrap;
  max-width: 200px;
  text-align: left;
}
.quick-pill:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.quick-pill:active { transform: scale(0.97); }

.quick-pill-icon { font-size: 12px; flex-shrink: 0; }

.quick-pill-nome {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.quick-pill-del {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: none;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 2px;
  transition: background var(--dur), color var(--dur);
}
.quick-pill-del:hover { background: rgba(224,64,64,.2); color: var(--color-danger); }

.quick-pill-recent { border-style: dashed; }


/* ── TOPBAR SCROLL-SHRINK ── */
.topbar {
  transition: height var(--dur) var(--ease), padding var(--dur) var(--ease);
}
.topbar-shrunk {
  height: 42px;
}
.topbar-shrunk .breadcrumb { opacity: 0; pointer-events: none; }
.topbar-shrunk .topbar-sep { opacity: 0; }
.breadcrumb { transition: opacity 200ms ease; }
.topbar-sep  { transition: opacity 200ms ease; }


/* ── RIPPLE ── */
@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}
.loja-card, .setor-card, .file-row { position: relative; }


/* ── SKELETON LOADING ── */
@keyframes skelPulse {
  0%, 100% { opacity: .55; }
  50%       { opacity: .25; }
}

.skel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  min-height: 120px;
}
.skel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
}
.skel-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--bg-card);
  flex-shrink: 0;
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-icon-lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-line {
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,.07);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-line-sm {
  height: 10px;
  animation-delay: 200ms;
}

/* Grid de skeletons de lojas */
#grid-lojas .skel-card { animation: skelPulse 1.4s ease-in-out infinite; }
#grid-lojas .skel-card:nth-child(2) { animation-delay: 100ms; }
#grid-lojas .skel-card:nth-child(3) { animation-delay: 200ms; }
#grid-lojas .skel-card:nth-child(4) { animation-delay: 300ms; }


/* ── TOAST REDESENHADO ── */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px 13px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  font-size: 13px;
  color: var(--text-primary);
  min-width: 220px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn 0.32s var(--ease) both;
  position: relative;
  overflow: hidden;
  cursor: default;
}
.toast.removing { animation: toastOut 0.22s ease both; }

.toast-icon-success { color: var(--color-success); }
.toast-icon-error   { color: var(--color-danger); }
.toast-icon-warning { color: var(--color-warning); }
.toast-icon-info    { color: var(--setor-prod); }

.toast-success { border-color: rgba(58,155,96,.35); }
.toast-error   { border-color: rgba(224,64,64,.35); }
.toast-warning { border-color: rgba(224,152,48,.35); }
.toast-info    { border-color: rgba(58,158,191,.3); }

.toast-msg { flex: 1; line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--dur);
}
.toast-close:hover { color: var(--text-primary); }

/* Barra de progresso — indica tempo restante */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  border-radius: 0 0 14px 14px;
  background: rgba(255,255,255,.15);
  animation: toastProgress linear forwards;
  transform-origin: left;
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.toast-success .toast-progress { background: var(--color-success); }
.toast-error   .toast-progress { background: var(--color-danger); }
.toast-warning .toast-progress { background: var(--color-warning); }
.toast-info    .toast-progress { background: var(--setor-prod); }


/* ── FICHA LOADING SKELETON ── */
.ficha-loading-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, 90%);
  margin: 0 auto;
}
.ficha-skel-bar {
  height: 14px;
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  animation: skelPulse 1.4s ease-in-out infinite;
}


/* ── STAGGER DE ENTRADA DOS CARDS (dinâmico via inline style) ── */
.loja-card {
  animation: fadeUp 0.3s var(--ease) both;
}


/* ── MOBILE: manter pills legíveis ── */
@media (max-width: 600px) {
  .quick-pill { font-size: 12px; height: 32px; padding: 0 10px 0 9px; }
  .quick-pill-nome { max-width: 140px; }
}
