/* T2 component styles — tokens from admin.css :root only (except a-code surfaces). */

.a-card,
.a-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}

.a-card {
    margin-bottom: var(--s-4);
    overflow: hidden;
}

.a-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-5);
    border-bottom: 1px solid var(--line);
}

.a-card__header h2 {
    font-size: 15px;
    line-height: 22px;
    font-weight: 600;
}

.a-card__body {
    padding: var(--s-5);
}

@media (max-width: 639px) {
    .a-card__body {
        padding: var(--s-4);
    }
}

.a-card--flush .a-card__body {
    padding: 0;
}

.a-stat {
    display: grid;
    gap: var(--s-1);
    padding: var(--s-5);
    color: var(--ink-2);
}

.a-stat__label {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--fs-sm);
    line-height: 20px;
    font-weight: 500;
    color: var(--muted);
}

.a-stat__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.a-stat--ok .a-stat__dot { color: var(--ok); }
.a-stat--warn .a-stat__dot { color: var(--warn); }
.a-stat--danger .a-stat__dot { color: var(--danger); }
.a-stat--info .a-stat__dot { color: var(--info); }
.a-stat--accent .a-stat__dot { color: var(--accent); }
.a-stat--muted .a-stat__dot { color: var(--muted); }

.a-stat__value,
.a-stat strong {
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.a-stat small {
    font-size: var(--fs-xs);
    line-height: 18px;
    color: var(--muted);
}

.a-stat--featured {
    background: var(--accent-soft);
    border-color: transparent;
}

.a-badge,
.a-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1;
    font-weight: 600;
}

.a-badge--ok,
.a-status--ok { background: var(--ok-soft); color: var(--ok); }
.a-badge--warn,
.a-status--warn { background: var(--warn-soft); color: var(--warn); }
.a-badge--danger,
.a-status--danger { background: var(--danger-soft); color: var(--danger); }
.a-badge--info,
.a-status--info { background: var(--info-soft); color: var(--info); }
.a-badge--accent,
.a-status--accent { background: var(--accent-soft); color: var(--accent); }
.a-badge--muted,
.a-status--muted { background: var(--surface-2); color: var(--muted); }

.a-badge__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.a-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    margin: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--sh-3);
}

.a-dialog::backdrop {
    background: rgba(13, 20, 18, .55);
}

.a-dialog[open] {
    animation: a-dialog-in 200ms cubic-bezier(.2, .8, .2, 1);
}

.a-dialog__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-5);
    border-bottom: 1px solid var(--line);
}

.a-dialog__header h2 {
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
}

.a-dialog__body {
    padding: var(--s-5);
}

.a-dialog__footer,
.a-dialog__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--s-2);
    padding: var(--s-4) var(--s-5) var(--s-5);
}

.a-dialog__body .a-dialog__actions {
    padding: var(--s-5) 0 0;
    margin: 0;
}

@media (max-width: 639px) {
    .a-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 92vh;
        margin: auto 0 0;
        border-radius: var(--r-lg) var(--r-lg) 0 0;
    }
}

.a-toasts {
    position: fixed;
    inset-inline-start: 24px;
    bottom: 24px;
    z-index: 40;
    display: grid;
    gap: var(--s-2);
    width: min(360px, calc(100vw - 48px));
    pointer-events: none;
}

.a-toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: var(--r-md);
    color: var(--surface);
    background: var(--ink);
    box-shadow: var(--sh-2);
    font-size: var(--fs-sm);
    line-height: 20px;
}

.a-toast--ok { background: var(--ok); }
.a-toast--warn { background: var(--warn); }
.a-toast--danger { background: var(--danger); }
.a-toast--info { background: var(--info); }

.a-secret {
    margin-block: var(--s-4);
    display: grid;
    gap: var(--s-2);
}

.a-secret__value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s-2);
    background: var(--surface-2);
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.a-secret__value code {
    font-family: JetBrains, monospace;
    direction: ltr;
    unicode-bidi: isolate;
    filter: blur(5px);
    user-select: none;
}

.a-secret__value[data-revealed="true"] code {
    filter: none;
    user-select: text;
}

.a-empty {
    text-align: center;
    padding: var(--s-8) var(--s-4);
    color: var(--muted);
    display: grid;
    justify-items: center;
    gap: var(--s-2);
}

.a-empty .a-icon {
    width: 40px;
    height: 40px;
    color: var(--muted);
}

.a-empty .a-icon svg {
    width: 40px;
    height: 40px;
}

.a-empty strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
    line-height: 22px;
    font-weight: 600;
}

.a-empty p {
    margin: 0;
    max-width: 36ch;
}

.a-pagination {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-4);
    color: var(--ink-2);
}

.a-pagination__btn,
.a-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    transition: background 150ms cubic-bezier(.2, .8, .2, 1), border-color 150ms cubic-bezier(.2, .8, .2, 1);
}

.a-pagination a:hover {
    background: var(--surface-2);
}

.a-pagination__btn[aria-disabled="true"] {
    opacity: .45;
    pointer-events: none;
}

.a-filters {
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}

.a-filters__toggle {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    user-select: none;
}

.a-filters__toggle::-webkit-details-marker {
    display: none;
}

