/* ============================================================
   VARIÁVEIS DE TEMA
   (tema da aplicação + tokens dos modais, unificados)
   ============================================================ */

:root {
  /* Cores base — identidade visual Ybyrá (Manual v1.0) */
  --green-dark:   #17663A; /* verde folha — principal */
  --green-mid:    #167F44; /* verde folha — apoio */
  --green-light:  #D5F6E4;

  --wood:         #F7D092; /* madeira — principal */
  --wood-dark:    #C9762D; /* madeira — apoio */

  --bg:           #f9fafb;
  --surface:      rgba(255,255,255,0.70);
  --surface-hover:rgba(255,255,255,0.90);
  --border:       rgba(0,0,0,0.10);
  --text:         #111827;
  --text-muted:   #6b7280;
  --input-bg:     #ffffff;
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --sidebar-bg:   rgba(255,255,255,0.70);
  --divider:      rgba(0,0,0,0.08);
  --dot-outline:  rgba(0,0,0,0.15);

  /* Tokens dos modais */
  --modal-overlay: rgba(15, 23, 42, 0.45);
  --modal-surface: #ffffff;
  --modal-surface-2: #fafafa;
  --modal-text: #111827;
  --modal-text-soft: #374151;
  --modal-muted: #6b7280;
  --modal-placeholder: #9ca3af;
  --modal-shadow: rgba(15, 23, 42, 0.22);
  --modal-accent-soft: rgba(23, 102, 58, 0.08);
  --modal-accent-soft-strong: rgba(23, 102, 58, 0.10);
}

[data-theme="dark"] {
  /* Cores base */
  --bg:           #111827;
  --surface:      rgba(31,41,55,0.70);
  --surface-hover:rgba(31,41,55,0.90);
  --border:       rgba(255,255,255,0.10);
  --text:         #f9fafb;
  --text-muted:   #9ca3af;
  --input-bg:     rgba(31,41,55,0.80);
  --shadow:       0 4px 24px rgba(0,0,0,0.30);
  --sidebar-bg:   rgba(17,24,39,0.80);
  --divider:      rgba(255,255,255,0.08);
  --dot-outline:  rgba(255,255,255,0.15);

  /* Tokens dos modais */
  --modal-overlay: rgba(0, 0, 0, 0.6);
  --modal-surface: #0f1b2d;
  --modal-surface-2: #0b1422;
  --modal-text: #f1f5f9;
  --modal-text-soft: #cbd5e1;
  --modal-muted: #94a3b8;
  --modal-placeholder: #64748b;
  --modal-shadow: rgba(0, 0, 0, 0.5);
  --modal-accent-soft: rgba(23, 102, 58, 0.16);
  --modal-accent-soft-strong: rgba(23, 102, 58, 0.20);
}

/* ============================================================
   RESET E BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, h3,
.page-header h1, .page-header h2,
.logo-text, .login-card h1 {
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select { font: inherit; color: var(--text); }

/* ============================================================
   FUNDO COM PADRÃO
   ============================================================ */

.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-size: 400px;
  background-repeat: repeat;
}

/* Textura escura — 50% */
[data-theme="dark"] .bg-pattern {
  background-image: url("/static/img/bridge-1.png");
  opacity: 0.5;
}

/* Textura clara — 80% */
[data-theme="light"] .bg-pattern,
:root:not([data-theme]) .bg-pattern {
  background-image: url("/static/img/bridge-2.png");
  opacity: 0.8;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: 256px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  min-height: 80px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-dark);
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  color: var(--text-muted);
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-link.active {
  background: linear-gradient(90deg, var(--green-dark), var(--green-mid));
  color: white;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Contador de pendências no menu (ex.: vistorias aguardando aprovação).
   `margin-left: auto` empurra para a direita do item sem precisar de wrapper. */
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* No item ativo o fundo já é verde forte: o vermelho sólido brigaria com ele. */
.nav-link.active .nav-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer .nav-link {
  font-size: 13px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Avatar do usuário — serve para <img> ou para iniciais (texto) */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--green-dark);
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: var(--text-muted); }

