/* v2 components: icons, buttons, cards, forms, tables, badges, tabs, modals, empty states. */

/* ---------- Icons ---------- */

.ico {
    display: inline-block;
    width: 20px;
    height: 20px;
    flex: none;
    vertical-align: -0.2em;
    fill: currentColor;
    color: inherit;
    pointer-events: none;
}

.ico-xs {
    width: 14px;
    height: 14px;
}
.ico-sm {
    width: 16px;
    height: 16px;
}
.ico-md {
    width: 20px;
    height: 20px;
}
.ico-lg {
    width: 24px;
    height: 24px;
}
.ico-xl {
    width: 32px;
    height: 32px;
}
.ico-2xl {
    width: 44px;
    height: 44px;
}

/* Phosphor duotone: the secondary path carries opacity, tinting from one color. */
.ico-duotone .ico-dt-bg {
    opacity: 0.22;
}

.ico-accent {
    color: var(--v2-accent-strong);
}
.ico-success {
    color: var(--v2-success);
}
.ico-warning {
    color: var(--v2-warning);
}
.ico-danger {
    color: var(--v2-danger);
}
.ico-muted {
    color: var(--v2-text-dim);
}

/* Icon in a tinted tile, used on feature cards and stat blocks. */
.v2-icon-tile {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
    background: var(--v2-accent-soft);
    color: var(--v2-accent-strong);
}

.v2-icon-tile.is-lg {
    width: 52px;
    height: 52px;
    border-radius: var(--v2-radius-lg);
}

.v2-icon-tile.is-success {
    background: var(--v2-success-soft);
    color: var(--v2-success);
}
.v2-icon-tile.is-warning {
    background: var(--v2-warning-soft);
    color: var(--v2-warning);
}
.v2-icon-tile.is-danger {
    background: var(--v2-danger-soft);
    color: var(--v2-danger);
}
.v2-icon-tile.is-info {
    background: var(--v2-info-soft);
    color: var(--v2-info);
}
.v2-icon-tile.is-cyan {
    background: var(--v2-cyan-soft);
    color: var(--v2-cyan);
}

/* ---------- Buttons ---------- */

.v2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--v2-space-2);
    box-sizing: border-box;
    padding: 9px var(--v2-space-4);
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--v2-radius-sm);
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-semibold);
    line-height: 1.25;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--v2-dur-fast) var(--v2-ease),
        border-color var(--v2-dur-fast) var(--v2-ease),
        color var(--v2-dur-fast) var(--v2-ease),
        transform var(--v2-dur-fast) var(--v2-ease);
}

.v2-btn:hover {
    text-decoration: none;
}

.v2-btn:link,
.v2-btn:visited {
    text-decoration: none;
}

.v2-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.v2-btn:disabled,
.v2-btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.v2-btn .ico {
    width: 16px;
    height: 16px;
}

/* Variants */
.v2-btn-primary {
    background: var(--v2-accent);
    color: var(--v2-accent-contrast);
}

.v2-btn-primary:visited {
    color: var(--v2-accent-contrast);
}

.v2-btn-primary:hover {
    background: var(--v2-accent-strong);
    color: var(--v2-accent-contrast);
}

.v2-btn-secondary {
    background: var(--v2-surface-3);
    border-color: var(--v2-border);
    color: var(--v2-text);
}

.v2-btn-secondary:visited {
    color: var(--v2-text);
}

.v2-btn-secondary:hover {
    background: var(--v2-surface-4);
    border-color: var(--v2-border-strong);
    color: var(--v2-text);
}

.v2-btn-ghost {
    background: transparent;
    color: var(--v2-text-muted);
}

.v2-btn-ghost:visited {
    color: var(--v2-text-muted);
}

.v2-btn-ghost:hover {
    background: var(--v2-surface-3);
    color: var(--v2-text);
}

.v2-btn-outline {
    background: transparent;
    border-color: var(--v2-border-strong);
    color: var(--v2-text);
}

.v2-btn-outline:hover {
    background: var(--v2-surface-3);
    border-color: var(--v2-accent);
    color: var(--v2-text);
}

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

.v2-btn-danger:hover {
    background: #e05252;
    color: #fff;
}

.v2-btn-success {
    background: var(--v2-success);
    color: var(--v2-text-inverse);
}

