:root {
    color-scheme: light;
}

.dark {
    color-scheme: dark;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    border-radius: .5rem;
    padding: .65rem .75rem;
    color: rgb(71 85 105);
    font-size: .925rem;
    font-weight: 500;
    transition: background-color .18s ease, color .18s ease;
}

.dark .nav-item {
    color: rgb(203 213 225);
}

.nav-item:hover {
    background: rgb(241 245 249);
    color: rgb(15 23 42);
}

.dark .nav-item:hover {
    background: rgb(30 41 59);
    color: white;
}

.nav-item-active,
.dark .nav-item-active {
    background: rgb(14 116 144);
    color: white;
}

.icon-button {
    display: inline-grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    border: 1px solid rgb(226 232 240);
    border-radius: .5rem;
    background: white;
    color: rgb(51 65 85);
}

.dark .icon-button {
    border-color: rgb(30 41 59);
    background: rgb(15 23 42);
    color: rgb(226 232 240);
}

.icon-button svg {
    width: 1.05rem;
    height: 1.05rem;
}

.search-input,
.form-input {
    width: 100%;
    border-radius: .5rem;
    border: 1px solid rgb(203 213 225);
    background: white;
    color: rgb(15 23 42);
    min-height: 2.5rem;
    padding: .55rem .75rem;
    font-size: .925rem;
    outline: none;
}

.search-input {
    padding-left: 2.4rem;
}

.dark .search-input,
.dark .form-input {
    border-color: rgb(51 65 85);
    background: rgb(15 23 42);
    color: rgb(248 250 252);
}

.form-input:focus,
.search-input:focus {
    border-color: rgb(14 116 144);
    box-shadow: 0 0 0 3px rgb(14 116 144 / .15);
}

.form-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: rgb(71 85 105);
}

.dark .form-label {
    color: rgb(203 213 225);
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: .5rem;
    padding: .55rem .9rem;
    font-size: .9rem;
    font-weight: 650;
    white-space: nowrap;
}

.btn-primary {
    background: rgb(14 116 144);
    color: white;
}

.btn-primary:hover {
    background: rgb(21 94 117);
}

.btn-secondary {
    border: 1px solid rgb(203 213 225);
    background: white;
    color: rgb(51 65 85);
}

.dark .btn-secondary {
    border-color: rgb(51 65 85);
    background: rgb(15 23 42);
    color: rgb(226 232 240);
}

.panel,
.metric-card {
    border: 1px solid rgb(226 232 240);
    border-radius: .5rem;
    background: white;
    padding: 1rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / .04);
}

