/* ============================================================
   Variables
   ============================================================ */
:root {
    --sidebar-w: 250px;
    --topbar-h: 56px;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #a1a1aa;
    --sidebar-active-bg: #2d2d2d;
    --sidebar-active-text: #fafafa;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --surface: #f8fafc;

    /* Bootstrap primary override */
    --bs-primary: #0ea5e9;
    --bs-primary-rgb: 14, 165, 233;
    --bs-link-color: #0ea5e9;
    --bs-link-hover-color: #0284c7;
    --bs-focus-ring-color: rgba(14, 165, 233, 0.25);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--surface);
    color: #1e293b;
    overflow-x: hidden;
}

/* ============================================================
   Login
   ============================================================ */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 0.75rem;
}
.login-logo-img {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}
.login-app-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.01em;
    margin: 0 0 1.75rem;
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: #94a3b8;
    gap: .75rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

#google-btn-container { display: flex; justify-content: center; }

/* ============================================================
   Sidebar
   ============================================================ */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-bottom: 1px solid #2d2d2d;
}
.sidebar-logo-img {
    height: 56px;
    width: auto;
    display: block;
    opacity: .92;
}

.sidebar-user {
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid #2d2d2d;
    background: #111111;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem;
    flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-info > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; color: #e2e8f0; }
.user-info .small { color: var(--sidebar-text); font-size: .75rem; }

.sidebar-nav {
    list-style: none;
    margin: .5rem 0;
    padding: 0;
    flex: 1;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: .4rem;
    margin: .1rem .5rem;
    font-size: .9rem;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.sidebar-nav .nav-link.active { background: var(--accent); color: white; }
.sidebar-nav .nav-link i { font-size: 1rem; width: 1.1rem; flex-shrink: 0; }
.nav-section {
    padding: .75rem 1rem .25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #475569;
}

.sidebar-footer {
    padding: .75rem 1rem;
    border-top: 1px solid #2d2d2d;
}
.btn-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .5rem .75rem;
    background: none;
    border: 1px solid #2d2d2d;
    border-radius: .4rem;
    color: var(--sidebar-text);
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-logout:hover { background: #ef4444; border-color: #ef4444; color: white; }

/* ============================================================
   Main wrapper
   ============================================================ */
#main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

#topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    z-index: 100;
}
#topbar h2 { margin: 0; font-size: 1.1rem; font-weight: 600; color: #1e293b; flex: 1; min-width: 0; }

.btn-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #475569;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.content-area { padding: 1.5rem; flex: 1; }

/* ============================================================
   Overlay sidebar mobile
   ============================================================ */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1050;
}

/* ============================================================
   Tables
   ============================================================ */
.table-container { background: white; border-radius: .75rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow: hidden; }
.table-toolbar { padding: 1rem 1.25rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; border-bottom: 1px solid #f1f5f9; }
.table-toolbar h3 { margin: 0; font-size: 1rem; font-weight: 600; flex: 1; }
.search-box { position: relative; }
.search-box i { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-box input { padding-left: 2rem; }

.table { margin: 0; }
.table thead th { background: #f8fafc; font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table td { vertical-align: middle; font-size: .9rem; }

.thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: .3rem;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}
.no-img { width: 40px; height: 40px; background: #f1f5f9; border-radius: .3rem; display: inline-flex; align-items: center; justify-content: center; color: #cbd5e1; }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { padding: .25rem .5rem; font-size: .8rem; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination-bar { padding: .75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: #64748b; border-top: 1px solid #f1f5f9; gap: .5rem; flex-wrap: wrap; }
.page-btns { display: flex; gap: .25rem; }
.page-btns button { padding: .3rem .65rem; border: 1px solid #e2e8f0; background: white; border-radius: .3rem; cursor: pointer; font-size: .82rem; }
.page-btns button.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btns button:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   Forms
   ============================================================ */
.form-card { background: white; border-radius: .75rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 1.5rem; max-width: 700px; }
.form-card h3 { margin: 0 0 1.5rem; font-size: 1rem; font-weight: 600; padding-bottom: .75rem; border-bottom: 1px solid #f1f5f9; }

.image-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: .5rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s;
    color: #94a3b8;
}
.image-upload-area:hover { border-color: var(--accent); color: var(--accent); }
.image-preview { max-height: 200px; border-radius: .4rem; }
.image-upload-area input[type=file] { display: none; }

/* ============================================================
   Autocomplete
   ============================================================ */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 .4rem .4rem;
    z-index: 500;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-item {
    padding: .5rem .75rem;
    cursor: pointer;
    font-size: .88rem;
    border-bottom: 1px solid #f1f5f9;
}
.autocomplete-item:hover { background: #f0f9ff; }
.autocomplete-item .ac-main { font-weight: 600; }
.autocomplete-item .ac-sub { color: #64748b; font-size: .8rem; }

/* ============================================================
   Toast
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 320px;
}
.toast-item {
    padding: .75rem 1rem;
    border-radius: .5rem;
    color: white;
    font-size: .88rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    gap: .5rem;
    animation: slideIn .25s ease;
}
.toast-item.success { background: #22c55e; }
.toast-item.error   { background: #ef4444; }
.toast-item.info    { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state { text-align: center; padding: 3rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; }
.empty-state p { margin: 0; font-size: .95rem; }

/* ============================================================
   Loading
   ============================================================ */
.loading-state { text-align: center; padding: 3rem; color: #94a3b8; }

/* ============================================================
   Calendario de Turnos
   ============================================================ */
.cal-container {
    background: white;
    border-radius: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}

.cal-header {
    padding: .85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}
.cal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    min-width: 170px;
    text-align: center;
}
.cal-nav-btn {
    padding: .3rem .6rem;
    border-radius: .35rem;
}
.cal-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Grid días */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-dow {
    padding: .5rem .4rem;
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}
.cal-day {
    min-height: 110px;
    padding: .3rem .3rem .4rem;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    overflow: hidden;
}
.cal-day:nth-child(7n + 8) { border-right: none; } /* Dom: sin borde derecho */
.cal-day.other-month { background: #fafafa; }
.cal-day.today-cell  { background: #f0f9ff; }

.cal-day-num {
    font-size: .8rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.6rem;
    width: 1.6rem;
    text-align: center;
    border-radius: 50%;
    margin-bottom: .2rem;
}
.cal-day-num.today-num {
    background: var(--accent);
    color: white;
}
.cal-day.other-month .cal-day-num { color: #cbd5e1; }

/* Bloque turno */
.cal-turno {
    padding: .2rem .35rem;
    margin-bottom: .2rem;
    border-radius: .25rem;
    font-size: .72rem;
    line-height: 1.3;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    overflow: hidden;
    display: flex;
    align-items: baseline;
    gap: .25rem;
    flex-wrap: wrap;
}
.cal-turno:hover { opacity: .8; transform: scale(1.01); }

.cal-hora    { font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.cal-cliente { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cal-tags    { font-size: .65rem; font-weight: 700; opacity: .7; white-space: nowrap; }
.cal-est-icon { font-size: .7rem; flex-shrink: 0; }

/* Colores pastel por dificultad — Baja=Media (verde), Alta=Muy Alta (rojo) */
.dif-baja, .dif-media    { background: #dcfce7; color: #16a34a; border-left: 3px solid #86efac; }
.dif-alta, .dif-muy-alta { background: #fee2e2; color: #dc2626; border-left: 3px solid #fca5a5; }

/* Estado visual sobre el bloque — sobreescriben color de dificultad */
.cal-turno.est-cancelado,
.cal-tb.est-cancelado {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    border-left-color: #9ca3af !important;
    opacity: 1;
    text-decoration: line-through;
}
.cal-turno.est-en-trabajo,
.cal-tb.est-en-trabajo {
    background: #fef9c3 !important;
    color: #854d0e !important;
    border-left-color: #eab308 !important;
    opacity: 1;
}
.cal-turno.est-finalizado,
.cal-tb.est-finalizado {
    background: #ffd6e7 !important;
    color: #111111 !important;
    border-left-color: #f472b6 !important;
    opacity: 1;
}
.cal-turno.est-facturado,
.cal-tb.est-facturado {
    background: #cffafe !important;
    color: #0e7490 !important;
    border-left-color: #22d3ee !important;
    opacity: 1;
}
.cal-turno.est-ausente,
.cal-tb.est-ausente {
    opacity: .55;
    font-style: italic;
}

/* Leyenda */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    padding: .65rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    font-size: .78rem;
    color: #64748b;
}
.legend-item { display: flex; align-items: center; gap: .35rem; }
.legend-dot {
    width: 14px; height: 10px;
    border-radius: 2px;
    display: inline-block;
}

/* Badge de dificultad en lista */
.dif-badge {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 1rem;
    font-size: .78rem;
    font-weight: 600;
}

/* Servicios en lista */
.tag-servicio {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    line-height: 1.5rem;
    text-align: center;
    border-radius: .25rem;
    background: #f1f5f9;
    color: #475569;
    font-size: .72rem;
    font-weight: 700;
    margin-right: .15rem;
}
.fecha-cell { font-family: monospace; font-size: .85rem; }

/* ── Día en el número del mes: clic para ir a vista día ── */
.cal-day-num { cursor: pointer; }
.cal-day-num:hover { background: #e0f2fe; }

/* ============================================================
   Time-grid (vistas Semana y Día)
   ============================================================ */
.cal-tg-wrap { overflow: hidden; }

.cal-tg-head {
    display: flex;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}
.cal-tg-spacer {
    width: 52px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
}
.cal-tg-dh {
    flex: 1;
    text-align: center;
    padding: .45rem .2rem .35rem;
    border-right: 1px solid #f1f5f9;
    min-width: 0;
}
.cal-tg-dh-single { flex: 1; }
.cal-tg-today-hdr { background: #f0f9ff; }
.cal-tg-dow {
    display: block;
    font-size: .67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}
.cal-tg-dnum {
    display: inline-block;
    width: 1.8rem;
    height: 1.8rem;
    line-height: 1.8rem;
    border-radius: 50%;
    font-size: .9rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    margin-top: .15rem;
}
.cal-tg-dnum:hover { background: #e0f2fe; }
.cal-tg-dnum.today-num { background: var(--accent); color: white; }

.cal-tg-scroll {
    display: flex;
    overflow-y: auto;
    max-height: 580px;
    position: relative;
}
.cal-tg-timecol {
    width: 52px;
    flex-shrink: 0;
    position: relative;
    border-right: 1px solid #e2e8f0;
    /* altura = ge-gs + 1 línea de padding */
}
.cal-tl {
    position: absolute;
    right: 5px;
    font-size: .66rem;
    color: #94a3b8;
    transform: translateY(-50%);
    white-space: nowrap;
    line-height: 1;
}

.cal-tg-cols {
    flex: 1;
    display: flex;
    position: relative;
    min-width: 0;
}
.cal-tg-cols-day { /* vista día: columna más ancha */}
.cal-tg-col {
    flex: 1;
    position: relative;
    border-right: 1px solid #f1f5f9;
    min-width: 0;
}
.cal-tg-col-today { background: #f0f9ff; }

.cal-hr-line {
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    background: #f1f5f9;
    pointer-events: none;
}

/* Bloques de turno en time-grid */
.cal-tb {
    position: absolute;
    border-radius: .3rem;
    padding: .2rem .35rem;
    font-size: .71rem;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    border-left-width: 3px;
    border-left-style: solid;
    z-index: 1;
    transition: opacity .12s, box-shadow .12s;
    box-sizing: border-box;
}
.cal-tb:hover { opacity: .85; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.cal-tb-hora  { font-weight: 700; font-size: .65rem; opacity: .75; line-height: 1; }
.cal-tb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; line-height: 1.25; }

/* Formulario turno */
.turno-form-card { max-width: 780px; }

/* Panel crear cliente inline */
.nuevo-cliente-panel {
    margin-top: .65rem;
    padding: .85rem 1rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: .5rem;
}
.nuevo-cliente-panel::before {
    content: '✦ Registrar nuevo cliente';
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: #166534;
    margin-bottom: .65rem;
}

/* Panel crear vehículo inline */
.nuevo-vehiculo-panel {
    margin-top: .65rem;
    padding: .85rem 1rem;
    background: #eff6ff;
    border: 1px solid #bae6fd;
    border-radius: .5rem;
}
.nuevo-vehiculo-panel::before {
    content: '✦ Registrar nuevo vehículo';
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: #0369a1;
    margin-bottom: .5rem;
}

/* Panel de acciones de estado en formulario de turno */
.turno-actions-section {
    padding: .75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
}
.turno-actions-label {
    font-size: .7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .6rem;
}
.turno-cancel-panel {
    padding: .75rem 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: .5rem;
}

/* Select dificultad con color */
.dif-select.dif-baja, .dif-select.dif-media    { background: #dcfce7; color: #16a34a; }
.dif-select.dif-alta, .dif-select.dif-muy-alta { background: #fee2e2; color: #dc2626; }

/* ============================================================
   Topbar — indicador de sucursal activa
   ============================================================ */
.topbar-suc {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    padding: .25rem .75rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: 220px;
}
.topbar-suc i { color: var(--accent); flex-shrink: 0; }
.topbar-suc #topbar-suc-nombre {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-suc-change {
    color: var(--accent) !important;
    font-size: .78rem;
    text-decoration: none;
    flex-shrink: 0;
    font-weight: 500;
}
.topbar-suc-change:hover { text-decoration: underline !important; }

/* ============================================================
   Picker de sucursal
   ============================================================ */
.suc-picker {
    max-width: 760px;
    margin: 0 auto;
    padding-top: .5rem;
}
.suc-picker-header {
    text-align: center;
    padding: 2rem 1rem 2.5rem;
}
.suc-picker-header i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: .75rem;
}
.suc-picker-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .4rem;
}
.suc-picker-header p { color: #64748b; margin: 0; }

.suc-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: .75rem;
    padding: 1.5rem 1.25rem;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .12s;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
}
.suc-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(14,165,233,.15);
    transform: translateY(-2px);
}
.suc-card-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #f0f9ff;
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    margin-bottom: .3rem;
}
.suc-card-nombre { font-weight: 700; font-size: 1rem; color: #1e293b; }
.suc-card-loc    { font-size: .82rem; color: #64748b; }
.suc-card-hours  { font-size: .78rem; color: #94a3b8; }

.suc-picker-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: #94a3b8;
}
.suc-picker-empty i { font-size: 3rem; display: block; margin-bottom: 1rem; }
.suc-picker-empty h4 { color: #475569; }

/* ============================================================
   Turno — vista solo lectura (perfil Taller)
   ============================================================ */
.turno-view-field {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    padding: .75rem 1rem;
    height: 100%;
}
.turno-view-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 600; margin-bottom: .25rem; }
.turno-view-value { font-size: .95rem; color: #1e293b; }

/* ============================================================
   Servicio — ingreso de vehículo
   ============================================================ */
.intake-vehicle-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f0f9ff;
    border: 2px solid var(--accent);
    border-radius: .75rem;
    padding: .85rem 1.25rem;
    font-size: 1rem;
}
.intake-vehicle-badge i { font-size: 2rem; color: var(--accent); }

/* Grid de 4 fotos */
.foto-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.foto-slot { position: relative; }
.foto-slot-empty {
    aspect-ratio: 1;
    border: 2px dashed #cbd5e1;
    border-radius: .5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    cursor: pointer;
    color: #94a3b8;
    font-size: .72rem;
    transition: border-color .15s, color .15s;
}
.foto-slot-empty:hover { border-color: var(--accent); color: var(--accent); }
.foto-slot-empty i { font-size: 1.5rem; }
.foto-thumb-preview { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; cursor: pointer; display: block; }
.foto-remove-btn {
    position: absolute; top: 4px; right: 4px;
    background: rgba(0,0,0,.55); border: none; border-radius: 50%;
    color: white; width: 22px; height: 22px; padding: 0; cursor: pointer; font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
}
.foto-loading { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #f1f5f9; border-radius: .5rem; color: #94a3b8; font-size: 1.5rem; }

/* ============================================================
   Servicio — paneles de trabajo
   ============================================================ */
.svc-container { max-width: 860px; }

.svc-header-card {
    background: white;
    border-radius: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    padding: 1.25rem;
}
.svc-obs { font-size: .88rem; color: #475569; background: #f8fafc; border-radius: .4rem; padding: .5rem .75rem; }
.svc-fotos-grid { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.svc-foto-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: .4rem; cursor: pointer; border: 1px solid #e2e8f0; }

.svc-panels { display: flex; flex-direction: column; gap: .5rem; }
.svc-panel { border-radius: .6rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.svc-panel-header {
    width: 100%;
    background: white;
    border: none;
    border-left: 4px solid transparent;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}
.svc-panel-header:hover { background: #f8fafc; }
.svc-panel-body {
    border-left: 4px solid transparent;
    padding: 1.25rem;
}
.svc-panel-empty { text-align: center; padding: 2rem 1rem; color: #94a3b8; }
.svc-panel-chevron { transition: transform .2s; font-size: .9rem; color: #94a3b8; }

/* ============================================================
   Diagrama de posiciones de neumáticos (vista cenital del auto)
   ============================================================ */
.car-diag-wrap {
    margin: .5rem 0 .75rem;
}
.car-diag {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    padding: .75rem 1rem;
    user-select: none;
}
.car-diag-main {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.car-diag-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: space-around;
}
.car-diag-car {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 80px;
}
.car-diag-lbl {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #94a3b8;
    font-weight: 700;
}
.car-diag-shape {
    flex: 1;
    width: 70px;
    min-height: 56px;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 14px 14px 10px 10px;
}
.car-diag-spare-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding-top: 2px;
    border-top: 1px dashed #e2e8f0;
    width: 100%;
}
.car-diag-spare-lbl {
    font-size: .6rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Botón de cubierta */
.tire-pos-btn {
    width: 34px;
    height: 52px;
    border: 2px solid #94a3b8;
    border-radius: 5px;
    background: #f8fafc;
    cursor: pointer;
    font-size: .6rem;
    font-weight: 800;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
    padding: 0;
    letter-spacing: .03em;
}
.tire-pos-btn:hover {
    border-color: var(--accent);
    background: #f0f9ff;
    color: var(--accent);
}
.tire-pos-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(14,165,233,.35);
}
/* Cubierta de auxilio: horizontal */
.tire-spare {
    width: 52px !important;
    height: 34px !important;
}

/* ============================================================
   Panel de Gomería
   ============================================================ */
.gom-check-group {
    padding: .85rem 1rem;
    background: white;
    border-radius: .5rem;
    border: 1px solid #e2e8f0;
}
.gom-section {
    margin-top: .75rem;
    padding-left: 1.25rem;
    border-left: 3px solid var(--accent);
}

/* ============================================================
   Turno — vista de detalle de servicios (perfil taller)
   ============================================================ */
.tv-svc-block {
    border-left: 4px solid #e2e8f0;
    border-radius: 0 .4rem .4rem 0;
    background: white;
    margin-bottom: .5rem;
    overflow: hidden;
}
.tv-svc-title {
    padding: .5rem .75rem;
    font-weight: 600;
    font-size: .95rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.tv-svc-body {
    padding: .5rem .75rem;
}
.tv-svc-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .25rem 0;
    font-size: .875rem;
    border-bottom: 1px solid #f8fafc;
}
.tv-svc-row:last-child { border-bottom: none; }
.tv-svc-lbl {
    color: #64748b;
    min-width: 9rem;
    flex-shrink: 0;
    padding-top: .1rem;
}
.tv-svc-val { flex: 1; }
.tv-svc-check { color: #374151; }
.tv-pos-row  { display: flex; gap: .25rem; flex-wrap: wrap; }
.tv-pos-chip {
    display: inline-block;
    padding: .15rem .45rem;
    border-radius: .3rem;
    font-size: .75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #94a3b8;
    letter-spacing: .03em;
}
.tv-pos-chip.on {
    background: #0ea5e9;
    color: white;
}

/* ============================================================
   Turno — bloques de servicio con sub-paneles
   ============================================================ */
.svc-check-block {
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    overflow: hidden;
}
.svc-check-header {
    padding: .6rem .85rem;
    margin: 0;
    background: white;
    cursor: pointer;
}
.svc-check-header:hover { background: #f8fafc; }
.svc-detail-panel {
    padding: .75rem 1rem;
    border-top: 2px solid #f1f5f9;
    background: #fafafa;
}

/* ============================================================
   Reportes
   ============================================================ */
.rep-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-bottom: .6rem;
}

.rep-cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.rep-stat-card {
    flex: 1 1 100px;
    min-width: 90px;
    max-width: 150px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #6366f1;
    border-radius: .5rem;
    padding: .75rem .85rem .65rem;
    text-align: center;
}
.rep-stat-icon { font-size: 1.1rem; display: block; margin-bottom: .25rem; }
.rep-stat-num  { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #1e293b; }
.rep-stat-lbl  { font-size: .7rem; color: #94a3b8; margin-top: .2rem; text-transform: uppercase; letter-spacing: .04em; }

.rep-bar-list  { display: flex; flex-direction: column; gap: .45rem; }
.rep-bar-row   { display: flex; align-items: center; gap: .5rem; }
.rep-bar-label { min-width: 90px; font-size: .82rem; color: #475569; flex-shrink: 0; }
.rep-bar-track { flex: 1; height: 10px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.rep-bar-fill  { height: 100%; border-radius: 99px; transition: width .3s; }
.rep-bar-val   { min-width: 28px; text-align: right; font-size: .82rem; font-weight: 600; color: #475569; }

.rep-filtros   { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .5rem; padding: .65rem .85rem; }

/* ── Acordeón de servicios en turno form ─────────────────────── */
.svc-accordion      { display: flex; flex-direction: column; gap: .35rem; }
.svc-acc-item       { border: 1px solid #e2e8f0; border-radius: .5rem; overflow: hidden; }
.svc-acc-header     { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem;
                       background: #f8fafc; cursor: pointer; user-select: none; }
.svc-acc-header:hover { background: #f1f5f9; }
.svc-acc-label      { font-weight: 500; font-size: .92rem; flex: 1; margin: 0; }
.svc-acc-panel      { padding: .75rem; border-top: 1px solid #e2e8f0; background: #fff; }
.svc-sub-checks     { padding-left: 1.5rem; }
.svc-sub-checks .form-check { margin-bottom: .2rem; }
.svc-neum-nuevo     { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .4rem;
                       padding: .6rem .75rem; margin-top: .4rem; }
.ac-add-new         { color: #16a34a; font-size: .88rem; border-top: 1px solid #e2e8f0; }

/* ── Panel de turno en formulario de ingreso ─────────────────── */
.intake-turno-card  { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .6rem;
                       padding: .85rem 1rem; }
.intake-turno-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.intake-turno-field { min-width: 0; }
.intake-turno-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
                       color: #94a3b8; font-weight: 600; margin-bottom: .15rem; }
.intake-turno-val   { font-size: .95rem; color: #1e293b; line-height: 1.3; }
.intake-turno-svcs  { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.intake-turno-obs        { }
.intake-turno-svcs-full  { }
.intake-svc-block        { background:#fff; border-radius:.35rem; padding:.45rem .6rem;
                            margin-bottom:.1rem; }
.intake-svc-title        { font-size:.88rem; }
.intake-svc-det          { padding-left:.2rem; }
.intake-det-item         { font-size:.82rem; color:#334155; line-height:1.6; }

/* Slot de foto única en ingreso */
.foto-slot-single   { width: 200px; }
.foto-slot-single .foto-slot-empty { height: 140px; border: 2px dashed #cbd5e1; border-radius: .5rem;
                       display: flex; flex-direction: column; align-items: center; justify-content: center;
                       cursor: pointer; color: #94a3b8; transition: border-color .15s; }
.foto-slot-single .foto-slot-empty:hover { border-color: var(--accent); color: var(--accent); }
.foto-slot-single .foto-thumb-preview { width: 200px; height: 140px; object-fit: cover; border-radius: .5rem; }
.foto-slot-single .foto-remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55);
                       border: none; border-radius: 50%; color: #fff; width: 26px; height: 26px;
                       display: flex; align-items: center; justify-content: center; cursor: pointer; }
.foto-slot-single #foto-preview-1 { position: relative; display: inline-block; }

/* ── Foto en header de paneles de servicio ───────────────────── */
.svc-panel-foto { width: 80px; height: 60px; object-fit: cover; border-radius: .4rem;
                   cursor: pointer; border: 1px solid #e2e8f0; flex-shrink: 0; }

/* ── Revisión / Diagnóstico ──────────────────────────────────── */
.svc-rev-section { margin-bottom: .85rem; }
.svc-rev-section-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    padding: .3rem 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: .35rem;
}
.svc-rev-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .28rem 0;
    border-bottom: 1px solid #f1f5f9;
    gap: .5rem;
}
.svc-rev-item:last-child { border-bottom: none; }
.svc-rev-label  { font-size: .84rem; color: #334155; flex: 1; min-width: 0; }
.svc-rev-radios { display: flex; gap: .3rem; flex-shrink: 0; }
.svc-rev-radio  { cursor: pointer; user-select: none; }
.svc-rev-radio input[type=radio] { display: none; }
.svc-rev-radio span {
    display: inline-block;
    padding: .18rem .5rem;
    border-radius: .35rem;
    border: 1px solid #e2e8f0;
    font-size: .75rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all .1s;
    white-space: nowrap;
}
.svc-rev-radio span:hover { border-color: #94a3b8; color: #64748b; }
/* Seleccionado por estado */
.rev-nr  input:checked + span { background:#f1f5f9; color:#475569; border-color:#94a3b8; }
.rev-ok  input:checked + span { background:#dcfce7; color:#15803d; border-color:#86efac; font-weight:700; }
.rev-obs input:checked + span { background:#fee2e2; color:#dc2626; border-color:#fca5a5; font-weight:700; }

/* ── Barra de acciones al pie del servicio ───────────────────── */
.svc-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding: 1rem 0 .5rem;
    border-top: 2px solid #e2e8f0;
}
.svc-action-btn {
    font-weight: 600;
    padding: .55rem 1.1rem;
    border-radius: .45rem;
    font-size: .9rem;
}
.btn-finalizar   { background: #22c55e; color: #fff; border-color: #22c55e; }
.btn-finalizar:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-presupuesto { background: #fff; color: #0ea5e9; border: 1.5px solid #0ea5e9; }
.btn-presupuesto:hover { background: #f0f9ff; }
.btn-tarjeta     { background: #fff; color: #475569; border: 1.5px solid #cbd5e1; }
.btn-tarjeta:hover { background: #f8fafc; }
.btn-volver      { background: #fff; color: #475569; border: 1.5px solid #cbd5e1; }
.btn-volver:hover { background: #f8fafc; }

/* ── Página de servicio completado ───────────────────────────── */
.svc-completed-banner {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    padding: 1rem 1.5rem;
    border-radius: .65rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(34,197,94,.25);
}

/* ── Vista de datos en página completado ─────────────────────── */
.svc-view-block { display: flex; flex-direction: column; gap: .35rem; }
.svc-view-item  { font-size: .9rem; color: #1e293b; line-height: 1.5; }
.svc-view-obs   { border-top: 1px solid rgba(0,0,0,.07); padding-top: .5rem; margin-top: .25rem; }

/* Revisión — vista completado */
.svc-rev-view-section { }
.svc-rev-view-items   { }
.svc-rev-view-item    { display: flex; justify-content: space-between; align-items: center;
                         padding: .28rem 0; border-bottom: 1px solid #f1f5f9; font-size: .86rem; gap: .5rem; }
.svc-rev-view-item:last-child { border-bottom: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
    #sidebar-overlay.show { display: block; }
    #main-wrapper { margin-left: 0; }
    .btn-menu { display: block; }
    .content-area { padding: 1rem; }
    .table-toolbar { gap: .5rem; }
    .table-toolbar .btn { padding: .35rem .65rem; font-size: .82rem; }
    .form-card { max-width: 100%; }

    /* Calendario mes - móvil */
    .cal-day { min-height: 70px; }
    .cal-cliente { display: none; }
    .cal-tags { display: none; }
    .cal-header { gap: .4rem; padding: .65rem .75rem; }
    .cal-title  { min-width: 100px; font-size: .9rem; }
    .cal-header-actions { flex-wrap: nowrap; gap: .3rem; }
    .turno-form-card { max-width: 100%; }
    .foto-grid { grid-template-columns: repeat(2, 1fr); }
    .svc-container { max-width: 100%; }
    .svc-rev-item { flex-wrap: wrap; gap: .3rem; }
    .svc-rev-radios { flex-wrap: wrap; }
    .svc-action-btn { font-size: .82rem; padding: .45rem .85rem; }
    .svc-completed-banner { font-size: 1.1rem; padding: .75rem 1rem; }

    /* Time-grid (semana/día) - móvil: scroll horizontal */
    .cal-tg-wrap { overflow-x: auto; }
    .cal-tg-head, .cal-tg-scroll { min-width: 480px; }
    .cal-tg-dh { min-width: 60px; }
    .cal-tg-scroll { max-height: 480px; }
}

/* ============================================================
   Footer de versión
   ============================================================ */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem 1.5rem;
    font-size: .72rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    user-select: none;
}
.app-version {
    font-family: monospace;
    font-size: .7rem;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 6px;
    color: #64748b;
}
