:root {
  color-scheme: dark;
  --app-bg: #0b1020;
  --app-bg-accent: #13203d;
  --surface-1: #11182a;
  --surface-2: #151d31;
  --surface-3: #1b2740;
  --surface-4: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(120, 153, 226, 0.24);
  --primary-soft: rgba(47, 107, 255, 0.16);
  --primary-glow: rgba(47, 107, 255, 0.24);
  --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.42);
  --shadow-md: 0 16px 30px rgba(2, 6, 23, 0.32);
  --shadow-sm: 0 10px 20px rgba(2, 6, 23, 0.2);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 292px;
  --content-max: 1700px;
}

body.theme-dark {
  --bg: #0b1020;
  --text: #f3f6ff;
  --text-soft: #d3dbef;
  --muted: #9dabc6;
  --card: #11182a;
  --card-2: #151d31;
  --border: rgba(255, 255, 255, 0.08);
  --primary: #2f6bff;
  --primary-strong: #255ae8;
  --on-primary: #f5f8ff;
  --success: #2ec27e;
  --warning: #f4b740;
  --danger: #e05a5a;
  --success-bg: rgba(46, 194, 126, 0.16);
  --warning-bg: rgba(244, 183, 64, 0.16);
  --danger-bg: rgba(224, 90, 90, 0.16);
  --warning-bg-strong: rgba(244, 183, 64, 0.28);
  --danger-bg-strong: rgba(224, 90, 90, 0.28);
  --upload-bg: rgba(47, 107, 255, 0.1);
  --upload-bg-hover: rgba(47, 107, 255, 0.18);
  --overlay: rgba(3, 7, 18, 0.8);
  --day-bg: rgba(255, 255, 255, 0.04);
  --day-bg-hover: rgba(255, 255, 255, 0.08);
  --focus-ring: rgba(47, 107, 255, 0.26);
}

/* Tema Legado: Clone exato do commit 6ef282a (31/03/2026) */
body.theme-legacy {
  --bg: #0a1020;
  --text: #e6edf7;
  --text-soft: #b8c4d6;
  --muted: #7a8699;
  --card: #131b2e;
  --card-2: #1a2336;
  --border: #2a3550;
  --border-soft: #1f2940;
  --primary: #0ea5e9;
  --primary-strong: #0284c7;
  --on-primary: #ffffff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning-bg-strong: rgba(245, 158, 11, 0.35);
  --danger-bg-strong: rgba(239, 68, 68, 0.35);
  --upload-bg: rgba(14, 165, 233, 0.06);
  --upload-bg-hover: rgba(14, 165, 233, 0.12);
  --overlay: rgba(15, 23, 42, 0.55);
  --day-bg: #f1f5f9;
  --day-bg-hover: #e2e8f0;
  --focus-ring: rgba(14, 165, 233, 0.2);
  --shadow: rgba(15, 23, 42, 0.08);
  --sidebar-width: 280px;
  --content-max: 1400px;
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px var(--shadow);
  --shadow-md: 0 4px 6px var(--shadow);
  --shadow-lg: 0 8px 16px var(--shadow);
}

body {
  font-family: "Segoe UI Variable Text", "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(47, 107, 255, 0.12), transparent 28%),
    radial-gradient(circle at top left, rgba(32, 194, 255, 0.08), transparent 22%),
    linear-gradient(180deg, #0a1020 0%, #09111e 100%);
  min-height: 100vh;
  color: var(--text);
}

/* Layout Legado: clone do commit 6ef282a (31/03/2026) */
body.theme-legacy {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body.theme-legacy::before {
  display: none;
}

/* Container sem sidebar grid — usa layout com tabs no topo */
body.theme-legacy .container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  display: block;
  grid-template-columns: none;
  grid-template-areas: none;
  gap: 0;
}

/* Sidebar vira barra horizontal de tabs no legado */
body.theme-legacy .tabs.app-sidebar {
  grid-area: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  flex-wrap: wrap;
  position: static !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 0 20px 0 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  gap: 10px !important;
}
body.theme-legacy .app-sidebar .sidebar-brand,
body.theme-legacy .app-sidebar .sidebar-label,
body.theme-legacy .app-sidebar .sidebar-section-label,
body.theme-legacy .app-sidebar .sidebar-quick-links,
body.theme-legacy .app-sidebar .sidebar-footer {
  display: none !important;
}
body.theme-legacy .app-sidebar .sidebar-nav {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  width: auto !important;
  flex: 0 0 auto !important;
  height: auto !important;
}
body.theme-legacy .app-sidebar .tab-btn,
body.theme-legacy .app-sidebar button.tab-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 10px 14px !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-soft) !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  margin-bottom: -1px !important;
}
body.theme-legacy .app-sidebar .tab-btn:hover {
  color: var(--text) !important;
  background: transparent !important;
}
body.theme-legacy .app-sidebar .tab-btn.active {
  color: var(--primary) !important;
  border-bottom-color: var(--primary) !important;
  background: transparent !important;
}

/* Subnav de módulo (Painel Técnico / Inspeções / ...) no legado */
body.theme-legacy .module-subnav {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px 18px !important;
  padding: 0 !important;
  margin: 0 0 20px 0 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
body.theme-legacy .module-subnav .tab-btn {
  flex: 0 0 auto !important;
  padding: 8px 4px !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-soft) !important;
  box-shadow: none !important;
  margin-bottom: -1px !important;
  font-size: 13px !important;
}
body.theme-legacy .module-subnav .tab-btn.active {
  color: var(--primary) !important;
  border-bottom-color: var(--primary) !important;
  background: transparent !important;
}
body.theme-legacy .module-subnav .tab-btn:hover {
  color: var(--text) !important;
  background: transparent !important;
}

/* Stats cards no legado — fundo escuro com número grande colorido */
body.theme-legacy .stat-card {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 20px !important;
  text-align: center !important;
  box-shadow: 0 2px 4px var(--shadow) !important;
}
body.theme-legacy .stat-number {
  font-size: 32px !important;
  font-weight: 700 !important;
  color: var(--primary) !important;
  display: block !important;
}
body.theme-legacy .stat-label {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  color: var(--muted) !important;
  margin-top: 4px !important;
}
body.theme-legacy .app-sidebar .sidebar-nav {
  align-items: center !important;
}

/* Header horizontal simples */
body.theme-legacy header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--primary);
  grid-template-columns: none;
  grid-template-areas: none;
  backdrop-filter: none;
  box-shadow: 0 4px 6px var(--shadow);
}

body.theme-legacy header.app-topbar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 20px !important;
  padding: 20px !important;
  margin-bottom: 30px !important;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  border-bottom: 3px solid var(--primary) !important;
  grid-template-columns: none !important;
  grid-template-areas: none !important;
  backdrop-filter: none !important;
  box-shadow: 0 4px 6px var(--shadow) !important;
}
body.theme-legacy .app-topbar .sidebar-toggle,
body.theme-legacy .app-topbar .topbar-search-wrap,
body.theme-legacy #themeToggle {
  display: none !important;
}
.legacy-only { display: none; }
body.theme-legacy .legacy-only { display: inline-flex !important; }

/* Variante clara do tema Legado */
body.theme-legacy.theme-legacy-light {
  --bg: #f8fafc;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --card: #ffffff;
  --card-2: #f1f5f9;
  --border: #e2e8f0;
  --border-soft: #e2e8f0;
  --shadow: rgba(15, 23, 42, 0.08);
}
body.theme-legacy .app-topbar .brand {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  flex: 1 !important;
}
body.theme-legacy .app-topbar .brand-logo {
  width: 80px !important;
  height: 80px !important;
  object-fit: contain !important;
  border-radius: 12px !important;
  background: var(--card-2) !important;
  border: 1px solid var(--border) !important;
  padding: 8px !important;
}
body.theme-legacy .app-topbar h1 {
  font-size: 28px !important;
  color: var(--primary) !important;
  margin: 0 !important;
}
body.theme-legacy .app-topbar .brand-company {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text-soft) !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}
body.theme-legacy .app-topbar .header-right {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
}
body.theme-legacy .app-topbar .header-info {
  display: flex !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}