.v2-btn-success:hover {
    background: #2bb885;
}

/* Sizes */
.v2-btn-sm {
    padding: 6px var(--v2-space-3);
    min-height: 0;
    font-size: var(--v2-text-xs);
}

.v2-btn-lg {
    padding: 13px var(--v2-space-6);
    font-size: var(--v2-text-md);
    border-radius: var(--v2-radius-md);
}

.v2-btn-block {
    width: 100%;
}

.v2-btn-icon {
    padding-left: var(--v2-space-2);
    padding-right: var(--v2-space-2);
}

.v2-btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--v2-space-2);
}

/* ---------- Cards ---------- */

.v2-card {
    padding: var(--v2-space-5);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-lg);
    background: var(--v2-surface-1);
    box-shadow: var(--v2-shadow-sm);
}

.v2-card.is-flush {
    padding: 0;
    overflow: hidden;
}

/* Target for the inline success/error HTML that several pages inject into a
   bare #msg element after a save. */
.v2-msg:empty {
    display: none;
}

.v2-msg {
    margin-top: var(--v2-space-4);
    font-size: var(--v2-text-sm);
}

.v2-msg p {
    margin: 0;
}

.v2-card.is-tight {
    padding: var(--v2-space-4);
}

.v2-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--v2-space-3);
    margin-bottom: var(--v2-space-4);
}

.v2-card-title {
    flex: 1;
    min-width: 0;
    font-size: var(--v2-text-md);
    font-weight: var(--v2-weight-semibold);
}

.v2-card.is-flush .v2-card-head {
    margin: 0;
    padding: var(--v2-space-4) var(--v2-space-5);
    border-bottom: 1px solid var(--v2-border-subtle);
}

.v2-card-body-pad {
    padding: var(--v2-space-5);
}

/* Interactive card (links to a page) */
.v2-card-link {
    display: block;
    color: inherit;
    transition: border-color var(--v2-dur-base) var(--v2-ease),
        transform var(--v2-dur-base) var(--v2-ease-out),
        box-shadow var(--v2-dur-base) var(--v2-ease);
}

.v2-card-link:hover {
    border-color: var(--v2-accent-ring);
    box-shadow: var(--v2-shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

/* Feature card used on marketing + hub pages */
.v2-feature-card {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-3);
    height: 100%;
}

.v2-feature-card h3 {
    font-size: var(--v2-text-md);
    font-weight: var(--v2-weight-semibold);
}

.v2-feature-card p {
    margin: 0;
    color: var(--v2-text-muted);
    font-size: var(--v2-text-sm);
}

/* ---------- Stats ---------- */

.v2-stat {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-1);
}

.v2-stat-label {
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    letter-spacing: var(--v2-tracking-caps);
    text-transform: uppercase;
    color: var(--v2-text-dim);
}

.v2-stat-value {
    font-size: var(--v2-text-2xl);
    font-weight: var(--v2-weight-bold);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.v2-stat-sub {
    font-size: var(--v2-text-xs);
    color: var(--v2-text-muted);
}

.v2-stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
}

.v2-stat-delta.is-up {
    color: var(--v2-success);
}
.v2-stat-delta.is-down {
    color: var(--v2-danger);
}

/* Ranked leaderboard list */
.v2-leader-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.v2-leader-list li {
    display: flex;
    align-items: center;
    gap: var(--v2-space-3);
    margin: 0;
    padding: var(--v2-space-2) var(--v2-space-2);
    border-radius: var(--v2-radius-sm);
    font-size: var(--v2-text-sm);
}

.v2-leader-list li:nth-child(odd) {
    background: var(--v2-surface-inset);
}

.v2-leader-rank {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: var(--v2-radius-xs);
    background: var(--v2-surface-4);
    font-size: 0.6875rem;
    font-weight: var(--v2-weight-bold);
    color: var(--v2-text-muted);
}

.v2-leader-list li:first-child .v2-leader-rank {
    background: var(--v2-accent);
    color: var(--v2-accent-contrast);
}

.v2-leader-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-leader-value {
    flex: none;
    font-weight: var(--v2-weight-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--v2-text);
}

/* ---------- Badges & pills ---------- */

