:root {
    --carbon-oscuro: #14161a;
    --carbon-medio: #262a33;
    --rojo-principal: #c8102e;
    --rojo-oscuro: #93101f;
    --ambar: #d9a441;
    --ambar-claro: #f4e9d5;
    --plata: #8b93a1;
    --crema: #f6f5f2;
    --crema-calida: #f2ece1;
    --texto: #1e2025;
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

body {
    background-color: var(--crema);
    color: var(--texto);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 0.94rem;
}

/* ---------- Layout general ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--carbon-oscuro), var(--carbon-medio));
    color: #fff;
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    transition: transform 0.25s ease;
    overflow-y: auto;
    transform: translateX(-100%);
    box-shadow: 2px 0 18px rgba(0,0,0,0.25);
}
.sidebar.show { transform: translateX(0); }

.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(217,164,65,0.25);
}
.sidebar-brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2px rgba(217,164,65,0.5); }
.sidebar-brand .brand-text { font-family: 'Playfair Display', 'Georgia', serif; font-size: 1.35rem; font-weight: 700; line-height: 1; letter-spacing: 0.5px; }
.sidebar-brand .brand-text small { display:block; font-size: 0.62rem; font-weight: normal; letter-spacing: 3px; opacity: 0.75; color: var(--ambar); font-family: 'Segoe UI', Roboto, Arial, sans-serif; }

.sidebar-nav { list-style: none; padding: 10px 0; margin: 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.sidebar-nav li a:hover { background: rgba(217,164,65,0.10); color: #fff; }
.sidebar-nav li a.active {
    background: rgba(200,16,46,0.22);
    border-left-color: var(--ambar);
    color: #fff;
    font-weight: 600;
}
.sidebar-nav li a i { width: 18px; text-align: center; }

.main-content {
    margin-left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e7e2d8;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar .btn-toggle { display: inline-block; background: none; border: none; font-size: 1.3rem; color: var(--rojo-principal); }

.content-area { padding: 20px; flex: 1; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1025;
}
.sidebar-overlay.show { display: block; }

/* ---------- Tarjetas / paneles ---------- */
.card-panel {
    background: #fff;
    border: 1px solid #e7e2d8;
    border-top: 3px solid var(--carbon-oscuro);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 6px rgba(20,22,26,0.06);
}
.card-panel h6.panel-title {
    color: var(--carbon-oscuro);
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--ambar-claro);
    padding-bottom: 8px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    border: 1px solid #e7e2d8;
    border-bottom: 3px solid var(--rojo-principal);
    text-align: center;
}
.stat-card .stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #857f72; font-weight: 600; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--carbon-oscuro); margin-top: 6px; }
.stat-card .stat-value.rojo { color: var(--rojo-principal); }
.stat-card i { font-size: 1.6rem; color: var(--ambar); }

/* Botones */
.btn-tsp { background: var(--rojo-principal); border-color: var(--rojo-principal); color: #fff; }
.btn-tsp:hover { background: var(--rojo-oscuro); border-color: var(--rojo-oscuro); color: #fff; }
.btn-outline-tsp { border-color: var(--rojo-principal); color: var(--rojo-principal); }
.btn-outline-tsp:hover { background: var(--rojo-principal); color: #fff; }

/* Tablas */
.table-tsp thead { background: var(--crema-calida); }
.table-tsp thead th { color: var(--carbon-oscuro); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--ambar); }
.table-tsp td, .table-tsp th { vertical-align: middle; }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--carbon-oscuro), var(--rojo-oscuro));
}
.login-box {
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    border-top: 4px solid var(--ambar);
}
.login-box img { width: 72px; height: 72px; border-radius: 50%; display: block; margin: 0 auto 10px; box-shadow: 0 0 0 3px var(--ambar-claro); }
.login-box h4 { font-family: 'Playfair Display', 'Georgia', serif; font-size: 1.6rem; letter-spacing: 0.5px; }

.text-tsp { color: var(--carbon-oscuro); }
.cursor-pointer { cursor: pointer; }
.fila-arrastrable td:first-child { touch-action: none; }

/* ---------- Selector de íconos ---------- */
.icon-picker { position: relative; }
.icon-picker-dropdown {
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #ded6c4;
    border-radius: 8px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    margin-top: 4px;
}
.icon-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.85rem;
}
.icon-picker-item:hover { background: var(--crema-calida); }
.icon-picker-item i { font-size: 1.05rem; color: var(--rojo-principal); width: 20px; text-align: center; }

/* ---------- Zona de arrastrar y soltar archivos ---------- */
.dropzone {
    border: 2px dashed #cfc6b3;
    border-radius: 10px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    color: #857f72;
    background: #fbfaf7;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dropzone-active {
    border-color: var(--ambar);
    background: var(--crema-calida);
    color: var(--carbon-oscuro);
}
.dropzone i { font-size: 1.8rem; display: block; margin-bottom: 6px; }

/* ---------- Fichas (vista móvil de listas, ej. carros.php) ---------- */
.ficha-item {
    border: 1px solid #e7e2d8;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
}
.ficha-item .ficha-foto {
    width: 56px; height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--crema-calida);
    display: flex; align-items: center; justify-content: center;
}
.ficha-item .ficha-foto img { width: 100%; height: 100%; object-fit: cover; }
.ficha-item .ficha-foto i { font-size: 1.4rem; color: #c9c2b2; }
.ficha-item .ficha-chip {
    background: var(--crema-calida);
    color: #6b6455;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ficha-item .ficha-chip .swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