body.theme-legacy .app-topbar .header-chip {
  background: transparent !important;
  padding: 4px 10px !important;
  border-radius: 0 !important;
  border: none !important;
  border-left: none !important;
  font-size: 13px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: var(--text-soft) !important;
}
body.theme-legacy .app-topbar .header-chip strong {
  color: var(--text) !important;
  font-weight: 500 !important;
}
body.theme-legacy .app-topbar .header-info-label {
  display: none !important;
}
body.theme-legacy .app-topbar .theme-toggle {
  padding: 8px 14px !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  background: var(--card-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

body.theme-legacy .brand-logo {
  width: 80px;
  height: 80px;
  min-width: 80px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  padding: 8px;
}

body.theme-legacy .brand-company {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
}

body.theme-legacy h1 {
  font-size: 28px;
  color: var(--primary);
}

/* Cards simples (sem glassmorphism) */
body.theme-legacy .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 6px var(--shadow);
  backdrop-filter: none;
}

body.theme-legacy .card h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Botões flat */
body.theme-legacy button {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: none;
  backdrop-filter: none;
}

body.theme-legacy button:hover {
  background: var(--primary-strong);
}

body.theme-legacy button.secondary {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Stats grid simples */
body.theme-legacy .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

body.theme-legacy .stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px var(--shadow);
  backdrop-filter: none;
}

body.theme-legacy .stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

body.theme-legacy .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

/* Inputs */
body.theme-legacy input,
body.theme-legacy select,
body.theme-legacy textarea {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  backdrop-filter: none;
}

body.theme-legacy input:focus,
body.theme-legacy select:focus,
body.theme-legacy textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Tema Light (claro moderno) */
body.theme-light {
  background: linear-gradient(180deg, #f5f7fa 0%, #ffffff 100%);
}

body.theme-light::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 28%), radial-gradient(circle at 50% 0%, rgba(200, 210, 255, 0.04), transparent 30%);
}

/* Tema Azul: claro + primary sky-500 */
body.theme-blue {
  --bg: #f0f9ff;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --card: #ffffff;
  --card-2: #f8fafc;
  --border: rgba(0, 0, 0, 0.10);
  --border-soft: rgba(0, 0, 0, 0.07);
  --primary: #0ea5e9;
  --primary-strong: #0284c7;
  --on-primary: #ffffff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --success-bg: rgba(22, 163, 74, 0.12);
  --warning-bg: rgba(217, 119, 6, 0.12);
  --danger-bg: rgba(220, 38, 38, 0.12);
  --warning-bg-strong: rgba(217, 119, 6, 0.22);
  --danger-bg-strong: rgba(220, 38, 38, 0.22);
  --upload-bg: rgba(14, 165, 233, 0.1);
  --upload-bg-hover: rgba(14, 165, 233, 0.18);
  --overlay: rgba(0, 0, 0, 0.5);
  --day-bg: rgba(0, 0, 0, 0.04);
  --day-bg-hover: rgba(0, 0, 0, 0.08);
  --focus-ring: rgba(14, 165, 233, 0.3);
}

body.theme-blue {
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
}

body.theme-blue::before {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.06), transparent 28%);
}

body.theme-blue .tabs.app-sidebar {
  background: linear-gradient(180deg, #0ea5e9, #0284c7) !important;
  border-right: 2px solid #0369a1;
  border-radius: 0;
  box-shadow: 2px 0 8px rgba(14, 165, 233, 0.2);
  border-bottom: 1px solid #0369a1;
}

body.theme-blue .app-sidebar .sidebar-brand,
body.theme-blue .app-sidebar .sidebar-brand strong,
body.theme-blue .app-sidebar .sidebar-label,
body.theme-blue .app-sidebar .sidebar-section-label,
body.theme-blue .app-sidebar .tab-btn,
body.theme-blue .app-sidebar button,
body.theme-blue .app-sidebar a {
  color: #ffffff;
}

body.theme-blue .app-sidebar .sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

body.theme-blue .app-sidebar button:hover {
  background-color: rgba(255, 255, 255, 0.18);
}

body.theme-blue .card {
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
}

body.theme-blue header {
  background: #ffffff;
  border-bottom: 2px solid #0ea5e9;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12);
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-company,
.sidebar-brand strong,
.stat-number,
.exec-kpi-card .kpi-value,
.audit-timer {
  font-family: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    radial-gradient(circle at 50% 0%, rgba(47, 107, 255, 0.08), transparent 30%);
  opacity: 0.9;
}

.container {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
  align-items: start;
  gap: 24px;
}

header {
  grid-area: topbar;
  margin-bottom: 0;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.92);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px) auto;
  gap: 18px;
  align-items: center;
}

.brand {
  justify-content: flex-start;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  min-width: 52px;
  padding: 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.brand-company {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.18em;
}

.brand-text h1 {
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  line-height: 1.1;
  color: var(--text);
  margin: 2px 0 0;
}

.brand-text p {
  margin-top: 6px !important;
  font-size: 13px !important;
  color: var(--muted) !important;
  max-width: 640px;
}

.brand-subtitle {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-toggle {
  display: none;
  min-width: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--card-2);
  color: var(--text);
  box-shadow: none;
}

.topbar-search-wrap {
  position: relative;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.topbar-search-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-search input {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.topbar-search input:focus {
  box-shadow: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(17, 24, 42, 0.98);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: none;
  gap: 6px;
  z-index: 20;
}

.search-results.is-open {
  display: grid;
}

.search-result-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: none;
}

.search-result-item:hover,
.search-result-item:focus-visible {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
}

.search-result-item strong {
  font-size: 14px;
  color: var(--text);
}

.search-result-item span {
  font-size: 12px;
  color: var(--muted);
}

.header-right {
  gap: 12px;
  justify-content: flex-end;
}

.header-right > div:not(.header-info) {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-info {
  gap: 10px;
  justify-content: flex-end;
}

.header-info > div {
  min-width: 112px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  border-left: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.header-info > div span:first-child,
.header-info-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.header-info strong,
.header-info span:last-child {
  font-size: 13px;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle,
.topbar-actions select {
  min-height: 44px;
  border-radius: 14px;
}

.topbar-select {
  min-width: 138px;
  padding: 8px 12px;
  margin-right: 8px;
}

.topbar-action-spaced {
  margin-right: 6px;
}

.topbar-action-spaced-left {
  margin-left: 6px;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.topbar-actions .danger-soft {
  background: var(--danger-bg);
  color: #ffcbcb;
  border-color: rgba(224, 90, 90, 0.2);
}

.tabs.app-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100vh - 48px);
  margin: 0;
  padding: 22px;
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(21, 29, 49, 0.98), rgba(11, 16, 32, 0.98)),
    rgba(17, 24, 42, 0.98);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 14px;
  padding: 6px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-brand > div {
  display: grid;
  gap: 4px;
}

.sidebar-brand-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 4px;
}

.sidebar-brand strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

.sidebar-brand span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding: 0 4px;
}

.sidebar-nav,
.sidebar-quick-links {
  display: grid;
  gap: 8px;
}

.sidebar-nav .tab-btn,
.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav .tab-btn span,
.sidebar-link span {
  pointer-events: none;
}

.sidebar-nav .tab-btn:hover,
.sidebar-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 2px 0 0 rgba(47, 107, 255, 0.35);
}

.sidebar-nav .tab-btn.active,
.sidebar-link.active {
  color: var(--text);
  border-color: rgba(47, 107, 255, 0.28);
  background:
    linear-gradient(90deg, rgba(47, 107, 255, 0.12), rgba(47, 107, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
}

.sidebar-nav .tab-btn:focus-visible,
.sidebar-link:focus-visible {
  outline: 2px solid rgba(47, 107, 255, 0.6);
  outline-offset: 2px;
  border-radius: 16px;
  box-shadow:
    inset 3px 0 0 var(--primary),
    0 10px 20px rgba(15, 23, 42, 0.26);
}

.sidebar-link[data-quick-hidden="true"] {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 16px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 6px;
}

.sidebar-account-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.sidebar-account-name {
  font-size: 15px;
  color: var(--text);
}

.sidebar-account-context {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar-footer .secondary {
  margin-top: 6px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(3, 7, 18, 0.52);
  z-index: 998;
  transition: opacity 0.2s ease;
  opacity: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  grid-area: content;
  min-width: 0;
  position: relative;
  z-index: 1;
}

#sst.tab-content.active {
  z-index: 5;
}

#ambiental.tab-content.active {
  z-index: 5;
}

#admin.tab-content.active {
  z-index: 5;
  grid-area: content;
  display: block !important;
  min-height: 200px;
  visibility: visible !important;
  opacity: 1 !important;
}
#admin.tab-content.active > * {
  visibility: visible !important;
}
#admin.tab-content.active > .module-subnav {
  display: flex !important;
}
#admin.tab-content.active > #adminDashboard {
  display: block !important;
}

.module-subnav {
  position: relative;
  z-index: 4;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  overflow-x: visible;
  padding: 12px;
  margin-bottom: 22px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.92);
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.module-subnav::-webkit-scrollbar {
  display: none;
}

#sstSubnav {
  z-index: 6;
}

#ambientalSubnav {
  z-index: 6;
}

.module-subnav .tab-btn {
  flex: 0 0 auto;
  padding: 12px 14px;
  min-height: 46px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.module-subnav .tab-btn.active {
  color: var(--text);
  border-color: rgba(47, 107, 255, 0.32);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.16), rgba(47, 107, 255, 0.06)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 18px rgba(15, 23, 42, 0.24);
}

.card,
.exec-kpi-card,
.smart-insight-card,
.audit-hist-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.95);
  box-shadow: var(--shadow-md);
}

.card {
  padding: 22px;
}

.module-toolbar-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.module-toolbar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.module-toolbar-head h3 {
  margin: 0;
}

.module-toolbar-eyebrow {
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 700;
}

.module-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  align-items: end;
}

.module-toolbar-field {
  min-width: 0;
}

