/* ===== BASE ===== */
:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e3a55;
    --accent: #27ae60;
    --accent-hover: #219a52;
    --surface: #ffffff;
    --surface-alt: #f8f9fa;
    --border: #dee2e6;
    --text: #2c3e50;
    --text-muted: #6c757d;
    --danger: #c0392b;
    --warning: #f39c12;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.1);
    --radius: 8px;
    --radius-lg: 12px;
}

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--surface-alt);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

a { color: var(--primary-light); }
a:hover { color: var(--primary); }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    padding: 2rem 1rem;
}

.login-container {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.login-info {
    background: var(--primary);
    color: #fff;
    padding: 3rem 2.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.login-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.login-brand-icon img {
    width: 28px;
    height: 28px;
}

.login-info h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.login-info .tagline {
    font-size: 1.05rem;
    opacity: .9;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.login-info .feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.login-info .feature-list li {
    padding: .45rem 0;
    font-size: .95rem;
    opacity: .9;
}

.login-info .feature-list li::before {
    content: "\f26e";
    font-family: "bootstrap-icons";
    margin-right: .6rem;
    font-weight: normal;
    opacity: .7;
}

.login-form-section {
    padding: 3rem 2.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-section h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
}

@media (max-width: 767.98px) {
    .login-container { flex-direction: column; }
    .login-info { padding: 2rem 1.5rem; }
    .login-form-section { padding: 2rem 1.5rem; }
}

/* ===== APP SHELL ===== */
.app-topbar {
    background: var(--primary);
    color: #fff;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.app-topbar .brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    text-decoration: none;
    margin-right: 2rem;
}

.app-topbar .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
}

.app-topbar .nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .25rem;
    flex: 1;
}

.app-topbar .nav-links a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: .5rem .85rem;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.app-topbar .nav-links .mobile-logout {
    display: none;
}

.app-topbar .nav-links a:hover,
.app-topbar .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,.15);
}

.app-topbar .nav-right {
    margin-left: auto;
}

.app-topbar .nav-right a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;
    padding: .5rem .85rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}

.app-topbar .nav-right a:hover {
    color: #fff;
    background: rgba(255,255,255,.15);
}

.app-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
    width: 100%;
}

/* Mobile nav toggle */
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
    padding: .25rem .5rem;
}

@media (max-width: 991.98px) {
    .topbar-toggle { display: block; }
    .app-topbar { flex-wrap: wrap; position: relative; }
    .app-topbar .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        padding: .5rem 0 1rem;
        gap: 0;
        z-index: 1040;
        box-shadow: 0 4px 12px rgba(0,0,0,.2);
        list-style: none;
        margin: 0;
    }
    .app-topbar .nav-links.show { display: flex; }
    .app-topbar .nav-links a { padding: .6rem 1.25rem; display: block; }
    .app-topbar .nav-right { display: none; }
    .app-topbar .nav-links .mobile-logout { display: none; }
    .app-topbar .nav-links.show .mobile-logout { display: list-item; }
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 1.75rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.page-header p {
    color: var(--text-muted);
    margin: .25rem 0 0;
    font-size: 1rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
    padding: .85rem 1.25rem;
}

.card-body { padding: 1.25rem; }

/* Summary stat cards */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: .15rem;
}

.stat-card .stat-label {
    font-size: .9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Quick action cards */
.action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .15s, border-color .15s;
}

.action-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
}