.dark .panel,
.dark .metric-card {
    border-color: rgb(30 41 59);
    background: rgb(15 23 42);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title {
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 700;
}

.panel-subtitle {
    color: rgb(100 116 139);
    font-size: .875rem;
}

.dark .panel-subtitle {
    color: rgb(148 163 184);
}

.segmented {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid rgb(203 213 225);
    border-radius: .5rem;
}

.dark .segmented {
    border-color: rgb(51 65 85);
}

.segmented button {
    min-width: 3.5rem;
    padding: .45rem .65rem;
    font-size: .8rem;
    color: rgb(71 85 105);
}

.dark .segmented button {
    color: rgb(203 213 225);
}

.segmented .active {
    background: rgb(14 116 144);
    color: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.data-table th {
    color: rgb(100 116 139);
    font-size: .75rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid rgb(226 232 240);
    padding: .85rem .75rem;
    vertical-align: middle;
}

.dark .data-table th,
.dark .data-table td {
    border-color: rgb(30 41 59);
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .25rem .55rem;
    font-size: .75rem;
    font-weight: 700;
}

.badge-green { background: rgb(220 252 231); color: rgb(22 101 52); }
.badge-blue { background: rgb(219 234 254); color: rgb(30 64 175); }
.badge-cyan { background: rgb(207 250 254); color: rgb(21 94 117); }
.badge-amber { background: rgb(254 243 199); color: rgb(146 64 14); }

.dark .badge-green { background: rgb(20 83 45); color: rgb(187 247 208); }
.dark .badge-blue { background: rgb(30 64 175); color: rgb(219 234 254); }
.dark .badge-cyan { background: rgb(21 94 117); color: rgb(207 250 254); }
.dark .badge-amber { background: rgb(120 53 15); color: rgb(254 243 199); }

.status-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    margin-right: .45rem;
    border-radius: 999px;
    background: rgb(16 185 129);
}

.status-limited,
.status-token_expiring {
    background: rgb(245 158 11);
}

.status-paused,
.status-error {
    background: rgb(239 68 68);
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
}

.check-row::before {
    content: "";
    flex: 0 0 auto;
    width: .55rem;
    height: .55rem;
    margin-top: .38rem;
    border-radius: 999px;
    background: rgb(16 185 129);
}

.timeline-item {
    position: relative;
    padding-left: 1.35rem;
    color: rgb(71 85 105);
    font-size: .925rem;
}

.dark .timeline-item {
    color: rgb(203 213 225);
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: .35rem;
    width: .65rem;
    height: .65rem;
    border: 2px solid rgb(14 116 144);
    border-radius: 999px;
}

.ai-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(2 6 23 / .72);
    backdrop-filter: blur(10px);
}

.ai-loading-overlay[hidden] {
    display: none;
}

.ai-loading-card {
    width: min(92vw, 34rem);
    border: 1px solid rgb(34 211 238 / .35);
    border-radius: .75rem;
    background: white;
    padding: 1.5rem;
    box-shadow: 0 24px 80px rgb(2 6 23 / .35);
}

.dark .ai-loading-card {
    border-color: rgb(34 211 238 / .22);
    background: rgb(15 23 42);
}

.ai-orbit {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgb(14 116 144 / .18), transparent 62%);
}

.ai-orbit::before {
    content: "";
    position: absolute;
    inset: .9rem;
    border-radius: 999px;
    border: 2px solid rgb(14 116 144 / .22);
}

.ai-orbit span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: .65rem;
    height: .65rem;
    margin: -.325rem;
    border-radius: 999px;
    background: rgb(14 116 144);
    animation: ai-spin 1.4s linear infinite;
}

.ai-orbit span:nth-child(2) {
    animation-delay: -.45s;
    background: rgb(5 150 105);
}

.ai-orbit span:nth-child(3) {
    animation-delay: -.9s;
    background: rgb(37 99 235);
}

@keyframes ai-spin {
    from { transform: rotate(0deg) translateX(1.85rem) rotate(0deg); }
    to { transform: rotate(360deg) translateX(1.85rem) rotate(-360deg); }
}

.ai-progress {
    height: .55rem;
    margin-top: 1.25rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgb(226 232 240);
}

.dark .ai-progress {
    background: rgb(30 41 59);
}

.ai-progress span {
    display: block;
    width: 18%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgb(14 116 144), rgb(5 150 105));
    transition: width .45s ease;
}

.ai-loading-steps {
    margin-top: 1rem;
    display: grid;
    gap: .55rem;
    color: rgb(100 116 139);
    font-size: .875rem;
}

.dark .ai-loading-steps {
    color: rgb(148 163 184);
}

.ai-loading-steps li {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ai-loading-steps li::before {
    content: "";
    width: .45rem;
    height: .45rem;
    border-radius: 999px;
    background: rgb(148 163 184);
}

.ai-loading-steps li.active {
    color: rgb(14 116 144);
    font-weight: 700;
}

.dark .ai-loading-steps li.active {
    color: rgb(103 232 249);
}

.ai-loading-steps li.active::before {
    background: rgb(14 116 144);
}

@media (max-width: 767px) {
    .panel-header {
        flex-direction: column;
    }

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