/* =========================================================
   ARMS ticket archive and machine history
   ========================================================= */

.atl-page {
    --atl-border: #d8e2ef;
    --atl-ink: #14213d;
    --atl-muted: #64748b;
    display: grid;
    gap: 1rem;
    padding-bottom: 1rem;
}

.atl-toolbar {
    display: flex;
    min-height: 4.25rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem;
    border: 1px solid var(--atl-border);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .045);
}

.atl-search {
    width: min(34rem, 100%);
}

.atl-toolbar-label,
.atl-toolbar-title {
    display: block;
}

.atl-toolbar-label {
    color: var(--atl-muted);
    font-size: .68rem;
}

.atl-toolbar-title {
    color: var(--atl-ink);
    font-size: .88rem;
}

.atl-count {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: baseline;
    gap: .35rem;
    padding: .42rem .7rem;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
}

.atl-count strong {
    font-size: 1rem;
}

.atl-count span {
    font-size: .68rem;
    font-weight: 800;
}

.atl-state {
    display: grid;
    min-height: 15rem;
    place-items: center;
    align-content: center;
    gap: .7rem;
    padding: 2rem;
    border: 1px solid var(--atl-border);
    border-radius: 17px;
    background: #fff;
    color: var(--atl-muted);
    text-align: center;
}

.atl-state strong {
    color: var(--atl-ink);
}

.atl-state p {
    max-width: 30rem;
    margin: 0;
    font-size: .8rem;
}

.atl-empty-icon {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    border-radius: 18px;
    background: #dcfce7;
    color: #15803d;
    font-size: 1.4rem;
    font-weight: 900;
}

.atl-spinner {
    display: inline-block;
    width: .95rem;
    height: .95rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: atl-spin .75s linear infinite;
}

.atl-spinner-large {
    width: 1.8rem;
    height: 1.8rem;
    border-width: 3px;
    color: #2563eb;
}

.atl-table-wrap {
    overflow: hidden;
    border: 1px solid var(--atl-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.atl-table {
    margin: 0;
    vertical-align: middle;
}

.atl-table thead th {
    padding: .8rem .75rem;
    border-bottom-color: #dbe4ef;
    background: #f8fafc;
    color: #475569;
    font-size: .68rem;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.atl-table tbody td {
    padding: .78rem .75rem;
    border-bottom-color: #edf2f7;
    color: #334155;
    font-size: .78rem;
}

.atl-table tbody tr:last-child td {
    border-bottom: 0;
}

.atl-table tbody tr:hover {
    background: #f8fbff;
}

.atl-ticket-number {
    color: #075eb5;
    font-weight: 850;
    text-decoration: none;
}

.atl-ticket-number:hover {
    text-decoration: underline;
}

.atl-card-list {
    display: none;
}

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

@media (min-width: 992px) {
    html {
        overflow-y: scroll;
        scrollbar-gutter: stable;
    }
}

@media (max-width: 767.98px) {
    .atl-page {
        gap: .75rem;
        padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
    }

    .atl-toolbar {
        min-height: auto;
        align-items: stretch;
        flex-direction: column;
        border-radius: 14px;
    }

    .atl-search {
        width: 100%;
    }

    .atl-count {
        align-self: flex-start;
    }

    .atl-table-wrap {
        display: none;
    }

    .atl-card-list {
        display: grid;
        gap: .75rem;
    }

    .atl-card {
        overflow: hidden;
        border: 1px solid var(--atl-border);
        border-radius: 15px;
        background: #fff;
        box-shadow: 0 5px 18px rgba(15, 23, 42, .055);
    }

    .atl-card-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: .75rem;
        padding: .85rem .9rem;
        border-bottom: 1px solid #e8eef5;
        background: #f8fafc;
    }

    .atl-card-top > div > span {
        display: block;
        margin-top: .15rem;
        color: var(--atl-muted);
        font-size: .66rem;
    }

    .atl-approved-badge {
        display: inline-flex;
        padding: .3rem .55rem;
        border-radius: 999px;
        background: #dcfce7;
        color: #15803d;
        font-size: .66rem;
        font-weight: 850;
    }

    .atl-machine {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: .9rem;
    }

    .atl-machine span {
        color: var(--atl-muted);
        font-size: .7rem;
    }

    .atl-machine strong {
        color: var(--atl-ink);
        font-size: 1.08rem;
    }

    .atl-card-meta {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
        padding: 0 .9rem .9rem;
    }

    .atl-card-meta-three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .atl-card-meta > span {
        min-width: 0;
        padding: .55rem;
        border-radius: 10px;
        background: #f8fafc;
    }

    .atl-card-meta small,
    .atl-card-meta strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .atl-card-meta small {
        margin-bottom: .18rem;
        color: var(--atl-muted);
        font-size: .6rem;
    }

    .atl-card-meta strong {
        color: #334155;
        font-size: .72rem;
    }

    .atl-details {
        display: flex;
        min-height: 2.8rem;
        margin: 0 .9rem .9rem;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        font-weight: 800;
    }

    .atl-state {
        min-height: 12rem;
        border-radius: 14px;
    }
}

@media (max-width: 399.98px) {
    .atl-card-meta-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .atl-card-meta-three > span:last-child {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .atl-spinner {
        animation-duration: 1.5s;
    }
}
