:root {
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --accent: #0ea5e9;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Shell */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.brand-row {
  display: block;
}

.mobile-header-quick-actions {
  display: none;
}

.mobile-top-chip {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mobile-top-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mobile-top-chip.mobile-exit-sim-btn {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

/* Sidebar */
.sidebar {
  width: 265px;
  background: var(--bg-sidebar);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  padding: 14px 14px;
  overflow-y: auto;
  transition: all 0.25s ease;
}

.brand-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  margin-bottom: 6px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.sidebar-main-logo {
  width: auto;
  max-width: 190px;
  height: auto;
  max-height: 76px;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #fff;
}

.brand-sub {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin: 8px 10px 3px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 9px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

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

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 265px;
  padding: 22px 28px 60px;
  max-width: 100%;
}

/* Top Bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-title p {
  font-size: 12.5px;
  color: var(--text-muted);
}

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

/* Sync & Offline Pill */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}

.sync-pill.online {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.sync-pill.offline {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

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

.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Harmonious Dashboard Components */
.dashboard-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border: none;
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.dashboard-hero-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-hero-text {
  flex: 1;
  min-width: 280px;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dashboard-inspections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.dashboard-inspection-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 11px;
  padding: 14px 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-inspection-card:hover {
  border-color: #7dd3fc;
  border-left-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.dashboard-team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.dashboard-team-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  gap: 8px;
  min-width: 0;
}

.dashboard-template-item {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Cards & Grids */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-entrada {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-saida {
  background: #fce7f3;
  color: #be185d;
}

.badge-periodica {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-concluida {
  background: #d1fae5;
  color: #047857;
}

.badge-andamento {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-assinatura {
  background: #fef3c7;
  color: #b45309;
}

.badge-agendada {
  background: #f1f5f9;
  color: #475569;
}

/* State Pills (1-Tap Evaluation) */
.state-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.state-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.state-btn:hover {
  border-color: #94a3b8;
}

.state-btn.active[data-state="Ótimo"] {
  background: #059669;
  color: #fff;
  border-color: #059669;
}

.state-btn.active[data-state="Bom"] {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
}

.state-btn.active[data-state="Regular"] {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
}

.state-btn.active[data-state="Danificado"] {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.state-btn.active[data-state="N/A"] {
  background: #475569;
  color: #fff;
  border-color: #475569;
}

/* Quick Chips for Materials & Observations */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
}

.chip:hover {
  background: #e2e8f0;
}

.chip.selected {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: #7dd3fc;
  font-weight: 600;
}

/* Split Inspector View (Field Editor) */
.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #e2e8f0;
  padding: 5px;
  border-radius: 11px;
  margin-bottom: 18px;
}

.inspector-tab {
  flex: 1;
  min-width: 135px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s;
}

.inspector-tab.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.split-inspector {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

.rooms-sidebar {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  position: sticky;
  top: 16px;
}

.room-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.15s;
}

.room-nav-item:hover {
  background: #f8fafc;
  border-color: var(--border);
}

.room-nav-item.active {
  background: var(--primary-light);
  border-color: #7dd3fc;
  color: var(--primary-dark);
  font-weight: 700;
}

.room-item-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}

.room-item-card.divergent {
  border-left: 4px solid var(--danger);
  background: #fffafa;
}

.room-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

/* Photos Grid */
.photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.photo-thumb {
  width: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #f8fafc;
  position: relative;
}

.photo-thumb img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.photo-thumb-caption {
  font-size: 10.5px;
  padding: 4px 6px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-thumb-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
}

/* Voice Recording Pulse */
.voice-active {
  background: #ef4444 !important;
  color: #fff !important;
  animation: pulseRed 1.2s infinite;
}

@keyframes pulseRed {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.form-control {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

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

table.data-table th {
  text-align: left;
  padding: 11px 12px;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

/* Canvas Annotator & Signature Pad */
.canvas-wrapper {
  border: 2px dashed #94a3b8;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.signature-pad {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 9px;
  border-left: 4px solid #38bdf8;
}

/* Native Mobile App Header (Hidden on Desktop Web, Visible on Mobile/Tablet & Simulators) */
.mobile-app-header {
  display: none;
  background: linear-gradient(160deg, #5b21b6 0%, #4c1d95 55%, #3b0764 100%);
  color: #ffffff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 16px 16px;
  margin: -12px -12px 14px -12px;
  box-shadow: 0 4px 18px rgba(59, 7, 100, 0.22);
}

.mheader-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mheader-logo-badge {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
}

.mheader-logo-badge img {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}

.mheader-icons-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mheader-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.mheader-icon-btn:hover,
.mheader-icon-btn:active {
  background: rgba(255, 255, 255, 0.24);
}

.mheader-sim-exit {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.mheader-greeting-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.mheader-greeting-text {
  font-size: 16.5px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mheader-counter-text {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  flex-shrink: 0;
}

.mheader-search-wrap {
  margin-bottom: 10px;
}

.mheader-search-wrap input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.mheader-segmented-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #2e054e;
  padding: 4px;
  border-radius: 13px;
}

.mseg-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mseg-btn.active {
  background: #ffffff;
  color: #3b0764;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Mobile Empty State & Native Mobile Cards (Reference Screenshot Style) */
.mobile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 20px 36px;
}

.mobile-empty-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.14) 0%, rgba(139, 92, 246, 0.04) 70%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.mobile-empty-dot-teal {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(167, 243, 208, 0.65);
}

.mobile-empty-dot-amber {
  position: absolute;
  bottom: 14px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(253, 230, 138, 0.75);
}

.mobile-empty-home-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c3aed;
}

.mobile-insp-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* Mobile Bottom Navigation (White 5-Tab Bar with Central Purple Circle + Button) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  color: #475569;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.mobile-nav-btn.active {
  color: #5b21b6;
  font-weight: 800;
}

.mobile-nav-btn .mnav-svg {
  stroke: currentColor;
}

.mobile-nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #5b21b6, #3b0764) !important;
  color: #ffffff !important;
  padding: 0 !important;
  box-shadow: 0 6px 16px rgba(91, 33, 182, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-fab .mnav-plus {
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

/* Unified Mobile & Tablet App Interface (Smartphone 420px & Tablet 860px Simulators) */
body.mobile-field-mode,
body.tablet-field-mode {
  background: #0b1120;
  padding: 14px 8px;
}

body.mobile-field-mode .app-layout,
body.tablet-field-mode .app-layout {
  width: 100%;
  max-width: 420px;
  min-height: calc(100vh - 28px);
  margin: 0 auto;
  border-radius: 30px;
  border: 6px solid #1e293b;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.65);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body.tablet-field-mode .app-layout {
  max-width: 860px;
  border-radius: 24px;
  border-width: 7px;
}

.install-hero-grid {
  display: grid;
  grid-template-columns: 205px 1fr;
  gap: 16px;
  align-items: center;
}

body.mobile-field-mode .install-hero-grid {
  grid-template-columns: 1fr !important;
}

/* Hide Desktop Sidebar & Topbar inside Mobile/Tablet Simulators, Show Native Mobile App Header */
body.mobile-field-mode .sidebar,
body.tablet-field-mode .sidebar,
body.mobile-field-mode .topbar,
body.tablet-field-mode .topbar {
  display: none !important;
}

body.mobile-field-mode .mobile-app-header,
body.tablet-field-mode .mobile-app-header {
  display: block !important;
}

body.mobile-field-mode .main-content,
body.tablet-field-mode .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  padding: 12px 12px 24px 12px !important;
  flex: 1;
}

body.tablet-field-mode .main-content {
  padding: 12px 18px 28px 18px !important;
}

body.tablet-field-mode .mobile-app-header {
  margin: -12px -18px 16px -18px;
}

body.mobile-field-mode .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin-bottom: 14px !important;
}

body.tablet-field-mode .kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
}

body.mobile-field-mode .kpi-card,
body.tablet-field-mode .kpi-card {
  padding: 12px !important;
}

body.mobile-field-mode .kpi-value,
body.tablet-field-mode .kpi-value {
  font-size: 21px !important;
}

body.mobile-field-mode .split-inspector,
body.mobile-field-mode .grid-2,
body.mobile-field-mode .grid-3,
body.mobile-field-mode .dashboard-inspections-grid,
body.mobile-field-mode .dashboard-bottom-grid,
body.mobile-field-mode .dashboard-team-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

body.tablet-field-mode .split-inspector {
  grid-template-columns: 230px minmax(0, 1fr) !important;
  gap: 14px !important;
}

body.tablet-field-mode .grid-2,
body.tablet-field-mode .grid-3,
body.tablet-field-mode .dashboard-inspections-grid,
body.tablet-field-mode .dashboard-bottom-grid,
body.tablet-field-mode .dashboard-team-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

body.mobile-field-mode .split-inspector>*,
body.mobile-field-mode .grid-2>*,
body.mobile-field-mode .grid-3>* {
  grid-column: 1 / -1 !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

body.mobile-field-mode .rooms-sidebar {
  position: relative !important;
  top: auto !important;
  padding: 12px !important;
}

body.mobile-field-mode .inspector-tabs {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
  padding: 5px !important;
}

body.tablet-field-mode .inspector-tabs {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
  padding: 6px !important;
}

body.mobile-field-mode .inspector-tab,
body.tablet-field-mode .inspector-tab {
  min-width: 0 !important;
  width: 100% !important;
  padding: 8px 6px !important;
  font-size: 11.5px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-field-mode .card,
body.tablet-field-mode .card {
  padding: 14px !important;
  margin-bottom: 12px !important;
  overflow-x: hidden;
}

body.mobile-field-mode .mobile-bottom-nav,
body.tablet-field-mode .mobile-bottom-nav {
  display: flex !important;
  position: sticky !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  border-radius: 0 0 23px 23px;
}

/* Responsive Real Smartphone & Tablet Viewport (<= 960px) */
@media (max-width: 960px) {
  .app-layout {
    flex-direction: column;
    overflow-x: hidden;
    background: #f8fafc;
    min-height: 100vh;
  }

  .sidebar,
  .topbar,
  .mheader-sim-exit {
    display: none !important;
  }

  .mobile-app-header {
    display: block !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 12px 12px 92px 12px !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .kpi-card {
    padding: 12px !important;
  }

  .kpi-value {
    font-size: 21px !important;
  }

  .split-inspector,
  .grid-2,
  .grid-3,
  .install-hero-grid,
  .dashboard-inspections-grid,
  .dashboard-bottom-grid,
  .dashboard-team-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .split-inspector>*,
  .grid-2>*,
  .grid-3>* {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .rooms-sidebar {
    position: relative !important;
    top: auto !important;
  }

  .inspector-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5px !important;
    padding: 5px !important;
  }

  .inspector-tab {
    min-width: 0 !important;
    width: 100% !important;
    padding: 8px 6px !important;
    font-size: 11.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card {
    padding: 14px !important;
    margin-bottom: 12px !important;
    overflow-x: hidden;
  }

  .mobile-bottom-nav {
    display: flex !important;
  }
}

/* Legal Safety & Hazard Highlight in Red */
.room-item-card.has-risk {
  border: 2px solid #dc2626 !important;
  border-left: 7px solid #dc2626 !important;
  background: #fef2f2 !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.14);
}

.risk-alert-box {
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 9px;
  background: #fee2e2;
  border: 1.5px solid #dc2626;
  color: #991b1b;
  font-size: 12.5px;
  line-height: 1.45;
}

.risk-alert-title {
  font-weight: 800;
  color: #dc2626;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.chip.risk-chip {
  background: #fff1f2;
  color: #be123c;
  border-color: #fda4af;
  font-weight: 600;
}

.chip.risk-chip.selected {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
  font-weight: 700;
}

/* Print / Official Laudo PDF Styles */
@media print {
  body {
    background: #fff !important;
  }

  .sidebar,
  .topbar,
  .no-print,
  #toast-container {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    break-inside: avoid;
  }
}

/* =========================================================================
   FULLSCREEN LOGIN GATE (MOBILE & DESKTOP)
   ========================================================================= */
.auth-gate-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: linear-gradient(145deg, #0b1120 0%, #0f172a 55%, #1e293b 100%);
  overflow-y: auto;
}

.auth-gate-card {
  width: 100%;
  max-width: 410px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.auth-gate-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-gate-logo img {
  max-height: 54px;
  width: auto;
  object-fit: contain;
}

.auth-gate-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #0369a1;
  background: #e0f2fe;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.auth-gate-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
}

.auth-gate-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.45;
}

.auth-gate-input {
  font-size: 16px !important;
  padding: 12px 14px !important;
  border-radius: 11px !important;
}

.auth-pass-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

.auth-remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  margin: 4px 0 14px;
  cursor: pointer;
  user-select: none;
  text-align: left;
}

.auth-gate-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  text-align: left;
}

.auth-gate-submit {
  width: 100%;
  justify-content: center;
  padding: 13px 16px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  border-radius: 12px !important;
  touch-action: manipulation;
  cursor: pointer;
}
