/* ================================================================
   GWM ERP - Estilos globais do shell
   ================================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body.shell {
  display: flex;
  height: 100vh;
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: #f4f6f9;
  color: #1e293b;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  transition: transform .3s;
}
.sidebar .brand { padding: 24px 20px; border-bottom: 1px solid #1e293b; }
.sidebar .brand h1 { font-size: 1.2rem; font-weight: 600; }
.sidebar .brand span { font-size: .75rem; color: #94a3b8; }

.nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav button {
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button:hover, .nav button.active { background: #1e293b; color: #fff; }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid #1e293b; font-size: .75rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #3b82f6; display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; margin-right: 8px;
}
.user { display: flex; align-items: center; margin-bottom: 12px; }
.btn-ghost {
  width: 100%; padding: 8px;
  background: #1e293b; border: 1px solid #334155; color: #cbd5e1;
  border-radius: 6px; cursor: pointer; font-size: .75rem;
}
.btn-ghost:hover { background: #334155; }

/* ===== Workspace ===== */
.workspace { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.hamburger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.crumbs { font-weight: 500; font-size: 1rem; }
.topbar-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }

.pill {
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  color: #475569;
}
.pill-ok { background: #dcfce7; color: #166534; }

/* ===== Tabbar ===== */
.tabbar {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 12px;
  overflow-x: auto;
}
.tabbar .tab {
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .85rem;
  color: #64748b;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabbar .tab.active {
  color: #0f172a;
  border-bottom-color: #3b82f6;
  font-weight: 500;
}

/* ===== Frames ===== */
.frames { flex: 1; position: relative; background: #f4f6f9; }
.frames iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none; display: none;
}
.frames iframe.active { display: block; }

/* ===== Welcome ===== */
.welcome { padding: 40px; }
.welcome h2 { font-size: 1.5rem; margin-bottom: 8px; }
.welcome p { color: #64748b; margin-bottom: 24px; }
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.welcome-grid .card {
  background: #fff; padding: 20px; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  cursor: pointer; transition: transform .2s;
}
.welcome-grid .card:hover { transform: translateY(-2px); }
.welcome-grid .card h3 { font-size: 1rem; margin-bottom: 4px; }
.welcome-grid .card p { font-size: .8rem; color: #64748b; }

/* ===== Seletor de idioma ===== */
.lang-selector { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  padding: 6px 12px; border-radius: 20px;
  font-size: .8rem; color: #475569;
  cursor: pointer; font-weight: 500; transition: .15s;
}
.lang-btn:hover { background: #e2e8f0; border-color: #cbd5e1; }
.lang-btn span:first-child { font-size: 1rem; }
.lang-caret { font-size: .7rem; color: #94a3b8; margin-left: 2px; }

.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  overflow: hidden; min-width: 180px; display: none; z-index: 200;
}
.lang-menu.show { display: block; }
.lang-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  background: none; border: none; color: #334155;
  font-size: .85rem; cursor: pointer; text-align: left;
  border-bottom: 1px solid #f1f5f9; transition: .1s;
}
.lang-menu button:last-child { border-bottom: none; }
.lang-menu button:hover { background: #f8fafc; }
.lang-menu button span { font-size: 1.1rem; }

/* ===== Overlay mobile ===== */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
.overlay.show { display: block; }

/* ===== Indicadores de status de sincronizacao ===== */
.pill-warn { background: #fef9c3; color: #854d0e; }
.pill-error { background: #fee2e2; color: #991b1b; }

#syncState::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
  transition: background .3s;
}
#syncState.pill-warn::before { background: #f59e0b; animation: pulse-dot 1s infinite; }
#syncState.pill-error::before { background: #ef4444; }
@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ===== Responsivo ===== */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 100; height: 100%; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
}
/* ===== Login ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 12px;
  padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .logo { text-align: center; margin-bottom: 30px; }
.login-card .logo h1 { font-size: 1.6rem; color: #0f172a; margin-bottom: 4px; }
.login-card .logo span { color: #64748b; font-size: .85rem; }

.login-form .field { margin-bottom: 16px; }
.login-form label {
  display: block; font-size: .8rem; font-weight: 500;
  color: #334155; margin-bottom: 6px;
}
.login-form input {
  width: 100%; padding: 12px 14px;
  border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: .9rem; transition: .15s;
}
.login-form input:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.login-form button {
  width: 100%; padding: 12px;
  background: #3b82f6; color: #fff; border: none;
  border-radius: 8px; font-size: .9rem; font-weight: 500;
  cursor: pointer; transition: .15s;
}
.login-form button:hover { background: #2563eb; }
.login-form button:disabled { background: #94a3b8; cursor: not-allowed; }

.login-error {
  background: #fee2e2; color: #991b1b;
  padding: 10px 14px; border-radius: 6px;
  font-size: .82rem; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }

.login-hint {
  margin-top: 20px; padding: 12px;
  background: #f8fafc; border-radius: 6px;
  font-size: .75rem; color: #64748b; line-height: 1.7;
}
.login-hint strong { color: #334155; }

/* ===== User info no sidebar ===== */
.user .role-badge {
  display: inline-block; padding: 1px 6px;
  border-radius: 8px; font-size: .65rem;
  font-weight: 600; margin-left: 6px;
  vertical-align: middle;
}
.role-gerencial { background: #dbeafe; color: #1e40af; }
.role-visualizador { background: #fef3c7; color: #854d0e; }