.module-toolbar-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.module-toolbar-field input,
.module-toolbar-field select {
  width: 100%;
  min-width: 0;
}

.module-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.module-toolbar-actions .secondary,
.module-toolbar-actions button {
  min-height: 46px;
}

.amb-toolbar-card {
  position: relative;
  overflow: hidden;
}

.amb-toolbar-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(47, 107, 255, 0.12), rgba(47, 107, 255, 0));
  pointer-events: none;
}

.amb-toolbar-grid {
  position: relative;
  z-index: 1;
}

.amb-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.amb-entity-card {
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.amb-entity-card:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 107, 255, 0.24);
  box-shadow: 0 14px 28px rgba(4, 10, 24, 0.24);
}

.amb-entity-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.amb-entity-card-main {
  min-width: 0;
}

.amb-entity-card-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.amb-entity-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.amb-entity-card-desc {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.55;
}

.amb-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.amb-thumb-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.amb-thumb-row-image {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}

.amb-thumb-row-count {
  font-size: 11px;
  color: var(--muted);
}

.amb-list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.amb-list-meta-copy {
  font-size: 12px;
  color: var(--muted);
}

.amb-list-meta-action {
  min-height: 38px;
  font-size: 12px;
}

.amb-table-shell {
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.amb-data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: transparent;
}

.amb-data-table--editor {
  min-width: 980px;
}

.amb-data-table thead tr {
  background: rgba(255, 255, 255, 0.05);
}

.amb-data-table th,
.amb-data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: middle;
}

.amb-data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.amb-data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.amb-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.amb-data-table .cell-center {
  text-align: center;
}

.amb-data-table input,
.amb-data-table select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

.amb-table-primary {
  font-weight: 600;
  color: var(--text);
}

.amb-table-secondary {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.amb-row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.amb-row-actions button {
  min-height: 34px;
  font-size: 12px;
  padding: 6px 10px;
}

.amb-tone-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.amb-tone-chip--success {
  color: #d7ffe8;
  background: rgba(46, 194, 126, 0.18);
  border-color: rgba(46, 194, 126, 0.28);
}

.amb-tone-chip--warning {
  color: #ffe9bf;
  background: rgba(244, 183, 64, 0.18);
  border-color: rgba(244, 183, 64, 0.28);
}

.amb-tone-chip--danger {
  color: #ffd7d7;
  background: rgba(224, 90, 90, 0.18);
  border-color: rgba(224, 90, 90, 0.28);
}

.amb-tone-chip--info {
  color: #d8e5ff;
  background: rgba(47, 107, 255, 0.18);
  border-color: rgba(47, 107, 255, 0.28);
}

.amb-tone-chip--neutral {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-soft);
}

.amb-empty-state {
  text-align: center;
}

.amb-empty-state-text,
.amb-attachment-empty,
.amb-evidence-empty,
.amb-timeline-empty {
  margin: 0;
  color: var(--muted);
}

.amb-timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.amb-timeline-item:last-child {
  border-bottom: 0;
}

.amb-timeline-body {
  min-width: 0;
}

.amb-timeline-title {
  font-weight: 600;
  color: var(--text);
}

