/* ============================================================
   SISTEMA CONDUCTORES — SLATE + NARANJA
   assets/css/main.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:         #0D1117;
    --bg2:        #161B22;
    --bg3:        #1C2128;
    --bg4:        #21262D;
    --border:     #30363D;
    --border2:    #21262D;
    --text:       #E6EDF3;
    --text2:      #8B949E;
    --text3:      #6E7681;

    --accent:     #F97316;
    --accent-dim: #F9731622;
    --accent-hover:#EA6C10;

    --blue:       #1F6FEB;
    --blue-dim:   #1F6FEB18;

    --success:    #3FB950;
    --success-dim:#3FB95020;
    --warning:    #D29922;
    --warning-dim:#D2992220;
    --danger:     #F85149;
    --danger-dim: #F8514920;
    --gold:       #F0C040;
    --gold-dim:   #F0C04020;

    --sidebar-w:  255px;
    --topbar-h:   56px;
    --radius:     8px;
    --radius-lg:  12px;
    --font:       'Inter', system-ui, sans-serif;
    --mono:       'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   LAYOUT
══════════════════════════════════════ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border2);
    display: flex; flex-direction: column;
    overflow-y: auto; overflow-x: hidden;
    z-index: 100;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ══════════════════════════════════════
   SIDEBAR — BRAND
══════════════════════════════════════ */
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid var(--border2);
    flex-shrink: 0;
}
.brand-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.brand-name  { display: block; font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand-version { display: block; font-size: 10.5px; color: var(--text3); font-family: var(--mono); margin-top: 1px; }

/* ══════════════════════════════════════
   SIDEBAR — USER PILL
══════════════════════════════════════ */
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    margin: 10px 10px 4px;
    border-radius: var(--radius);
    background: var(--bg3);
    border: 1px solid var(--border2);
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.user-info   { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.user-name   { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-rol    { font-size: 11px; color: var(--accent); margin-top: 1px; }
.user-linea  { font-size: 10.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ══════════════════════════════════════
   SIDEBAR — NAV
══════════════════════════════════════ */
.sidebar-nav { padding: 8px 8px; flex: 1; display: flex; flex-direction: column; }
.nav-group   { margin-bottom: 4px; }
.nav-group-label {
    display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em;
    color: var(--text3); text-transform: uppercase; padding: 10px 10px 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: var(--radius);
    color: var(--text2); text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: background .12s, color .12s;
    position: relative;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-left: 2px solid var(--accent);
    padding-left: 8px;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-logout { color: var(--danger) !important; margin-top: 4px; }
.nav-logout:hover { background: var(--danger-dim) !important; }

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
.topbar {
    height: var(--topbar-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border2);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
    flex-shrink: 0;
}
.btn-toggle-sidebar {
    background: none; border: none; color: var(--text2);
    font-size: 18px; cursor: pointer; padding: 6px 8px;
    border-radius: var(--radius); line-height: 1;
    transition: background .12s, color .12s;
}
.btn-toggle-sidebar:hover { background: var(--bg3); color: var(--text); }
.page-title { font-size: 16px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-clock { font-family: var(--mono); font-size: 12px; color: var(--text3); }

/* ══════════════════════════════════════
   CONTENT
══════════════════════════════════════ */
.content-body { padding: 24px; flex: 1; }

/* ══════════════════════════════════════
   FLASH MESSAGES
══════════════════════════════════════ */
.flash {
    margin: 14px 24px 0; padding: 12px 16px;
    border-radius: var(--radius); display: flex; align-items: center;
    justify-content: space-between; font-size: 13.5px; font-weight: 500;
    animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.flash-success { background: var(--success-dim); border: 1px solid #3FB95050; color: var(--success); }
.flash-error   { background: var(--danger-dim);  border: 1px solid #F8514950; color: var(--danger); }
.flash-warning { background: var(--warning-dim); border: 1px solid #D2992250; color: var(--warning); }
.flash-info    { background: var(--blue-dim);    border: 1px solid #1F6FEB50; color: #58A6FF; }
.flash-close   { background: none; border: none; color: inherit; cursor: pointer; font-size: 18px; opacity: .6; transition: opacity .12s; }
.flash-close:hover { opacity: 1; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border2);
}
.card-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }

/* ══════════════════════════════════════
   STATS GRID
══════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px; margin-bottom: 22px;
}
.stat-card {
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: var(--radius-lg); padding: 18px 18px 16px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color .15s;
}
.stat-card:hover { border-color: var(--border); }
.stat-icon { font-size: 28px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; line-height: 1; }
.stat-label { font-size: 11.5px; color: var(--text2); margin-top: 4px; }
.stat-card.accent  { border-left: 3px solid var(--accent); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.danger  { border-left: 3px solid var(--danger); }
.stat-card.accent  .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger  .stat-value { color: var(--danger); }

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg3); }
thead th {
    padding: 10px 16px; text-align: left;
    font-size: 10.5px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .07em; color: var(--text3); white-space: nowrap;
    border-bottom: 1px solid var(--border2);
}
tbody tr { border-bottom: 1px solid var(--border2); transition: background .1s; }
tbody tr:hover { background: var(--bg3); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 11px 16px; font-size: 13px; vertical-align: middle; }

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label {
    font-size: 11px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: .06em;
}
input, select, textarea {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    padding: 9px 13px; font-family: var(--font); font-size: 13.5px;
    transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(249,115,22,.18);
}
input::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 88px; }
select option { background: var(--bg3); color: var(--text); }
.form-hint  { font-size: 11px; color: var(--text3); }
.form-error { font-size: 11px; color: var(--danger); }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-family: var(--font); font-size: 13px; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: all .15s; white-space: nowrap; line-height: 1;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success   { background: #238636; color: #fff; }
.btn-success:hover { background: #2EA043; }
.btn-danger    { background: #B62324; color: #fff; }
.btn-danger:hover { background: #CF2626; }
.btn-warning   { background: var(--warning); color: #000; }
.btn-warning:hover { background: #B8860B; }
.btn-secondary {
    background: transparent; color: var(--text2);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg3); color: var(--text); border-color: var(--border); }
.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge-info      { background: var(--blue-dim);    color: #58A6FF; border: 1px solid #1F6FEB40; }
.badge-success   { background: var(--success-dim); color: var(--success); border: 1px solid #3FB95040; }
.badge-warning   { background: var(--warning-dim); color: var(--warning); border: 1px solid #D2992240; }
.badge-danger    { background: var(--danger-dim);  color: var(--danger);  border: 1px solid #F8514940; }
.badge-gold      { background: var(--gold-dim);    color: var(--gold);    border: 1px solid #F0C04040; }
.badge-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.badge-accent    { background: var(--accent-dim); color: var(--accent); border: 1px solid #F9731640; }

/* Estados licencia */
.lic-vigente    { color: var(--success); font-weight: 600; }
.lic-por_vencer { color: var(--warning); font-weight: 600; }
.lic-vencida    { color: var(--danger);  font-weight: 600; }

/* ══════════════════════════════════════
   AVATARES
══════════════════════════════════════ */
.avatar-lg {
    width: 88px; height: 88px; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--accent);
}
.avatar-initials-lg {
    width: 88px; height: 88px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 700; color: #fff;
    border: 3px solid var(--accent);
}

/* ══════════════════════════════════════
   MAPA
══════════════════════════════════════ */
#mapa, .mapa-container {
    height: 350px; border-radius: var(--radius-lg);
    border: 1px solid var(--border2);
}

/* ══════════════════════════════════════
   MODALES
══════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.75);
    z-index: 200; display: flex; align-items: center;
    justify-content: center; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); max-width: 680px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border2);
}
.modal-title   { font-size: 15px; font-weight: 700; }
.modal-body    { padding: 22px; }
.modal-footer  {
    padding: 14px 22px; border-top: 1px solid var(--border2);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ══════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════ */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-bar input, .search-bar select { flex: 1; min-width: 180px; }

/* ══════════════════════════════════════
   TIMELINE (historial líneas)
══════════════════════════════════════ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: ''; position: absolute; left: 5px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 22px; }
.timeline-dot {
    position: absolute; left: -20px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg2);
}
.timeline-date { font-size: 11px; color: var(--text3); margin-bottom: 4px; font-family: var(--mono); }
.timeline-content {
    background: var(--bg3); border-radius: var(--radius);
    padding: 12px 14px; border: 1px solid var(--border2);
    border-left: 3px solid var(--accent);
}

/* ══════════════════════════════════════
   REGISTROS DE DESEMPEÑO
══════════════════════════════════════ */
.registro-card {
    background: var(--bg3); border-radius: var(--radius-lg);
    border: 1px solid var(--border2); padding: 16px; margin-bottom: 12px;
    transition: border-color .15s;
}
.registro-card:hover { border-color: var(--border); }
.registro-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.registro-meta {
    font-size: 11.5px; color: var(--text3); margin-top: 10px;
    display: flex; gap: 14px; flex-wrap: wrap; padding-top: 10px;
    border-top: 1px solid var(--border2);
}
.registro-adjuntos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.adjunto-thumb {
    width: 58px; height: 58px; border-radius: var(--radius);
    object-fit: cover; border: 1px solid var(--border);
    cursor: pointer; transition: border-color .15s;
}
.adjunto-thumb:hover { border-color: var(--accent); }
.adjunto-doc {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 6px 10px;
    font-size: 12px; color: var(--accent); text-decoration: none;
    transition: border-color .15s;
}
.adjunto-doc:hover { border-color: var(--accent); }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid  { grid-template-columns: 1fr; }
    .content-body { padding: 14px; }
    .topbar { padding: 0 14px; }
}

/* ══════════════════════════════════════
   UTILITIES
══════════════════════════════════════ */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.mt-4  { margin-top: 16px; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text2); }
.text-sm     { font-size: 12px; }
.font-mono   { font-family: var(--mono); }
.w-full      { width: 100%; }
.hidden      { display: none !important; }

/* ══════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════ */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; padding: 20px;
    background:
        radial-gradient(ellipse 60% 50% at 20% 40%, rgba(249,115,22,.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 85% 20%, rgba(31,111,235,.07) 0%, transparent 55%),
        var(--bg);
}
.login-box {
    width: 100%; max-width: 400px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 38px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
    width: 60px; height: 60px; border-radius: 14px;
    background: var(--accent); margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.login-logo p  { font-size: 13px; color: var(--text2); margin-top: 4px; }
