.attendance-page {
    display: grid;
    gap: 22px;
}

.attendance-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 26px;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    background: #fff;
}

.attendance-hero h1 {
    margin: 6px 0 8px;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.attendance-eyebrow {
    margin: 0;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    color: #64748b;
}

.attendance-subtitle {
    margin: 0;
    color: #64748b;
    line-height: 1.8;
}

.attendance-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.attendance-date,
.attendance-select,
.attendance-search input {
    min-height: 44px;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    background: #fff;
    padding: 0 13px;
    font: inherit;
}

.attendance-refresh {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    padding: 0 18px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    background: #111827;
    color: #fff;
}

.attendance-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.attendance-kpi {
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
}

.attendance-kpi span {
    display: block;
    color: #64748b;
    font-size: .86rem;
    margin-bottom: 9px;
}

.attendance-kpi strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1;
}

.attendance-kpi small {
    display: block;
    margin-top: 9px;
    color: #94a3b8;
}

.attendance-panel {
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    background: #fff;
    overflow: hidden;
}

.attendance-toolbar {
    display: grid;
    grid-template-columns:
        minmax(220px, 1fr)
        minmax(160px, 220px)
        minmax(160px, 220px);
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid #edf0f4;
}

.attendance-search input,
.attendance-select {
    width: 100%;
}

.attendance-summary {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    color: #64748b;
    font-size: .88rem;
    border-bottom: 1px solid #edf0f4;
}

.attendance-table-wrap {
    overflow-x: auto;
}

.attendance-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

.attendance-table th,
.attendance-table td {
    padding: 15px 16px;
    text-align: right;
    border-bottom: 1px solid #edf0f4;
    vertical-align: middle;
}

.attendance-table th {
    font-size: .78rem;
    color: #64748b;
    background: #f8fafc;
    white-space: nowrap;
}

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

.attendance-employee {
    display: flex;
    align-items: center;
    gap: 11px;
}

.attendance-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 900;
}

.attendance-employee strong,
.attendance-employee small {
    display: block;
}

.attendance-employee small {
    margin-top: 3px;
    color: #94a3b8;
}

.attendance-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}

.attendance-badge.is-success {
    background: #dcfce7;
    color: #166534;
}

.attendance-badge.is-warning {
    background: #fef3c7;
    color: #92400e;
}

.attendance-badge.is-danger {
    background: #fee2e2;
    color: #991b1b;
}

.attendance-badge.is-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.attendance-badge.is-neutral {
    background: #f1f5f9;
    color: #475569;
}

.attendance-row-action {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.attendance-loading,
.attendance-empty,
.attendance-error {
    padding: 44px 20px;
    text-align: center;
}

.attendance-error {
    color: #991b1b;
    background: #fef2f2;
}

.attendance-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, .38);
}

.attendance-drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1110;
    width: min(470px, 94vw);
    height: 100dvh;
    overflow-y: auto;
    background: #fff;
    box-shadow: 18px 0 50px rgba(15, 23, 42, .18);
}

.attendance-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 22px;
    border-bottom: 1px solid #e5e7eb;
}

.attendance-drawer-header h2 {
    margin: 0 0 5px;
}

.attendance-drawer-header p {
    margin: 0;
    color: #64748b;
}

.attendance-drawer-close {
    width: 40px;
    height: 40px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
}

.attendance-drawer-body {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.attendance-detail-card {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.attendance-detail-card h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.attendance-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.attendance-detail-item {
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
}

.attendance-detail-item span,
.attendance-detail-item strong {
    display: block;
}

.attendance-detail-item span {
    margin-bottom: 5px;
    color: #64748b;
    font-size: .76rem;
}

.attendance-detail-item strong {
    overflow-wrap: anywhere;
}

.attendance-location {
    direction: ltr;
    text-align: left;
}

@media (max-width: 1100px) {
    .attendance-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .attendance-hero {
        flex-direction: column;
    }

    .attendance-hero-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .attendance-date {
        width: 100%;
    }

    .attendance-toolbar {
        grid-template-columns: 1fr;
    }

    .attendance-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .attendance-kpis {
        grid-template-columns: 1fr;
    }

    .attendance-hero-actions {
        grid-template-columns: 1fr;
    }

    .attendance-refresh {
        width: 100%;
    }
}
/* UI-8.4D2-B SCHEDULE MANAGEMENT */

.attendance-schedule-action {
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    color: #0f172a;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

.attendance-schedule-action:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 23, 42, .24);
    box-shadow: 0 7px 18px rgba(15, 23, 42, .08);
}

.attendance-schedule-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.attendance-schedule-cell small {
    color: #64748b;
    font-size: 12px;
}

.attendance-schedule-badge,
.attendance-state-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.attendance-schedule-badge.is-scheduled,
.attendance-state-pill.is-active {
    background: #ecfdf5;
    color: #047857;
}

.attendance-schedule-badge.is-day-off {
    background: #eff6ff;
    color: #1d4ed8;
}

.attendance-schedule-badge.is-leave {
    background: #fff7ed;
    color: #c2410c;
}

.attendance-schedule-badge.is-holiday {
    background: #f5f3ff;
    color: #6d28d9;
}

.attendance-schedule-badge.is-cancelled {
    background: #fef2f2;
    color: #b91c1c;
}

.attendance-employee-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.attendance-employee-cell small {
    color: #64748b;
}

.attendance-schedule-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    direction: rtl;
}

