/* ============================================================
   TUPPERWARE SHE — Design System
   Industrial EHS · Verde Tupperware + Âmbar Segurança
   ============================================================ */

/* Fontes carregadas via <link> no HTML para melhor performance */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Verde Tupperware */
  --green-50:  #eaf4ee;
  --green-100: #c0deca;
  --green-200: #8fc2a0;
  --green-400: #2e8b57;
  --green-600: #1b6b45;
  --green-800: #0f4229;
  --green-900: #072918;

  /* Âmbar — alertas e vencimentos */
  --amber-50:  #fff8ec;
  --amber-100: #fde8b4;
  --amber-300: #f9c143;
  --amber-500: #d97706;
  --amber-700: #92400e;

  /* Vermelho — crítico / meta não atingida */
  --red-50:  #fef2f2;
  --red-200: #fecaca;
  --red-500: #ef4444;
  --red-700: #b91c1c;

  /* Grafite industrial */
  --gray-0:   #ffffff;
  --gray-50:  #f7f6f2;
  --gray-100: #edecea;
  --gray-200: #d6d3cc;
  --gray-300: #b8b5ad;
  --gray-400: #8c897f;
  --gray-500: #636059;
  --gray-600: #464340;
  --gray-700: #2e2c2a;
  --gray-800: #1e1c1a;
  --gray-900: #121110;

  /* Typography */
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 250ms ease;

  /* Sidebar */
  --sidebar-w: 240px;
}

/* ── LIGHT MODE (padrão) ─────────────────────────────────── */
[data-theme="light"] {
  --bg-page:       var(--gray-50);
  --bg-surface:    var(--gray-0);
  --bg-surface-2:  var(--gray-100);
  --bg-surface-3:  var(--gray-200);
  --bg-sidebar:    var(--green-800);
  --bg-sidebar-hover: var(--green-600);
  --bg-sidebar-active: var(--green-600);

  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-tertiary:  var(--gray-400);
  --text-on-dark:   var(--gray-50);
  --text-sidebar:   var(--green-100);
  --text-sidebar-active: #ffffff;

  --border:         var(--gray-200);
  --border-strong:  var(--gray-300);

  --accent:         var(--green-600);
  --accent-hover:   var(--green-800);
  --accent-light:   var(--green-50);
  --accent-text:    var(--green-800);

  --warning:        var(--amber-500);
  --warning-light:  var(--amber-50);
  --warning-text:   var(--amber-700);

  --danger:         var(--red-500);
  --danger-light:   var(--red-50);
  --danger-text:    var(--red-700);

  --success:        var(--green-400);
  --success-light:  var(--green-50);
  --success-text:   var(--green-800);

  --input-bg:       var(--gray-0);
  --input-border:   var(--gray-200);
  --input-focus:    var(--green-600);

  --table-header:   var(--gray-100);
  --table-hover:    var(--gray-50);
  --table-stripe:   #fafaf8;
}

/* ── DARK MODE ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page:       #161714;
  --bg-surface:    #1e2220;
  --bg-surface-2:  #262b28;
  --bg-surface-3:  #2e3430;
  --bg-sidebar:    #111412;
  --bg-sidebar-hover: #1e2a23;
  --bg-sidebar-active: var(--green-800);

  --text-primary:   #e8e6e1;
  --text-secondary: #9a9790;
  --text-tertiary:  #666460;
  --text-on-dark:   #e8e6e1;
  --text-sidebar:   #a0b8a8;
  --text-sidebar-active: #ffffff;

  --border:         #2a2f2c;
  --border-strong:  #363c38;

  --accent:         #2e8b57;
  --accent-hover:   #3aaa6a;
  --accent-light:   #0f2a1c;
  --accent-text:    #6dbd90;

  --warning:        #f9c143;
  --warning-light:  #2a2000;
  --warning-text:   #f9c143;

  --danger:         #f87171;
  --danger-light:   #2a0f0f;
  --danger-text:    #f87171;

  --success:        #4ade80;
  --success-light:  #0a2018;
  --success-text:   #4ade80;

  --input-bg:       #1e2220;
  --input-border:   #2a2f2c;
  --input-focus:    #2e8b57;

  --table-header:   #262b28;
  --table-hover:    #1e2220;
  --table-stripe:   #1a1f1c;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-md), color var(--transition-md);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── LAYOUT SHELL ────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo img {
  height: 28px;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-sidebar);
  opacity: 0.6;
  padding: var(--space-6) var(--space-5) var(--space-2);
}

.sidebar-nav { flex: 1; padding: var(--space-2) 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  border-left-color: #6dbd90;
  font-weight: 500;
}

.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.sidebar-bottom {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--green-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-email {
  font-size: 11px;
  color: var(--text-sidebar);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
#topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-8);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── THEME TOGGLE ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.theme-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition);
  font-size: 13px;
}

.theme-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ── PAGE CONTENT ────────────────────────────────────────── */
#content {
  flex: 1;
  padding: var(--space-8);
  max-width: 1400px;
  width: 100%;
}

