*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); color-scheme: dark; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 500 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.tnum { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

.h-display { font-size: clamp(40px, 7vw, 76px); font-weight: 700; line-height: 1.02; letter-spacing: -.035em; }
.h-1 { font-size: 32px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.h-2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.h-3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

.btn {
    --glass-line: rgba(255, 255, 255, .1);
    --glass-line-hi: rgba(255, 255, 255, .3);
    --glass-tint: rgba(255, 255, 255, .1);
    --glass-ink: #ececef;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    overflow: hidden;
    border: 1px solid var(--glass-line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .035);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
    color: var(--glass-ink);
    font-size: 13.5px;

    font-weight: 500;
    letter-spacing: -.005em;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: border-color 180ms var(--ease-out), background 180ms var(--ease-out),
        color 180ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn > * { position: relative; }
.btn .icon { width: 16px; height: 16px; }

.btn:hover:not(:disabled) {
    border-color: var(--glass-line-hi);
    background: var(--glass-tint);
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 3px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

.btn-sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-block { width: 100%; }

.btn-primary,
.btn-soft {
    --glass-line: rgba(99, 102, 241, .2);
    --glass-line-hi: rgba(99, 102, 241, .5);
    --glass-tint: rgba(99, 102, 241, .1);
    --glass-ink: #c7d2fe;
}

.btn-ok {
    --glass-line: rgba(34, 197, 94, .2);
    --glass-line-hi: rgba(34, 197, 94, .5);
    --glass-tint: rgba(34, 197, 94, .1);
    --glass-ink: #bbf7d0;
}

.btn-bad {
    --glass-line: rgba(239, 68, 68, .2);
    --glass-line-hi: rgba(239, 68, 68, .5);
    --glass-tint: rgba(239, 68, 68, .1);
    --glass-ink: #fecaca;
}

.btn-ghost {
    border-color: transparent;
    background: none;
    box-shadow: none;
    color: var(--text-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.btn-ghost:hover:not(:disabled) {
    border-color: transparent;
    background: rgba(255, 255, 255, .06);
    box-shadow: none;
    color: var(--text);
    transform: none;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
}

.btn-icon.btn-sm { width: 34px; height: 34px; }
.btn-icon.btn-lg { width: 48px; height: 48px; }
.btn-icon .icon { width: 18px; height: 18px; }
.btn-icon.btn-lg .icon { width: 22px; height: 22px; }

.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading .icon { opacity: 0; }
.btn.is-loading::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 15px;
    margin: -7.5px 0 0 -7.5px;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: var(--glass-ink);
    border-radius: 50%;
    content: "";
    animation: spin .7s linear infinite;
}

.btn-solid {
    border-color: transparent;
    background: #f4f4f5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color: #09090b;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.aurora-page a.btn-solid { color: #09090b; }

.btn-solid:hover:not(:disabled) {
    border-color: transparent;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    transform: none;
}

.btn-solid:active:not(:disabled) { background: #e4e4e7; transform: none; }
.btn-solid.is-loading::after { border-color: rgba(9, 9, 11, .2); border-top-color: #09090b; }

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

.field { display: grid; gap: 8px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.label .req { color: var(--bad); }
.hint { font-size: 12px; color: var(--text-3); }

.input, .select, .textarea {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.textarea { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; }
.select {
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 6 3-3 3 3M5 10l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span {
    position: absolute;
    inset: 0;
    background: var(--press);
    border-radius: var(--r-pill);
    pointer-events: none;
    transition: background var(--t) var(--ease);
}
.switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
    transition: transform var(--t-slow) var(--ease), width var(--t) var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:active + span::after { width: 24px; }
.switch input:checked:active + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }

.segmented {
    position: relative;
    display: inline-flex;
    padding: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}
.segmented button {
    position: relative;
    z-index: 1;
    height: 32px;
    padding: 0 14px;
    border: 0;
    background: none;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--t) var(--ease);
}
.segmented button[aria-pressed="true"] { color: var(--text); }
.segmented .thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    background: var(--hover);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    transition: transform var(--t-slow) var(--ease), width var(--t-slow) var(--ease);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
}
.card-pad { padding: var(--s-5); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); }
.card-hover { transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t-slow) var(--ease); will-change: transform; }
.card-hover:hover { border-color: var(--line-strong); background: var(--raised); transform: translateY(-2px); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    background: var(--raised);
    border: 1px solid var(--line-strong);
    color: var(--text-2);
}
.badge-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.badge-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-hi); }
.badge-code { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; border-radius: var(--r-xs); }

.avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    background: var(--raised);
    border: 1px solid var(--line-strong);
    font-weight: 700;
    color: var(--text-2);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--raised); }

.empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-2);
    font-size: 14px;
}

.skeleton {
    border-radius: var(--r-sm);
    background: linear-gradient(90deg, var(--raised) 0%, var(--hover) 50%, var(--raised) 100%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.menu {
    position: absolute;
    z-index: 30;
    min-width: 220px;
    padding: 6px;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity var(--t) var(--ease), transform var(--t-slow) var(--ease);
}
.menu.is-open { opacity: 1; transform: none; pointer-events: auto; }

.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, .6);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-slow) var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
    width: min(460px, 100%);
    background: var(--surface);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-pop);
    transform: scale(.96) translateY(8px);
    transition: transform var(--t-slow) var(--ease);
}
.overlay.is-open .modal { transform: none; }

.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    padding: 12px 14px;
    background: var(--raised);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    font-size: 14px;
    animation: toast-in var(--t-slow) var(--ease-out);
}
.toast.is-leaving { animation: toast-out var(--t) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.savebar {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 8px 8px 18px;
    background: var(--raised);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    font-size: 14px;
    transform: translate(-50%, 140%);
    transition: transform var(--t-slow) var(--ease);
}
.savebar.is-open { transform: translate(-50%, 0); }
.savebar span { margin-right: 24px; color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
    .btn,
    .btn:hover:not(:disabled),
    .btn:active:not(:disabled) { transform: none; }
}