.v2-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-full);
    background: var(--v2-surface-3);
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    line-height: 1.5;
    color: var(--v2-text-muted);
    white-space: nowrap;
}

.v2-badge .ico {
    width: 12px;
    height: 12px;
}

.v2-badge.is-accent {
    border-color: transparent;
    background: var(--v2-accent-soft);
    color: var(--v2-accent-strong);
}
.v2-badge.is-success {
    border-color: transparent;
    background: var(--v2-success-soft);
    color: var(--v2-success);
}
.v2-badge.is-warning {
    border-color: transparent;
    background: var(--v2-warning-soft);
    color: var(--v2-warning);
}
.v2-badge.is-danger {
    border-color: transparent;
    background: var(--v2-danger-soft);
    color: var(--v2-danger);
}
.v2-badge.is-info {
    border-color: transparent;
    background: var(--v2-info-soft);
    color: var(--v2-info);
}

.v2-badge-premium {
    border-color: transparent;
    background: linear-gradient(135deg, var(--v2-accent-soft), var(--v2-cyan-soft));
    color: var(--v2-accent-strong);
}

.v2-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: var(--v2-radius-full);
    background: var(--v2-text-dim);
}

.v2-dot.is-online {
    background: var(--v2-success);
    box-shadow: 0 0 0 3px var(--v2-success-soft);
}
.v2-dot.is-busy {
    background: var(--v2-danger);
}
.v2-dot.is-idle {
    background: var(--v2-warning);
}

/* ---------- Forms ---------- */

.v2-field {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-2);
}

.v2-field + .v2-field {
    margin-top: var(--v2-space-4);
}

.v2-label {
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-medium);
    color: var(--v2-text);
}

.v2-hint {
    font-size: var(--v2-text-xs);
    color: var(--v2-text-dim);
}

.v2-error {
    font-size: var(--v2-text-xs);
    color: var(--v2-danger);
}

.v2-input,
.v2-select,
.v2-textarea {
    width: 100%;
    padding: 9px var(--v2-space-3);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    background: var(--v2-surface-2);
    color: var(--v2-text);
    font-size: var(--v2-text-sm);
    transition: border-color var(--v2-dur-fast) var(--v2-ease),
        box-shadow var(--v2-dur-fast) var(--v2-ease);
}

.v2-input::placeholder,
.v2-textarea::placeholder {
    color: var(--v2-text-dim);
}

.v2-input:hover,
.v2-select:hover,
.v2-textarea:hover {
    border-color: var(--v2-border-strong);
}

.v2-input:focus,
.v2-select:focus,
.v2-textarea:focus {
    outline: none;
    border-color: var(--v2-accent);
    box-shadow: 0 0 0 3px var(--v2-accent-softer);
}

.v2-input:disabled,
.v2-select:disabled,
.v2-textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.v2-select {
    appearance: none;
    padding-right: var(--v2-space-8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23a2abbf'%3E%3Cpath d='M8 11 3.5 6h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--v2-space-3) center;
    background-size: 14px;
}

.v2-textarea {
    min-height: 96px;
    line-height: var(--v2-leading-normal);
}

.v2-input-group {
    display: flex;
    align-items: center;
    gap: var(--v2-space-2);
}

.v2-input-group .v2-input {
    flex: 1;
    min-width: 0;
}

/* Search input with a leading icon */
.v2-search {
    position: relative;
    display: flex;
    align-items: center;
}

.v2-search .ico {
    position: absolute;
    left: var(--v2-space-3);
    color: var(--v2-text-dim);
    width: 16px;
    height: 16px;
}

.v2-search .v2-input {
    padding-left: var(--v2-space-8);
}

/* Toggle switch */
.v2-toggle {
    display: flex;
    align-items: flex-start;
    gap: var(--v2-space-3);
    cursor: pointer;
}

/* Hidden visually but not from assistive tech: a 0x0 checkbox is pruned from
   the accessibility tree, so screen readers lose the control entirely. Keep it
   1px and clipped instead. */
.v2-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
}

.v2-toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    flex: none;
    margin-top: 1px;
    border-radius: var(--v2-radius-full);
    background: var(--v2-surface-4);
    transition: background var(--v2-dur-base) var(--v2-ease);
}

