:root {
    --ink: #1f1d3a;
    --muted: #6b6b80;
    --line: #e4e4ee;
    --bg: #f6f6fb;
    --card: #ffffff;
    --primary: #5b3fd6;
    --primary-hover: #4a31b8;
    --up: #1e8e3e;
    --down: #c5221f;
    --danger: #c5221f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

h1, h2 {
    margin: 0;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.error {
    color: var(--danger);
    font-size: 14px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}

.btn-danger {
    background: #fff;
    border-color: #f2c4c3;
    color: var(--danger);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-large {
    padding: 12px 28px;
    font-size: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    font-size: 20px;
}

.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 32px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.section-header p {
    margin: 4px 0 0;
}

.notice {
    padding: 12px 16px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: #fff4e5;
    color: #8a5300;
    font-size: 14px;
}

.accounts {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
}

.account-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.account-name {
    font-weight: 700;
    font-size: 16px;
}

.account-actions {
    display: flex;
    gap: 8px;
}

.domain {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.domain-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.domain-name {
    font-weight: 600;
}

.overall {
    font-size: 14px;
}

.llms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.llm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
}

.llm-name {
    color: var(--muted);
}

.llm-score {
    font-weight: 700;
}

.change {
    font-size: 12px;
    font-weight: 600;
}

.change-up {
    color: var(--up);
}

.change-down {
    color: var(--down);
}

.change-none {
    color: var(--muted);
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 18, 40, 0.45);
    z-index: 10;
}

.modal-content {
    width: min(460px, calc(100vw - 32px));
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
}

.modal-content h2 {
    margin-bottom: 16px;
}

.modal-content label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
}

.modal-content input,
.modal-content select {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    font-weight: normal;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-buttons {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.spacer {
    flex: 1;
}

.view-session {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: var(--card);
    z-index: 20;
}

.view-session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.view-session-bar h2 {
    font-size: 18px;
}

.view-session iframe {
    flex: 1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    width: min(380px, calc(100vw - 32px));
    padding: 36px 28px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: center;
}

.login-card h1 {
    font-size: 22px;
    margin-bottom: 6px;
}

.login-card .muted {
    margin-bottom: 22px;
}

.spinner {
    width: 28px;
    height: 28px;
    margin: 8px auto;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
    .topbar,
    .content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .section-header,
    .account-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
