:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #eab308;
    --warning-light: #fef9c3;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --muted: #6b7280;
    --muted-light: #f3f4f6;
    --text: #111827;
    --text-light: #374151;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

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

.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--primary);
    color: var(--white);
    padding: 0.75rem 2rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-center {
    text-align: center;
}

.clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clock-date {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: capitalize;
}

.clock-time {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.user-icon {
    font-size: 1.2rem;
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-secondary {
    background-color: var(--white);
    color: var(--text-light);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--muted-light);
}

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

.btn-success:hover {
    background-color: #15803d;
}

.btn-warning {
    background-color: var(--warning);
    color: var(--text);
}

.btn-warning:hover {
    background-color: #ca8a04;
}

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

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.btn-block {
    width: 100%;
}

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

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.toolbar h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.toolbar-right {
    display: flex;
    gap: 0.5rem;
}

/* Workers Table */
.workers-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

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

.workers-table th,
.workers-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.workers-table th {
    background-color: var(--muted-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-light);
}

.workers-table tbody tr:hover {
    background-color: var(--bg);
}

.workers-table tbody tr:last-child td {
    border-bottom: none;
}

.loading-cell {
    text-align: center;
    color: var(--muted);
    padding: 2rem !important;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-not_arrived {
    background-color: var(--danger-light);
    color: var(--danger);
}

.status-working {
    background-color: var(--success-light);
    color: var(--success);
}

.status-lunch {
    background-color: var(--warning-light);
    color: #a16207;
}

.status-completed {
    background-color: var(--muted-light);
    color: var(--muted);
}

/* Summary Cards */
.summary-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.summary-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.summary-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.summary-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--muted) !important; }

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-md);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
    line-height: 1.5;
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-light);
}

.modal-content input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--muted);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-light);
}

.login-form input {
    width: 100%;
    padding: 0.7rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-form .btn {
    margin-top: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
}

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-error {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid #86efac;
}

/* Reports */
.reports-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* Schedule Section */
.schedule-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.reports-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.report-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.no-data {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
}

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

.report-results th,
.report-results td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.report-results th {
    background-color: var(--muted-light);
    font-weight: 600;
}

.report-summary {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.report-summary-item {
    font-size: 0.9rem;
}

.report-summary-item strong {
    color: var(--primary);
}

/* Admin Section */
.admin-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.admin-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tab-header h3 {
    font-size: 1rem;
}

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

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: var(--muted-light);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Schedule Grid */
.schedule-form-container {
    max-width: 800px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.form-row label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-row select,
.form-row input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.schedule-grid {
    display: grid;
    gap: 1rem;
}

.schedule-day {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 100px auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.schedule-day-name {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: capitalize;
}

.schedule-day input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Audit */
.audit-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.audit-filters label {
    font-size: 0.85rem;
    font-weight: 500;
}

.audit-filters input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.audit-detail {
    font-size: 0.8rem;
    color: var(--muted);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    main {
        padding: 1rem;
    }

    .toolbar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .workers-table {
        font-size: 0.85rem;
    }

    .workers-table th,
    .workers-table td {
        padding: 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .schedule-day {
        grid-template-columns: 1fr;
    }

    .report-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-wrap: wrap;
    }
}