.v2-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: var(--v2-radius-full);
    background: #fff;
    box-shadow: var(--v2-shadow-sm);
    transition: transform var(--v2-dur-base) var(--v2-ease-out);
}

.v2-toggle input:checked + .v2-toggle-track {
    background: var(--v2-accent);
}

.v2-toggle input:checked + .v2-toggle-track::after {
    transform: translateX(18px);
}

.v2-toggle input:focus-visible + .v2-toggle-track {
    outline: 2px solid var(--v2-accent);
    outline-offset: 2px;
}

.v2-toggle-text {
    min-width: 0;
}

/* Both are spans so the label stays a single click target; block keeps the
   description on its own line instead of running on after the title. */
.v2-toggle-title {
    display: block;
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-medium);
}

.v2-toggle-desc {
    display: block;
    margin-top: 2px;
    font-size: var(--v2-text-xs);
    line-height: 1.5;
    color: var(--v2-text-dim);
}

/* Checkbox / radio */
.v2-check {
    display: inline-flex;
    align-items: center;
    gap: var(--v2-space-2);
    font-size: var(--v2-text-sm);
    cursor: pointer;
}

.v2-check input[type='checkbox'],
.v2-check input[type='radio'] {
    width: 16px;
    height: 16px;
    accent-color: var(--v2-accent);
    cursor: pointer;
}

/* ---------- Tables ---------- */

.v2-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-lg);
    background: var(--v2-surface-1);
}

.v2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--v2-text-sm);
}

.v2-table th,
.v2-table td {
    padding: var(--v2-space-3) var(--v2-space-4);
    text-align: left;
    vertical-align: middle;
}

.v2-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--v2-surface-2);
    border-bottom: 1px solid var(--v2-border);
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    letter-spacing: var(--v2-tracking-wide);
    text-transform: uppercase;
    color: var(--v2-text-dim);
    white-space: nowrap;
}

.v2-table tbody tr + tr td {
    border-top: 1px solid var(--v2-border-subtle);
}

.v2-table tbody tr:hover td {
    background: var(--v2-surface-2);
}

.v2-table .is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.v2-table a:not(.v2-btn) {
    color: var(--v2-link);
}

.v2-table a:not(.v2-btn):visited {
    color: var(--v2-link-visited);
}

.v2-table a:not(.v2-btn):hover {
    color: var(--v2-link-hover);
}

/*
 * Below 768px tables become stacked cards. Each td needs a data-label
 * attribute carrying the column heading.
 */
@media (max-width: 767px) {
    .v2-table.is-stacked,
    .v2-table.is-stacked tbody,
    .v2-table.is-stacked tr,
    .v2-table.is-stacked td {
        display: block;
        width: 100%;
    }

    .v2-table.is-stacked thead {
        display: none;
    }

    .v2-table.is-stacked tr {
        padding: var(--v2-space-3) var(--v2-space-4);
    }

    .v2-table.is-stacked tbody tr + tr {
        border-top: 1px solid var(--v2-border-subtle);
    }

    .v2-table.is-stacked tbody tr + tr td {
        border-top: 0;
    }

    .v2-table.is-stacked td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--v2-space-4);
        padding: 3px 0;
        text-align: right;
    }

    .v2-table.is-stacked td::before {
        content: attr(data-label);
        flex: none;
        font-size: var(--v2-text-xs);
        font-weight: var(--v2-weight-semibold);
        letter-spacing: var(--v2-tracking-wide);
        text-transform: uppercase;
        color: var(--v2-text-dim);
        text-align: left;
    }

    .v2-table.is-stacked tbody tr:hover td {
        background: none;
    }
}

/* ---------- Tabs ---------- */

.v2-tabs {
    display: flex;
    gap: var(--v2-space-1);
    overflow-x: auto;
    margin-bottom: var(--v2-space-5);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--v2-border);
    scrollbar-width: none;
}

.v2-tabs::-webkit-scrollbar {
    display: none;
}

.v2-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--v2-space-2);
    padding: var(--v2-space-3) var(--v2-space-4);
    border: 0;
    background: none;
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-medium);
    color: var(--v2-text-muted);
    white-space: nowrap;
    transition: color var(--v2-dur-fast) var(--v2-ease);
}

.v2-tab:hover {
    color: var(--v2-text);
    text-decoration: none;
}

