/* ===== Reset & Variables ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f2f4f6;
    --sidebar-bg: #2c2c2c;
    --sidebar-text: #b0b0b0;
    --sidebar-active: #ffffff;
    --card-bg: #ffffff;
    --text: #363636;
    --text-secondary: #636161;
    --gray: #636161;
    --teal: #4799a3;
    --teal-light: #57c7d4;
    --primary: #4799a3;
    --primary-light: #e8f5f7;
    --primary-gradient: linear-gradient(135deg, #4799a3, #57c7d4);
    --green: #059669;
    --green-light: #ecfdf5;
    --orange: #d97706;
    --orange-light: #fffbeb;
    --red: #dc2626;
    --red-light: #fef2f2;
    --blue: #4799a3;
    --blue-light: #e8f5f7;
    --purple: #636161;
    --purple-light: #f0f0f0;
    --border: #e5e7eb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --transition: 0.2s ease;
}

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

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

/* ===== Sidebar ===== */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 10px;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.logo-img {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
}

.logo-sub {
    font-size: 12px;
    color: var(--teal-light);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.employee-list {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.employee-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: none;
    color: var(--sidebar-text);
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: 13px;
}

.employee-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.employee-item.active {
    background: var(--primary-gradient);
    color: #fff;
}

.employee-item .emp-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.employee-item.active .emp-avatar-small {
    background: rgba(255,255,255,0.2);
}

.employee-item .emp-name-small {
    font-weight: 500;
    line-height: 1.3;
}

.employee-item .emp-role-small {
    font-size: 11px;
    opacity: 0.7;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 11px;
    opacity: 0.5;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    margin-left: 280px;
    padding: 24px 32px;
    max-width: 1200px;
}

/* ===== Dashboard ===== */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-icon {
    width: 40px;
    height: auto;
}

.dashboard-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.dashboard-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.dashboard-chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    position: relative;
    height: 380px;
}

.dashboard-chart-card canvas {
    width: 100% !important;
    height: 100% !important;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.dash-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--teal);
}

.dash-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

/* ===== Employee Meta Row (dates + contract) ===== */
.emp-meta-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.emp-meta-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.input-group-sm label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.input-date {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #fafafa;
    transition: border-color var(--transition);
}

.input-date:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.emp-seniority {
    font-size: 12px;
    color: var(--teal);
    font-weight: 500;
    white-space: nowrap;
    padding-bottom: 6px;
}

/* Contract upload zone */
.contract-zone {
    margin-left: auto;
    cursor: pointer;
}

.contract-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    transition: all var(--transition);
}

.contract-placeholder:hover {
    border-color: var(--teal-light);
    color: var(--teal);
    background: var(--primary-light);
}

.contract-attached {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--teal-light);
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--teal);
    font-size: 12px;
    font-weight: 500;
}

.btn-sm {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--teal);
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.btn-sm:hover {
    background: rgba(71, 153, 163, 0.15);
}

.btn-sm-danger {
    color: var(--text-secondary);
}

.btn-sm-danger:hover {
    color: var(--red);
    background: var(--red-light);
}

/* ===== Employee Header ===== */
.employee-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
    flex-wrap: wrap;
}

.employee-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.employee-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.employee-info h2 {
    font-size: 22px;
    font-weight: 700;
}

.emp-job {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

.emp-badges {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.hourly-cost-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 24px;
    text-align: right;
    box-shadow: var(--shadow);
    border: 2px solid var(--teal-light);
    position: relative;
    overflow: hidden;
}

.hourly-cost-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.hourly-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hourly-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin: 4px 0;
}

.hourly-sub {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== Salary Input ===== */
.salary-input-section {
    margin-bottom: 24px;
}

.salary-input-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 180px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    transition: border-color var(--transition);
    background: #fafafa;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.input-suffix {
    position: absolute;
    right: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    pointer-events: none;
}

.btn-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-reset:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Summary Cards ===== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: transform var(--transition);
}