.logout-btn {
  color: var(--text-muted);
  transition: color 0.15s;
  display: flex;
  align-items: center;
}
.logout-btn:hover { color: #dc2626; }
.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   CABEÇALHO DE PÁGINA
   ============================================================ */

.page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 80px;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 2px solid rgba(4,120,87,0.15);
  background: linear-gradient(to right, rgba(4,120,87,0.02), rgba(6,95,70,0.04));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.page-header h1,
.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================================
   FILTROS
   ============================================================ */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px 32px;
}

.filter-group { position: relative; }

/* Cresce para ocupar o espaço (campo de busca) */
.filter-group.filter-grow { flex: 1; min-width: 240px; }

/* z-index: 2 mantém o ícone ACIMA do input — sem ele, o
   backdrop-filter do input borra o ícone que ficaria atrás. */
.filter-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 18px;
  height: 18px;
  pointer-events: none;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}

.input-field,
.select-field {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.input-field:focus,
.select-field:focus { border-color: var(--green-dark); }

.input-field.with-icon  { padding-left: 40px; }
.select-field.with-icon { padding-left: 40px; }
.select-field { appearance: none; padding-right: 32px; cursor: pointer; }

.search-field { min-width: 300px; flex: 1; }
.filter-date  { min-width: 170px; }

.results-count {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 32px 16px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.12); }

.card-body { padding: 24px; }

/* ============================================================
   GRID DE PONTES
   ============================================================ */

.bridges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  padding: 0 32px 32px;
}

.bridge-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--green-dark);
  margin-bottom: 16px;
  display: block;
  background: linear-gradient(135deg, #D5F6E4, #87EEB3);
}

/* placeholder quando não há imagem */
.bridge-img-placeholder {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  border: 2px solid var(--green-dark);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  display: flex;
  align-items: center;
  justify-content: center;
}

.bridge-img-placeholder svg {
  width: 48px;
  height: 48px;
  stroke: rgba(255,255,255,0.6);
  fill: none;
  stroke-width: 1.5;
}

.bridge-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}

.bridge-code {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.bridge-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.bridge-location svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.status-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.6;
  border: 1px solid var(--dot-outline);
  display: inline-block;
}

.dot-good     { background: #22c55e; }
.dot-low      { background: #3b82f6; }
.dot-medium   { background: #eab308; }
.dot-high     { background: #f97316; }
.dot-critical { background: #dc2626; }

.card-divider {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green-dark), var(--green-mid));
  margin: 0 0 12px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.card-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.card-date svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* ============================================================
   BOTÕES
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--green-dark), var(--green-mid));
  color: white;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(4,120,87,0.3);
}

.btn-primary:hover  { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled,
.btn-primary.disabled {
  background: #6b7280;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--surface-hover); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.btn-icon:hover { background: var(--surface-hover); }

.btn-icon svg,
.btn-primary svg,
.btn-secondary svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================================
   LINHA DO TEMPO (HISTÓRICO)
   ============================================================ */

.timeline { max-width: 760px; }

.day-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.day-separator:first-child { margin-top: 0; }

.day-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(4,120,87,0.3), transparent);
}

.day-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-entry {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.entry-time {
  width: 48px;
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding-top: 14px;
}

.entry-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.track-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-dark);
  border: 2px solid var(--bg);
  margin-top: 14px;
  flex-shrink: 0;
}

.track-line {
  width: 2px;
  flex: 1;
  background: rgba(4,120,87,0.25);
  min-height: 32px;
}

.entry-card {
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.entry-card:hover { border-color: rgba(4,120,87,0.3); }

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.entry-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
}

.entry-action svg {
  width: 16px;
  height: 16px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.8;
}

.level-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

.level-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.6;
  border: 1px solid var(--dot-outline);
}

.entry-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-bridge { font-weight: 500; color: var(--text); }