.v2-tab.is-active {
    color: var(--v2-text);
}

.v2-tab.is-active::after {
    content: '';
    position: absolute;
    left: var(--v2-space-3);
    right: var(--v2-space-3);
    bottom: -1px;
    height: 2px;
    border-radius: var(--v2-radius-full);
    background: var(--v2-accent);
}

.v2-tab .ico {
    width: 16px;
    height: 16px;
}

.v2-tab-panel {
    display: none;
}

.v2-tab-panel.is-active {
    display: block;
}

/* Segmented control */
.v2-segment {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
    background: var(--v2-surface-2);
}

.v2-segment button {
    padding: 5px var(--v2-space-3);
    border-radius: var(--v2-radius-sm);
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    color: var(--v2-text-muted);
    transition: background var(--v2-dur-fast) var(--v2-ease),
        color var(--v2-dur-fast) var(--v2-ease);
}

.v2-segment button.is-active {
    background: var(--v2-surface-4);
    color: var(--v2-text);
}

/* ---------- Alerts ---------- */

.v2-alert {
    display: flex;
    gap: var(--v2-space-3);
    padding: var(--v2-space-4);
    border: 1px solid var(--v2-border);
    border-left-width: 3px;
    border-radius: var(--v2-radius-md);
    background: var(--v2-surface-2);
    font-size: var(--v2-text-sm);
}

.v2-alert .ico {
    flex: none;
    margin-top: 1px;
}

.v2-alert.is-info {
    border-left-color: var(--v2-info);
    background: var(--v2-info-soft);
}
.v2-alert.is-success {
    border-left-color: var(--v2-success);
    background: var(--v2-success-soft);
}
.v2-alert.is-warning {
    border-left-color: var(--v2-warning);
    background: var(--v2-warning-soft);
}
.v2-alert.is-danger {
    border-left-color: var(--v2-danger);
    background: var(--v2-danger-soft);
}

/* ---------- Empty states ---------- */

.v2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--v2-space-3);
    padding: var(--v2-space-10) var(--v2-space-5);
    text-align: center;
    color: var(--v2-text-muted);
}

.v2-empty .ico {
    color: var(--v2-text-dim);
}

.v2-empty-title {
    font-size: var(--v2-text-md);
    font-weight: var(--v2-weight-semibold);
    color: var(--v2-text);
}

.v2-empty-text {
    max-width: 44ch;
    font-size: var(--v2-text-sm);
}

/* ---------- Skeleton loading ---------- */

.v2-skeleton {
    border-radius: var(--v2-radius-sm);
    background: linear-gradient(
        90deg,
        var(--v2-surface-3) 25%,
        var(--v2-surface-4) 37%,
        var(--v2-surface-3) 63%
    );
    background-size: 400% 100%;
    animation: v2-shimmer 1.4s ease infinite;
}

@keyframes v2-shimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

/* ---------- Modal ---------- */

.v2-modal {
    position: fixed;
    inset: 0;
    z-index: var(--v2-z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
}

.v2-modal[hidden] {
    display: none;
}

.v2-modal-panel {
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-xl) var(--v2-radius-xl) 0 0;
    background: var(--v2-surface-1);
    box-shadow: var(--v2-shadow-lg);
    animation: v2-sheet-in var(--v2-dur-base) var(--v2-ease-out);
}

@keyframes v2-sheet-in {
    from {
        transform: translateY(16px);
        opacity: 0;
    }
}

.v2-modal-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: var(--v2-space-3);
    padding: var(--v2-space-4) var(--v2-space-5);
    border-bottom: 1px solid var(--v2-border-subtle);
    background: var(--v2-surface-1);
}

.v2-modal-title {
    flex: 1;
    min-width: 0;
    font-size: var(--v2-text-md);
    font-weight: var(--v2-weight-semibold);
}

.v2-modal-body {
    padding: var(--v2-space-5);
}

.v2-modal-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--v2-space-2);
    padding: var(--v2-space-4) var(--v2-space-5);
    border-top: 1px solid var(--v2-border-subtle);
}

@media (min-width: 640px) {
    .v2-modal {
        align-items: center;
        padding: var(--v2-space-6);
    }

    .v2-modal-panel {
        max-width: 560px;
        border-radius: var(--v2-radius-xl);
    }

    .v2-modal-panel.is-wide {
        max-width: 880px;
    }
}