.summary-card:hover {
    transform: translateY(-1px);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-gross .card-icon { background: var(--primary-light); color: var(--teal); }
.card-employee .card-icon { background: var(--orange-light); color: var(--orange); }
.card-net .card-icon { background: var(--green-light); color: var(--green); }
.card-employer .card-icon { background: var(--red-light); color: var(--red); }
.card-total .card-icon { background: #e8f5f7; color: var(--gray); }
.card-netpay .card-icon { background: var(--green-light); color: var(--green); }

.card-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

.card-gross .card-value { color: var(--teal); }
.card-employee .card-value { color: var(--orange); }
.card-net .card-value { color: var(--green); }
.card-employer .card-value { color: var(--red); }
.card-total .card-value { color: var(--gray); }
.card-netpay .card-value { color: var(--green); }

/* ===== Detail Tables ===== */
.detail-tables {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.detail-header:hover {
    background: #fafafa;
}

.detail-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
}

.detail-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.chevron {
    transition: transform var(--transition);
}

.detail-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.detail-body.open {
    max-height: 2000px;
}

.detail-header .chevron {
    transform: rotate(0deg);
}

.detail-body.open ~ .detail-header .chevron,
.detail-body:not(.open) + .detail-header .chevron {
    transform: rotate(-90deg);
}

.charges-table {
    width: 100%;
    border-collapse: collapse;
}

.charges-table thead {
    background: #f8f9fb;
}

.charges-table th {
    padding: 10px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
}

.charges-table th:last-child,
.charges-table td:last-child {
    text-align: right;
}

.charges-table th:nth-child(2),
.charges-table td:nth-child(2),
.charges-table th:nth-child(3),
.charges-table td:nth-child(3) {
    text-align: right;
}

.charges-table td {
    padding: 10px 20px;
    font-size: 13px;
    border-top: 1px solid #f0f1f3;
}

.charges-table tr:hover td {
    background: #fafbfc;
}

.charges-table .section-label td {
    background: #f8f9fb;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 20px;
}

.charges-table .total-row td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    font-size: 14px;
    background: #f8f9fb;
}

/* Recap Table */
.recap-card {
    border: 2px solid var(--teal-light);
    position: relative;
    overflow: hidden;
}

.recap-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.recap-card .detail-header {
    cursor: default;
}

.recap-table {
    width: 100%;
    border-collapse: collapse;
}

.recap-table td {
    padding: 12px 20px;
    font-size: 14px;
    border-top: 1px solid #f0f1f3;
}

.recap-table td:last-child {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.recap-table .recap-highlight td {
    font-size: 16px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
}

.recap-table .recap-green td {
    color: var(--green);
    font-weight: 700;
    font-size: 15px;
}

.recap-table .recap-red td {
    color: var(--red);
}

.recap-table .recap-separator td {
    padding: 2px;
    background: var(--border);
}

/* ===== Compliance Alerts Section ===== */
.alerts-section {
    margin-bottom: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.alerts-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.alerts-header:hover {
    background: #fafafa;
}

.alerts-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--teal);
}

.alerts-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.alerts-badges {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.alert-badge-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-badge-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-badge-info {
    background: #e8f5f7;
    color: var(--teal);
    border: 1px solid #b2e0e6;
}

.alert-badge-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.alerts-chevron {
    color: var(--text-secondary);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.alerts-section.collapsed .alerts-chevron {
    transform: rotate(-90deg);
}

.alerts-section.collapsed .syntec-alerts {
    display: none;
}

.syntec-alerts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
}

.syntec-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.syntec-alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.syntec-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.syntec-alert-content strong {
    font-weight: 600;
    font-size: 13px;
}

.syntec-alert-content span {
    font-size: 12px;
    opacity: 0.85;
}

.syntec-alert-rule {
    font-size: 11px !important;
    opacity: 0.6 !important;
    font-style: italic;
    margin-top: 2px;
}

/* Error */
.syntec-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.syntec-error .syntec-alert-icon { color: #dc2626; }

/* Warning */
.syntec-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.syntec-warning .syntec-alert-icon { color: #d97706; }

/* Info */
.syntec-info {
    background: #e8f5f7;
    border: 1px solid #b2e0e6;
    color: #1a6d75;
}

.syntec-info .syntec-alert-icon { color: var(--teal); }

/* Success */
.syntec-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.syntec-success .syntec-alert-icon { color: #059669; }

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.employee-view {
    animation: fadeIn 0.3s ease;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        width: 220px;
        min-width: 220px;
    }
    .main {
        margin-left: 220px;
        padding: 16px;
    }
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .employee-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .hourly-cost-card {
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }
    .main {
        margin-left: 0;
    }
    .app {
        flex-direction: column;
    }
    .salary-input-card {
        flex-direction: column;
    }
    .summary-cards {
        grid-template-columns: 1fr;
    }
}