.a-filters__body {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    align-items: end;
    margin-top: var(--s-3);
}

@media (min-width: 768px) {
    .a-filters__toggle {
        display: none;
    }

    .a-filters__body {
        margin-top: 0;
    }

    .a-filters:not([open]) > .a-filters__body {
        display: flex;
    }
}

@media (max-width: 767px) {
    .a-filters:not([open]) > .a-filters__body {
        display: none;
    }
}

.a-search,
.a-select {
    min-width: min(100%, 220px);
}

.a-search input[type="search"],
.a-select select {
    min-height: 40px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 0 12px;
}

.a-search-input {
    width: 100%;
    min-height: 40px;
    margin-block: 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 0 12px;
    background: var(--surface);
}

.a-search-results {
    max-height: 320px;
    overflow: auto;
}

.a-search-results a {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.a-search-results a:focus,
.a-search-results a:hover,
.a-search-results [aria-selected="true"] {
    background: var(--accent-soft);
    outline: none;
}

.a-toggle,
.a-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.a-toggle input,
.a-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.a-toggle__track,
.a-switch__track {
    width: 40px;
    height: 24px;
    border-radius: var(--r-pill);
    background: var(--line-strong);
    position: relative;
    flex: none;
    transition: background 150ms cubic-bezier(.2, .8, .2, 1);
}

.a-toggle__track::after,
.a-switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--sh-1);
    transition: transform 150ms cubic-bezier(.2, .8, .2, 1);
}

.a-toggle input:checked + .a-toggle__track,
.a-switch input:checked + .a-switch__track {
    background: var(--accent);
}

.a-toggle input:checked + .a-toggle__track::after,
.a-switch input:checked + .a-switch__track::after {
    transform: translateX(-16px);
}

.a-toggle input:focus-visible + .a-toggle__track,
.a-switch input:focus-visible + .a-switch__track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.a-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.a-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.a-identity > span:last-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.a-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.a-pulse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 18px;
}

.a-pulse__dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
    background: var(--muted);
}

.a-pulse__dot--online,
.a-pulse__dot--recent {
    background: var(--ok);
}

.a-pulse__dot--online {
    animation: a-pulse 2s infinite;
}

@keyframes a-pulse {
    0% { box-shadow: 0 0 0 0 var(--ok); }
    70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.a-sparkline {
    display: block;
    width: 100%;
    height: 80px;
    color: var(--accent);
}

.a-bars {
    display: block;
    width: 100%;
    height: 160px;
    color: var(--accent);
}

.a-chart-empty {
    color: var(--muted);
    font-size: var(--fs-sm);
    padding: var(--s-5);
    text-align: center;
}

.a-hourstrip {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 4px;
    align-items: end;
    height: 64px;
}

.a-hourstrip span {
    min-height: 2px;
    height: var(--v, 3%);
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    opacity: .75;
}

.a-timeline {
    padding: 0;
    list-style: none;
    border-inline-start: 2px solid var(--line);
    margin: 0;
    margin-inline-start: 8px;
}

.a-timeline > *,
.a-timeline__item {
    position: relative;
    padding: 0 20px 20px 0;
}

.a-timeline > *::before,
.a-timeline__item::before {
    content: "";
    position: absolute;
    inset-inline-start: -6px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.a-skeleton {
    background: var(--line);
    border-radius: var(--r-sm);
    animation: a-skeleton 1.5s ease-in-out infinite alternate;
}

@keyframes a-skeleton {
    to { opacity: .45; }
}

.a-code {
    position: relative;
    background: #0E1714;
    color: #D7E5DF;
    border-radius: 10px;
    overflow: hidden;
}

.a-code__copy {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    z-index: 1;
    min-width: 32px;
    min-height: 32px;
    color: #D7E5DF;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(215, 229, 223, .2);
    border-radius: var(--r-sm);
}

.a-code__copy:hover {
    background: rgba(255, 255, 255, .12);
}

.a-code pre,
.a-code code {
    margin: 0;
    font-family: JetBrains, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    direction: ltr;
    unicode-bidi: isolate;
    white-space: pre;
}

.a-code pre {
    padding: 16px;
    padding-inline-end: 48px;
    overflow-x: auto;
    max-width: 100%;
}

.a-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--s-3);
}

.a-checklist__item {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--ink);
}

.a-checklist__icon {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.a-checklist__item[data-done="true"] .a-checklist__icon {
    color: var(--ok);
}

.a-checklist__item[data-done="false"] .a-checklist__circle {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--muted);
    border-radius: 50%;
    opacity: .7;
}

@keyframes a-dialog-in {
    from {
        opacity: 0;
        transform: scale(.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .a-dialog[open],
    .a-skeleton,
    .a-pulse__dot--online,
    .a-toggle__track,
    .a-toggle__track::after,
    .a-switch__track,
    .a-switch__track::after,
    .a-pagination a {
        animation: none !important;
        transition: none !important;
    }
}

@media (pointer: coarse) {
    .a-pagination__btn,
    .a-pagination a,
    .a-code__copy,
    .a-toggle__track,
    .a-switch__track {
        min-height: 44px;
    }

    .a-toggle__track,
    .a-switch__track {
        width: 48px;
        height: 28px;
    }
}
