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

:root {
    --primary: #2F5496;
    --primary-light: #4472C4;
    --primary-dark: #1F3864;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    --bg: #F5F6FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E1E8ED;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* === HEADER === */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    position: relative;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header .subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* === NOTIFICATION BELL === */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.notification-bell:hover {
    background: rgba(255,255,255,0.15);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 1100;
    overflow: hidden;
}

.notif-dropdown.active {
    display: block;
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover {
    background: #F8FAFF;
}

.notif-item.notif-read {
    opacity: 0.6;
}

.notif-item.notif-critical {
    border-left: 3px solid var(--danger);
}

.notif-item.notif-warning {
    border-left: 3px solid var(--warning);
}

.notif-item.notif-info {
    border-left: 3px solid var(--info);
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.notif-message {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.notif-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* === LAYOUT === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #f0f2f5;
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #EDF2FB;
}

/* === PANELS === */
.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* === CARDS === */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

/* === OFFER LIST === */
.offer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.offer-item:hover {
    border-color: var(--primary-light);
    background: #F8FAFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47,84,150,0.1);
}

.offer-item .offer-info h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.offer-item .offer-meta {
    font-size: 0.8rem;
    color: var(--text-light);
}

.offer-item .badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-sala { background: #E8F4FD; color: #1565C0; }
.badge-cocina { background: #FFF3E0; color: #E65100; }
.badge-count { background: #EDF2FB; color: var(--primary); }

/* === URGENCY BADGES === */
.urgency-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.urgency-baja { background: #E8F5E9; color: #2E7D32; }
.urgency-media { background: #FFF3E0; color: #E65100; }
.urgency-alta { background: #FFF3E0; color: #E65100; border: 1px solid #F39C12; }
.urgency-critica { background: #FFEBEE; color: #C62828; border: 1px solid #E74C3C; animation: urgency-pulse 2s infinite; }

@keyframes urgency-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* === FORMS === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,84,150,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover { background: #219A52; }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { background: #C0392B; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

/* === CANDIDATE TABLE === */
.candidates-table {
    width: 100%;
    border-collapse: collapse;
}

.candidates-table th {
    background: var(--primary);
    color: white;
    padding: 0.8rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
}

.candidates-table th:first-child { border-radius: 8px 0 0 0; }
.candidates-table th:last-child { border-radius: 0 8px 0 0; }

.candidates-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    vertical-align: middle;
}

.candidates-table tr:hover {
    background: #F8FAFF;
}

/* === SCORE BAR === */
.score-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-bar .bar,
.bar {
    flex: 1;
    height: 8px;
    background: #E8E8E8;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar .bar-fill,
.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-high { background: var(--success); }
.score-medium { background: var(--warning); }
.score-low { background: var(--danger); }

.score-number {
    font-weight: 700;
    min-width: 35px;
    text-align: right;
}

/* === STATUS BADGES === */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.status-nuevo { background: #F0F0F0; color: #666; }
.status-preseleccionado { background: #C6EFCE; color: #1B5E20; }
.status-en_revision { background: #FFEB9C; color: #7F6003; }
.status-descartado { background: #FFC7CE; color: #9C2B2E; }
.status-contratado { background: #B4C6E7; color: #1F3864; }

/* === FILTERS === */
.filters-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filters-bar select,
.filters-bar input {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}

/* === MODAL === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* === CANDIDATE DETAIL === */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.detail-item {
    padding: 0.5rem;
}

.detail-item .detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.detail-item .detail-value {
    font-size: 0.95rem;
    margin-top: 0.2rem;
}

/* === AI ANALYSIS BOX === */
.ai-analysis-box {
    background: #EDF2FB;
    border: 1px solid var(--primary-light);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* === STAR RATING === */
.star-rating .star {
    font-size: 1.8rem;
    color: #DDD;
    cursor: pointer;
    transition: color 0.15s;
}

.star-rating .star:hover,
.star-rating .star.active {
    color: #F39C12;
}

.star-rating .star:hover ~ .star {
    color: #DDD;
}

/* === CRITERIA FEEDBACK === */
.criteria-fb-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
}

.criteria-fb-row label {
    width: 120px;
    font-weight: 500;
}

.criteria-fb-row .fb-options {
    display: flex;
    gap: 0.3rem;
}

.criteria-fb-row .fb-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
}

.criteria-fb-row .fb-btn:hover { border-color: var(--primary); }
.criteria-fb-row .fb-btn.selected-ok { background: #C6EFCE; border-color: #27AE60; }
.criteria-fb-row .fb-btn.selected-high { background: #FFC7CE; border-color: #E74C3C; }
.criteria-fb-row .fb-btn.selected-low { background: #FFEB9C; border-color: #F39C12; }

/* === PRECISION PANEL === */
.precision-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.8rem;
}

.precision-meter {
    height: 20px;
    background: #E8E8E8;
    border-radius: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.precision-meter-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s;
}

/* === AGENT STATUS === */
.agent-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.agent-status-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    transition: box-shadow 0.2s;
}

.agent-status-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.agent-dot-ok {
    background: var(--success);
}

.agent-dot-error {
    background: var(--danger);
}

.agent-status-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.agent-error {
    color: var(--danger);
    font-weight: 500;
}

/* === AGENT ACTIONS FEED === */
.action-item {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.action-item:last-child {
    border-bottom: none;
}

.action-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.action-agent {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: #EDF2FB;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.action-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-left: auto;
}

.action-desc {
    font-size: 0.85rem;
    color: var(--text);
}

.action-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
}

.action-status-executed { background: #C6EFCE; color: #1B5E20; }
.action-status-pending { background: #FFEB9C; color: #7F6003; }
.action-status-approved { background: #B4C6E7; color: #1F3864; }
.action-status-rejected { background: #FFC7CE; color: #9C2B2E; }

/* === PENDING ACTIONS === */
.pending-action-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    background: #FFFDF5;
    border-left: 4px solid var(--warning);
}

.pending-reasoning {
    font-size: 0.83rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.pending-suggestion {
    font-size: 0.83rem;
    color: var(--text);
    margin-bottom: 0.3rem;
    padding: 0.3rem 0.5rem;
    background: #EDF2FB;
    border-radius: 6px;
}

.pending-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

/* === STRATEGIC REPORT === */
.strategic-header {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.strategic-summary {
    font-size: 0.95rem;
    color: var(--text);
    padding: 0.8rem;
    background: #EDF2FB;
    border-radius: 8px;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.strategic-section {
    margin-bottom: 1rem;
}

.strategic-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.strategic-item {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.strategic-item strong {
    display: block;
    margin-bottom: 0.2rem;
}

.strategic-item p {
    color: var(--text-light);
    font-size: 0.82rem;
}

.priority-item {
    border-left: 3px solid var(--danger);
}

.risk-item {
    border-left: 3px solid var(--warning);
}

.mitigation {
    color: var(--success) !important;
    font-style: italic;
    margin-top: 0.3rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .header { flex-direction: column; gap: 0.5rem; }
    .agent-status-grid { grid-template-columns: 1fr; }
    .notif-dropdown { width: 300px; right: -1rem; }
}
