.am-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.am-summary article,
.am-panel {
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.68);
}

.am-summary article {
    padding: 16px;
}

.am-summary span,
.am-summary strong,
.am-summary small {
    display: block;
}

.am-summary span {
    color: #94a3b8;
    font-size: 12px;
}

.am-summary strong {
    margin-top: 7px;
    font-size: 24px;
}

.am-summary small {
    margin-top: 4px;
    color: #64748b;
}

.am-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 2px;
    overflow-x: auto;
}

.am-tabs button {
    white-space: nowrap;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.72);
    color: #94a3b8;
}

.am-tabs button.active {
    border-color: #3b82f6;
    background: rgba(37, 99, 235, 0.16);
    color: #dbeafe;
}

.am-panel {
    padding: 20px;
}

.am-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.am-head.compact {
    margin-top: 24px;
}

.am-head h3 {
    margin: 0 0 5px;
}

.am-head p {
    margin: 0;
    color: #64748b;
}

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

.am-filter-card {
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.28);
}

.am-filter-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.am-filter-card header > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.am-filter-card label,
.am-general-grid label,
.am-limit-grid label,
.am-threshold label,
.am-head > label {
    display: grid;
    gap: 6px;
    color: #cbd5e1;
    font-size: 12px;
}

.am-filter-card select,
.am-filter-card input,
.am-general-grid input,
.am-limit-grid input,
.am-threshold input,
.am-threshold select,
.am-panel input,
.am-panel select {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.80);
    color: #f8fafc;
}

.am-two,
.am-general-grid,
.am-limit-grid,
.am-whitelist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.am-two {
    margin-top: 12px;
}

.am-limit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.am-switch {
    display: inline-flex;
}

.am-switch input {
    display: none;
}

.am-switch span {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #334155;
}

.am-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: 0.18s;
}

.am-switch input:checked + span {
    background: #2563eb;
}

.am-switch input:checked + span::after {
    transform: translateX(20px);
}

.am-suffix {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.am-suffix span {
    padding: 0 10px;
    color: #64748b;
}

.am-thresholds {
    display: grid;
    gap: 10px;
}

.am-threshold {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.25);
}

.hidden {
    display: none !important;
}

.am-users {
    display: grid;
    gap: 10px;
}

.am-user {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 13px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
}

.am-user strong,
.am-user span {
    display: block;
}

.am-user > div:first-child span {
    color: #64748b;
    font-size: 11px;
}

.am-score {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.13);
    color: #fde68a;
}

.am-badges,
.am-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.am-badges span,
.am-selected span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
}

.am-badges button,
.am-selected button {
    padding: 0;
    background: none;
    color: #94a3b8;
}

.am-add,
.am-adjust {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.am-adjust {
    grid-template-columns: 120px 1fr auto auto;
}

.am-savebar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 16px;
    padding: 14px 18px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
}

.am-savebar > div {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.am-savebar .success {
    color: #86efac;
}

.am-savebar .error {
    color: #fca5a5;
}

.am-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.80);
}

.am-modal {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 17px;
    background: #111827;
}

.am-modal header {
    display: flex;
    justify-content: space-between;
    padding: 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.am-modal header h3,
.am-modal header p {
    margin: 0;
}

.am-modal header p {
    margin-top: 4px;
    color: #64748b;
}

.am-modal-body {
    max-height: 70vh;
    padding: 18px;
    overflow: auto;
}

.am-history {
    display: grid;
    gap: 9px;
    margin-top: 16px;
}

.am-history article {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 11px;
}

.am-history strong,
.am-history span {
    display: block;
}

.am-history article > div span {
    color: #64748b;
    font-size: 12px;
}

.positive {
    color: #fbbf24;
}

.negative {
    color: #86efac;
}

.am-empty {
    padding: 30px;
    border: 1px dashed rgba(148, 163, 184, 0.20);
    border-radius: 12px;
    color: #64748b;
    text-align: center;
}

@media (max-width: 900px) {
    .am-summary,
    .am-filter-grid,
    .am-limit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .am-threshold {
        grid-template-columns: 1fr 1fr;
    }

    .am-user {
        grid-template-columns: 1fr auto;
    }

    .am-whitelist {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .am-summary,
    .am-filter-grid,
    .am-limit-grid,
    .am-general-grid,
    .am-two {
        grid-template-columns: 1fr;
    }

    .am-panel {
        padding: 15px;
    }

    .am-head {
        flex-direction: column;
    }

    .am-adjust,
    .am-add {
        grid-template-columns: 1fr;
    }

    .am-savebar {
        flex-wrap: wrap;
    }

    .am-savebar > div {
        width: 100%;
    }

    .am-threshold {
        grid-template-columns: 1fr;
    }
}
