/* ============================================================
   PEOPLE Asistencias & Novedades - Estilos
   Tema claro con acentos ámbar/dorado
   ============================================================ */

:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-alt: #fafbfc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #94a3b8;
    --amber: #b45309;
    --amber-light: #fef3c7;
    --amber-border: #fde68a;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --purple: #7c3aed;
    --purple-light: #ede9fe;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 70px;
}

/* ============ TOP BAR ============ */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #b45309, #d97706);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; color: #fff;
}
.brand-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.brand-sub { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }
.select-empresa {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 32px 8px 14px; color: var(--text-secondary); font-size: 13px;
    font-weight: 600; cursor: pointer; outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.btn-export {
    background: var(--green); border: none; border-radius: var(--radius);
    padding: 8px 16px; color: #fff; font-size: 12px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    box-shadow: 0 2px 6px rgba(22,163,74,0.25); transition: opacity 0.15s;
}
.btn-export:hover { opacity: 0.9; }

/* ============ FILTERS BAR ============ */
.filters-bar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-item { display: flex; flex-direction: column; gap: 2px; }
.filter-item label {
    font-size: 9px; font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.06em; text-transform: uppercase;
}
.filter-item select {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 7px 28px 7px 10px; color: var(--text-secondary); font-size: 13px;
    font-weight: 600; cursor: pointer; outline: none; min-width: 160px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    transition: opacity 0.15s;
}
.filter-item select:disabled { opacity: 0.45; cursor: not-allowed; }
.chevron-right { flex-shrink: 0; }
.filter-separator { width: 1px; height: 32px; background: var(--border); margin: 0 4px; }
.input-date {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 10px; color: var(--text-secondary); font-size: 12px; outline: none;
}
.date-arrow { color: var(--border); font-size: 12px; }
.quick-days { display: flex; gap: 3px; }
.btn-days {
    background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
    padding: 4px 10px; color: var(--text-muted); font-size: 11px; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
}
.btn-days.active { background: var(--amber); border-color: var(--amber); color: #fff; }
.filter-search { position: relative; }
.filter-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.filter-search input {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 7px 12px 7px 32px; color: var(--text-secondary); font-size: 12px;
    width: 200px; outline: none;
}
.filter-summary {
    font-size: 11px; color: var(--text-muted); background: var(--border-light);
    padding: 5px 12px; border-radius: 7px; font-weight: 600;
}

/* ============ LEGEND ============ */
.legend-bar {
    padding: 6px 20px; display: flex; gap: 4px; flex-wrap: wrap;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.conv-badge {
    display: inline-flex; align-items: center; gap: 3px; font-size: 10px;
    padding: 2px 7px; border-radius: 5px; font-weight: 700; cursor: default;
    line-height: 1.3;
}

/* ============ GRID ============ */
.grid-wrapper {
    overflow: auto; margin: 12px 12px 0; position: relative;
    background: var(--surface); border-radius: 14px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.grid-loading {
    position: absolute; inset: 0; background: rgba(248,249,251,0.9);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 14px; color: var(--text-muted); z-index: 10;
}
.grid-loading.hidden { display: none; }
.spinner {
    width: 24px; height: 24px; border: 3px solid var(--border);
    border-top-color: var(--amber); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.att-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.att-grid th, .att-grid td { text-align: center; }

/* Header */
.att-grid thead th {
    background: var(--bg); border-bottom: 2px solid var(--border);
    padding: 4px 0; position: sticky; top: 0; z-index: 5;
}
.th-employee {
    min-width: 260px; width: 260px; text-align: left; padding: 10px 12px !important;
    border-right: 2px solid var(--border); position: sticky; left: 0;
    background: var(--bg) !important; z-index: 15 !important;
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.th-day { min-width: 46px; width: 46px; }
.th-day-name { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; }
.th-day-num { font-size: 13px; font-weight: 700; }
.th-sunday .th-day-name { color: var(--red); }
.th-sunday .th-day-num { color: #b91c1c; }
.th-holiday { background: #fffbeb !important; }
.th-holiday .th-day-name { color: var(--amber); }
.th-holiday .th-day-num { color: #92400e; }
.th-total {
    min-width: 70px; width: 70px; border-left: 2px solid var(--border);
    font-size: 9px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.08em;
    padding: 8px 4px !important;
}
.th-cost { min-width: 95px; width: 95px; }
.th-cost-total {
    min-width: 100px; width: 100px; font-size: 9px; font-weight: 700;
    color: var(--green); letter-spacing: 0.08em; padding: 8px 4px !important;
    background: #f0fdf422 !important;
}

/* Rows */
.att-grid tbody tr {
    border-bottom: 1px solid var(--border-light); transition: background 0.1s;
}
.att-grid tbody tr:nth-child(even) { background: var(--surface-alt); }
.att-grid tbody tr:hover { background: #f5f7fa; }

.td-employee {
    text-align: left; padding: 7px 12px; border-right: 2px solid var(--border);
    position: sticky; left: 0; background: inherit; z-index: 3; cursor: pointer;
}
.emp-row { display: flex; align-items: center; gap: 8px; }
.emp-avatar {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #92400e; border: 1px solid #fcd34d;
}
.emp-info { overflow: hidden; }
.emp-name {
    font-size: 12px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.emp-cargo { font-size: 10px; color: var(--text-muted); }

/* Day cells */
.td-day {
    padding: 5px 1px; border-right: 1px solid var(--bg);
    cursor: pointer; position: relative; min-width: 46px;
}
.td-day:hover { background: #f1f5f9; }
.td-day.td-sunday { background: #fef2f211; }
.td-day.td-holiday { background: #fffbeb22; }
.td-day .conv-badge { cursor: pointer; position: relative; }

/* Habituality badge */
.hab-badge {
    position: absolute; top: -4px; right: -4px;
    width: 13px; height: 13px; border-radius: 50%;
    background: #9333ea; color: #fff; font-size: 7px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid #fff; line-height: 1;
}

/* Total cells */
.td-hours {
    padding: 6px 4px; border-left: 2px solid var(--border);
    font-size: 12px; font-weight: 700; color: var(--text);
}
.td-hours span { background: var(--border-light); padding: 2px 8px; border-radius: 5px; }
.td-cost { padding: 6px 4px; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.td-auxbon { padding: 6px 4px; font-size: 10px; font-weight: 600; color: var(--purple); }
.td-total { padding: 6px 4px; font-size: 12px; font-weight: 700; color: var(--green); background: #f0fdf422; }

/* Empty state */
.grid-empty {
    padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 14px;
}

/* ============ FOOTER ============ */
.footer-totals {
    position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
    border-top: 3px solid var(--amber); padding: 12px 20px;
    display: flex; gap: 32px; align-items: center; z-index: 40;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}
.total-item {}
.total-label { font-size: 9px; color: var(--text-muted); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.total-value { font-size: 20px; font-weight: 800; color: var(--text); }
.total-green { color: var(--green) !important; }
.total-amber { color: var(--amber) !important; }
.total-counters { display: flex; gap: 20px; font-size: 11px; color: var(--text-muted); }
.total-counters strong { color: var(--text); font-weight: 700; }
.text-red { color: var(--red) !important; }
.text-amber { color: #d97706 !important; }

/* ============ MODALS ============ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.3);
    backdrop-filter: blur(6px); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}

/* Convention selector modal */
.modal-conv {
    background: var(--surface); border-radius: 16px; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-conv-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-conv-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-conv-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.btn-close {
    background: var(--border-light); border: none; border-radius: 8px;
    width: 32px; height: 32px; font-size: 18px; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-conv-body { padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 400px; overflow-y: auto; }
.conv-option {
    padding: 10px 8px; border-radius: 8px; border: 1px solid var(--border);
    cursor: pointer; text-align: center; transition: all 0.15s;
    background: var(--surface);
}
.conv-option:hover { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(180,83,9,0.1); }
.conv-option-code { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.conv-option-name { font-size: 9px; color: var(--text-muted); line-height: 1.3; }

/* Change request modal */
.modal-cambio {
    background: var(--surface); border-radius: 16px; width: 100%; max-width: 500px;
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-cambio-body { padding: 20px; }
.cambio-info { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cambio-row { display: flex; align-items: center; gap: 10px; }
.cambio-label { font-size: 13px; color: var(--text-muted); font-weight: 600; min-width: 100px; }
.select-conv-cambio {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; outline: none;
}
.cambio-motivo { margin-bottom: 16px; }
.cambio-motivo label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.cambio-motivo textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; font-family: inherit; resize: vertical; outline: none;
}
.cambio-motivo textarea:focus { border-color: var(--amber); }
.required { color: var(--red); }
.cambio-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 12px; }
.btn-secondary {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 20px; color: var(--text-secondary); font-size: 13px;
    font-weight: 600; cursor: pointer;
}
.btn-primary {
    background: linear-gradient(135deg, #b45309, #d97706); border: none;
    border-radius: var(--radius); padding: 10px 20px; color: #fff;
    font-size: 13px; font-weight: 700; cursor: pointer;
    box-shadow: 0 2px 8px rgba(180,83,9,0.25);
}
.cambio-nota {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--amber-light); border: 1px solid var(--amber-border);
    border-radius: 8px; font-size: 11px; color: #92400e;
}

/* Detail modal */
.modal-detail {
    background: var(--surface); border-radius: 18px; width: 100%; max-width: 960px;
    max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg);
}

/* ============ UTILITIES ============ */
.hidden { display: none !important; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .filters-bar { padding: 8px 12px; }
    .filter-item select { min-width: 120px; font-size: 11px; }
    .filter-search input { width: 140px; }
    .footer-totals { gap: 16px; padding: 10px 12px; }
    .total-value { font-size: 16px; }
    .total-counters { gap: 12px; font-size: 10px; }
}