.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* ── KPI CARDS ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before  { background: var(--danger); }
.kpi-card.success::before { background: var(--success); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-3);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.6s ease;
}

.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

/* ── TABLES ──────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--table-header);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--table-hover); }

tbody tr:nth-child(even) td { background: var(--table-stripe); }
tbody tr:nth-child(even):hover td { background: var(--table-hover); }

.td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-text);
}

.badge-neutral {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent-text);
}

/* dot indicator */
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-2);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn svg { width: 14px; height: 14px; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(27, 107, 69, 0.15);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c897f' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-textarea { resize: vertical; min-height: 80px; }

/* ── SEARCH BAR ──────────────────────────────────────────── */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 34px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  width: 280px;
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(27, 107, 69, 0.15);
}

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

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

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

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body { padding: var(--space-6); }

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}

.empty-state-icon { font-size: 40px; margin-bottom: var(--space-4); opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state-text { font-size: 13px; }

/* ── LOADING ─────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  color: var(--text-tertiary);
  gap: var(--space-3);
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideUp 0.2s ease;
  max-width: 360px;
  border-left: 3px solid var(--accent);
}

.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.success { border-left-color: var(--success); }

/* ── LOGIN SCREEN ────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  position: relative;
  overflow: hidden;
}

/* industrial grid pattern */
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
}

#login-screen::after {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
  opacity: 0.6;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-10);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.login-logo img { height: 36px; }

.login-she-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

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

.login-form { display: flex; flex-direction: column; gap: var(--space-4); }

.login-error {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  display: none;
}

/* ── NR STATUS GRID (colaborador detail) ─────────────────── */
.nr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.nr-cell {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: 12px;
}

.nr-cell-name {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.nr-cell-status { margin-top: var(--space-2); }
.nr-cell-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

/* ── ALERT BANNER ────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: var(--space-5);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-6) 0;
}

/* ── UTILS ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success-text); }
.text-warning { color: var(--warning); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
  justify-content: space-between;
}

.pagination-info { font-size: 12px; color: var(--text-tertiary); }

.pagination-buttons { display: flex; gap: var(--space-1); }

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── CHART CONTAINER ─────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar deslizante */
  #sidebar {
    transform: translateX(-260px);
    width: 260px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  #main { margin-left: 0; }

  /* Topbar mobile */
  #topbar {
    position: sticky;
    top: 0;
    z-index: 150;
    height: 52px;
    padding: 0 var(--space-4);
  }

  /* Content com espaço para tab bar */
  #content {
    padding: var(--space-4);
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* ── TAB BAR ── */
  #mobile-tab-bar {
    display: flex !important;
  }

  /* Grids */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .dash-grid-2 { grid-template-columns: 1fr !important; }

  /* Toolbar */
  .toolbar { flex-wrap: wrap; gap: var(--space-2); }
  .search-input { width: 100%; }
  .toolbar-spacer { display: none; }

  /* Tables */
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Modals — bottom sheet */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal, .modal-lg, .modal-xl {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin: 0;
  }

  /* NR grid */
  .nr-grid { grid-template-columns: repeat(2, 1fr); }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .page-header > .btn,
  .page-header > div > .btn { width: 100%; justify-content: center; }
  .page-header > .flex { width: 100%; }

  /* Formulários */
  .form-input, .form-select, .form-textarea {
    font-size: 16px;
  }

  /* KPI value menor no mobile */
  .kpi-value { font-size: 24px; }

  /* Barra de NRs adaptada */
  .nr-bar-row {
    grid-template-columns: 1fr 52px 44px !important;
    gap: 8px !important;
  }
  .nr-bar-label { display: none; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ── TAB BAR (mobile bottom navigation) ─────────────────── */
#mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-sidebar);
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 150;
  justify-content: space-around;
  align-items: center;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.15s;
  min-width: 52px;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.tab-item.active {
  color: #6dbd90;
}

.tab-item span {
  font-size: 10px;
  line-height: 1;
}


/* ── PWA STANDALONE MODE ─────────────────────────────────── */
@media (display-mode: standalone) {
  #topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
  }

  #sidebar {
    padding-top: env(safe-area-inset-top);
  }

  body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── TOUCH IMPROVEMENTS ──────────────────────────────────── */
.btn, .nav-item, .page-btn, button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, select, textarea {
  font-size: 16px; /* Evita zoom automático no iOS */
}

@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}