.entry-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry-user svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.entry-change {
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================================
   RELATÓRIOS
   ============================================================ */

.report-config {
  max-width: 720px;
  margin: 0 auto;
}

.form-group { margin-bottom: 20px; }

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-label svg {
  width: 15px;
  height: 15px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.8;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 10px;
}

.checkbox-option:hover { border-color: rgba(4,120,87,0.3); }

.checkbox-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green-dark);
  cursor: pointer;
}

.checkbox-label { font-size: 14px; font-weight: 500; }
.checkbox-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.format-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.format-option {
  padding: 16px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.format-option.selected {
  border-color: var(--green-dark);
  background: rgba(4,120,87,0.08);
}

.format-option input { position: absolute; opacity: 0; pointer-events: none; }

.format-option svg {
  width: 32px;
  height: 32px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.5;
  margin: 0 auto 8px;
  display: block;
}

.format-name { font-weight: 600; font-size: 15px; }
.format-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.recent-report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.recent-report-item:hover { border-color: rgba(4,120,87,0.3); }

.report-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(4,120,87,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.8;
}

.report-info { flex: 1; margin-left: 12px; }
.report-name { font-size: 14px; font-weight: 500; }
.report-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   ADMINISTRAÇÃO (TABS)
   ============================================================ */

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 32px;
  border-bottom: 2px solid rgba(4,120,87,0.15);
  background: linear-gradient(to right, rgba(4,120,87,0.02), rgba(6,95,70,0.04));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover  { color: var(--text); border-color: rgba(4,120,87,0.3); }
.tab-btn.active { color: var(--green-dark); border-color: var(--green-dark); }

.tab-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* Tabela */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead { background: rgba(4,120,87,0.05); }
thead tr th {
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid var(--border);
}
thead tr th:last-child { text-align: right; }

tbody tr td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

tbody tr td:last-child { text-align: right; }
tbody tr:hover { background: rgba(4,120,87,0.03); }
tbody tr:last-child td { border-bottom: none; }

.table-wrapper {
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(4,120,87,0.1);
  color: var(--green-dark);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dark);
}

/* Card de usuário */

.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.user-card-admin {
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s;
}

.user-card-admin:hover { border-color: rgba(4,120,87,0.3); }

.user-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  border: 2px solid var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Config de níveis */

.level-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.level-row:hover { border-color: rgba(4,120,87,0.3); }

.level-color-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  opacity: 0.6;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.level-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.field-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

/* Upload IFC */

