:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --dark: #0f172a;
    --muted: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--dark);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--dark);
    color: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 32px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.sidebar-brand strong {
    display: block;
    font-size: 18px;
}

.sidebar-brand span {
    display: block;
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.sidebar-menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 14px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.logout-btn {
    margin-top: 20px;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.app-main {
    flex: 1;
    padding: 28px;
}

.topbar {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
}

.card span {
    color: var(--muted);
    font-size: 14px;
}

.card strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
}

@media (max-width: 800px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .app-main {
        padding: 16px;
    }
}

.btn-primary,
.btn-secondary,
.btn-danger {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-message {
    margin-top: 14px;
    font-size: 14px;
    min-height: 20px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f8fafc;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-muted {
    background: #f1f5f9;
    color: #475569;
}

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
}

.action-btn:hover {
    background: #f8fafc;
}

@media (max-width: 800px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        gap: 14px;
        flex-direction: column;
    }
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, sans-serif;
    background: #f8fafc;
    color: #0f172a;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

#appLayout {
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: #0f172a;
    color: #ffffff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
}

.sidebar-brand strong {
    display: block;
    font-size: 18px;
}

.sidebar-brand span {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    margin-top: 2px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 15px;
    transition: 0.2s;
}

.sidebar-menu a:hover {
    background: #1e293b;
    color: #ffffff;
}

.sidebar-menu a.active {
    background: #2563eb;
    color: #ffffff;
    font-weight: 700;
}

.logout-btn {
    margin-top: 24px;
    width: 100%;
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.logout-btn:hover {
    background: #dc2626;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

.topbar {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 6px 0 0;
    color: #64748b;
}

.card {
    background: #ffffff;
    padding: 22px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.stat-icon {
    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 12px;

    border-radius: 10px;

    background: #eff6ff;
    color: #2563eb;
}

.stat-icon svg {
    width: 21px;
    height: 21px;
    stroke-width: 2;
}

.stat-card strong {
    display: block;
    font-size: 22px;
    line-height: 1.2;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.stat-card p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 12px;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.placa-badge {
    display: inline-block;
    padding: 5px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.06em;
}

.veiculo-modelo {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.veiculo-versao {
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.table-action-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.table-action-btn:hover {
    background: #f1f5f9;
}

.table-action-btn.danger {
    color: #dc2626;
    border-color: #fecaca;
}

.table-action-btn.danger:hover {
    background: #fef2f2;
}


input[readonly] {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}


.data-table td strong {
    font-size: 14px;
    font-weight: 700;
}

.data-table .placa-badge {
    font-size: 12px;
}

.data-table .veiculo-modelo {
    font-size: 13px;
}

.data-table .veiculo-versao {
    font-size: 11px;
}

.dashboard-metric-card h2 {
    font-size: 20px;
}

.dashboard-metric-card strong {
    font-size: 18px;
    line-height: 1.2;
}

.dashboard-metric-card > div > div > div > strong {
    font-size: 16px;
}

.dashboard-metric-card span {
    font-size: 14px;
}

.dashboard-metric-card .veiculo-versao {
    font-size: 12px;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}


.btn-upgrade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;

  background: #16a34a;
  color: #ffffff;

  border: none;
  border-radius: 8px;

  font-size: 14px;
  font-weight: 600;
  text-decoration: none;

  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-upgrade:hover {
  background: #15803d;
  color: #ffffff;
  text-decoration: none;
}

.btn-upgrade:active {
  transform: translateY(1px);
}

.btn-upgrade:visited {
  color: #ffffff;
  text-decoration: none;
}

/* =====================================================
   MODAL DE AJUDA
===================================================== */

.help-modal-overlay {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(15, 23, 42, 0.55);

    z-index: 9999;
}


.help-modal {
    width: 100%;
    max-width: 620px;

    max-height: 85vh;
    overflow: hidden;

    background: #ffffff;

    border-radius: 16px;

    box-shadow:
        0 20px 60px
        rgba(15, 23, 42, 0.20);

    display: flex;
    flex-direction: column;
}


.help-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    padding: 24px;

    border-bottom: 1px solid #e2e8f0;
}


.help-modal-header h2 {
    margin: 4px 0 0;

    font-size: 22px;

    color: #0f172a;
}


.help-modal-label {
    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.08em;

    color: #2563eb;
}


.help-modal-close {
    border: 0;
    background: transparent;

    padding: 0;

    font-size: 28px;
    line-height: 1;

    color: #64748b;

    cursor: pointer;
}


.help-modal-body {
    padding: 24px;

    overflow-y: auto;

    color: #475569;

    font-size: 14px;
    line-height: 1.7;
}


.help-modal-body h3 {
    margin:
        22px 0
        8px;

    color: #0f172a;

    font-size: 15px;
}


.help-modal-body h3:first-child {
    margin-top: 0;
}


.help-modal-body p {
    margin:
        0 0
        12px;
}


.help-modal-body ul {
    margin:
        8px 0
        16px;

    padding-left: 20px;
}


.help-modal-body li {
    margin-bottom: 6px;
}


.help-modal-example {
    margin-top: 16px;

    padding: 14px;

    background: #f8fafc;

    border: 1px solid #e2e8f0;

    border-radius: 10px;
}


.help-modal-footer {
    display: flex;
    justify-content: flex-end;

    padding: 16px 24px;

    border-top: 1px solid #e2e8f0;
}

/* Botão de ajuda */
.btn-help {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 8px 14px;

    background: #16a34a;
    color: #ffffff;

    border: 1px solid #15803d;
    border-radius: 8px;

    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

.btn-help:hover {
    background: #15803d;
    border-color: #166534;
    color: #ffffff;
}

.btn-help:active {
    background: #166534;
    transform: translateY(1px);
}

