/* ── Loading / Error ── */
.at-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.9rem;
    padding: 2rem 0;
}

.at-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: at-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes at-spin {
    to { transform: rotate(360deg); }
}

.at-error-banner {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ── Header actions ── */
.ta-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── View toggle ── */
.ta-view-toggle {
    display: inline-flex;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.ta-toggle-btn {
    padding: 0.42rem 0.9rem;
    border: none;
    background: #fff;
    color: #6b7280;
    font-size: 0.83rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.ta-toggle-btn:not(:last-child) {
    border-right: 1.5px solid #e5e7eb;
}

.ta-toggle-btn--active {
    background: #6366f1;
    color: #fff;
    font-weight: 600;
}

.ta-toggle-btn:not(.ta-toggle-btn--active):hover {
    background: #f3f4f6;
}

/* ── Export buttons ── */
.ah-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.83rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.ah-export-btn:not(:disabled):hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ah-export-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Filter bar ── */
.at-filterbar {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.at-filterbar-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ah-range-sep {
    font-size: 0.85rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.ah-clear-btn {
    padding: 0.42rem 0.85rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    font-size: 0.83rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease;
    flex-shrink: 0;
}

.ah-clear-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.at-filterbar-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.42rem 0.75rem;
    color: #9ca3af;
    transition: border-color 0.15s ease;
}

.at-filterbar-date:focus-within {
    border-color: #6366f1;
}

.at-filterbar-date input[type="date"] {
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #111827;
    font-family: inherit;
    background: transparent;
    cursor: pointer;
}

.at-filterbar-search {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.42rem 0.75rem;
    color: #9ca3af;
    transition: border-color 0.15s ease;
}

.at-filterbar-search:focus-within {
    border-color: #6366f1;
}

.at-filterbar-search input {
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #111827;
    font-family: inherit;
    background: transparent;
    flex: 1;
    width: 100%;
}

.at-filterbar-search input::placeholder {
    color: #9ca3af;
}

.at-filterbar-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f9fafb;
    border: 1.5px solid #f3f4f6;
    border-radius: 12px;
    padding: 0.45rem 0.75rem;
    flex-wrap: wrap;
}

.at-chip-group {
    display: flex;
    gap: 0.25rem;
}

.at-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    border: 1.5px solid transparent;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.at-chip:hover { background: #fff; color: #374151; border-color: #e5e7eb; }

.at-chip--on {
    background: #fff;
    border-color: #c7d2fe;
    color: #4338ca;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.12);
}

.at-chip--green  { border-color: #bbf7d0 !important; color: #166534 !important; background: #f0fdf4 !important; }
.at-chip--purple { border-color: #ddd6fe !important; color: #4338ca !important; background: #f5f3ff !important; }
.at-chip--amber  { border-color: #fde68a !important; color: #92400e !important; background: #fffbeb !important; }
.at-chip--grace  { border-color: #fef08a !important; color: #854d0e !important; background: #fefce8 !important; }
.at-chip--red    { border-color: #fecaca !important; color: #991b1b !important; background: #fff1f2 !important; }

.at-chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.at-chip-dot--green  { background: #16a34a; }
.at-chip-dot--purple { background: #6366f1; }
.at-chip-dot--amber  { background: #d97706; }

.at-filter-sep { width: 1px; height: 20px; background: #e5e7eb; flex-shrink: 0; margin: 0 0.15rem; }

.at-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    padding: 0.22rem 0.55rem;
    color: #9ca3af;
}

.at-select-wrap:focus-within { border-color: #6366f1; }

.at-select-wrap select {
    border: none;
    outline: none;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}

.at-flag-legend-strip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-left: 0.75rem;
    border-left: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.at-flag-legend-label { font-size: 0.73rem; color: #9ca3af; font-weight: 600; white-space: nowrap; }
.at-flag-legend-item { display: inline-flex; align-items: center; gap: 0.28rem; font-size: 0.73rem; color: #6b7280; white-space: nowrap; }

/* ── Status pills ── */
.at-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.at-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.at-status-checkedin .at-status-dot  { background: #16a34a; }
.at-status-checkedin                  { background: #dcfce7; color: #166534; }
.at-status-checkedout .at-status-dot  { background: #6366f1; }
.at-status-checkedout                  { background: #ede9fe; color: #4338ca; }
.at-status-autoclosed .at-status-dot  { background: #d97706; }
.at-status-autoclosed                  { background: #fef3c7; color: #92400e; }
.at-status-onbreak .at-status-dot     { background: #7c3aed; animation: at-pulse 1.4s ease-in-out infinite; }
.at-status-onbreak                     { background: #ede9fe; color: #5b21b6; }

/* ── Active break indicator ── */
.at-break-active {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #7c3aed;
    font-weight: 600;
    white-space: nowrap;
}

.at-break-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7c3aed;
    flex-shrink: 0;
    animation: at-pulse 1.4s ease-in-out infinite;
}

@keyframes at-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Flags ── */
.at-flags { display: flex; gap: 0.3rem; }

.at-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.3rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.at-flag--grace    { background: #fef9c3; color: #a16207; }
.at-flag--late     { background: #fef3c7; color: #92400e; }
.at-flag--verylate { background: #fee2e2; color: #991b1b; }
.at-flag--early    { background: #fee2e2; color: #991b1b; }

/* ── Expandable rows ── */
.at-row--expanded td { background: #fafafa; }

.at-break-detail-row td { background: #f9fafb; border-bottom: 1px solid #f3f4f6; }

.at-break-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
}

.at-break-list__label { font-size: 0.78rem; color: #9ca3af; font-weight: 600; }

.at-break-chip {
    display: inline-block;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    color: #374151;
}

/* ── Empty state ── */
.at-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: #9ca3af;
    font-size: 0.9rem;
}

/* ── Pagination ── */
.at-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid #f3f4f6;
}

.at-page-btn {
    padding: 0.45rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.at-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.at-page-btn:not(:disabled):hover { background: #f3f4f6; }
.at-page-info { font-size: 0.85rem; color: #6b7280; }

/* ── Clickable rows ── */
.table-row { cursor: pointer; }
.table-row:hover td { background: #fafafa; }

/* ── Summary table sort ── */
.ta-sortable {
    cursor: pointer;
    user-select: none;
}

.ta-sortable:hover {
    background: #f9fafb;
}

.ta-sort-icon {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-left: 0.2rem;
}

/* ── Inline style replacements ── */
.ta-card-body-flush {
    padding: 0;
}

/* ── Late count badge ── */
.ta-late-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 0.35rem;
}
