/* ===== APP SHELL ===== */
/* Source-of-truth: linear-layout.html */

/* ===== LAYOUT ===== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  min-width: 0;
  overflow-x: hidden;
  transition: padding .25s ease, background-color .25s, border-color .25s;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 8px;
  min-height: 64px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: padding .25s ease, background .15s, color .15s;
  min-width: 0;
  overflow: hidden;
}
.brand:hover { background: var(--surface-2); color: var(--text); }
.brand:focus-visible {
  outline: none;
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.brand-logo { display: none; }
.brand-logo-full { height: 44px; width: auto; max-width: 100%; }
.brand-logo-icon { height: 28px; width: 28px; }

[data-theme="dark"] .brand-logo-dark { display: block; }
[data-theme="light"] .brand-logo-light { display: block; }

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  min-height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
  transition: padding .25s ease, background .15s, border-color .15s;
}
.user-card:hover { border-color: var(--border-strong); }
.user-card .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  font-weight: 600;
  font-size: 11.5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-card .user-meta { min-width: 0; flex: 1; }
.user-card .user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.user-card .user-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}

.nav { flex: 1; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 1px; min-width: 0; overflow-x: hidden; overflow-y: auto; }
.nav-section { padding: 10px 6px 4px; font-size: 10.5px; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.nav-section:first-child { padding-top: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  transition: background .12s ease, color .12s ease, padding .25s ease;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text);
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.nav-item.active .badge { background: var(--accent); color: #fff; }
.nav-item.has-children::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--dim);
  border-bottom: 1.5px solid var(--dim);
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform .15s;
}
.nav-item.has-children.open::after { transform: rotate(-135deg); }

.nav-sub { padding: 2px 0 4px 26px; display: flex; flex-direction: column; gap: 1px; }
.nav-sub .nav-item { padding: 5px 10px; font-size: 12.5px; }

.sidebar-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  transition: padding .25s ease, background .15s ease, color .15s ease;
  width: 100%;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle .toggle-track {
  margin-left: auto;
  width: 30px; height: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: background .2s;
}
.theme-toggle .toggle-track::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 12px; height: 12px;
  background: var(--text);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
[data-theme="light"] .theme-toggle .toggle-track::after { transform: translateX(14px); background: var(--accent); }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ===== MAIN ===== */
.main { min-width: 0; overflow-x: hidden; }

.topbar {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb .sep { color: var(--dim); }
.breadcrumb .cur { color: var(--text); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

.content { padding: 28px 32px 80px; width: 100%; }

/* ===== PAGE HEAD ===== */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; color: var(--text); }
.page-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 7px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  transition: opacity .15s;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover { opacity: .85; color: var(--bg); }
.btn-ghost {
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  transition: all .15s;
  background: var(--surface);
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost.is-disabled { opacity: .5; pointer-events: none; }

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  position: relative;
  text-align: left;
  text-decoration: none;
  color: inherit;
  display: block;
}
.stat:last-child { border-right: none; }
.stat:hover { background: var(--surface-2); }
.stat.active { background: var(--surface-2); }
.stat.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}
.stat-row { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 400; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  flex-wrap: wrap;
}
.toolbar-fields {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}
.toolbar-actions {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.toolbar .search-inline {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
  min-width: 0;
}
.toolbar .search-inline:hover { border-color: var(--border-strong); }
.toolbar .search-inline:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.toolbar .search-inline--placa { width: 220px; }
.toolbar .search-inline--md { width: 220px; }
.toolbar .search-inline--date { width: 170px; cursor: pointer; }
.toolbar .search-inline svg { color: var(--dim); flex-shrink: 0; }
.toolbar input[type="text"],
.toolbar input[type="date"] {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
  font-family: inherit;
  line-height: 1;
}
.toolbar input[type="date"] { color-scheme: dark; }
[data-theme="light"] .toolbar input[type="date"] { color-scheme: light; }
.toolbar input::placeholder { color: var(--dim); }
.toolbar .filter-chip,
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.toolbar .filter-chip:hover,
.filter-chip:hover { background: var(--surface-2); }
.toolbar .filter-chip svg,
.filter-chip svg { width: 12px; height: 12px; color: var(--muted); }
.toolbar .filter-chip .v-count,
.filter-chip .v-count {
  color: var(--bg);
  background: var(--accent);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.toolbar .filter-chip--primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 500;
}
.toolbar .filter-chip--primary:hover { opacity: .88; background: var(--text); color: var(--bg); }
.toolbar .filter-chip--primary svg { color: var(--bg); }
.toolbar .clear {
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  padding: 0 4px;
}
.toolbar .clear:hover { color: var(--text); }

/* ===== TABLE ===== */
table.t { font-size: 13px; font-variant-numeric: tabular-nums; width: 100%; border-collapse: collapse; }
table.t thead th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}
table.t thead th a { color: inherit; text-decoration: none; }
table.t thead th a:hover { color: var(--text); }
table.t tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.4;
  vertical-align: middle;
}
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover td { background: var(--surface); }