/* ---------- Media frame (marketing screenshots / GIFs) ---------- */

.v2-media {
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-lg);
    background: var(--v2-surface-2);
    box-shadow: var(--v2-shadow-md);
    line-height: 0;
}

.v2-media img {
    width: 100%;
    height: auto;
}

.v2-media.is-browser {
    position: relative;
    padding-top: 28px;
}

.v2-media.is-browser::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 28px;
    border-bottom: 1px solid var(--v2-border);
    background: var(--v2-surface-3);
}

.v2-media.is-browser::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 12px;
    width: 8px;
    height: 8px;
    border-radius: var(--v2-radius-full);
    background: var(--v2-text-dim);
    box-shadow: 14px 0 0 var(--v2-text-dim), 28px 0 0 var(--v2-text-dim);
    opacity: 0.5;
}

.v2-media.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    aspect-ratio: 16 / 9;
    line-height: 1.4;
    border-style: dashed;
    box-shadow: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
        var(--v2-surface-2);
}

.v2-media.is-placeholder.is-browser {
    min-height: 248px;
}

.v2-media-placeholder-label {
    color: var(--v2-text-dim);
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-medium);
}

/* ---------- Avatars ---------- */

.v2-avatar {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: var(--v2-radius-full);
    object-fit: cover;
    background: var(--v2-surface-4);
}

.v2-avatar.is-sm {
    width: 24px;
    height: 24px;
}
.v2-avatar.is-lg {
    width: 48px;
    height: 48px;
}
.v2-avatar.is-xl {
    width: 72px;
    height: 72px;
}

.v2-avatar.is-square {
    border-radius: var(--v2-radius-md);
}

/* ---------- Progress ---------- */

.v2-progress {
    height: 6px;
    overflow: hidden;
    border-radius: var(--v2-radius-full);
    background: var(--v2-surface-4);
}

.v2-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--v2-accent);
    transition: width var(--v2-dur-slow) var(--v2-ease-out);
}

.v2-progress-bar.is-success {
    background: var(--v2-success);
}
.v2-progress-bar.is-warning {
    background: var(--v2-warning);
}
.v2-progress-bar.is-danger {
    background: var(--v2-danger);
}

/* ---------- Role chips (MMO) ---------- */

.v2-role {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--v2-radius-full);
    background: var(--v2-surface-3);
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    white-space: nowrap;
}

.v2-role .ico {
    width: 13px;
    height: 13px;
}

.v2-role.is-tank {
    color: var(--v2-role-tank);
}
.v2-role.is-healer {
    color: var(--v2-role-healer);
}
.v2-role.is-support {
    color: var(--v2-role-support);
}
.v2-role.is-ranged {
    color: var(--v2-role-ranged);
}
.v2-role.is-melee {
    color: var(--v2-role-melee);
}

/* ---------- Sidebar user menu ---------- */

.v2-user-menu {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
    background: var(--v2-surface-2);
}

.v2-user-menu > summary {
    display: flex;
    align-items: center;
    gap: var(--v2-space-2);
    padding: var(--v2-space-2) var(--v2-space-3);
    border-radius: var(--v2-radius-md);
    cursor: pointer;
    list-style: none;
}

.v2-user-menu > summary::-webkit-details-marker {
    display: none;
}

.v2-user-menu > summary:hover {
    background: var(--v2-surface-3);
}

.v2-user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-medium);
}

.v2-user-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--v2-space-1) var(--v2-space-1) var(--v2-space-2);
    border-top: 1px solid var(--v2-border-subtle);
}

/* ---------- Theme toggle icon swap ---------- */

.v2-theme-ico-dark {
    display: none;
}

[data-theme='light'] .v2-theme-ico-light,
[data-theme='pastel-light'] .v2-theme-ico-light {
    display: none;
}

[data-theme='light'] .v2-theme-ico-dark,
[data-theme='pastel-light'] .v2-theme-ico-dark {
    display: inline-block;
}

/* ---------- Divider with label ---------- */