.attendance-schedule-modal.is-open {
    display: block;
}

.attendance-schedule-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(3px);
}

.attendance-schedule-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.attendance-schedule-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.attendance-schedule-kicker {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.attendance-schedule-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 21px;
}

.attendance-schedule-header p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 13px;
}

.attendance-schedule-close {
    border: 0;
    background: #f1f5f9;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #334155;
    font-size: 24px;
    cursor: pointer;
}

.attendance-schedule-form {
    padding: 22px 26px 26px;
}

.attendance-schedule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.attendance-schedule-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.attendance-schedule-field-wide {
    grid-column: 1 / -1;
}

.attendance-schedule-field > span {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.attendance-schedule-field input,
.attendance-schedule-field select,
.attendance-schedule-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 11px;
    padding: 10px 12px;
    font: inherit;
    outline: none;
}

.attendance-schedule-field input,
.attendance-schedule-field select {
    min-height: 43px;
}

.attendance-schedule-field textarea {
    resize: vertical;
    min-height: 86px;
}

.attendance-schedule-field input:focus,
.attendance-schedule-field select:focus,
.attendance-schedule-field textarea:focus {
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, .12);
}

.attendance-schedule-field.is-disabled {
    opacity: .48;
}

.attendance-schedule-timezone {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
}

.attendance-schedule-error {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 700;
}

.attendance-schedule-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.attendance-schedule-primary,
.attendance-schedule-secondary {
    min-height: 42px;
    padding: 9px 18px;
    border-radius: 11px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.attendance-schedule-primary {
    border: 1px solid #0f172a;
    background: #0f172a;
    color: #fff;
}

.attendance-schedule-primary:disabled {
    opacity: .6;
    cursor: wait;
}

.attendance-schedule-secondary {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
}

.attendance-schedule-toast {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 10050;
    max-width: min(420px, calc(100vw - 48px));
    padding: 12px 16px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition:
        opacity .18s ease,
        transform .18s ease;
}

.attendance-schedule-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.attendance-schedule-toast[data-type="success"] {
    background: #065f46;
}

.attendance-schedule-toast[data-type="error"] {
    background: #991b1b;
}

.attendance-schedule-modal-open {
    overflow: hidden;
}

@media (max-width: 680px) {
    .attendance-schedule-panel {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 16px;
    }

    .attendance-schedule-header,
    .attendance-schedule-form {
        padding-left: 18px;
        padding-right: 18px;
    }

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

    .attendance-schedule-field-wide {
        grid-column: auto;
    }

    .attendance-schedule-actions {
        flex-direction: column-reverse;
    }

    .attendance-schedule-primary,
    .attendance-schedule-secondary {
        width: 100%;
    }

    .attendance-schedule-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}
/* UI-8.4D2-D1 ACTION GROUP */

.attendance-row-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.attendance-schedule-row-action {
    border-color: rgba(14, 116, 144, .22);
    background: #ecfeff;
    color: #0e7490;
}

.attendance-schedule-row-action:hover {
    border-color: rgba(14, 116, 144, .38);
    background: #cffafe;
}

.attendance-schedule-live-badge {
    background: #ecfdf5;
    color: #047857;
}

@media (max-width: 760px) {
    .attendance-row-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
/* Schedule breaks and "repeat until" (client schedule setup) */
.schedule-breaks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.schedule-breaks label, .schedule-repeat label { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.schedule-breaks input { width: 100%; }
.schedule-repeat { display: grid; gap: 8px; }
.schedule-weekdays { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.schedule-repeat small { opacity: .75; }
@media (max-width: 600px) { .schedule-breaks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