.placa { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.02em; }
.id, .id-cell { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.resp-link { color: var(--text); text-decoration: none; }
.resp-link:hover { text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.filial-text { color: var(--muted); }
.tel-text { color: var(--text); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.tel-text .wa { color: var(--green); opacity: .65; transition: opacity .15s; display: inline-flex; }
.tel-text:hover .wa { opacity: 1; }
.tel-text .wa svg { width: 13px; height: 13px; }
.data-text { color: var(--muted); }

.status-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: 12.5px; white-space: nowrap; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions > .row-action-btn,
.row-actions > button,
.row-actions > a,
.row-actions > .row-action-form > button {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: all .12s;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.row-actions > .row-action-btn:hover,
.row-actions > button:hover,
.row-actions > a:hover,
.row-actions > .row-action-form > button:hover { background: var(--surface-2); color: var(--text); }
.row-actions .row-action-edit:hover { color: var(--accent); background: var(--accent-soft); }
.row-actions .row-action-attach:hover { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.row-actions .row-action-danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.row-actions > .row-action-btn > svg,
.row-actions > a > svg,
.row-actions > .row-action-form > button > svg { width: 14px; height: 14px; }
.row-action-form { display: inline; margin: 0; }

.table-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
.pag { display: flex; gap: 6px; align-items: center; }
.pag-btn {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.pag-btn:hover { background: var(--surface-2); }
.pag-btn.disabled { opacity: .4; cursor: not-allowed; }

/* Laravel paginator default styles override */
.pagination, nav[role="navigation"] ul.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
nav[role="navigation"] svg { width: 14px; height: 14px; }
nav[role="navigation"] a, nav[role="navigation"] span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface);
  font-size: 12.5px;
  text-decoration: none;
  transition: all .15s;
}
nav[role="navigation"] a:hover { background: var(--surface-2); }
nav[role="navigation"] [aria-current="page"] span { background: var(--text); color: var(--bg); border-color: var(--text); }
nav[role="navigation"] [aria-disabled="true"] span { opacity: .4; }

/* Logout button in sidebar */
.logout-form { margin: 0; padding: 0; }
.logout-btn { width: 100%; text-align: left; background: none; border: none; font-family: inherit; }

/* ===== BOOTSTRAP COMPAT (durante migração) ===== */
/* Override Bootstrap text/bg utilities pra ficar legível no tema escuro */
.text-muted { color: var(--muted) !important; }
.text-secondary { color: var(--muted) !important; }
.text-primary { color: var(--accent) !important; }
.text-danger { color: var(--red) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--amber) !important; }
.text-info { color: var(--accent) !important; }
.text-dark { color: var(--text) !important; }
.text-light { color: var(--text) !important; }
.text-white { color: var(--text-strong) !important; }
.text-body { color: var(--text) !important; }

/* Background utilities */
.bg-light { background-color: var(--surface-2) !important; color: var(--text); }
.bg-white { background-color: var(--surface) !important; color: var(--text); }
.bg-dark { background-color: var(--bg) !important; color: var(--text); }
.bg-body { background-color: var(--bg) !important; }
.bg-primary { background-color: var(--accent) !important; color: var(--bg); }
.bg-secondary { background-color: var(--surface-3) !important; color: var(--text); }
.bg-success { background-color: color-mix(in srgb, var(--green) 18%, transparent) !important; color: var(--green); }
.bg-danger { background-color: color-mix(in srgb, var(--red) 18%, transparent) !important; color: var(--red); }
.bg-warning { background-color: color-mix(in srgb, var(--amber) 18%, transparent) !important; color: var(--amber); }
.bg-info { background-color: color-mix(in srgb, var(--accent) 18%, transparent) !important; color: var(--accent); }

/* Borders */
.border, .border-top, .border-bottom, .border-start, .border-end, .border-left, .border-right { border-color: var(--border) !important; }

/* Card */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  box-shadow: none;
}
.card-header, .card-footer {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text);
}
.card-title { color: var(--text); }
.card-body { color: var(--text); }

/* Form controls Bootstrap */
.form-control, .form-select {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  background-color: var(--surface);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder { color: var(--dim); }
.form-control-sm { font-size: 12.5px; padding: 5px 10px; }
.form-label { color: var(--muted); font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.form-check-input {
  background-color: var(--surface);
  border-color: var(--border-strong);
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-label { color: var(--text); }
.input-group-text {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}

/* Bootstrap buttons override pra harmonizar */
.btn {
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}
.btn-outline-primary {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-outline-secondary {
  border-color: var(--border-strong);
  color: var(--text);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline-danger {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
.btn-outline-danger:hover {
  background: var(--red);
  color: var(--bg);
}
.btn-link { color: var(--accent); text-decoration: none; }
.btn-link:hover { color: var(--accent); text-decoration: underline; }
.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }

/* Badges Bootstrap */
.badge {
  font-weight: 500;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge.bg-primary { background-color: var(--accent) !important; color: var(--bg); }
.badge.bg-secondary { background-color: var(--surface-3) !important; color: var(--text); }
.badge.bg-success { background-color: color-mix(in srgb, var(--green) 22%, transparent) !important; color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 40%, transparent); }
.badge.bg-danger { background-color: color-mix(in srgb, var(--red) 22%, transparent) !important; color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); }
.badge.bg-warning { background-color: color-mix(in srgb, var(--amber) 22%, transparent) !important; color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); }
.badge.bg-info { background-color: color-mix(in srgb, var(--accent) 22%, transparent) !important; color: var(--accent); }

/* Bootstrap Modal — restyle */
.modal-content {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.modal-footer {
  border-top: 1px solid var(--border);
  background: transparent;
}
.modal-title { color: var(--text); font-weight: 600; font-size: 15px; }
.btn-close { filter: invert(0.7); }
[data-theme="light"] .btn-close { filter: none; }

/* Alerts Bootstrap */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid;
  padding: 10px 14px;
  font-size: 13px;
}
.alert-success {
  background-color: color-mix(in srgb, var(--green) 12%, transparent);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
  color: var(--green);
}
.alert-danger {
  background-color: color-mix(in srgb, var(--red) 12%, transparent);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red);
}
.alert-warning {
  background-color: color-mix(in srgb, var(--amber) 12%, transparent);
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
  color: var(--amber);
}
.alert-info {
  background-color: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}

/* Dropdowns Bootstrap */
.dropdown-menu {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  border-radius: var(--radius-md);
}
.dropdown-item { color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--surface-2);
  color: var(--text);
}
.dropdown-divider { border-color: var(--border); }

/* Pagination Bootstrap */
.page-link {
  background-color: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.page-link:hover {
  background-color: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.page-item.active .page-link {
  background-color: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.page-item.disabled .page-link {
  background-color: var(--surface);
  color: var(--dim);
  border-color: var(--border);
}

/* HR */
hr { border-color: var(--border); opacity: 1; }

/* Spinner */
.spinner-border { color: var(--accent); }

/* Form muted small text inside modals */
.modal small.text-muted { color: var(--muted) !important; }

/* ===== SIDEBAR COLLAPSED STATE ===== */
.app:has(.sidebar.collapsed) { grid-template-columns: 64px 1fr; }

.sidebar.collapsed {
  padding: 14px 8px;
}
.sidebar.collapsed .sidebar-header {
  padding: 4px 0 14px;
}
.sidebar.collapsed .brand {
  justify-content: center;
  padding: 4px;
}
.sidebar.collapsed .brand-logo-full { display: none; }
.sidebar.collapsed .brand-logo-icon { display: block; }

.sidebar.collapsed .user-card {
  padding: 4px 10px;
  background: transparent;
  border-color: transparent;
}
.sidebar.collapsed .user-card .user-meta { display: none; }

.sidebar.collapsed .nav-section { visibility: hidden; pointer-events: none; }
.sidebar.collapsed .nav-item {
  padding: 6px 16px;
}
.sidebar.collapsed .nav-item > span,
.sidebar.collapsed .nav-item .badge { display: none; }

.sidebar.collapsed .theme-toggle {
  padding: 6px 16px;
}
.sidebar.collapsed .theme-toggle .theme-label,
.sidebar.collapsed .theme-toggle .toggle-track { display: none; }

.sidebar.collapsed .logout-btn {
  padding: 6px 16px;
}
.sidebar.collapsed .logout-btn > span,
.sidebar.collapsed .logout-form span { display: none; }

/* ===== MOBILE TOGGLE / BACKDROP (default hidden) ===== */
.mobile-menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  /* === App layout: single column === */
  .app { grid-template-columns: 1fr; transition: none; }
  .app:has(.sidebar.collapsed) { grid-template-columns: 1fr; }

  /* === Sidebar as overlay drawer === */
  .sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  /* Force expanded layout on mobile: collapsed state ignored in drawer */
  .sidebar.collapsed { padding: 14px 12px; }
  .sidebar.collapsed .brand-logo-icon { display: none; }
  [data-theme="dark"] .sidebar.collapsed .brand-logo-dark { display: block; }
  [data-theme="light"] .sidebar.collapsed .brand-logo-light { display: block; }
  [data-theme="dark"] .sidebar.collapsed .brand-logo-light { display: none; }
  [data-theme="light"] .sidebar.collapsed .brand-logo-dark { display: none; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 6px 10px; }
  .sidebar.collapsed .nav-item > span,
  .sidebar.collapsed .nav-item .badge { display: inline; }
  .sidebar.collapsed .user-card { padding: 6px 8px; background: var(--surface-2); border-color: var(--border); }
  .sidebar.collapsed .user-card .user-meta { display: block; }
  .sidebar.collapsed .nav-section { visibility: visible; }
  .sidebar.collapsed .theme-toggle,
  .sidebar.collapsed .logout-btn { justify-content: flex-start; padding: 6px 10px; }
  .sidebar.collapsed .theme-toggle .theme-label,
  .sidebar.collapsed .theme-toggle .toggle-track,
  .sidebar.collapsed .logout-btn > span,
  .sidebar.collapsed .logout-form span { display: inline; }

  /* === Backdrop === */
  body.sidebar-overlay-active .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1000;
  }
  body.sidebar-overlay-active { overflow: hidden; }

  /* === Hamburger button === */
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    flex-shrink: 0;
  }

  /* === Topbar === */
  .topbar { padding: 0 12px; gap: 6px; height: 48px; }
  .topbar-right .icon-btn { width: 32px; height: 32px; }
  .breadcrumb { font-size: 12.5px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .breadcrumb > span { overflow: hidden; text-overflow: ellipsis; }

  /* === Content === */
  .content { padding: 16px 12px 60px; }

  /* === Page head: stack === */
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .page-title { font-size: 18px; }
  .head-actions { width: 100%; flex-wrap: wrap; }
  .head-actions .btn-primary,
  .head-actions .btn-ghost { flex: 1 1 auto; justify-content: center; min-width: 0; }

  /* === Stats row: 2 cols === */
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stats-row .stat { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .stats-row .stat:nth-child(2n) { border-right: none; }
  .stats-row .stat:nth-last-child(-n+2) { border-bottom: none; }
  .stat-value { font-size: 20px; }

  /* === Toolbar: stack === */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
  .toolbar > *,
  .toolbar .search-inline,
  .toolbar .filter-chip { width: 100%; max-width: none; min-width: 0; }
  .toolbar .clear { margin-left: 0; text-align: right; }

  /* === Table: horizontal scroll wrapper === */
  table.t {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table.t thead, table.t tbody, table.t tr { display: table; width: 100%; }
  table.t thead th, table.t tbody td {
    padding: 10px 10px;
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Vistorias list — fixed columns to prevent shift between rows */
  table.t.vistorias-list-t thead, table.t.vistorias-list-t tbody, table.t.vistorias-list-t tr {
    table-layout: fixed;
    min-width: 820px;
  }
  table.t.vistorias-list-t thead th:nth-child(1), table.t.vistorias-list-t tbody td:nth-child(1) { width: 50px; }
  table.t.vistorias-list-t thead th:nth-child(2), table.t.vistorias-list-t tbody td:nth-child(2) { width: 90px; }
  table.t.vistorias-list-t thead th:nth-child(3), table.t.vistorias-list-t tbody td:nth-child(3) { width: 150px; }
  table.t.vistorias-list-t thead th:nth-child(4), table.t.vistorias-list-t tbody td:nth-child(4) { width: 110px; }
  table.t.vistorias-list-t thead th:nth-child(5), table.t.vistorias-list-t tbody td:nth-child(5) { width: 140px; }
  table.t.vistorias-list-t thead th:nth-child(6), table.t.vistorias-list-t tbody td:nth-child(6) { width: 100px; }
  table.t.vistorias-list-t thead th:nth-child(7), table.t.vistorias-list-t tbody td:nth-child(7) { width: 100px; }
  table.t.vistorias-list-t thead th:nth-child(8), table.t.vistorias-list-t tbody td:nth-child(8) { width: 110px; }

  /* === Table footer / pagination === */
  .table-footer { flex-direction: column; align-items: stretch; gap: 8px; }
  .pag { justify-content: center; flex-wrap: wrap; }

  /* === Modal: full screen === */
  .modal-linear .modal-dialog { margin: 0; max-width: 100%; height: 100vh; }
  .modal-linear .modal-content-linear { height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
  .modal-linear .modal-header-linear { padding: 12px 14px; }
  .modal-linear .modal-body-linear { padding: 14px; }
  .modal-linear .modal-footer-linear { padding: 12px 14px; }
  .modal-linear .modal-title-linear { font-size: 14px; }

  /* === Form rows stack === */
  .modal-body-linear .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }

  /* === Vistoria info grid 1 col === */
  .vistoria-info-grid { grid-template-columns: 1fr !important; }

  /* === Cargas table inside modal: smaller === */
  .cargas-table th, .cargas-table td { padding: 6px 8px; font-size: 11.5px; }

  /* === Anexo actions === */
  .anexo-actions { flex-direction: column; align-items: stretch; gap: 6px; }
  .anexo-actions > * { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-right .icon-btn { width: 30px; height: 30px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 18px; }
}