.amb-timeline-details {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.amb-timeline-meta {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.amb-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.amb-fact-item {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
}

.amb-fact-label {
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.amb-fact-value {
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.amb-text-block {
  margin-bottom: 14px;
}

.amb-text-block-title {
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.amb-text-block-body {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.amb-text-block-pre {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.amb-attachment-shell,
.amb-evidence-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.amb-attachment-upload,
.amb-evidence-head {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.amb-attachment-field {
  flex: 1 1 220px;
  min-width: 0;
}

.amb-attachment-field input {
  width: 100%;
}

.amb-attachment-action,
.amb-evidence-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.amb-attachment-list {
  display: flex;
  flex-direction: column;
}

.amb-attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.amb-attachment-item:last-child {
  border-bottom: 0;
}

.amb-attachment-main {
  min-width: 0;
}

.amb-attachment-main a {
  color: var(--text);
  text-decoration: none;
}

.amb-attachment-main a:hover {
  color: var(--primary);
}

.amb-attachment-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.amb-attachment-delete {
  min-height: 34px;
  font-size: 12px;
}

.amb-evidence-head h4 {
  margin: 0;
}

.amb-evidence-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.amb-evidence-thumb {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.amb-evidence-thumb img {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  display: block;
}

.amb-evidence-caption {
  max-width: 116px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.amb-detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.amb-detail-badges,
.amb-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.amb-detail-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.amb-detail-actions {
  margin-top: 16px;
}

.amb-indicator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.amb-indicator-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.amb-indicator-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.amb-indicator-meta,
.amb-indicator-unit {
  color: var(--muted);
  font-size: 12px;
}

.amb-indicator-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.amb-form-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.amb-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.amb-form-grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.amb-form-field {
  min-width: 0;
}

.amb-form-field textarea,
.amb-form-field input,
.amb-form-field select {
  width: 100%;
}

.amb-form-field--compact label {
  margin-bottom: 6px;
  font-size: 11px;
}

.amb-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.amb-checklist-stack {
  display: grid;
  gap: 12px;
}

.amb-checklist-group {
  padding: 14px;
}

.amb-checklist-title {
  margin: 0 0 10px;
}

.amb-checklist-item {
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.amb-checklist-item--simple {
  padding: 14px;
  border-top: 0;
}

.amb-checklist-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.amb-checklist-copy {
  flex: 1 1 240px;
  min-width: 0;
}

.amb-checklist-item-title {
  font-weight: 600;
  color: var(--text);
}

.amb-checklist-meta,
.amb-checklist-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.amb-checklist-note--danger {
  color: var(--danger);
}

.amb-checklist-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.card h3,
.section-title {
  color: var(--text);
  margin-bottom: 14px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.section-title {
  text-transform: uppercase;
  color: var(--muted);
}

.stats-grid {
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(circle at top right, rgba(47, 107, 255, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.94);
  box-shadow: var(--shadow-md);
  text-align: left;
  padding: 20px 18px;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), rgba(47, 107, 255, 0));
  opacity: 0.8;
}

.stat-number {
  font-size: clamp(2rem, 2.8vw, 2.4rem);
  line-height: 1;
  color: var(--text);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.grid-2,
.grid-3 {
  gap: 18px;
}

label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.03em;
}

input,
select,
textarea {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(7, 13, 25, 0.65);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

input::placeholder,
textarea::placeholder {
  color: #71819d;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 107, 255, 0.44);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

textarea {
  min-height: 108px;
}

button {
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3a78ff, #255ae8);
  color: var(--on-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 24px rgba(47, 107, 255, 0.22);
}

button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #447dff, #2b60eb);
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

button.danger-soft {
  background: var(--danger-bg);
  color: #ffc2c2;
  border: 1px solid rgba(224, 90, 90, 0.22);
  box-shadow: none;
}

button.danger-soft:hover {
  background: rgba(224, 90, 90, 0.22);
}

button:disabled {
  opacity: 0.54;
  cursor: not-allowed;
  transform: none;
}

.status-badge,
.status-btn,
.incident-filter-chip,
.incident-severity-preview,
.badge-count {
  border-radius: 999px;
}

.status-badge {
  padding: 6px 12px;
}

.status-btn {
  min-height: 36px;
  padding: 8px 14px;
  border-width: 1px;
  background: rgba(255, 255, 255, 0.04);
}

.status-btn.active-conforme {
  background: rgba(46, 194, 126, 0.16);
  border-color: rgba(46, 194, 126, 0.28);
  color: #8ef0c3;
}

.status-btn.active-nc {
  background: rgba(224, 90, 90, 0.16);
  border-color: rgba(224, 90, 90, 0.28);
  color: #ffb0b0;
}

.status-btn.active-na {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

.nr-section,
.incident-section-card,
.incident-detail-box,
.audit-incident-item,
.audit-insp-item,
.insight-card {
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.incident-item,
.audit-hist-item,
.audit-incident-item,
.audit-insp-item,
.photo-item,
.checklist-item,
.checklist-item-v2 {
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.incident-item:hover,
.photo-item:hover,
.audit-hist-item:hover,
.smart-insight-card:hover,
.exec-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 107, 255, 0.22);
}

.incident-item.critical {
  border-left-color: var(--danger);
}

.incident-item.warning {
  border-left-color: var(--warning);
}

.incident-type-pill,
.incident-media-card,
.incident-attachment-item,
.incident-media-count {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.incident-type-pill.active {
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.18), rgba(47, 107, 255, 0.08));
  border-color: rgba(47, 107, 255, 0.32);
}

.incident-filter-grid {
  gap: 12px;
}

.incident-filter-chip {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
}

.incident-gallery img,
.incident-media-card img,
.photo-item img,
.image-preview img {
  border-radius: 14px;
}

.photo-gallery {
  gap: 16px;
}

.photo-item-info {
  background: transparent;
}

.upload-area {
  border-radius: 18px;
  border: 1px dashed rgba(47, 107, 255, 0.4);
}

.upload-preview-card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.05);
  min-width: 126px;
}

.upload-preview-image {
  max-width: 140px;
  max-height: 88px;
  border-radius: 10px;
  object-fit: cover;
}

.upload-preview-meta {
  font-size: 11px;
  color: var(--muted);
  max-width: 180px;
  word-break: break-word;
}

.upload-preview-remove {
  align-self: flex-start;
  min-height: 30px;
  padding: 6px 10px;
}

#reportPresetBar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.photo-gallery p,
#incidentList p,
#bpList p,
#trainingsList p,
#ambAlertas p,
#ambRecentDesvios p {
  color: var(--muted) !important;
}

table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: transparent !important;
  color: var(--text);
}

table thead tr {
  background: transparent !important;
}

table th {
  padding: 14px 16px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px !important;
  border-bottom: 1px solid var(--border-soft) !important;
}

table th:first-child {
  border-top-left-radius: 14px;
}

table th:last-child {
  border-top-right-radius: 14px;
}

table td {
  padding: 14px 16px !important;
  color: var(--text) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: rgba(255, 255, 255, 0.02) !important;
}

table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.05) !important;
}

.exec-table td.overdue,
.exec-table .overdue {
  background: rgba(224, 90, 90, 0.16) !important;
}

.modal {
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(10px);
}

.modal-content {
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.98);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  color: var(--muted);
}

.app-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  text-align: center;
  z-index: 99999;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.2);
  backdrop-filter: blur(10px);
}

.app-banner-offline {
  background: linear-gradient(180deg, rgba(244, 183, 64, 0.96), rgba(240, 170, 33, 0.92));
  color: #18140a;
  font-size: 13px;
  font-weight: 700;
}

.app-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9998;
  background: rgba(3, 7, 18, 0.76);
  backdrop-filter: blur(12px);
}

.app-overlay-auth {
  z-index: 10000;
}

.app-overlay-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px;
  border-radius: 26px;
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(17, 24, 42, 0.98), rgba(11, 16, 32, 0.98)),
    rgba(17, 24, 42, 0.98);
  box-shadow: var(--shadow-lg);
}

.auth-card {
  width: min(380px, 100%);
  align-items: stretch;
  text-align: center;
}

.auth-logo {
  width: 104px;
  height: 104px;
  margin: 0 auto 2px;
  object-fit: contain;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow-sm);
}

.auth-title {
  margin: 0;
  color: var(--text);
}

.auth-subtitle {
  margin: -10px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-error {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(224, 90, 90, 0.2);
  background: rgba(224, 90, 90, 0.12);
  color: #ffc0c0;
  font-size: 13px;
}

.auth-form-control {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.auth-submit {
  width: 100%;
}

/* =====================================================
   AUTH SPLIT LAYOUT (2-column desktop, 1-column mobile)
   ===================================================== */

.app-overlay-auth {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.auth-split {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

/* LEFT PANEL: media/video */
.auth-split-media {
  position: relative;
  flex: 0 0 60%;
  width: 60%;
  overflow: hidden;
  background: #05091a;
}

.auth-preview-video,
.auth-preview-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.auth-preview-fallback {
  z-index: 0;
}

.auth-preview-video {
  z-index: 1;
}

/* Gradient overlay on top of video */
.auth-media-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
  background: linear-gradient(
    to top,
    rgba(5, 9, 26, 0.92) 0%,
    rgba(5, 9, 26, 0.4) 50%,
    transparent 100%
  );
}

.auth-media-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.auth-media-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.auth-media-name {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.auth-media-tagline {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.auth-media-copy {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  max-width: 380px;
}

/* RIGHT PANEL: form */
.auth-split-form {
  flex: 0 0 40%;
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: radial-gradient(
      circle at top right,
      rgba(47, 107, 255, 0.18),
      transparent 28%
    ),
    linear-gradient(135deg, #0a1020 0%, #13203d 100%);
  overflow-y: auto;
}

.auth-split-form .auth-card {
  width: 100%;
  max-width: 360px;
}

/* Entrance animations */
#loginOverlay.app-overlay-auth {
  animation: authOverlayIn 0.35s ease forwards;
}

.auth-split-form .auth-card {
  animation: authCardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

/* Mobile: collapse to single column */
@media (max-width: 768px) {
  .app-overlay-auth {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }

  .auth-split {
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  .auth-split-media {
    display: none;
  }

  .auth-split-form {
    flex: none;
    width: 100%;
    padding: 0;
    background: transparent;
  }

  .auth-split-form .auth-card {
    max-width: min(380px, 100%);
  }
}

.workspace-overlay-card {
  gap: 20px;
}

.workspace-overlay-header {
  display: grid;
  gap: 6px;
}

.workspace-overlay-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
}

.workspace-overlay-header h2 {
  margin: 0;
}

.workspace-overlay-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace-overlay-field {
  margin: 0;
}

.workspace-overlay-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text);
}

.workspace-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.workspace-choice {
  min-height: 132px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  color: var(--text);
  box-shadow: none;
}

.workspace-choice strong {
  display: block;
  font-size: 16px;
  color: var(--text);
}

.workspace-choice span {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.workspace-choice:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
}

.workspace-choice.is-selected[data-area="seguranca"] {
  border-color: rgba(47, 107, 255, 0.48);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.2), rgba(47, 107, 255, 0.06)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 255, 0.25), 0 14px 24px rgba(15, 23, 42, 0.25);
}

.workspace-choice.is-selected[data-area="meio_ambiente"] {
  border-color: rgba(46, 194, 126, 0.42);
  background:
    linear-gradient(180deg, rgba(46, 194, 126, 0.18), rgba(46, 194, 126, 0.05)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(46, 194, 126, 0.22), 0 14px 24px rgba(15, 23, 42, 0.25);
}

.workspace-overlay-hint {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
}

.workspace-overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* =====================================================
   NEW WORKSPACE SELECTOR — FULL-SCREEN DESIGN
   ===================================================== */

.ws-page {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

/* Left brand panel */
.ws-brand-panel {
  position: relative;
  flex: 0 0 35%;
  width: 35%;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 30% 70%, rgba(47, 107, 255, 0.15), transparent 40%),
    linear-gradient(135deg, #0a1020 0%, #131c34 100%);
  overflow-y: auto;
}

.ws-brand-top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.ws-brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.ws-brand-name {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.ws-brand-sub {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.ws-brand-features {
  flex: 1;
  margin-bottom: 40px;
}

.ws-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}

.ws-feature-icon {
  flex: 0 0 auto;
  color: rgba(47, 107, 255, 0.7);
  font-weight: 700;
}

.ws-brand-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.6;
  margin: 0;
}

/* Right selector panel */
.ws-selector-panel {
  flex: 0 0 65%;
  width: 65%;
  padding: 60px 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at bottom right, rgba(47, 107, 255, 0.12), transparent 40%),
    linear-gradient(135deg, #0f1828 0%, #1a2642 100%);
  overflow-y: auto;
}

.ws-selector-inner {
  width: 100%;
  max-width: 500px;
}

.ws-selector-header {
  margin-bottom: 40px;
}

.ws-selector-header h2 {
  margin: 0 0 8px;
  font-size: 32px;
  color: #fff;
  line-height: 1.2;
}

.ws-selector-header p {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.65);
}

.ws-step {
  margin-bottom: 40px;
}

.ws-step-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
}

.ws-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(47, 107, 255, 0.2);
  color: rgba(47, 107, 255, 0.8);
  font-weight: 700;
  font-size: 13px;
}

/* Module cards */
.ws-module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ws-module-card {
  position: relative;
  padding: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(20, 28, 46, 0.5);
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ws-module-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(20, 28, 46, 0.6);
  transform: translateY(-2px);
}

.ws-module-card.selected {
  border-color: rgba(47, 107, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.15), rgba(47, 107, 255, 0.05)),
    rgba(20, 28, 46, 0.7);
  box-shadow: inset 0 0 0 1.5px rgba(47, 107, 255, 0.3);
}

.ws-module-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.ws-module-icon svg {
  width: 24px;
  height: 24px;
}

.ws-module-card.selected .ws-module-icon {
  background: rgba(47, 107, 255, 0.2);
  color: rgba(47, 107, 255, 0.9);
}

.ws-module-card strong {
  font-size: 16px;
  font-weight: 700;
  display: block;
}

.ws-module-card span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.ws-module-card p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.5);
}

/* Obra selector */
.ws-obra-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ws-obra-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 1;
}

.ws-obra-select {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(20, 28, 46, 0.5);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.6)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

.ws-obra-select:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(20, 28, 46, 0.6);
}

.ws-obra-select:focus {
  outline: none;
  border-color: rgba(47, 107, 255, 0.4);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 255, 0.2);
}

.ws-obra-select option {
  background: #1a2642;
  color: #fff;
}

/* Layout preview cards */
.ws-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ws-layout-card {
  position: relative;
  padding: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(20, 28, 46, 0.5);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.ws-layout-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(20, 28, 46, 0.6);
  transform: translateY(-2px);
}

