/* Estilos do Roteirizador — substitui o CDN do Tailwind no ambiente local */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.hidden { display: none !important; }

.app-logo {
    display: block;
    width: auto;
    max-width: 140px;
    height: auto;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.app-logo-header {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 2px;
    flex-shrink: 0;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #fff;
    color: #333;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 2rem 2.25rem 2.25rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.login-app-name {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1e3a5f;
    letter-spacing: 0.01em;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-field {
    margin-bottom: 1rem;
}

.login-field:last-of-type {
    margin-bottom: 1.25rem;
}

.login-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    color: #333;
    margin-bottom: 0.35rem;
}

.login-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font: inherit;
    font-size: 0.9375rem;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 0;
    border-color: #007bff;
}

.login-error {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.login-btn {
    width: 100%;
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.login-btn:hover:not(:disabled) {
    background: #0069d9;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.h-screen { height: 100vh; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.sticky { position: sticky; top: 0; }
.inline-block { display: inline-block; }
.block { display: block; }

/* Flexbox */
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }

/* Espaçamento */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pb-20 { padding-bottom: 5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* Largura */
.w-80 { width: 20rem; }
.w-full { width: 100%; }

/* Tipografia */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }

/* Cores de texto */
.text-white { color: #fff; }
.text-slate-800 { color: #1e293b; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-red-500 { color: #ef4444; }
.text-blue-200 { color: #bfdbfe; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }
.text-green-800 { color: #166534; }
.text-yellow-800 { color: #854d0e; }

/* Fundos */
.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-700 { background-color: #1d4ed8; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-600 { background-color: #16a34a; }
.bg-yellow-100 { background-color: #fef9c3; }

/* Bordas */
.border { border: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }
.border-r { border-right: 1px solid #e5e7eb; }
.border-none { border: none; }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-100 { border-color: #dbeafe; }
.border-blue-500 { border-color: #3b82f6; }
.border-l-4 { border-left-width: 4px; border-left-style: solid; }

/* Cantos e sombra */
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* Z-index */
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }

/* Formulários */
select, button {
    font: inherit;
}

select:focus, button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.focus\:ring-0:focus { outline: none; box-shadow: none; }
.focus\:outline-none:focus { outline: none; }

/* Botões e links */
button, a {
    cursor: pointer;
}

a { text-decoration: none; }

.hover\:underline:hover { text-decoration: underline; }
.hover\:text-white:hover { color: #fff; }
.hover\:bg-blue-200:hover { background-color: #bfdbfe; }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.hover\:bg-green-700:hover { background-color: #15803d; }

.transition { transition: color 0.15s, background-color 0.15s; }
.transition-colors { transition: background-color 0.15s, color 0.15s; }

button:disabled, .disabled\:opacity-50:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mapa */
/* Mapa — altura controlada pelo shell em páginas com mapa */
.shell-map-area #route-map,
.shell-map-area #fleet-map {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    z-index: 10;
}

#route-map, #fleet-map { z-index: 10; }
.leaflet-draw { z-index: 1000 !important; }

/* Localizar endereço — controle do mapa de rotas */
.route-locate-control {
    clear: both;
    margin-top: 10px !important;
    position: relative;
}

.route-locate-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid #ccc;
    cursor: pointer;
}

.route-locate-btn:hover,
.route-locate-btn-active {
    background: #f4f4f4;
}

.route-locate-icon {
    display: block;
    width: 18px;
    height: 18px;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
}

.route-locate-panel {
    position: absolute;
    top: 0;
    left: 36px;
    width: min(280px, calc(100vw - 5rem));
    padding: 0.65rem 0.75rem;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
    z-index: 1001;
}

.route-locate-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.4rem;
}

.route-locate-row {
    display: flex;
    gap: 0.35rem;
}

.route-locate-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    outline: none;
}

.route-locate-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.route-locate-search {
    flex-shrink: 0;
    border: none;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
}

.route-locate-search:hover:not(:disabled) {
    background: #1d4ed8;
}

.route-locate-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.route-locate-msg {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: #6b7280;
}

.route-locate-msg-error {
    color: #dc2626;
}

.locate-marker-pin {
    width: 22px;
    height: 22px;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237c3aed' stroke='%23fff' stroke-width='1.5'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z'/%3E%3Ccircle cx='12' cy='9' r='2.5' fill='%23fff'/%3E%3C/svg%3E");
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

/* Portal tenant */
.tenant-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: #1e3a8a;
    color: #fff;
    flex-wrap: wrap;
}
.tenant-nav-brand { display: flex; flex-direction: column; }
.tenant-nav-logo { font-weight: 700; font-size: 1.1rem; }
.tenant-nav-org { font-size: 0.75rem; opacity: 0.85; }
.tenant-nav-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.tenant-nav-link {
    color: #bfdbfe;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    text-decoration: none;
}
.tenant-nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.tenant-nav-link-active { background: #2563eb; color: #fff; font-weight: 600; }
.tenant-nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; }
.tenant-nav-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}
.tenant-nav-logout:hover { background: rgba(255,255,255,0.15); }

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.portal-grid-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.portal-stat-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.portal-stat-label { font-size: 0.75rem; color: #6b7280; margin: 0; }
.portal-stat-value { font-size: 1.75rem; font-weight: 700; color: #1d4ed8; margin: 0.25rem 0 0; }
.portal-card {
    display: block;
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.portal-card:hover { box-shadow: 0 4px 12px rgb(0 0 0 / 0.1); border-color: #93c5fd; }
.portal-card-cta { display: inline-block; margin-top: 1rem; font-size: 0.875rem; color: #2563eb; font-weight: 600; }
.fleet-driver-card { cursor: pointer; transition: border-color 0.15s; }
.w-full { width: 100%; }
.text-left { text-align: left; }
.max-w-5xl { max-width: 64rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.min-h-screen { min-height: 100vh; }
.w-96 { width: 24rem; }
.overflow-y-auto { overflow-y: auto; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; }
.max-h-64 { max-height: 16rem; }

/* Painel admin da plataforma */
.text-indigo-700 { color: #4338ca; }
.text-green-700 { color: #15803d; }
.max-w-6xl { max-width: 72rem; }
.gap-2 { gap: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.admin-stat { color: #4338ca !important; }

.admin-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: linear-gradient(135deg, #312e81, #4338ca);
    color: #fff;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}
.admin-nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.admin-nav-logo { font-weight: 700; font-size: 1.125rem; }
.admin-nav-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}
.admin-nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; }

.admin-panel {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
    padding: 1.25rem;
}
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-search-input {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: 220px;
}
.admin-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgb(99 102 241 / 0.2);
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.admin-table th,
.admin-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.admin-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    background: #f9fafb;
}
.admin-table-compact td,
.admin-table-compact th { padding: 0.45rem 0.5rem; }
.admin-empty {
    text-align: center;
    color: #9ca3af;
    padding: 2rem !important;
}
.admin-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}
.admin-badge-active { background: #dcfce7; color: #166534; }
.admin-badge-suspended { background: #fee2e2; color: #991b1b; }

.admin-btn {
    background: #4338ca;
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}
.admin-btn:hover { background: #3730a3; }
.admin-btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.admin-btn-danger { background: #dc2626; }
.admin-btn-danger:hover { background: #b91c1c; }
.admin-btn-success { background: #16a34a; }
.admin-btn-success:hover { background: #15803d; }
.admin-btn-muted { background: #e5e7eb; color: #374151; }
.admin-btn-muted:hover { background: #d1d5db; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.admin-skill-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #f9fafb;
    cursor: pointer;
}
.admin-skill-chip input { margin: 0; }

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.45);
}
.admin-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.2);
}
.admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}
.admin-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}
.admin-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}
.admin-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-modal-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin: 0 0 0.25rem;
}
.admin-modal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.75rem 1rem;
    background: #f5f3ff;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.admin-modal-actions { margin-top: 0.5rem; }