.v2-divider {
    display: flex;
    align-items: center;
    gap: var(--v2-space-3);
    margin: var(--v2-space-6) 0;
    font-size: var(--v2-text-xs);
    font-weight: var(--v2-weight-semibold);
    letter-spacing: var(--v2-tracking-caps);
    text-transform: uppercase;
    color: var(--v2-text-dim);
}

.v2-divider::before,
.v2-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--v2-border);
}

/* ---------- Form layout helpers ---------- */

.v2-grid-2,
.v2-grid-4 {
    display: grid;
    gap: var(--v2-space-4);
    align-items: start;
}

/* Grid tracks position their own children, so the stacked-field margin would
   only shove later columns out of alignment with the first. */
.v2-grid-2 > .v2-field + .v2-field,
.v2-grid-4 > .v2-field + .v2-field {
    margin-top: 0;
}

.v2-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v2-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

@media (max-width: 600px) {
    .v2-grid-2,
    .v2-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Keeps the checkbox + submit pair bottom-aligned with the inputs beside it. */
.v2-field-actions {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-2);
    justify-content: flex-end;
}

.v2-inline-actions {
    display: flex;
    align-items: center;
    gap: var(--v2-space-3);
    flex-wrap: wrap;
}

.v2-subsection {
    margin-top: var(--v2-space-5);
    padding-top: var(--v2-space-5);
    border-top: 1px solid var(--v2-border);
}

.v2-subsection-title {
    margin: 0 0 var(--v2-space-3);
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-semibold);
    color: var(--v2-text);
}

.v2-disclosure {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-space-3);
    width: 100%;
    padding: var(--v2-space-3) 0;
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-semibold);
    text-align: left;
    cursor: pointer;
}

.v2-disclosure .ico {
    transition: transform var(--v2-dur-fast) var(--v2-ease);
}

.v2-disclosure[aria-expanded='true'] .ico {
    transform: rotate(90deg);
}

/* ---------- Details panel ---------- */

.v2-details {
    background: var(--v2-surface-2);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
}

.v2-details > summary {
    display: flex;
    align-items: center;
    gap: var(--v2-space-2);
    padding: var(--v2-space-4);
    font-size: var(--v2-text-sm);
    font-weight: var(--v2-weight-semibold);
    cursor: pointer;
    list-style: none;
}

.v2-details > summary::-webkit-details-marker {
    display: none;
}

.v2-details[open] > summary {
    border-bottom: 1px solid var(--v2-border);
}

.v2-details-note {
    font-weight: var(--v2-weight-normal);
    font-size: var(--v2-text-xs);
    color: var(--v2-text-muted);
}

.v2-details-body {
    padding: var(--v2-space-5);
}

/* ---------- Row / filter helpers ---------- */

.v2-row-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--v2-space-2);
    align-items: center;
}

.v2-grow {
    flex: 1 1 220px;
    min-width: 0;
}

.v2-form-actions {
    margin-top: var(--v2-space-5);
    padding-top: var(--v2-space-5);
    border-top: 1px solid var(--v2-border);
}

.v2-required {
    color: var(--v2-danger);
}

.v2-filter-card.card {
    padding: 14px 18px;
    margin-bottom: var(--v2-space-5);
    background: var(--v2-surface-1);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-lg);
    box-shadow: none;
}

.v2-filter-card .v2-filter-bar,
.v2-filter-card .filter-bar,
.v2-filter-card .stat-filters {
    margin: 0;
    padding: 0;
    border: none;
}

.v2-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--v2-space-3);
    align-items: flex-end;
    margin-bottom: var(--v2-space-4);
    padding-bottom: var(--v2-space-4);
    border-bottom: 1px solid var(--v2-border);
}

.v2-filter-bar > .v2-field + .v2-field {
    margin-top: 0;
}

.v2-filter-bar > .v2-field {
    flex: 0 1 auto;
    min-width: 0;
}

.v2-filter-card .v2-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
}

/* Controls dropped straight into a filter bar (no wrapping .v2-field) must
   shed the 100% width they use inside a form, or each one wraps to its own row. */
.v2-filter-bar > .v2-input,
.v2-filter-bar > .v2-select,
.v2-filter-bar > .v2-field .v2-input,
.v2-filter-bar > .v2-field .v2-select {
    width: auto;
    min-width: 130px;
}

.v2-filter-bar > .v2-search {
    flex: 1 1 200px;
    min-width: 170px;
}
