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

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: #f3f4f6; color: #111827; font-size: 14px; }

/* ===================== LOGIN ===================== */
.login-body { min-height: 100vh; background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 14px; padding: 40px 44px; width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,0.07); border: 1px solid #e5e7eb; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 52px; }
.login-logo-text { font-size: 26px; font-weight: 600; color: #8B0000; letter-spacing: -0.5px; }
.login-title { font-size: 18px; font-weight: 600; color: #111827; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: #6b7280; text-align: center; margin-bottom: 28px; }
.login-group { margin-bottom: 16px; }
.login-group label { display: block; font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.login-group input { width: 100%; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 7px; font-size: 14px; font-family: inherit; color: #111827; background: #f9fafb; }
.login-group input:focus { outline: none; border-color: #8B0000; background: white; box-shadow: 0 0 0 3px rgba(139,0,0,0.07); }
.login-btn { width: 100%; background: #8B0000; color: white; border: none; padding: 11px; border-radius: 7px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; margin-top: 8px; }
.login-btn:hover { background: #6B0000; }
.login-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; border-radius: 6px; padding: 9px 12px; font-size: 13px; margin-top: 12px; text-align: center; }

/* ===================== APP LAYOUT ===================== */
.app-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar { background: #111827; height: 52px; display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0; z-index: 100; }
.topbar-logo-img { height: 30px; }
.topbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.15); margin: 0 4px; }
.topbar-brand { color: white; font-size: 15px; font-weight: 600; }
.topbar-title { flex: 1; font-size: 13px; color: rgba(255,255,255,0.45); }
.topbar-user { font-size: 13px; color: rgba(255,255,255,0.65); }
.topbar-logout { background: #8B0000; border: none; color: white; padding: 6px 16px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; }
.topbar-logout:hover { background: #6B0000; }

.app-layout { display: flex; flex: 1; overflow: hidden; }

/* ===================== SIDEBAR ===================== */
.sidebar { width: 220px; background: #1a1a2e; display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; padding: 10px 0 20px; }
.sidebar-section { padding: 16px 16px 4px; font-size: 10px; color: rgba(255,255,255,0.28); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }
.sidebar-section:first-child { padding-top: 10px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 16px; color: rgba(255,255,255,0.52); font-size: 13px; cursor: pointer; border-left: 3px solid transparent; user-select: none; }
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.8); }
.sidebar-item.active { background: rgba(139,0,0,0.18); color: #f87171; border-left-color: #8B0000; }
.sidebar-item i { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }

/* ===================== WORKER PANEL ===================== */
.worker-panel { width: 240px; background: white; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; flex-shrink: 0; position: relative; transition: width 0.2s ease; overflow: hidden; }
.worker-panel.collapsed { width: 28px; }
.worker-panel.collapsed .worker-search,
.worker-panel.collapsed .worker-filters,
.worker-panel.collapsed .worker-list,
.worker-panel.collapsed .worker-footer { display: none; }
.worker-toggle { position: absolute; top: 50%; right: 0; transform: translateY(-50%); width: 20px; height: 48px; background: #e5e7eb; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #6b7280; font-size: 11px; z-index: 10; border-radius: 4px 0 0 4px; transition: background 0.15s; }
.worker-toggle:hover { background: #d1d5db; color: #374151; }
.worker-panel.collapsed .worker-toggle { right: 0; border-radius: 0 4px 4px 0; left: auto; width: 28px; }
.worker-search { padding: 10px; border-bottom: 1px solid #f0f0f0; display: flex; gap: 6px; }
.worker-search input { flex: 1; border: 1px solid #e5e7eb; border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; color: #111827; background: #f9fafb; }
.worker-search input:focus { outline: none; border-color: #8B0000; background: white; }
.worker-search button { background: #8B0000; color: white; border: none; border-radius: 6px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.worker-filters { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; display: flex; gap: 6px; }
.worker-filters select { flex: 1; border: 1px solid #e5e7eb; border-radius: 5px; padding: 5px 6px; font-size: 12px; font-family: inherit; color: #374151; background: #f9fafb; }
.worker-list { flex: 1; overflow-y: auto; }
.worker-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f5f5f5; cursor: pointer; border-left: 3px solid transparent; }
.worker-item:hover { background: #fafafa; }
.worker-item.selected { background: #fff5f5; border-left-color: #8B0000; }
.worker-avatar { width: 36px; height: 36px; border-radius: 50%; background: #8B0000; color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.worker-info { flex: 1; min-width: 0; }
.worker-name { font-size: 13px; font-weight: 500; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worker-meta { font-size: 11px; color: #9ca3af; margin-top: 1px; }
.worker-footer { padding: 10px; border-top: 1px solid #f0f0f0; }
.btn-nuevo { width: 100%; background: #8B0000; color: white; border: none; padding: 8px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-nuevo:hover { background: #6B0000; }

/* ===================== MAIN AREA ===================== */
.main-content-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #f3f4f6; }
.detail-header { background: white; border-bottom: 1px solid #e5e7eb; padding: 14px 24px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; min-height: 72px; }
.detail-avatar { width: 44px; height: 44px; border-radius: 50%; background: #8B0000; color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; flex-shrink: 0; }
.detail-name { font-size: 16px; font-weight: 600; color: #111827; }
.detail-meta { font-size: 12px; color: #6b7280; margin-top: 3px; }
.detail-id { display: inline-block; background: #f3f4f6; color: #6b7280; padding: 2px 7px; border-radius: 4px; font-size: 11px; margin-left: 6px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content-area { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ===================== BUTTONS ===================== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; border: 1px solid transparent; }
.btn-primary { background: #8B0000; color: white; border-color: #8B0000; }
.btn-primary:hover { background: #6B0000; border-color: #6B0000; }
.btn-secondary { background: white; color: #374151; border-color: #e5e7eb; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: white; color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-success { background: white; color: #16a34a; border-color: #86efac; }
.btn-success:hover { background: #f0fdf4; }
.btn-save { background: #8B0000; color: white; border: none; padding: 8px 18px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; }
.btn-save:hover { background: #6B0000; }
.btn-delete { background: white; color: #6b7280; border: 1px solid #e5e7eb; padding: 8px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; }
.btn-delete:hover { background: #fef2f2; color: #8B0000; border-color: #fca5a5; }

/* ===================== CARDS ===================== */
.card { background: white; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 8px; }
.card-title i { color: #8B0000; font-size: 16px; }

/* ===================== FORMS ===================== */
.form-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; flex: 1 1 140px; min-width: 0; }
.form-group.full { flex: 1 1 100%; }
.form-group.half { flex: 2 1 200px; }
.form-group.quarter { flex: 1 1 120px; }
.subsection { margin-top: 16px; padding-top: 14px; border-top: 1px solid #f0f0f0; }
.form-group label { font-size: 11px; font-weight: 500; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input,
.form-group select,
.form-group textarea { border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 10px; font-size: 13px; font-family: inherit; color: #111827; background: #f9fafb; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #8B0000; background: white; box-shadow: 0 0 0 3px rgba(139,0,0,0.06); }
.form-group input[readonly] { background: #f3f4f6; color: #6b7280; }
.form-group textarea { resize: vertical; min-height: 70px; }
.subsection-title { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.subsection-title i { color: #8B0000; }
.form-section { background: white; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }

/* ===================== TABLES ===================== */
.data-table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: #f9fafb; padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 500; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 1px solid #e5e7eb; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f5f5f5; color: #374151; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }
.text-center { text-align: center; }

/* ===================== BADGES ===================== */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-activo { background: #dcfce7; color: #15803d; }
.badge-baja { background: #fee2e2; color: #b91c1c; }
.badge-pendiente { background: #fef9c3; color: #854d0e; }
.badge-aprobada-area { background: #dbeafe; color: #1d4ed8; }
.badge-aprobada, .badge-aprobado { background: #dcfce7; color: #15803d; }
.badge-rechazada, .badge-rechazado { background: #fee2e2; color: #b91c1c; }

/* ===================== ALERTS ===================== */
.alert { padding: 10px 14px; border-radius: 7px; font-size: 13px; position: fixed; top: 60px; right: 16px; z-index: 9999; min-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ===================== MODALS ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal { background: white; border-radius: 12px; min-width: 420px; max-width: 580px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; }
.modal-header span { font-size: 15px; font-weight: 500; color: #111827; }
.modal-close { background: none; border: none; font-size: 22px; color: #9ca3af; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: #374151; }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid #f0f0f0; }

/* ===================== EXTRAS ===================== */
.adjunto-btn { background: none; border: 1px solid #e5e7eb; padding: 3px 8px; border-radius: 5px; cursor: pointer; font-size: 12px; color: #6b7280; }
.adjunto-btn:hover { background: #f9fafb; border-color: #8B0000; color: #8B0000; }
.saldo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.saldo-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; text-align: center; }
.saldo-num { font-size: 26px; font-weight: 600; color: #8B0000; }
.saldo-label { font-size: 11px; color: #6b7280; margin-top: 2px; }
.mt-8 { margin-top: 8px; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