.ws-layout-card.selected {
  border-color: rgba(47, 107, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.15), rgba(47, 107, 255, 0.05)),
    rgba(20, 28, 46, 0.7);
  box-shadow: inset 0 0 0 1.5px rgba(47, 107, 255, 0.3);
}

/* Layout preview mini-mockup */
.ws-layout-preview {
  width: 100%;
  height: 80px;
  border-radius: 10px;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ws-layout-preview--dark {
  background: #0a1020;
}

.ws-layout-preview--light {
  background: #f8fafc;
}

.ws-lp-sidebar {
  flex: 0 0 20%;
  background: rgba(255, 255, 255, 0.06);
}

.ws-layout-preview--light .ws-lp-sidebar {
  background: rgba(0, 0, 0, 0.06);
}

.ws-lp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
}

.ws-lp-topbar {
  height: 12%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.ws-layout-preview--light .ws-lp-topbar {
  background: rgba(0, 0, 0, 0.1);
}

.ws-lp-cards {
  flex: 1;
  display: flex;
  gap: 3px;
}

.ws-lp-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
}

.ws-layout-preview--light .ws-lp-card {
  background: rgba(0, 0, 0, 0.08);
}

.ws-layout-preview--legacy {
  background: #f8fafc;
}

.ws-layout-preview--legacy .ws-lp-sidebar {
  display: none;
}

.ws-layout-preview--legacy .ws-lp-main {
  flex: 1;
}

.ws-layout-preview--legacy .ws-lp-topbar {
  background: #ffffff;
  border-bottom: 2px solid #0ea5e9;
}

.ws-layout-preview--legacy .ws-lp-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
}

.ws-layout-preview--blue {
  background: #e0f2fe;
}

.ws-layout-preview--blue .ws-lp-sidebar {
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
}

.ws-layout-preview--blue .ws-lp-topbar {
  background: rgba(14, 165, 233, 0.3);
}

.ws-layout-preview--blue .ws-lp-card {
  background: #ffffff;
  border-radius: 2px;
}

.ws-layout-card strong {
  font-size: 15px;
  font-weight: 700;
  display: block;
}

.ws-layout-card span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

/* Action button */
.ws-actions {
  margin-top: 30px;
  display: flex;
  gap: 12px;
}

.ws-confirm-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(47, 107, 255, 0.9), rgba(47, 107, 255, 0.7));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ws-confirm-btn:hover {
  background: linear-gradient(135deg, rgba(47, 107, 255, 1), rgba(47, 107, 255, 0.85));
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(47, 107, 255, 0.3);
}

.ws-confirm-btn:active {
  transform: translateY(0);
}

.ws-confirm-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
  .ws-brand-panel {
    flex: 0 0 40%;
    padding: 50px 30px;
  }

  .ws-selector-panel {
    flex: 0 0 60%;
    padding: 50px 30px;
  }

  .ws-selector-inner {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .ws-page {
    flex-direction: column;
  }

  .ws-brand-panel {
    flex: none;
    width: 100%;
    padding: 40px 24px;
    justify-content: flex-start;
    min-height: auto;
  }

  .ws-selector-panel {
    flex: none;
    width: 100%;
    padding: 30px 24px 50px;
    justify-content: flex-start;
    align-items: stretch;
  }

  .ws-selector-inner {
    max-width: 100%;
  }

  .ws-brand-top {
    margin-bottom: 30px;
  }

  .ws-brand-features {
    display: none;
  }

  .ws-module-grid {
    grid-template-columns: 1fr;
  }

  .ws-layout-grid {
    grid-template-columns: 1fr;
  }
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-splash-card {
  text-align: center;
}

.app-splash-logo {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 18px;
}

.app-splash-title {
  margin-top: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
}

.app-splash-progress {
  width: min(320px, 80vw);
  height: 12px;
  margin: 16px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.app-splash-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #5aa6ff);
  transition: width 180ms linear;
}

.app-splash-label {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

#loginOverlay,
#workspaceOverlay,
#splash {
  backdrop-filter: blur(12px);
}

#loginOverlay {
  /* background now handled by .auth-split-form */
}

#loginOverlay > div,
#workspaceOverlay > div {
  border-radius: 26px !important;
  border: 1px solid var(--border-soft) !important;
  background:
    linear-gradient(180deg, rgba(17, 24, 42, 0.98), rgba(11, 16, 32, 0.98)) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--text);
}

#workspaceOverlay h2,
#workspaceOverlay strong,
#workspaceOverlay label {
  color: var(--text) !important;
}

#workspaceOverlay .workspace-overlay-header p,
#workspaceOverlay #workspaceOverlayHint {
  color: var(--muted) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--border-soft) !important;
}

#workspaceAreaSafety,
#workspaceAreaEnvironment {
  color: var(--text) !important;
}

#splash {
  background: radial-gradient(circle at top, rgba(47, 107, 255, 0.22), transparent 28%), linear-gradient(180deg, #0a1020, #09111f) !important;
}

#splash img {
  box-shadow: var(--shadow-lg) !important;
}

#splash-label {
  color: var(--muted) !important;
}

#splash > div > div:nth-child(2) {
  color: var(--text) !important;
}

#splash > div > div:nth-child(3) {
  background: rgba(255, 255, 255, 0.07) !important;
}

#presentation table td,
#presentation table th {
  text-align: left;
}

#presentation [style*="background: linear-gradient"],
#presentation [style*="background-color: #f5f5f5"],
#reports [style*="background-color: var(--card-2)"],
#reports [style*="background-color: #f5f5f5"] {
  background: rgba(255, 255, 255, 0.04) !important;
}

#presentation [style*="color: #555"],
#presentation [style*="color: #999"] {
  color: var(--muted) !important;
}

#presentation [style*="color: var(--primary)"],
#reports [style*="color: var(--primary)"] {
  color: var(--text) !important;
}

.amb-hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: start;
}

.amb-hero-eyebrow,
.amb-metric-label,
.amb-priority-row span,
.amb-quick-note {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.amb-hero-title {
  margin: 8px 0 10px;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  color: var(--text);
}

.amb-hero-copy {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.amb-pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.amb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
}

.amb-pill.is-primary {
  color: #bdd3ff;
  background: rgba(47, 107, 255, 0.14);
  border-color: rgba(47, 107, 255, 0.26);
}

.amb-pill.is-danger {
  color: #ffb4b4;
  background: rgba(224, 90, 90, 0.14);
  border-color: rgba(224, 90, 90, 0.24);
}

.amb-pill.is-success {
  color: #9cebc5;
  background: rgba(46, 194, 126, 0.14);
  border-color: rgba(46, 194, 126, 0.24);
}

.amb-metric-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow-sm);
}

