/* ==========================================================
   Mobilidade Barcelos — Backoffice Styles
   Visual identity aligned with PDM Barcelos admin
   ========================================================== */

:root {
  --primary-color: #00677f;
  --primary-dark: #00536a;
  --secondary-color: #d4a843;
  --text-dark: #1a2b30;
  --soft-bg: #f5f8f9;
}

body {
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: var(--soft-bg);
  color: var(--text-dark);
  line-height: 1.5;
}

[ng\:cloak], [ng-cloak], .ng-cloak { display: none !important; }

/* ─── Layout ─── */

.backoffice-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #00677f 0%, #003d4d 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-wrap {
  color: #fff;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.sidebar-logo-wide {
  width: 176px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.22));
}

.sidebar-title {
  margin: 8px 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

.sidebar-menu {
  flex: 1;
  padding: 8px 0;
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.menu-item {
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 22px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  font-size: 0.84rem;
}

.menu-item i:first-child {
  width: 18px;
  text-align: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.menu-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.menu-item.active {
  background: rgba(255,255,255,0.12);
  border-left-color: var(--secondary-color);
  color: #fff;
  font-weight: 600;
}

.menu-item-external {
  margin-top: 4px;
  opacity: 0.65;
  font-size: 0.8rem;
}
.menu-item-external:hover { opacity: 1; }
.menu-ext-icon { font-size: 0.6rem; margin-left: auto; opacity: 0.5; }

/* ─── Collapsible Menu Groups ─── */

.menu-group {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.menu-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.55);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.menu-group-toggle i:first-child {
  width: 18px;
  text-align: center;
  font-size: 0.78rem;
}

.menu-group-toggle:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.04);
}

.menu-group.open > .menu-group-toggle {
  color: rgba(255,255,255,0.8);
}

.mg-arrow {
  margin-left: auto;
  font-size: 0.55rem;
  transition: transform 0.25s ease;
}

.menu-group.open > .menu-group-toggle .mg-arrow {
  transform: rotate(180deg);
}

.menu-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.menu-group.open > .menu-group-items {
  max-height: 400px;
}

.menu-group-items .menu-item {
  padding-left: 48px;
  font-size: 0.82rem;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-chip {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.82rem;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.user-chip .btn-logout {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  transition: all 0.15s;
}

.user-chip .btn-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ─── Main Content ─── */

.main-content {
  margin-left: 250px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar-simple {
  padding: 10px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
  border-bottom: 1px solid #dbe5ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #0d3f57;
  flex: 0 1 300px;
}

.page-context-title {
  color: #183449;
  font-weight: 700;
  font-size: 0.95rem;
}

.page-context-subtitle {
  color: #5e7085;
  font-size: 0.75rem;
}

.topbar-global-search {
  flex: 1 1 580px;
  max-width: 760px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d3deea;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(17, 58, 88, 0.08);
  padding: 0 8px 0 14px;
}

.topbar-global-search i {
  color: #6b7d91;
  font-size: 0.84rem;
}

.topbar-global-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.86rem;
  color: #1f3144;
}

.topbar-global-search input:focus {
  outline: none;
}

.topbar-search-btn {
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #0d5f84 0%, #084f6f 100%);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  line-height: 1;
  transition: background 0.18s ease;
}

.topbar-search-btn:hover {
  background: linear-gradient(180deg, #0c5372 0%, #084861 100%);
}

.topbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.topbar-actions-slot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-body {
  padding: 24px 28px;
}

/* ─── Cards ─── */

.card-soft {
  background: #fff;
  border: 1px solid #e8dfcf;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(25,31,45,0.06);
  margin-bottom: 20px;
}

.card-soft .card-header {
  padding: 14px 18px;
  font-weight: 700;
  color: #274055;
  background: linear-gradient(120deg, #fbfdff 0%, #f4f8fc 100%);
  border-bottom: 1px solid #e5edf4;
  border-radius: 12px 12px 0 0;
  font-size: 0.92rem;
}

.card-soft .card-body {
  padding: 18px;
}

/* ─── Stat Cards ─── */

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e8dfcf;
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: #d8c28a;
  box-shadow: 0 4px 12px rgba(38,27,15,0.08);
}

.stat-label,
.card-label {
  font-size: 0.72rem;
  color: #556275;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-value,
.card-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: #1c2a3c;
}

.stat-value.small {
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 700;
}

.card-ok { border-left: 3px solid #16a34a; }
.card-warning { border-left: 3px solid var(--secondary-color); }
.card-error { border-left: 3px solid #dc2626; }

/* ─── Tables ─── */

.table th, .table td { vertical-align: middle; }

.table thead th {
  font-size: 0.72rem;
  color: #546072;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.table tbody td {
  color: #2c3340;
  font-size: 0.88rem;
}

.table-simple { width: 100%; border-collapse: collapse; }
.table-simple td, .table-simple th { padding: 8px 12px; text-align: left; border-bottom: 1px solid #e8f0f2; }
.table-simple th { font-size: 0.72rem; text-transform: uppercase; color: #5e7580; letter-spacing: 0.04em; font-weight: 700; background: #f7fafa; }
.table-simple tr:hover td { background: #f7fafa; }

.table-data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(25,31,45,0.05);
}

.table-data td, .table-data th { padding: 10px 14px; text-align: left; border-bottom: 1px solid #e8f0f2; font-size: 0.85rem; }
.table-data th { font-size: 0.7rem; text-transform: uppercase; color: #5e7580; letter-spacing: 0.04em; font-weight: 700; background: #f7fafa; }
.table-data tr:last-child td { border-bottom: none; }

/* ─── Badges ─── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-critical { background: #7c2d12; color: #fff; }
.badge-error { background: #f9e7e7; color: #8a2222; }
.badge-warning { background: #faf3e0; color: #78350f; }
.badge-info { background: #e6efff; color: #244b97; }
.badge-ok { background: #e7f4ea; color: #1d6a39; }

.badge.status-submetida { background: #e8edf3; color: #3d4f64; }
.badge.status-em_analise { background: #e6efff; color: #244b97; }
.badge.status-deferida { background: #e7f4ea; color: #1d6a39; }
.badge.status-indeferida { background: #f9e7e7; color: #8a2222; }

/* ─── Buttons ─── */

.btn-action {
  border: 1px solid transparent;
  background: var(--secondary-color);
  color: #2b210f;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  min-height: 38px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-action:hover { background: #b18d3e; color: #2b210f; }

.btn-action.dark {
  background: var(--primary-color);
  color: #fff;
}

.btn-action.dark:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-action:disabled {
  opacity: 0.64;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  min-height: 38px;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; min-height: 32px; }
.btn-success { background: #1a7a3a; color: #fff; }
.btn-success:hover { background: #156832; }

/* ─── Login ─── */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(130deg, rgba(0,103,127,0.10) 0%, rgba(0,103,127,0) 45%),
    linear-gradient(315deg, rgba(212,168,67,0.12) 0%, rgba(212,168,67,0) 40%),
    #f6f4ef;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e8dfcf;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0,50,65,0.14);
  padding: 28px;
  animation: cardIn 0.24s ease-out;
}

.login-card h1 {
  font-size: 1.35rem;
  margin: 12px 0 4px;
  font-weight: 800;
}

.login-card .login-subtitle {
  color: #6d7888;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.login-logo {
  max-width: 200px;
  width: 100%;
  height: auto;
}

.login-form .form-group { margin-bottom: 16px; }

.login-form label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #5e7580;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d4e4e7;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(0,103,127,0.12);
}

/* ─── Panels ─── */

.panel {
  background: #fff;
  border: 1px solid #e8dfcf;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 6px 18px rgba(25,31,45,0.06);
  margin-bottom: 20px;
}

.panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: #274055;
}

/* ─── Page Header ─── */

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); }
.page-header-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header-actions h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }

/* ─── Filters ─── */

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.filters select, .filters input {
  padding: 7px 12px;
  border: 1px solid #d4e4e7;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #fff;
}

/* ─── GTFS Files Grid ─── */

.gtfs-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.gtfs-file-item {
  background: #f7fafa;
  border: 1px solid #d4e4e7;
  border-radius: 10px;
  padding: 12px;
}

.gtfs-file-item.missing { border-color: #dc2626; background: #fef2f2; }
.gtfs-file-name { font-weight: 700; font-size: 0.85rem; }
.gtfs-file-lines { font-size: 0.78rem; color: #5e7580; }

/* ─── Form Errors ─── */

.form-error {
  color: #8a2222;
  font-size: 0.85rem;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #f9e7e7;
  border-radius: 8px;
  border-left: 3px solid #dc2626;
}

/* ─── Run Info ─── */

.run-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 0.85rem; }
.run-info dt { font-weight: 700; color: #5e7580; }
.run-info dd { margin: 0; }

/* ─── Misc ─── */

.loading-msg { color: #5e7580; padding: 24px 0; }
.text-muted { color: #5e7580; }
.text-error { color: #8a2222; }
.text-success { color: #1d6a39; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.empty-state { text-align: center; padding: 40px 20px; color: #5e7580; }
.empty-state p { margin-bottom: 16px; }

.dashboard-summary {
  background: #fff;
  border: 1px solid #e8dfcf;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 6px 18px rgba(25,31,45,0.06);
}

.dashboard-summary h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: #274055; }
.dashboard-summary a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.dashboard-summary a:hover { text-decoration: underline; }

/* ─── Inline Spinner ─── */

.inline-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.55);
  border-right-color: rgba(255,255,255,0.06);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
}

.inline-spinner.dark {
  border-color: rgba(61,48,24,0.3);
  border-right-color: rgba(61,48,24,0.06);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Panel Grid ─── */

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .panel-grid { grid-template-columns: 1fr; }
}

/* ─── Table Admin ─── */

.table-admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table-admin th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #e5e7eb;
}

.table-admin td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
}

.table-admin tr:hover td {
  background: #f9fafb;
}

/* ─── Operators Page (new layout) ─── */

.operators-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.operators-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.operators-kpi {
  background: #fff;
  border: 1px solid #e0e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.operators-kpi-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5f7084;
  font-weight: 700;
}

.operators-kpi-value {
  font-size: 1.2rem;
  color: #0d4766;
  font-weight: 800;
}

.operators-kpi-content {
  min-width: 0;
}

.operators-kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f1fa;
  color: #1f5f8e;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.operators-kpi-icon.icon-active {
  background: #e7f7ee;
  color: #1b8a48;
}

.operators-kpi-icon.icon-inactive {
  background: #fbecec;
  color: #bf2f2f;
}

.operators-kpi-icon.icon-gtfs {
  background: #fff4db;
  color: #b7771d;
}

.operators-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.operators-filter-item label {
  font-size: 0.68rem;
  color: #516173;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.operators-filter-item select,
.operators-filter-item input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #ccd9e6;
  border-radius: 8px;
  background: #fff;
  min-width: 140px;
  font-size: 0.84rem;
}

.operators-filter-search {
  flex: 1 1 280px;
}

.operators-filter-search input {
  width: 100%;
}

.operators-table-wrap {
  border: 1px solid #d7e0ea;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.operators-table-toolbar {
  background: var(--primary-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  padding: 10px 12px;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.operators-table-toolbar .operators-filter-item label {
  color: #d6e6f4;
}

.operators-table-toolbar .operators-filter-item select,
.operators-table-toolbar .operators-filter-item input {
  border: 1px solid #dbe7f3;
}

.operators-table-toolbar .btn-outline {
  border-color: #9fb7cb;
  color: #eaf2f9;
  background: rgba(255, 255, 255, 0.06);
}

.operators-table-toolbar .btn-outline:hover {
  border-color: #d6e6f4;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.operators-table {
  width: 100%;
  border-collapse: collapse;
}

.operators-table thead tr {
  background: var(--primary-dark);
}

.operators-table thead th {
  background: var(--primary-dark);
  color: #f5f8fb;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 11px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.operators-table thead th:last-child {
  border-right: none;
}

.operators-table tbody tr {
  cursor: pointer;
}

.operators-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  font-size: 0.86rem;
  color: #213447;
}

.operators-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.operators-table tbody tr:hover td {
  background: #eaf3ff;
}

.operators-inline-tag {
  margin-left: 6px;
}

.operators-actions-cell {
  white-space: nowrap;
}

.operators-topbar-actions {
  display: contents;
}

.operator-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 41, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 18px;
}

.operator-dialog {
  width: min(1120px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #f8fbff;
  border: 1px solid;
  border-color: var(--primary-dark) var(--primary-dark) #cfdde9 var(--primary-dark);
  border-radius: 14px;
  box-shadow: 0 22px 55px rgba(10, 37, 58, 0.28);
  padding: 14px;
}

.operator-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  margin: -14px -14px 10px;
  background: var(--primary-dark);
  border-radius: 12px 12px 0 0;
}

.operator-dialog-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #f5f8fb;
  font-weight: 800;
}

.operator-dialog-header p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: #d6e6f4;
}

.operator-dialog-header .btn-icon {
  color: #d9e9f4;
}

.operator-dialog-header .btn-icon:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.operator-dialog-body {
  padding: 2px;
}

.operator-dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.operator-dialog-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.operator-dialog-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.operator-dialog-feed-item {
  padding: 8px 0;
  border-bottom: 1px solid #eef3f8;
  font-size: 0.82rem;
}

.operator-dialog-feed-item .status-tag {
  margin-left: 8px;
}

.operator-dialog-footer {
  position: sticky;
  bottom: 0;
  background: #f8fbff;
  border-top: 1px solid #e1ebf4;
  margin-top: 12px;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.operator-dialog-footer-left,
.operator-dialog-footer-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── Badges ─── */

.badge-type {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f0f5f6;
  color: #3d6973;
  white-space: nowrap;
}

.badge-estado {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-pendente { background: #fef2f2; color: #dc2626; }
.badge-analise  { background: #fffbeb; color: #d97706; }
.badge-corrigido { background: #f0fdf4; color: #16a34a; }
.badge-rejeitado { background: #f3f4f6; color: #6b7280; }

.badge-prior {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-alta  { background: #fef2f2; color: #dc2626; }
.badge-media { background: #fffbeb; color: #d97706; }
.badge-baixa { background: #f0fdf4; color: #16a34a; }

.btn-icon {
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: #f0f5f6;
  color: #00677f;
}

.row-highlight td { background: #f0f8ff !important; }

.panel-stat {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #e0e4e8;
  border-radius: 8px;
  background: #fff;
  color: #4d6269;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-outline:hover {
  border-color: #00677f;
  color: #00677f;
  background: #f0f8fa;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #00677f;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary:hover { background: #005467; }

/* ─── Import Page ─── */

:root {
  --primary: #00677f;
  --primary-hover: #00536a;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #244b97;
  --text-primary: #1a2b30;
  --text-muted: #5e7580;
  --bg-secondary: #f7fafa;
}

.upload-zone {
  border: 2px dashed #d4e4e7;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: #f0f8fa;
}

.upload-zone.uploading {
  cursor: default;
  border-color: var(--primary);
  background: #f0f8fa;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
}

.row-active td { background: #f0fdf4 !important; }
.row-dead td { background: #fef2f2 !important; }

.badge-success { background: #e7f4ea; color: #1d6a39; }
.badge-processing { background: #fff7ed; color: #9a3412; animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.btn-outline-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.import-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.import-stats-grid .stat-card {
  text-align: center;
}

.stat-clean {
  font-size: 0.72rem;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

.import-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 0;
}

.import-tabs button {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.import-tabs button:hover {
  color: var(--primary);
}

.import-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.issue-card {
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.15s;
}

.issue-card:hover { background: var(--bg-secondary); }

.issue-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.issue-type {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4d6269;
}

.issue-message {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.issue-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-danger { color: var(--danger) !important; }

.correction-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
}

.route-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
}

.route-badge-urbano {
  background: #e6efff;
  color: #244b97;
}

.route-badge-municipal {
  background: #e7f4ea;
  color: #1d6a39;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* (legacy menu-group-label removed — replaced by collapsible .menu-group) */

/* ─── Page Intro ─── */

.page-intro {
  margin-bottom: 20px;
}

.page-intro h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.page-intro p {
  font-size: 0.88rem;
  color: #5e7580;
  margin: 0;
}

.page-intro .page-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ─── Status Badges (friendly) ─── */

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-tag i {
  font-size: 0.6rem;
}

.status-tag.tag-active { background: #e7f4ea; color: #1d6a39; }
.status-tag.tag-hidden { background: #fff3cd; color: #856404; }
.status-tag.tag-out-scope { background: #e8edf3; color: #3d4f64; }
.status-tag.tag-inactive { background: #f9e7e7; color: #8a2222; }
.status-tag.tag-override { background: #e6efff; color: #244b97; }

/* ─── Info Cards Grid ─── */

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
  transition: all 0.2s;
}

.info-card:hover {
  border-color: #d4e4e7;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.info-card .ic-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 4px;
}

.info-card .ic-label {
  font-size: 0.82rem;
  color: #5e7580;
  font-weight: 600;
}

.info-card .ic-details {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.info-card.card-link {
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.info-card.card-link:hover {
  border-color: var(--primary-color);
}

/* ─── Summary List ─── */

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

.summary-row:last-child { border-bottom: none; }

.summary-row .sr-label {
  font-size: 0.88rem;
  color: #374151;
}

.summary-row .sr-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1c2a3c;
}

/* ─── Filter Bar ─── */

.filter-bar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.filter-bar .filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-bar .filter-label {
  font-size: 0.68rem;
  color: #6b7280;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── Bulk Actions Bar ─── */

.bulk-bar {
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bulk-bar .bulk-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e40af;
}

/* ─── Export Zone ─── */

.export-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.export-card .export-icon {
  font-size: 2rem;
  color: var(--primary-color);
  min-width: 50px;
  text-align: center;
}

.export-card .export-info h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text-dark);
}

.export-card .export-info p {
  font-size: 0.85rem;
  color: #5e7580;
  margin: 0 0 12px;
}

/* ─── Responsive ─── */

@media (max-width: 1000px) {
  .sidebar { width: 70px; }

  .menu-item span,
  .user-chip span,
  .menu-group-toggle span,
  .mg-arrow,
  .menu-ext-icon { display: none; }

  .menu-group-toggle { justify-content: center; padding: 10px; }
  .menu-group-items .menu-item { padding-left: 0; justify-content: center; }

  .sidebar-logo-wide { width: 38px; height: 38px; }

  .sidebar-title { display: none; }

  .main-content { margin-left: 70px; }

  .page-context { display: none; }

  .info-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .export-card { flex-direction: column; }

  .val-kpi-strip { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
  .val-kpi { padding: 14px 16px; gap: 10px; }
  .val-kpi-icon { width: 36px; height: 36px; font-size: 0.95rem; }
  .val-kpi-value { font-size: 1.3rem; }

  .val-feed-stats { font-size: 0.78rem; padding: 8px 12px; gap: 8px; }
  .val-feed-sep { display: none; }

  .topbar-actions-slot .btn { font-size: 0.75rem; padding: 5px 10px; }
  .topbar-global-search { max-width: none; flex: 1; min-width: 0; }
  .topbar-search-btn { padding: 7px 10px; }
  .operators-kpi-row { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 680px) {
  .topbar-simple {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar-global-search {
    order: 3;
    flex: 1 1 100%;
  }

  .operators-kpi-row {
    grid-template-columns: 1fr;
  }

  .operator-dialog {
    padding: 10px;
    border-radius: 10px;
  }

  .operator-dialog-header {
    margin: -10px -10px 10px;
    border-radius: 10px 10px 0 0;
  }

  .operator-dialog-grid,
  .operator-dialog-cols {
    grid-template-columns: 1fr;
  }
}

/* ─── Tab Bar ─── */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover { color: #334155; }
.tab-btn.active { color: #1e40af; border-bottom-color: #1e40af; }

.tab-count {
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.tab-btn.active .tab-count {
  background: #dbeafe;
  color: #1e40af;
}

/* ─── Validation Groups ─── */

.validation-group {
  border-left: 4px solid #e2e8f0;
  transition: border-color 0.2s;
}
.validation-group.vg-error { border-left-color: #ef4444; }
.validation-group.vg-warning { border-left-color: #f59e0b; }
.validation-group.vg-info { border-left-color: #3b82f6; }
.validation-group.vg-autofix { border-left-color: #8b5cf6; opacity: 0.85; }

.vg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.vg-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.vg-header-right {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.vg-count {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}
.vg-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.status-tag.tag-error { background: #fef2f2; color: #b91c1c; }
.status-tag.tag-warning { background: #fffbeb; color: #92400e; }
.status-tag.tag-info { background: #eff6ff; color: #1e40af; }
.status-tag.tag-autofix { background: #f5f3ff; color: #6d28d9; }

.validation-map-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #64748b;
}
.validation-map-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.validation-map-legend .fa-circle { font-size: 8px; }
.vmap-marker { background: transparent !important; border: none !important; }

.osm-suggestion-row td { border-top: none !important; }
.osm-suggestion { animation: fadeInDown 0.2s ease; }
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.table-compact th, .table-compact td { padding: 6px 10px; }

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #334155;
}
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }

.btn-stop { border-color: #f59e0b; color: #92400e; }
.btn-stop:hover { background: #fffbeb; }
.btn-route { border-color: #3b82f6; color: #1e40af; }
.btn-route:hover { background: #eff6ff; }

.mr-5 { margin-right: 5px; }
.mb-5 { margin-bottom: 5px; }

/* ─── Action Row ─── */

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Summary Grid ─── */

.summary-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-item strong {
  font-size: 20px;
  color: #1e293b;
}

/* ─── Validation KPI Strip ─── */

.val-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.val-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.val-kpi:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.val-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.val-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
}
.val-kpi-label {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.val-kpi.kpi-bad .val-kpi-icon  { background: #fef2f2; color: #dc2626; }
.val-kpi.kpi-bad .val-kpi-value { color: #dc2626; }
.val-kpi.kpi-bad                { border-color: #fecaca; }

.val-kpi.kpi-good .val-kpi-icon  { background: #f0fdf4; color: #16a34a; }
.val-kpi.kpi-good .val-kpi-value { color: #16a34a; }
.val-kpi.kpi-good                { border-color: #bbf7d0; }

.val-kpi.kpi-warn .val-kpi-icon  { background: #fffbeb; color: #d97706; }
.val-kpi.kpi-warn .val-kpi-value { color: #d97706; }
.val-kpi.kpi-warn                { border-color: #fde68a; }

.val-kpi.kpi-neutral .val-kpi-icon  { background: #eff6ff; color: #2563eb; }
.val-kpi.kpi-neutral .val-kpi-value { color: #2563eb; }
.val-kpi.kpi-neutral                { border-color: #bfdbfe; }

.val-kpi.kpi-autofix .val-kpi-icon  { background: #f5f3ff; color: #7c3aed; }
.val-kpi.kpi-autofix .val-kpi-value { color: #7c3aed; }
.val-kpi.kpi-autofix                { border-color: #ddd6fe; }

.val-kpi.kpi-meta .val-kpi-icon  { background: #f8fafc; color: #64748b; }
.val-kpi.kpi-meta .val-kpi-value { color: #334155; }
.val-kpi.kpi-meta                { border-color: #e2e8f0; }

/* ─── Feed Stats Bar ─── */

.val-feed-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.85rem;
  color: #475569;
  flex-wrap: wrap;
}
.val-feed-stats strong {
  color: #1e293b;
  font-weight: 700;
}
.val-feed-sep {
  width: 1px;
  height: 14px;
  background: #cbd5e1;
}

/* ─── Auto-fix Note ─── */

.val-autofix-note {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: #5b21b6;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.val-autofix-note .text-muted { color: #7c3aed; opacity: 0.7; }

/* ─── Export Banner ─── */

.val-export-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 20px;
  color: #166534;
  font-size: 0.9rem;
}
.val-export-banner i { font-size: 1.1rem; }

/* ─── Mobility Module Badges ─── */

.badge-estado {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-estado.badge-analise { background: #fffbeb; color: #d97706; }
.badge-estado.badge-processing { background: #fff7ed; color: #9a3412; animation: pulse 1.5s infinite; }
.badge-estado.badge-ok { background: #e7f4ea; color: #1d6a39; }
.badge-estado.badge-rejeitado { background: #f3f4f6; color: #6b7280; }

.mobility-scope-icons i {
  margin-right: 4px;
  font-size: 0.78rem;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d4e4e7;
  border-radius: 8px;
  font-size: 0.88rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary, #00677f);
  box-shadow: 0 0 0 3px rgba(0,103,127,0.1);
}

.menu-item .fa-border-all { font-size: 0.82rem; }