.action-card .action-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.action-card .action-icon.bg-primary-subtle { background: #d6eaf8; color: var(--primary); }
.action-card .action-icon.bg-accent-subtle { background: #d5f5e3; color: var(--accent); }
.action-card .action-icon.bg-warning-subtle { background: #fef9e7; color: var(--warning); }
.action-card .action-icon.bg-info-subtle { background: #d1ecf1; color: #0c5460; }

.action-card .action-text strong {
    display: block;
    font-size: 1rem;
}

.action-card .action-text span {
    font-size: .875rem;
    color: var(--text-muted);
}

/* ===== TABLES ===== */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--surface-alt);
    font-weight: 600;
    font-size: .875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom-width: 2px;
    padding: .75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: .7rem 1rem;
    vertical-align: middle;
    font-size: .95rem;
    border-color: #f0f2f4;
    white-space: nowrap;
}

.table tbody tr:hover { background: #f8fafc; }

.table-subtotal td {
    font-weight: 600;
    background: #f0f4f8 !important;
    border-top: 2px solid var(--border);
}

.table-grandtotal td {
    font-weight: 700;
    background: #e8eef4 !important;
    border-top: 2px solid var(--primary);
    color: var(--primary);
}

/* ===== BADGES ===== */
.badge-status {
    display: inline-block;
    padding: .25em .65em;
    border-radius: 50px;
    font-size: .82rem;
    font-weight: 600;
}

.badge-active { background: #d5f5e3; color: #1e8449; }
.badge-on-leave { background: #fef9e7; color: #b7950b; }
.badge-inactive { background: #f2f3f4; color: #6c757d; }
.badge-in-progress { background: #d6eaf8; color: #1a5276; }
.badge-completed { background: #d5f5e3; color: #1e8449; }
.badge-not-started { background: #f2f3f4; color: #6c757d; }
.badge-partial { background: #fef9e7; color: #b7950b; }
.badge-paid { background: #d5f5e3; color: #1e8449; }
.badge-unpaid { background: #fadbd8; color: #922b21; }

.badge-pay-type {
    display: inline-block;
    padding: .2em .55em;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
    background: #eaf2f8;
    color: var(--primary);
}

.badge-pay-hourly { background: #d6eaf8; color: #1a5276; }
.badge-pay-fixed { background: #d5f5e3; color: #1e8449; }
.badge-pending { background: #fef9e7; color: #b7950b; }

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: 6px;
    padding: .5rem 1.25rem;
}

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

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    padding: .5rem 1.25rem;
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: 6px;
}

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

/* ===== FORMS ===== */
.form-label {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
    margin-bottom: .35rem;
}

.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid var(--border);
    padding: .5rem .85rem;
    font-size: .95rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(41,128,185,.15);
}

/* ===== SECTION TITLES ===== */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.section-title:first-child { margin-top: 0; }

/* ===== FILTER BAR ===== */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: end;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-width: 160px;
}

.filter-bar .filter-group label {
    font-size: .82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* ===== ACTIVITY LIST ===== */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .7rem 0;
    border-bottom: 1px solid #f0f2f4;
}

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

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: .45rem;
    flex-shrink: 0;
}

.activity-dot.type-time { background: var(--primary-light); }
.activity-dot.type-payment { background: var(--accent); }
.activity-dot.type-job { background: var(--warning); }
.activity-dot.type-employee { background: #8e44ad; }

.activity-text { font-size: .925rem; }
.activity-time { font-size: .82rem;

/* ===== MODAL / FORM CARD OVERLAY ===== */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.form-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

/* ===== REPORT SECTIONS ===== */
.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: box-shadow .15s;
}

.report-card:hover { box-shadow: var(--shadow); }

.report-card .report-icon {
    font-size: 2rem;
    margin-bottom: .5rem;
    color: var(--primary);
}

.report-card h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.report-card p {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ===== FOOTER ===== */
.app-footer {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: .875rem;
    margin-top: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    align-self: stretch;
}

/* ===== PAYMENT PROGRESS ===== */
.payment-progress-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.payment-progress {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    overflow: hidden;
}

.payment-progress .progress-bar {
    border-radius: 3px;
    transition: width .3s ease;
}

.payment-progress-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* ===== OT COLUMN TINTING ===== */
.th-ot1 {
    background: #fef9e7 !important;
    color: #b7950b !important;
}

.th-ot2 {
    background: #fadbd8 !important;
    color: #922b21 !important;
}

.td-ot1 {
    background: #fffdf4;
}

.td-ot2 {
    background: #fef5f4;
}

/* ===== FORM CARD HIGHLIGHT ===== */
.form-card-highlight {
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

/* ===== FORM HELPER TEXT ===== */
.form-helper-text {
    font-size: .88rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    margin-top: -.5rem;
}

/* ===== UTILITIES ===== */
.text-money { font-family: 'Segoe UI', monospace; font-weight: 600; }
.gap-grid { gap: 1rem; }

/* ===== REPORT META STRIP ===== */
.report-meta-strip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.report-meta-item {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.report-meta-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.report-meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== REPORT CARD LINK ===== */
.report-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.report-card-link:hover { text-decoration: none; color: inherit; }

.report-card-link .report-card {
    border-color: var(--primary-light);
    position: relative;
}

.report-card-link .report-card::after {
    content: "\F138";
    font-family: "bootstrap-icons";
    position: absolute;
    top: .75rem;
    right: .75rem;
    font-size: .85rem;
    color: var(--primary-light);
    opacity: .6;
}

.report-card-link:hover .report-card {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.report-card-link:hover .report-card::after { opacity: 1; }

/* ===== PROJECT BY JOB — EXPANDABLE ROWS ===== */
.pbjob-expandable:hover {
    background: #f0f6fb !important;
}

.pbjob-this-period {
    color: var(--primary-light);
    font-weight: 700;
}

.pbjob-detail-inner {
    padding: 0;
    border-top: 2px solid var(--border);
}

.pbjob-detail-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .6rem 1.25rem;
    background: #eef2f7;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.pbjob-detail-table {
    background: var(--surface);
    border-radius: 0;
    overflow: hidden;
    border: none;
    margin-bottom: 0;
}

.pbjob-detail-table thead th {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: #f4f7fb;
    padding: .55rem 1.25rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.pbjob-detail-table tbody td {
    font-size: .88rem;
    padding: .55rem 1.25rem;
    border-color: #f0f2f4;
}

.pbjob-detail-table tfoot td {
    font-size: .88rem;
    font-weight: 700;
    padding: .55rem 1.25rem;
    background: #f0f4f8 !important;
    border-top: 2px solid var(--border);
}