.upload-zone {
  border: 2px dashed rgba(4,120,87,0.3);
  border-radius: 14px;
  padding: 48px;
  text-align: center;
  background: rgba(4,120,87,0.03);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-zone:hover {
  border-color: var(--green-dark);
  background: rgba(4,120,87,0.06);
}

.upload-zone svg {
  width: 48px;
  height: 48px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.5;
  margin: 0 auto 12px;
  display: block;
}

.upload-zone h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.upload-zone p  { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.ifc-model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.ifc-model-item:hover { border-color: rgba(4,120,87,0.3); }

/* ============================================================
   VIEWER PLACEHOLDER
   ============================================================ */

.viewer-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  padding: 48px;
  text-align: center;
}

.viewer-placeholder svg {
  width: 80px;
  height: 80px;
  stroke: rgba(4,120,87,0.4);
  fill: none;
  stroke-width: 1;
}

.viewer-placeholder h3 { font-size: 20px; color: var(--text); }
.viewer-placeholder p  { font-size: 14px; max-width: 400px; }

/* ============================================================
   LOGIN
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.login-logo { margin-bottom: 48px; text-align: center; }

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}

.login-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-logo .logo-text {
  font-size: 32px;
  font-weight: 800;
  color: var(--green-dark);
}

.login-logo .logo-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 36px;
}

.login-card h1 { font-size: 26px; font-weight: 600; margin-bottom: 4px; }
.login-card .subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

.login-card .form-group { margin-bottom: 16px; }

.login-card label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.login-card .input-field { width: 100%; }

.login-footer {
  margin-top: 20px;
  text-align: center;
  border-top: 2px solid;
  border-image: linear-gradient(90deg, var(--green-dark), var(--green-mid)) 1;
  padding-top: 18px;
}

.login-footer a { color: var(--green-dark); font-size: 14px; font-weight: 500; }
.login-footer a:hover { color: var(--green-mid); }
.login-footer .system-name { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.login-copyright {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ok      { background: rgba(34,197,94,0.12);  color: #16a34a; }
.status-ok      .status-dot { background: #22c55e; }
.status-atencao { background: rgba(245,158,11,0.12); color: #d97706; }
.status-atencao .status-dot { background: #f59e0b; }
.status-critico { background: rgba(239,68,68,0.12);  color: #dc2626; }
.status-critico .status-dot { background: #ef4444; }

/* Pausada — azul (status sem classe ok/atencao/critico) */
.status-pausada { color: #2563eb; background: rgba(37,99,235,0.14); border: 1px solid rgba(37,99,235,0.40); }
.status-pausada .status-dot { background: #2563eb; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.5;
  margin: 0 auto 16px;
  display: block;
  opacity: 0.5;
}

/* ============================================================
   MODAIS (administração)
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  animation: modal-fade 0.18s ease-out;
}

.modal-box {
  background: var(--modal-surface);
  color: var(--modal-text);
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px var(--modal-shadow);
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-box.wide { max-width: 560px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-accent-soft-strong);
  flex-shrink: 0;
}
.modal-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--green-dark);
  fill: none;
  stroke-width: 1.8;
}

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--modal-muted);
  display: flex;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--modal-text); }
.modal-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-field { display: flex; flex-direction: column; gap: 6px; }

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--modal-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}
.modal-body > .modal-section-title:first-child { margin-top: 0; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--modal-surface-2);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 18px;
  font-weight: 500;
  cursor: pointer;
  color: var(--modal-text-soft);
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--border); }

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  .modal-grid-2 { grid-template-columns: 1fr; }
}

/* Seletor de arquivo customizado */
.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.file-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--modal-surface);
  font-weight: 500;
  font-size: 14px;
  color: var(--modal-text-soft);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.file-picker-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.file-picker:hover .file-picker-btn {
  background: var(--modal-accent-soft);
  border-color: var(--green-dark);
  color: var(--green-dark);
}
.file-picker.has-file .file-picker-btn {
  border-color: var(--green-dark);
  color: var(--green-dark);
}

.file-picker-name {
  font-size: 13px;
  color: var(--modal-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-picker.has-file .file-picker-name {
  color: var(--modal-text);
  font-weight: 500;
}

/* Preview de imagem */
.image-preview {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.image-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--modal-placeholder);
  transition: border-color 0.15s, color 0.15s;
}
.image-placeholder svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.file-picker:hover .image-placeholder { border-color: var(--green-dark); color: var(--green-dark); }

/* Banner de erro */
.modal-error {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 10px;
  word-break: break-word;
}
[data-theme="dark"] .modal-error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

/* Exclusão */
.text-danger {
  color: #dc2626;
  cursor: pointer;
}
.text-danger:hover { color: #b91c1c; }
[data-theme="dark"] .text-danger { color: #f87171; }
[data-theme="dark"] .text-danger:hover { color: #fca5a5; }

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.6; cursor: default; }

.modal-icon.danger { background: rgba(220, 38, 38, 0.12); }
.modal-icon.danger svg { stroke: #dc2626; }
[data-theme="dark"] .modal-icon.danger { background: rgba(220, 38, 38, 0.20); }
[data-theme="dark"] .modal-icon.danger svg { stroke: #f87171; }

/* ============================================================
   UTILITÁRIOS
   ============================================================ */

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mt-32  { margin-top: 32px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.p-32   { padding: 32px; }
.text-green { color: var(--green-dark); }
.text-muted { color: var(--text-muted); }
.font-mono  { font-family: "Courier New", monospace; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 11px; }
.overflow-auto { overflow: auto; }
.flex-1  { flex: 1; }
.w-full  { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-content { padding: 32px; flex: 1; overflow-y: auto; }