.amb-metric-value {
  margin-top: 10px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.amb-metric-copy {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

.amb-priority-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.amb-priority-row:last-child {
  border-bottom: 0;
}

.amb-priority-row strong {
  font-size: 18px;
  font-weight: 800;
}

.amb-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.amb-quick-note {
  margin-top: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

.amb-kpi-alert {
  color: #ffb4b4 !important;
}

.amb-list-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.amb-list-meta-info,
.amb-empty-copy,
.amb-upload-meta,
.amb-timeline-detail,
.amb-timeline-meta,
.amb-thumb-caption {
  font-size: 12px;
  color: var(--muted);
}

.amb-list-meta-action,
.amb-inline-btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

.amb-empty-state {
  text-align: center;
}

.amb-empty-state p,
.amb-empty-copy {
  margin: 0;
}

.amb-timeline {
  display: grid;
}

.amb-timeline-entry {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.amb-timeline-entry:last-child {
  border-bottom: 0;
}

.amb-timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.amb-timeline-title {
  font-weight: 700;
  color: var(--text);
}

.amb-timeline-meta {
  text-align: right;
  max-width: 220px;
}

.amb-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.amb-fact-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.amb-fact-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.amb-fact-value {
  color: var(--text);
  line-height: 1.55;
}

.amb-text-section {
  margin-bottom: 14px;
}

.amb-text-title {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.amb-text-body {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.amb-text-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  color: var(--text-soft);
}

.amb-upload-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.amb-upload-field {
  flex: 1;
  min-width: 220px;
}

.amb-upload-list {
  margin-top: 12px;
}

.amb-upload-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.amb-upload-item:last-child {
  border-bottom: 0;
}

.amb-thumb-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.amb-thumb-item {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.amb-thumb-item:hover {
  transform: none;
}

.amb-thumb-image {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  display: block;
}

.amb-thumb-caption {
  max-width: 116px;
  margin-top: 6px;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.table-shell--wide table {
  min-width: 860px;
}

.admin-subnav {
  margin-bottom: 22px;
}

.admin-dashboard-grid {
  margin-top: 20px;
}

.panel-toolbar,
.filter-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-toolbar {
  align-items: center;
}

.filter-toolbar {
  align-items: flex-end;
  margin-bottom: 15px;
}

.panel-toolbar-end,
.panel-toolbar-center {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-toolbar-end {
  justify-content: flex-end;
}

.panel-toolbar-center {
  justify-content: center;
}

.card-spaced {
  margin-top: 20px;
}

.card-spaced-bottom {
  margin-bottom: 20px;
}

.toolbar-field {
  margin: 0;
  flex: 1 1 140px;
  min-width: 130px;
}

.toolbar-field--date {
  flex: 0 1 130px;
}

.inline-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.admin-session-info,
.admin-count-list {
  display: grid;
  gap: 10px;
}

.admin-count-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-count-row:last-child {
  border-bottom: 0;
}

.admin-count-row span:first-child {
  color: var(--text-soft);
  font-weight: 600;
}

.admin-count-row strong,
.admin-setting-value {
  color: var(--text);
  font-weight: 700;
}

.entity-list {
  display: grid;
  gap: 12px;
}

.entity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.entity-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.entity-title-line,
.entity-meta-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.entity-title-line strong {
  color: var(--text);
  font-size: 14px;
}

.entity-handle,
.entity-meta,
.entity-status-note {
  font-size: 12px;
  color: var(--muted);
}

.entity-status-note.is-danger {
  color: #ffb1b1;
}

.entity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.entity-actions button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 12px;
}

.admin-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.admin-table-card {
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 10px;
  text-align: left;
}

.admin-table-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.admin-table-total {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.admin-table-action {
  justify-self: flex-start;
}

.admin-danger-card {
  border-color: rgba(224, 90, 90, 0.32);
  background:
    radial-gradient(circle at top right, rgba(224, 90, 90, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.95);
}

.admin-danger-card h3 {
  color: #ffb8b8;
}

.admin-danger-card p {
  color: var(--muted);
  font-size: 13px;
}

.admin-info-banner {
  margin-bottom: 15px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.checkbox-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.checkbox-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-soft);
}

.checkbox-tile:hover {
  border-color: rgba(47, 107, 255, 0.26);
  background: rgba(255, 255, 255, 0.05);
}

.checkbox-tile input {
  min-height: auto;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  border-radius: 4px;
}

.admin-token-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-token {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(47, 107, 255, 0.2);
  background: rgba(47, 107, 255, 0.12);
  color: #cfe0ff;
  font-size: 11px;
  font-weight: 600;
}

.admin-token--success {
  border-color: rgba(46, 194, 126, 0.22);
  background: rgba(46, 194, 126, 0.16);
  color: #9ef0c8;
}

.admin-empty {
  padding: 20px;
  border-radius: 16px;
  border: 1px dashed var(--border-soft);
  color: var(--muted);
  text-align: center;
}

.table-link {
  color: #9cc0ff;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.admin-cell-nowrap {
  white-space: nowrap;
}

.admin-cell-ellipsis {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.admin-action-badge {
  color: #f5f8ff;
}

.admin-action-login {
  background: rgba(47, 107, 255, 0.18);
  border: 1px solid rgba(47, 107, 255, 0.32);
  color: #bfd2ff;
}

.admin-action-logout {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-soft);
}

.admin-action-create {
  background: rgba(46, 194, 126, 0.18);
  border: 1px solid rgba(46, 194, 126, 0.28);
  color: #9ef0c8;
}

.admin-action-update {
  background: rgba(244, 183, 64, 0.18);
  border: 1px solid rgba(244, 183, 64, 0.28);
  color: #ffd88a;
}

.admin-action-delete {
  background: rgba(224, 90, 90, 0.18);
  border: 1px solid rgba(224, 90, 90, 0.28);
  color: #ffb8b8;
}

.admin-template-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.admin-template-index {
  min-width: 24px;
  font-size: 11px;
  color: var(--muted);
}

.admin-template-input {
  flex: 1;
  min-height: 42px;
}

#scheduleFormArea {
  border-radius: 18px !important;
  border: 1px solid var(--border-soft) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03) !important;
  padding: 18px !important;
}

.report-mode-hint {
  margin: 8px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.stack-actions {
  display: grid;
  gap: 10px;
}

.stack-actions button {
  width: 100%;
}

.report-summary-grid,
.presentation-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.report-summary-grid {
  margin-top: 15px;
}

.report-summary-card,
.presentation-kpi-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.report-summary-card strong,
.presentation-kpi-value {
  display: block;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.report-summary-card span,
.presentation-kpi-label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.presentation-kpi-card.is-primary {
  background:
    radial-gradient(circle at top right, rgba(47, 107, 255, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.04);
}

.presentation-kpi-card.is-danger {
  background:
    radial-gradient(circle at top right, rgba(224, 90, 90, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.04);
}

.presentation-kpi-card.is-warning {
  background:
    radial-gradient(circle at top right, rgba(244, 183, 64, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.04);
}

.presentation-kpi-card.is-success {
  background:
    radial-gradient(circle at top right, rgba(46, 194, 126, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.04);
}

.presentation-kpi-card.is-primary .presentation-kpi-value {
  color: #9cc0ff;
}

.presentation-kpi-card.is-danger .presentation-kpi-value {
  color: #ffb8b8;
}

.presentation-kpi-card.is-warning .presentation-kpi-value {
  color: #ffd88a;
}

.presentation-kpi-card.is-success .presentation-kpi-value {
  color: #9ef0c8;
}

.presentation-actions,
.queue-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.presentation-actions {
  margin-top: 15px;
}

.presentation-actions button,
.queue-actions button {
  flex: 1 1 220px;
}

.queue-shell {
  display: grid;
  gap: 16px;
}

.queue-empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.queue-delete-btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 11px;
}

.modal-content--sm {
  max-width: 500px;
}

.modal-content--md {
  max-width: 700px;
}

.modal-content--wide {
  max-width: 700px;
  width: 95%;
}

.modal-title {
  margin-bottom: 15px;
}

.modal-subtitle {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.modal-field-tight {
  margin: 0;
}

.modal-block {
  margin-bottom: 10px;
}

.modal-actions {
  margin-top: 15px;
}

.modal-actions button {
  flex: 1 1 180px;
}

.modal-actions--split {
  justify-content: space-between;
}

.modal-media-image {
  width: 100%;
  border-radius: 16px;
  margin-bottom: 15px;
  display: block;
}

.modal-media-title {
  margin-bottom: 10px;
}

.modal-media-desc {
  color: var(--text-soft);
  margin-bottom: 10px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

.signature-pad-shell {
  margin-bottom: 12px;
  border: 2px dashed var(--border-soft);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.signature-canvas {
  width: 100%;
  height: 200px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.signature-badge {
  margin-top: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.signature-badge--missing {
  color: var(--warning);
}

.signature-badge--present {
  color: var(--success);
}

.signature-thumb {
  height: 28px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  cursor: pointer;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.96);
}

.presentation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.presentation-badge--danger {
  background: rgba(224, 90, 90, 0.16);
  border-color: rgba(224, 90, 90, 0.22);
  color: #ffb8b8;
}

.presentation-badge--warning {
  background: rgba(244, 183, 64, 0.16);
  border-color: rgba(244, 183, 64, 0.22);
  color: #ffd88a;
}

.presentation-badge--success {
  background: rgba(46, 194, 126, 0.16);
  border-color: rgba(46, 194, 126, 0.22);
  color: #9ef0c8;
}

.presentation-row-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.modal-checkbox-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
}

.modal-checkbox-grid--compact {
  max-height: 120px;
}

.exec-hero-section {
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(circle at top right, rgba(47, 107, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(17, 24, 42, 0.95);
}

.exec-score-component-bar,
.audit-start-card,
.audit-active-card,
.smart-insight-recommendation,
.incident-profile-banner,
.incident-inline-hint,
.incident-summary-line {
  background: rgba(255, 255, 255, 0.04);
}

.audit-active-card {
  border-color: rgba(46, 194, 126, 0.28);
}

.audit-active-badge {
  color: #08111d;
}

.audit-hist-score,
.audit-active-badge,
.badge-count {
  box-shadow: none;
}

.radar-stat-card {
  position: relative;
  overflow: hidden;
}

.radar-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.95;
}

.radar-stat-card--safe {
  color: #9ef0c8;
}

.radar-stat-card--danger {
  color: #ffb8b8;
}

.radar-stat-card--warning {
  color: #ffc793;
}

.radar-stat-card--alert {
  color: #ffd88a;
}

.radar-stat-card--accent {
  color: #c7b0ff;
}

.radar-shell,
.radar-legend-card,
.manhours-summary-card,
.manhours-list-card,
.wla-history-card {
  margin-top: 15px;
}

.radar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.radar-title {
  margin: 0;
  color: var(--primary);
}

.radar-toolbar h3 {
  margin: 0;
  color: var(--primary);
}

.radar-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radar-weekdays,
.radar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.radar-weekdays {
  margin-bottom: 10px;
}

.radar-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.radar-day {
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.radar-day:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 107, 255, 0.35);
  box-shadow: 0 12px 24px rgba(5, 10, 25, 0.28);
}

.radar-day.is-safe {
  background: linear-gradient(180deg, rgba(46, 194, 126, 0.3), rgba(46, 194, 126, 0.18));
  color: #ebfff4;
}

.radar-day.is-future {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

.radar-day.is-accident {
  background: linear-gradient(180deg, rgba(224, 90, 90, 0.34), rgba(224, 90, 90, 0.2));
  color: #fff1f1;
}

.radar-day.is-nonconformity {
  background: linear-gradient(180deg, rgba(244, 138, 65, 0.34), rgba(244, 138, 65, 0.2));
  color: #fff3eb;
}

.radar-day.is-incident {
  background: linear-gradient(180deg, rgba(244, 183, 64, 0.3), rgba(244, 183, 64, 0.18));
  color: #fff8e8;
}

.radar-day.is-deviation {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.32), rgba(139, 92, 246, 0.18));
  color: #f6f0ff;
}

.radar-day.is-today {
  border-color: rgba(47, 107, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.22);
}

.radar-day--empty {
  min-height: 56px;
  border-radius: 14px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.03);
  cursor: default;
}

.radar-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.radar-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.radar-legend-swatch {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.radar-legend-swatch--safe {
  background: #22c55e;
}

.radar-legend-swatch--danger {
  background: #ef4444;
}

.radar-legend-swatch--warning {
  background: #f97316;
}

.radar-legend-swatch--alert {
  background: #eab308;
}

.radar-legend-swatch--accent {
  background: #8b5cf6;
}

.radar-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.radar-modal-title {
  margin: 0;
  font-size: 18px;
}

.radar-modal-close {
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.radar-modal-body {
  max-height: 70vh;
  overflow-y: auto;
  display: grid;
  gap: 18px;
}

.radar-section {
  display: grid;
  gap: 10px;
}

.radar-section-stack {
  display: grid;
  gap: 10px;
}

.radar-section-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-section-title--danger {
  color: var(--danger);
}

.radar-section-title--primary {
  color: var(--primary);
}

.radar-section-title--success {
  color: var(--success);
}

.radar-detail-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
}

.radar-detail-card--danger {
  border-left: 4px solid rgba(224, 90, 90, 0.9);
}

.radar-detail-card--primary {
  border-left: 4px solid rgba(47, 107, 255, 0.9);
}

.radar-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.radar-detail-title {
  color: var(--text);
}

.radar-detail-context {
  color: var(--muted);
}

.radar-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.radar-status-chip--success {
  background: rgba(46, 194, 126, 0.16);
  border-color: rgba(46, 194, 126, 0.24);
  color: #9ef0c8;
}

.radar-status-chip--warning {
  background: rgba(244, 183, 64, 0.16);
  border-color: rgba(244, 183, 64, 0.24);
  color: #ffd88a;
}

.radar-status-chip--danger {
  background: rgba(224, 90, 90, 0.16);
  border-color: rgba(224, 90, 90, 0.24);
  color: #ffb8b8;
}

.radar-status-chip--muted {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-soft);
}

.radar-detail-copy {
  margin-top: 8px;
  color: var(--text);
  font-size: 13px;
}

.radar-detail-copy--soft {
  color: var(--text-soft);
}

.radar-detail-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.radar-detail-meta--danger {
  color: #ffb8b8;
}

.radar-inline-photo-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.radar-inline-photo {
  width: 88px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
}

.radar-progress-track {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.radar-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(47, 107, 255, 0.95), rgba(124, 162, 255, 0.95));
}

.radar-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.radar-photo-card {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.radar-photo-thumb {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
}

.radar-photo-label {
  font-size: 11px;
  color: var(--text-soft);
}

.radar-photo-user {
  font-size: 10px;
  color: var(--muted);
}

.radar-empty-state {
  padding: 40px 20px;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.radar-empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.radar-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.radar-empty-copy {
  margin-top: 4px;
  font-size: 13px;
}

.manifesto-shell {
  text-align: center;
  padding: 30px;
}

.manifesto-list {
  max-width: 700px;
  margin: 0 auto;
  text-align: left;
}

.manifesto-item {
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 14px;
  border-left: 4px solid var(--primary);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.manifesto-ack {
  max-width: 700px;
  margin: 25px auto 0;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(46, 194, 126, 0.22);
  background: rgba(46, 194, 126, 0.12);
}

.manifesto-ack-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}

.manifesto-checkbox {
  width: 20px;
  height: 20px;
}

.manifesto-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.manhours-visitor-block {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.manhours-visitor-title {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.manhours-visitor-grid {
  margin-top: 8px;
}

.manhours-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.manhours-chart-item {
  text-align: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.manhours-chart-stage {
  height: 88px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.manhours-chart-bar {
  width: 42px;
  min-height: 4px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.95), rgba(47, 107, 255, 0.45));
  box-shadow: 0 10px 18px rgba(47, 107, 255, 0.2);
}

.manhours-chart-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.manhours-chart-value {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.manhours-list {
  display: grid;
  gap: 10px;
}

.manhours-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.manhours-item-main {
  min-width: 0;
  flex: 1;
}

.manhours-item-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.manhours-item-title {
  color: var(--text);
}

.manhours-meta-row {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.manhours-meta-row--strong {
  color: var(--text-soft);
}

.manhours-shift-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.manhours-shift-pill--day {
  background: rgba(47, 107, 255, 0.9);
}

.manhours-shift-pill--night {
  background: rgba(139, 92, 246, 0.9);
}

.manhours-shift-pill--weekend {
  background: rgba(244, 183, 64, 0.9);
  color: #1d1403;
}

.manhours-delete-btn,
.wla-delete-btn {
  flex: 0 0 auto;
  min-height: 34px;
}

.wla-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.wla-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.wla-risk-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.wla-risk-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 107, 255, 0.26);
  background: rgba(255, 255, 255, 0.06);
}

.wla-risk-tile:has(input:checked) {
  border-color: rgba(47, 107, 255, 0.42);
  background: rgba(47, 107, 255, 0.12);
}

.wla-list {
  display: grid;
  gap: 12px;
}

.wla-item {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid rgba(47, 107, 255, 0.85);
}

.wla-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.wla-meta {
  font-size: 12px;
  color: var(--muted);
}

.wla-block {
  margin-top: 10px;
}

.wla-block-title {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}

.wla-doc-list {
  display: grid;
  gap: 6px;
}

.wla-doc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wla-doc-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.wla-doc-meta {
  font-size: 11px;
  color: var(--muted);
}

.wla-risk-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wla-risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.16);
  border: 1px solid rgba(244, 183, 64, 0.22);
  color: #ffd88a;
  font-size: 12px;
}

@media (max-width: 1400px) {
  header {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-right,
  .header-info,
  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "content";
    padding: 18px;
  }

  .tabs.app-sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: min(var(--sidebar-width), calc(100vw - 32px));
    min-height: auto;
    height: calc(100vh - 32px);
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.22s ease;
    z-index: 999;
  }

  body.sidebar-open .tabs.app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
    opacity: 1;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .brand {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .stats-grid,
  .exec-kpi-grid-primary,
  .exec-kpi-grid-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .incident-detail-grid,
  .audit-form-grid,
  .amb-hero-shell,
  .modal-form-grid,
  .modal-meta-grid {
    grid-template-columns: 1fr;
  }

  .module-subnav {
    padding: 10px;
  }

  .radar-legend {
    grid-template-columns: 1fr;
  }

  .manhours-item,
  .wla-item-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 12px;
    gap: 16px;
  }

  header {
    padding: 16px;
    gap: 14px;
    border-radius: 22px;
  }

  .brand-text h1 {
    font-size: 1.35rem;
  }

  .topbar-search {
    min-height: 48px;
  }

  .header-info {
    grid-template-columns: 1fr 1fr;
    display: grid;
    width: 100%;
  }

  .header-info > div {
    min-width: 0;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions select,
  .topbar-actions button {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .presentation-actions,
  .queue-actions,
  .modal-actions {
    flex-direction: column;
  }

  .radar-weekdays,
  .radar-grid {
    gap: 4px;
  }

  .radar-day,
  .radar-day--empty {
    min-height: 48px;
    border-radius: 12px;
  }

  .radar-photo-grid,
  .wla-risk-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .card,
  .stat-card,
  .exec-kpi-card {
    border-radius: 18px;
    padding: 18px;
  }

  .module-subnav .tab-btn {
    min-height: 42px;
    padding: 10px 12px;
  }

  table th,
  table td {
    padding: 12px !important;
  }
}

/* Shell stability overrides */
body.theme-dark {
  overflow-x: hidden;
}

.container > header,
.container > .tabs.app-sidebar,
.container > .tab-content,
#sstViewHost,
#sstViewHost > .tab-content,
#ambiental,
#admin {
  min-width: 0;
  max-width: 100%;
}

header.app-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.92fr);
  grid-template-areas:
    "brand actions"
    "search actions";
  gap: 16px 18px;
  align-items: start;
  width: 100%;
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

header.app-topbar .brand {
  grid-area: brand;
  width: 100%;
  min-width: 0;
  align-self: start;
}

header.app-topbar .topbar-search-wrap {
  grid-area: search;
  width: 100%;
  min-width: 0;
}

header.app-topbar .header-right {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.header-right .header-info {
  order: 1;
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.header-right > div:not(.header-info),
.header-right > button {
  order: 2;
  flex: 0 0 auto;
}

.header-right > div:not(.header-info) {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-info .header-chip,
.header-info > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.brand-text,
.sidebar-brand > div,
.header-info strong,
.header-info-label,
.header-chip strong,
.header-chip span,
.sidebar-brand strong,
.sidebar-brand span,
.sidebar-account-name,
.sidebar-account-context,
.workspace-choice strong,
.workspace-choice span {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

.brand-company,
.brand-text h1,
.brand-subtitle,
.sidebar-brand strong,
.sidebar-brand span,
.sidebar-nav .tab-btn,
.sidebar-link {
  overflow-wrap: normal;
  word-break: normal;
}

.brand-text h1 {
  max-width: 100%;
  line-height: 1.14;
}

.brand-subtitle,
.sidebar-brand span,
.sidebar-account-context {
  line-height: 1.45;
}

.topbar-search,
.topbar-search input {
  width: 100%;
  min-width: 0;
}

.topbar-search {
  overflow: hidden;
}

.topbar-search input {
  text-overflow: ellipsis;
}

.tabs.app-sidebar {
  width: 100%;
  max-width: var(--sidebar-width);
  overflow-x: hidden;
  box-shadow: var(--shadow-md);
}

.sidebar-nav .tab-btn,
.sidebar-link {
  align-items: flex-start;
  white-space: normal;
  line-height: 1.35;
}

.sidebar-nav .tab-btn span,
.sidebar-link span {
  display: block;
  width: 100%;
}

.tab-content,
#sst,
#ambiental,
#admin {
  display: none;
  width: 100%;
  min-width: 0;
  grid-area: content;
}

#sst.tab-content.active,
#ambiental.tab-content.active,
#admin.tab-content.active {
  display: block;
  z-index: 5;
}

#sstViewHost {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#ambientalViewHost {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#sstViewHost > .tab-content,
#ambientalViewHost > .amb-section,
#ambiental .amb-section,
#admin .admin-section {
  min-width: 0;
  max-width: 100%;
}

.module-subnav {
  overflow-y: hidden;
  box-shadow: var(--shadow-sm);
}

.module-subnav .tab-btn {
  white-space: nowrap;
}

.card,
.stat-card,
.exec-kpi-card,
.smart-insight-card,
.audit-hist-item {
  box-shadow: var(--shadow-sm);
}

@media (max-width: 1400px) {
  header.app-topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "search"
      "actions";
  }

  header.app-topbar .header-right {
    justify-content: stretch;
  }
}

@media (max-width: 900px) {
  .header-right .header-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-right > div:not(.header-info),
  .header-right > button {
    flex: 1 1 calc(50% - 8px);
  }

  .topbar-select,
  .theme-toggle {
    width: 100%;
  }
}

@media (max-width: 640px) {
  header.app-topbar {
    padding: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .header-right > div:not(.header-info),
  .header-right > button {
    flex: 1 1 100%;
  }

  .sidebar-nav .tab-btn,
  .sidebar-link {
    padding: 12px 14px;
  }

  /* Hide non-essential topbar chips at small screen */
  .header-chip[data-chip="date"],
  .header-chip[data-chip="photos"] {
    display: none;
  }

  /* Workspace selector responsive */
  .workspace-choice-grid {
    grid-template-columns: 1fr;
  }

  .workspace-choice {
    min-height: 100px;
  }

  .workspace-overlay-actions {
    flex-direction: column;
  }

  .workspace-overlay-actions button {
    width: 100%;
  }
}

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

/* Visual and shell refinements */
body.theme-dark {
  --bg: #101726;
  --text: #f6f8ff;
  --text-soft: #dbe4f5;
  --muted: #b4bfd7;
  --card: #172033;
  --card-2: #1c2740;
  --border: rgba(255, 255, 255, 0.1);
  --primary: #3d78ff;
  --primary-strong: #2f67ee;
  --upload-bg: rgba(61, 120, 255, 0.12);
  --upload-bg-hover: rgba(61, 120, 255, 0.2);
  --overlay: rgba(6, 10, 20, 0.72);
  --day-bg: rgba(255, 255, 255, 0.05);
  --day-bg-hover: rgba(255, 255, 255, 0.09);
  --focus-ring: rgba(61, 120, 255, 0.24);
}

body {
  background:
    radial-gradient(circle at top right, rgba(61, 120, 255, 0.16), transparent 32%),
    radial-gradient(circle at top left, rgba(90, 166, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #101726 0%, #0d1422 100%);
}

header,
.tabs.app-sidebar,
.module-subnav,
.card,
.stat-card,
.exec-kpi-card,
.smart-insight-card,
.audit-hist-item {
  box-shadow: var(--shadow-sm);
}

header {
  background:
    linear-gradient(180deg, rgba(26, 35, 56, 0.96), rgba(19, 27, 44, 0.94)),
    rgba(23, 32, 51, 0.96);
  border-color: rgba(255, 255, 255, 0.09);
}

.tabs.app-sidebar {
  background:
    linear-gradient(180deg, rgba(24, 34, 55, 0.98), rgba(16, 24, 39, 0.97)),
    rgba(20, 29, 47, 0.98);
}

.module-subnav {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(20, 28, 46, 0.95);
}

.card,
.stat-card,
.exec-kpi-card,
.smart-insight-card,
.audit-hist-item {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03)),
    rgba(23, 32, 51, 0.97);
}

header.app-topbar,
.tabs.app-sidebar,
.module-subnav,
#loginOverlay,
#workspaceOverlay,
#splash {
  backdrop-filter: none;
}

.header-info > div {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.topbar-search {
  background: rgba(255, 255, 255, 0.06);
}

input,
select,
textarea {
  background: rgba(13, 20, 34, 0.82);
  border-color: rgba(255, 255, 255, 0.11);
}

input::placeholder,
textarea::placeholder {
  color: #8fa0be;
}

button.secondary,
.theme-toggle {
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-footer {
  gap: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.sidebar-account-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-account-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-account-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sidebar-account-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-context {
  display: block;
}

.app-module-view-host {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#ambiental {
  display: none;
  width: 100%;
  min-width: 0;
}

#ambiental.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  grid-area: content;
}

#ambiental .grid-2,
#ambiental .stats-grid {
  align-items: stretch;
}

#ambientalViewHost .amb-section {
  display: none;
  width: 100%;
  min-width: 0;
  animation: fadeIn 180ms ease-in-out;
}

#ambientalViewHost .amb-section.active {
  display: block;
}

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

@keyframes authOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#ambientalViewHost > .amb-section {
  width: 100%;
}

@media (max-width: 900px) {
  .sidebar-account-profile {
    align-items: flex-start;
  }

  .sidebar-account-avatar {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .module-toolbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .module-toolbar-grid {
    grid-template-columns: 1fr;
  }

  .module-toolbar-actions {
    width: 100%;
  }

  .module-toolbar-actions button {
    flex: 1 1 180px;
  }

  .amb-timeline-item,
  .amb-attachment-item,
  .amb-attachment-upload,
  .amb-evidence-head {
    flex-direction: column;
    align-items: stretch;
  }

  .amb-timeline-meta {
    text-align: left;
    white-space: normal;
  }

  .amb-data-table {
    min-width: 640px;
  }

  .amb-row-actions {
    justify-content: flex-start;
  }

  .amb-form-actions,
  .amb-checklist-row,
  .amb-checklist-controls {
    flex-direction: column;
    align-items: stretch;
  }

  /* Ajusta grids para caber em mobile */
  .amb-form-grid,
  .amb-form-grid--3,
  .amb-fact-grid,
  .amb-quick-grid {
    grid-template-columns: 1fr;
  }

  /* Reduz table min-width para scroll horizontal */
  .amb-data-table {
    min-width: 100%;
  }

  .amb-data-table--editor {
    min-width: 100%;
  }

  /* Ajusta dashboard stats para mobile */
  #ambiental .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Reduz padding em cards de mobile */
  .amb-section .card {
    padding: 16px;
  }
}

/* Mobile extra pequeno (< 480px) */
@media (max-width: 480px) {
  /* Garante que tabelas usem scroll horizontal em vez de quebrar layout */
  .amb-data-table,
  .amb-data-table--editor {
    min-width: 280px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Reduz gap entre seções */
  #ambientalViewHost {
    gap: 12px;
  }

  #ambiental {
    gap: 12px;
  }

  /* Stack de 1 coluna para tudo em extra pequeno */
  .amb-form-grid,
  .amb-form-grid--3,
  .amb-fact-grid,
  .amb-quick-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Reduz padding agressivamente */
  .amb-section {
    padding: 12px;
  }

  .amb-section .card {
    padding: 12px;
  }

  /* Ajusta module toolbar em mobile */
  .module-toolbar-grid {
    grid-template-columns: 1fr;
  }

  .module-toolbar-actions button {
    flex: 1 1 auto;
    min-height: 40px;
  }
}
