/* ==============================================
   Details Panel Styles
   Profile-style layout for entity details
   ============================================== */

/* --- Profile Header Section --- */
.profile-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    position: relative;
    overflow: visible;
}

/* When profile follows hierarchy path, remove top radius */
.hierarchy-path + .profile-header {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--profile-accent-color, var(--accent-color));
}

.profile-info-both {
    grid-column: 1;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--profile-accent-color, var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.profile-info {
    flex: 1;
    min-width: 220px;
}

.profile-header-bottom {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.profile-header-bottom > .stat-table-draft-container,
.profile-header-bottom > .details-section-container,
.profile-header-bottom > .section-header,
.profile-header-bottom > .data-table-container,
.profile-header-bottom > .compact-card-list,
.profile-header-bottom > .admin-console-section {
    min-width: 0;
    width: 100%;
}

.profile-next-event-strip {
    grid-column: 2;
    display: flex;
    width: 100%;
    justify-content: flex-start;
    align-self: stretch;
    margin-left: 0;
    padding: 0;
    min-width: 0;
}

.profile-next-event-strip .sticky-event-item.profile-next-event-card {
    --card-width: 100%;
    --profile-event-card-fit-scale: 1;
    display: block;
    width: 100%;
    max-width: none;
    min-height: 138px;
    margin-left: 0;
    padding: 16px 20px 14px;
    border-left-width: 5px;
    overflow: hidden;
}

.profile-next-event-strip .profile-next-event-card .sticky-event-card-fit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 20px;
    row-gap: 9px;
    align-items: center;
    width: var(--profile-event-card-fit-natural-width, 100%);
    min-height: 108px;
    transform: scale(var(--profile-event-card-fit-scale));
    transform-origin: top left;
}

.profile-next-event-strip .profile-next-event-card .sticky-event-head {
    display: contents;
}

.profile-next-event-strip .profile-next-event-card .sticky-event-foot {
    grid-column: 1 / 3;
    grid-row: 3;
    align-self: end;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 5px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.profile-next-event-strip .profile-next-event-card .event-venue-wrap {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    max-width: 100%;
}

.profile-next-event-strip .profile-next-event-card .event-state {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
}

.profile-next-event-strip .profile-next-event-card .sticky-event-matchup {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    margin-top: 0;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1.2;
}

.profile-next-event-strip .profile-next-event-card .event-info-line {
    display: contents;
    min-width: 0;
}

.profile-next-event-strip .profile-next-event-card .event-time-line {
    grid-column: 1 / 4;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-self: center;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
}

.profile-next-event-strip .profile-next-event-card .event-meta-line {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    min-width: 0;
    color: rgba(255, 255, 255, 0.58);
    text-align: left;
    white-space: nowrap;
}

.profile-next-event-strip .profile-next-event-card .event-type-badge {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: center;
}

.profile-next-event-strip .profile-next-event-card .event-context,
.profile-next-event-strip .profile-next-event-card .event-info-line,
.profile-next-event-strip .profile-next-event-card .event-countdown {
    font-size: 0.78rem;
}

.profile-next-event-strip .profile-next-event-card .event-state,
.profile-next-event-strip .profile-next-event-card .event-type-badge {
    font-size: 0.62rem;
}

.profile-next-event-strip .profile-next-event-card .event-countdown {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid rgba(251, 191, 36, 0.18);
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    letter-spacing: 0;
}

.profile-next-event-strip .profile-next-event-card .event-countdown::before {
    content: 'Starts in';
    margin-right: 5px;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 700;
}

@media (max-width: 980px) {
    .profile-header,
    .profile-header-bottom {
        grid-template-columns: 1fr;
    }

    .profile-info-both,
    .profile-next-event-strip,
    .profile-header-bottom {
        grid-column: 1;
        width: 100%;
    }

    .profile-next-event-strip {
        justify-content: center;
        margin-left: 0;
        min-width: 0;
    }

    .profile-next-event-card {
        width: min(640px, 100%);
    }
}

@media (max-width: 600px) {
    .profile-next-event-strip .sticky-event-item.profile-next-event-card {
        min-height: 0;
        padding: 12px;
    }

    .profile-next-event-strip .profile-next-event-card .sticky-event-card-fit {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        min-height: 0;
    }

    .profile-next-event-strip .profile-next-event-card .sticky-event-head {
        display: flex;
        grid-column: 1;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .profile-next-event-strip .profile-next-event-card .sticky-event-head {
        grid-row: 1;
    }

    .profile-next-event-strip .profile-next-event-card .sticky-event-matchup {
        grid-column: 1;
        grid-row: 2;
        font-size: 1rem;
    }

    .profile-next-event-strip .profile-next-event-card .sticky-event-foot {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        grid-column: 1;
        grid-row: 3;
        align-items: stretch;
        width: 100%;
    }

    .profile-next-event-strip .profile-next-event-card .event-info-line {
        display: contents;
        min-width: 0;
    }

    .profile-next-event-strip .profile-next-event-card .event-time-line {
        flex-wrap: wrap;
        row-gap: 4px;
    }
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.profile-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--profile-accent-color, var(--accent-color));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.profile-type-icon {
    font-size: 0.875rem;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.profile-meta-label {
    color: var(--text-muted);
}

.profile-meta-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Share & Links Admin Section --- */
.share-links-container {
    display: grid;
    gap: 12px;
}

.route-alias-card {
    display: grid;
    gap: 12px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.route-alias-card--disabled {
    border-style: dashed;
    opacity: 0.86;
}

.route-alias-summary {
    display: grid;
    gap: 8px;
}

.route-alias-row {
    display: grid;
    grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.route-alias-label,
.route-alias-link-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.route-alias-value,
.route-alias-identity {
    min-width: 0;
    overflow-wrap: anywhere;
}

.route-alias-value {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
}

.route-alias-identity {
    color: #dbeafe;
    font-size: 0.78rem;
}

.route-alias-link-block {
    display: grid;
    gap: 8px;
}

.route-alias-link-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

.route-alias-link-input {
    min-width: 0;
    width: 100%;
    height: 34px;
    background: rgba(2, 6, 23, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0 10px;
}

.route-alias-copy-btn {
    min-width: 72px;
    height: 34px;
    background: rgba(59, 130, 246, 0.22);
    border: 1px solid rgba(96, 165, 250, 0.42);
    border-radius: var(--radius-sm);
    color: #dbeafe;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.route-alias-copy-btn:hover,
.route-alias-copy-btn:focus-visible {
    background: rgba(59, 130, 246, 0.34);
    outline: none;
}

.route-alias-open-link {
    color: #bfdbfe;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    width: fit-content;
}

.route-alias-open-link:hover,
.route-alias-open-link:focus-visible {
    color: #eff6ff;
    text-decoration: underline;
}

.route-alias-helper,
.route-alias-note,
.route-alias-unavailable,
.route-alias-copy-status {
    font-size: 0.76rem;
    line-height: 1.35;
    margin: 0;
}

.route-alias-helper {
    color: var(--text-secondary);
}

.route-alias-note {
    color: var(--text-muted);
}

.route-alias-unavailable {
    color: #fecaca;
}

.route-alias-copy-status[data-state="success"] {
    color: #bbf7d0;
}

.route-alias-copy-status[data-state="error"] {
    color: #fecaca;
}

/* --- Profile Actions (Chat button, etc) --- */
.profile-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* --- Details Grid --- */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.detail-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    border-left: 3px solid var(--card-accent-color, var(--border-color));
}

.detail-card-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-card-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-card-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* --- Section Headers --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-icon {
    font-size: 1rem;
}

.section-count {
    font-size: 0.6875rem;
    background: var(--bg-accent);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}

/* --- Data Table --- */
.data-table-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

.data-table-container--fit {
    --data-table-scale: 1;
}

/* Remove background when nested in section container */
.details-section-container .data-table-container {
    background: transparent;
    margin-bottom: 0;
}

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

.data-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 10px 12px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(74, 158, 255, 0.08);
}

/* --- Stats Admin Sections --- */
.stat-admin-container {
    gap: 18px;
}

.stat-admin-note,
.stat-admin-empty {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.stat-admin-empty--error {
    color: #fca5a5;
}

.stat-admin-workbook {
    min-width: max-content;
    margin-top: 12px;
}

.stat-admin-sheet-tabs-label,
.stat-admin-sheet-select-fallback > span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-admin-sheet-tabs {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    min-height: 36px;
    margin-bottom: -1px;
    padding-left: 8px;
    overflow-x: visible;
}

.stat-admin-sheet-tab {
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-bottom-color: rgba(96, 165, 250, 0.24);
    border-radius: 6px 6px 0 0;
    background: rgba(15, 23, 42, 0.42);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.stat-admin-sheet-tab:hover {
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.62);
}

.stat-admin-sheet-tab--active {
    position: relative;
    z-index: 2;
    border-color: rgba(96, 165, 250, 0.28);
    border-bottom-color: rgba(8, 13, 28, 0.96);
    background: rgba(8, 13, 28, 0.96);
    color: var(--text-primary);
}

.stat-admin-sheet-tabs-empty {
    margin: 4px 0 8px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.stat-admin-sheet-select-fallback {
    display: none;
    margin: 0 0 10px;
}

.stat-admin-table-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px;
}

.stat-admin-table-heading-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.stat-admin-table-heading-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.stat-admin-table-heading h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-admin-table-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.stat-admin-stat-table-block {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 44px 12px 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.24);
}

.stat-admin-stat-table-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stat-admin-stat-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-admin-stat-table-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 800;
}

.stat-admin-stat-table-controls {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) max-content max-content;
    gap: 10px 12px;
    align-items: end;
}

.stat-admin-stat-table-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.stat-admin-table-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.stat-admin-table-control > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.stat-admin-table-control--narrow {
    max-width: 120px;
}

.stat-admin-table-control--check {
    justify-content: center;
}

.stat-admin-table-control--inline-check {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.stat-admin-table-control--inline-check > span {
    margin: 0;
}

.stat-admin-table-function-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 8px;
    align-items: center;
}

.stat-admin-table-function-picker .stat-admin-table-select {
    min-width: 0;
    width: 100%;
}

.stat-admin-table-function-add {
    white-space: nowrap;
    min-height: 36px;
    padding-inline: 12px;
}

.stat-admin-table-graph-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.34);
}

.stat-admin-table-graph-detail-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 10px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.stat-admin-table-graph-detail-main strong {
    color: var(--text-primary);
    font-size: 0.78rem;
}

.stat-admin-table-graph-detail-main span {
    overflow-wrap: anywhere;
}

.stat-admin-table-graph-empty {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.stat-admin-table-graph-config {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(96, 165, 250, 0.12);
    display: grid;
    gap: 10px;
}

.stat-admin-table-graph-heading {
    display: grid;
    gap: 3px;
}

.stat-admin-table-graph-heading h6 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stat-admin-table-graph-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.stat-admin-table-graph-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    align-items: start;
}

.stat-admin-table-graph-grid [data-stat-graph-position-control] {
    grid-column: 1 / -1;
}

.stat-admin-table-graph-grid .stat-admin-table-control--wide {
    grid-column: 1 / -1;
}

@media (max-width: 760px) {
    .stat-admin-table-function-picker {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat-admin-table-function-add {
        width: 100%;
    }

    .stat-admin-table-graph-detail {
        align-items: stretch;
        flex-direction: column;
    }
}

.stat-admin-table-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-start;
    margin-top: 10px;
}

.stat-admin-field--invalid {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--error-color) 18%, transparent);
}

.stat-admin-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}

.stat-admin-scope-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-admin-scope-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    background: rgba(8, 13, 28, 0.58);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.stat-admin-table-advanced {
    min-width: min(100%, 220px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    background: rgba(8, 13, 28, 0.3);
}

.stat-admin-table-advanced summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    list-style: none;
}

.stat-admin-table-advanced summary::-webkit-details-marker {
    display: none;
}

.stat-admin-table-advanced summary::after {
    content: '▾';
    margin-left: 6px;
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.stat-admin-table-advanced[open] summary::after {
    transform: rotate(180deg);
}

.stat-admin-table-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px 12px;
    padding: 0 10px 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.admin-config-container.stat-admin-container {
    overflow-x: auto;
    overflow-y: visible;
}

.admin-config-container.stat-admin-container > .add-event-subsection {
    min-width: max-content;
}

.stat-admin-sheet-frame {
    position: relative;
    min-width: max-content;
    padding: 14px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 6px;
    background: rgba(8, 13, 28, 0.96);
}

.stat-admin-event-type-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 12px;
}

.stat-admin-event-type-heading h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
}

.stat-admin-event-type-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.stat-admin-subsections {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: max-content;
}

.stat-admin-subsection-collapsible {
    border: 1px solid rgba(100, 116, 139, 0.24);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.34);
    overflow: visible;
}

.stat-admin-subsection-collapsible[open] {
    background: rgba(15, 23, 42, 0.46);
}

.stat-admin-subsection-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    list-style: none;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
}

.stat-admin-subsection-summary::-webkit-details-marker {
    display: none;
}

.stat-admin-subsection-summary::before {
    content: '▶';
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.6rem;
    transition: transform 0.15s ease;
}

.stat-admin-subsection-collapsible[open] > .stat-admin-subsection-summary::before {
    transform: rotate(90deg);
}

.stat-admin-subsection-summary:hover {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-primary);
}

.stat-admin-subsection-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-admin-subsection-content {
    padding: 12px;
    border-top: 1px solid rgba(100, 116, 139, 0.18);
}

.stat-admin-subsection-content > .stat-admin-placeholder-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.stat-admin-placeholder-panel {
    padding: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.36);
}

.stat-admin-placeholder-panel h5 {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.stat-admin-placeholder-panel p,
.stat-admin-placeholder-panel li,
.stat-admin-placeholder-list-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.stat-admin-placeholder-panel p {
    margin: 0 0 10px;
}

.stat-admin-placeholder-panel p:last-child {
    margin-bottom: 0;
}

.stat-admin-placeholder-panel ul {
    margin: 6px 0 12px 18px;
    padding: 0;
}

.stat-admin-placeholder-list-label {
    font-weight: 700;
}

.stat-admin-prompt-table {
    width: max-content;
    min-width: 930px;
    margin: 4px 0 12px;
}

.stat-admin-prompt-table th,
.stat-admin-prompt-table td {
    padding: 7px 8px;
    vertical-align: middle;
}

.stat-admin-prompt-table th {
    color: var(--text-muted);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-admin-prompt-order-header,
.stat-admin-prompt-order-cell {
    width: 58px;
    min-width: 58px;
    text-align: center;
}

.stat-admin-prompt-order-tools {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.stat-admin-prompt-table code {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.stat-admin-prompt-input,
.stat-admin-prompt-select {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 4px 6px;
    font-size: 0.75rem;
}

.stat-admin-prompt-select {
    background-color: rgba(15, 23, 42, 0.92);
    color: var(--text-primary, #f8fafc);
    color-scheme: dark;
}

.stat-admin-prompt-select option {
    background: #111827;
    color: #f8fafc;
}

.stat-admin-prompt-select option:checked,
.stat-admin-prompt-select option:hover {
    background: #2563eb;
    color: #ffffff;
}

.stat-admin-prompt-select option:disabled {
    color: #94a3b8;
}

.stat-admin-prompt-input--key {
    min-width: 128px;
}

.stat-admin-prompt-input--default {
    min-width: 120px;
}

.stat-admin-prompt-new-row {
    background: rgba(96, 165, 250, 0.06);
}

.stat-admin-prompt-row--focused > td {
    background: rgba(96, 165, 250, 0.12);
    box-shadow: inset 0 1px 0 rgba(147, 197, 253, 0.18), inset 0 -1px 0 rgba(147, 197, 253, 0.18);
}

.stat-admin-prompt-row--focused > td:first-child {
    box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.9), inset 0 1px 0 rgba(147, 197, 253, 0.18), inset 0 -1px 0 rgba(147, 197, 253, 0.18);
}

.stat-admin-prompts-note {
    padding-top: 4px;
}

.stat-admin-inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stat-admin-table-wrap {
    --stat-admin-row-label-width: 156px;
    --stat-admin-column-width: 172px;
    --stat-admin-new-column-width: 172px;
    --stat-admin-field-col-width: var(--stat-admin-row-label-width);
    --stat-admin-stat-col-width: var(--stat-admin-column-width);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 2px;
    scrollbar-gutter: stable;
}

.stat-admin-definition-table {
    width: max-content;
    min-width: calc(var(--stat-admin-field-col-width) + var(--stat-admin-stat-col-width));
    table-layout: fixed;
}

.stat-admin-field-col {
    width: var(--stat-admin-field-col-width);
}

.stat-admin-stat-col {
    width: var(--stat-admin-stat-col-width);
}

.stat-admin-definition-table th,
.stat-admin-definition-table td {
    padding: 6px;
    vertical-align: middle;
}

.stat-admin-definition-table th {
    color: var(--text-primary);
    font-size: 0.625rem;
}

.stat-admin-field-section-cell {
    padding: 8px 6px 4px;
    background: rgba(15, 23, 42, 0.96);
    border-top: 1px solid rgba(96, 165, 250, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.stat-admin-field-header,
.stat-admin-field-label {
    position: sticky;
    left: 0;
    z-index: 1;
    width: var(--stat-admin-field-col-width);
    min-width: var(--stat-admin-field-col-width);
    max-width: var(--stat-admin-field-col-width);
    background: rgba(8, 13, 28, 0.98);
    color: var(--text-muted);
    font-weight: 700;
}

.stat-admin-field-header {
    z-index: 2;
}

.stat-admin-stat-header,
.stat-admin-stat-cell {
    width: var(--stat-admin-stat-col-width);
    min-width: var(--stat-admin-stat-col-width);
    max-width: var(--stat-admin-stat-col-width);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.stat-admin-stat-col--new,
.stat-admin-stat-header--new,
.stat-admin-stat-cell--new {
    width: var(--stat-admin-new-column-width);
    min-width: var(--stat-admin-new-column-width);
    max-width: var(--stat-admin-new-column-width);
}

.stat-admin-stat-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.stat-admin-stat-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-admin-column-tools {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.stat-admin-column-move,
.stat-admin-prompt-move,
.stat-admin-remove-btn {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.6875rem;
    line-height: 1;
}

.stat-admin-column-move:hover:not(:disabled),
.stat-admin-prompt-move:hover:not(:disabled),
.stat-admin-remove-btn:hover:not(:disabled) {
    border-color: rgba(96, 165, 250, 0.52);
    background: rgba(37, 99, 235, 0.22);
    color: var(--text-primary);
}

.stat-admin-column-move:disabled,
.stat-admin-prompt-move:disabled,
.stat-admin-remove-btn:disabled {
    cursor: not-allowed;
    opacity: 0.34;
}

.stat-admin-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(248, 113, 113, 0.36);
    color: #fecaca;
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-admin-remove-btn:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, 0.64);
    background: rgba(127, 29, 29, 0.28);
}

.stat-admin-order-value {
    min-width: 18px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.stat-admin-sort-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.32);
}

.stat-admin-sort-section[hidden] {
    display: none;
}

.stat-admin-sort-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-admin-sort-heading h6 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.stat-admin-sort-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.stat-admin-sort-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-admin-sort-rule {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 180px) auto;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.4);
}

.stat-admin-sort-rule-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding-bottom: 4px;
}

.stat-admin-sort-rule-field,
.stat-admin-sort-rule-direction {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.stat-admin-sort-rule-field {
    min-width: 0;
}

.stat-admin-sort-rule-direction {
    min-width: 0;
}

.stat-admin-sort-rule-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.stat-admin-sort-rule-field select,
.stat-admin-sort-rule-direction select {
    min-width: 0;
    flex: 1 1 auto;
}

.stat-admin-sort-rule-remove {
    flex: 0 0 auto;
    align-self: center;
    margin-bottom: 2px;
}

.stat-admin-sort-actions {
    display: flex;
    gap: 8px;
}

.stat-admin-sort-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-style: italic;
}

.stat-admin-column--removed,
.stat-admin-row--removed {
    display: none;
}

.stat-admin-stat-header--new,
.stat-admin-stat-cell--new {
    position: relative;
    background: rgba(96, 165, 250, 0.06);
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.stat-admin-stat-header--new {
    overflow: visible;
    z-index: 4;
}

.stat-admin-new-column-cell--inactive {
    cursor: pointer;
    box-shadow:
        inset 1px 0 0 rgba(147, 197, 253, 0.28),
        inset -1px 0 0 rgba(147, 197, 253, 0.28);
}

.stat-admin-new-column-cell--inactive.stat-admin-stat-cell--new::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    border-left: 1px dashed rgba(147, 197, 253, 0.3);
    border-right: 1px dashed rgba(147, 197, 253, 0.3);
    background: rgba(8, 13, 28, 0.38);
    pointer-events: none;
}

.stat-admin-sheet-actions[hidden] {
    display: none;
}

.stat-admin-scope-expression {
    margin: -2px 0 10px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 700;
}

.stat-admin-scope-empty {
    margin: -6px 0 10px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.stat-admin-new-column-activate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid rgba(96, 165, 250, 0.46);
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.28), rgba(30, 64, 175, 0.2));
    color: #dbeafe;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.stat-admin-new-column-activate:hover,
.stat-admin-new-column-activate:focus-visible {
    border-color: rgba(147, 197, 253, 0.78);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.36), rgba(37, 99, 235, 0.28));
    color: var(--text-primary);
    outline: none;
}

.stat-admin-new-column-activate:focus-visible {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 2px rgba(96, 165, 250, 0.25);
}

.stat-admin-stat-cell--new :is(input, select):disabled {
    opacity: 0.48;
    pointer-events: none;
}

.stat-admin-new-column--active .stat-admin-new-column-activate {
    display: none;
}

.stat-admin-new-column--active .stat-admin-stat-header--new,
.stat-admin-new-column--active .stat-admin-stat-cell--new {
    background: rgba(96, 165, 250, 0.1);
    cursor: default;
}

.stat-admin-table-input,
.stat-admin-table-select {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 4px 6px;
    font-size: 0.75rem;
}

.stat-admin-table-select {
    background-color: rgba(15, 23, 42, 0.92);
    color: var(--text-primary, #f8fafc);
    color-scheme: dark;
}

.stat-admin-table-select option {
    background: #111827;
    color: #f8fafc;
}

.stat-admin-table-select option:checked,
.stat-admin-table-select option:hover {
    background: #2563eb;
    color: #ffffff;
}

.stat-admin-table-select option:disabled {
    color: #94a3b8;
}

.stat-admin-table-input--short {
    max-width: 100%;
}

.stat-admin-formula-editor {
    display: grid;
    gap: 4px;
    min-width: 130px;
}

.stat-admin-formula-reference-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 18px;
}

.stat-admin-formula-reference-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    border: 1px solid rgba(59, 130, 246, 0.48);
    border-radius: 999px;
    background: rgba(30, 64, 175, 0.28);
    color: #dbeafe;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.stat-admin-formula-reference-pill:hover {
    border-color: rgba(96, 165, 250, 0.72);
    background: rgba(37, 99, 235, 0.38);
}

.stat-admin-formula-reference-pill--selected {
    border-color: rgba(125, 211, 252, 0.85);
    background: rgba(14, 116, 144, 0.46);
    color: #ecfeff;
}

.stat-admin-formula-editor[hidden] {
    display: none;
}

.stat-admin-function-editor[hidden] {
    display: none;
}

.stat-admin-display-precision-editor {
    display: grid;
    gap: 3px;
    justify-items: center;
    min-width: 118px;
}

.stat-admin-display-precision-editor[hidden] {
    display: none;
}

.stat-admin-display-precision-input {
    max-width: 72px;
    text-align: center;
}

.stat-admin-display-precision-help {
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1.2;
}

.stat-admin-formula-input {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.stat-admin-field-hidden-select {
    display: none;
}

.stat-admin-field-picker {
    display: grid;
    gap: 5px;
    min-width: 150px;
}

.stat-admin-field-picker[hidden] {
    display: none;
}

.stat-admin-field-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.stat-admin-field-manual {
    min-height: 18px;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.stat-admin-field-group[hidden],
.stat-admin-field-manual[hidden] {
    display: none;
}

.stat-admin-field-chip,
.stat-admin-field-selected-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 20px;
    padding: 2px 6px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    overflow-wrap: anywhere;
}

.stat-admin-field-chip {
    cursor: pointer;
}

.stat-admin-field-chip:hover:not(:disabled) {
    border-color: rgba(96, 165, 250, 0.56);
    background: rgba(30, 64, 175, 0.3);
    color: var(--text-primary);
}

.stat-admin-field-chip--selected,
.stat-admin-field-selected-chip {
    border-color: rgba(96, 165, 250, 0.62);
    background: rgba(37, 99, 235, 0.28);
    color: #dbeafe;
}

.stat-admin-field-chip:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.stat-admin-field-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 18px;
}

.stat-admin-field-empty {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.stat-admin-formula-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 18px;
}

.stat-admin-formula-token {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 5px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

.stat-admin-formula-token--reference {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(22, 101, 52, 0.24);
    color: #bbf7d0;
}

.stat-admin-formula-token--operator {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(30, 64, 175, 0.22);
    color: #bfdbfe;
}

.stat-admin-formula-token--number {
    border-color: rgba(251, 191, 36, 0.42);
    background: rgba(146, 64, 14, 0.22);
    color: #fde68a;
}

.stat-admin-formula-token--unknown {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(127, 29, 29, 0.26);
    color: #fecaca;
}

.stat-admin-table-check {
    width: 16px;
    height: 16px;
}

.stat-admin-col--number,
.stat-admin-col--check {
    text-align: center;
    white-space: nowrap;
}

.stat-admin-row-action-note {
    color: var(--text-muted);
    font-size: 0.6875rem;
    white-space: nowrap;
}

.stat-admin-empty-row td {
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-style: italic;
    text-align: center;
}

.stat-admin-inline-add-btn {
    min-height: 30px;
    padding: 4px 10px;
    white-space: nowrap;
}

.stat-admin-sheet-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-admin-sheet-actions .add-event-btn {
    flex: 0 0 auto;
    min-width: 96px;
}

.stat-entry-event-picker {
    margin: 12px 0 16px;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus
    .admin-section-wrapper--focused[data-section-key="add_manage_stats"] {
    width: min(100%, 980px);
    margin-inline: auto;
}

.admin-tab-content.admin-section-preview-mode--cards.admin-section-preview-mode--section-focus
    .admin-section-wrapper--focused[data-section-key="add_manage_stats"] > details {
    width: 100%;
}

.stat-entry-event-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.stat-entry-event-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 200px));
    justify-content: start;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    max-height: 220px;
    padding: 6px;
    overflow: auto;
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 6px;
    background: rgba(8, 13, 28, 0.24);
}

.stat-entry-event-cards::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.stat-entry-event-cards::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
}

.stat-entry-event-cards::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
}

.stat-entry-event-card {
    position: relative;
    display: block;
    min-width: 0;
    width: 100%;
    min-height: 49px;
    padding: 4px 8px;
    border: 0;
    border-left: 3px solid var(--event-color, #4caf50);
    border-radius: 4px;
    background: color-mix(in srgb, var(--event-color, #4caf50) 8%, rgba(255, 255, 255, 0.04));
    color: var(--text-primary);
    container-type: inline-size;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.6875rem;
    text-align: left;
    white-space: normal;
    transition: background 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease, transform 0.15s ease;
}

.stat-entry-event-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.stat-entry-event-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--event-color, #4caf50) 46%, transparent);
}

.stat-entry-event-card--active {
    background: color-mix(in srgb, var(--event-color, #4caf50) 14%, rgba(255, 255, 255, 0.06));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--event-color, #4caf50) 60%, transparent), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.stat-entry-event-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    line-height: 1;
}

.stat-entry-event-card-venue-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.stat-entry-event-card-venue-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--facility-color, var(--event-color, #4caf50));
}

.stat-entry-event-card-context {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.5rem;
    font-style: italic;
    line-height: 1;
    opacity: 0.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-entry-event-card-state {
    flex: 0 0 auto;
    font-size: 0.3125rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    line-height: 1;
    text-transform: uppercase;
}

.stat-entry-event-card-state--future {
    color: #69f0ae;
}

.stat-entry-event-card-state--past {
    color: #ff5252;
}

.stat-entry-event-card-title {
    overflow: hidden;
    color: #fff;
    font-size: clamp(0.5rem, 6cqi, 0.75rem);
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-entry-event-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    line-height: 1;
}

.stat-entry-event-card-info {
    min-width: 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-entry-event-card-badge {
    flex: 0 0 auto;
    padding: 1px 4px;
    border-radius: 2px;
    background: var(--event-color, #4caf50);
    color: #fff;
    font-size: 0.375rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.3;
    opacity: 0.75;
    text-transform: uppercase;
}

.stat-entry-event-cards-empty {
    grid-column: 1 / -1;
    padding: 8px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.stat-entry-event-prompts {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
}

.stat-entry-scope-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.stat-entry-scope-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-entry-prompt-grid,
.stat-entry-team-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.stat-entry-team-prompts {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.14);
}

.stat-entry-prompt-field {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-entry-prompt-field .stat-entry-input {
    width: 100%;
}

.stat-entry-team-ref-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.stat-entry-team-ref-option {
    position: relative;
    min-width: 0;
}

.stat-entry-team-ref-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.stat-entry-team-ref-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 6px;
    background: rgba(8, 13, 28, 0.48);
    color: var(--text-primary);
    cursor: pointer;
    transition:
        background 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease,
        transform 140ms ease;
}

.stat-entry-team-ref-card:hover {
    border-color: color-mix(in srgb, var(--team-color, #6366f1) 70%, rgba(147, 197, 253, 0.6));
    background: color-mix(in srgb, var(--team-color, #6366f1) 12%, rgba(8, 13, 28, 0.64));
}

.stat-entry-team-ref-input:checked + .stat-entry-team-ref-card {
    border-color: color-mix(in srgb, var(--team-color, #6366f1) 78%, #ffffff);
    background: color-mix(in srgb, var(--team-color, #6366f1) 22%, rgba(8, 13, 28, 0.72));
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--team-color, #6366f1) 62%, transparent),
        0 0 0 2px rgba(96, 165, 250, 0.16);
}

.stat-entry-team-ref-input:focus-visible + .stat-entry-team-ref-card {
    outline: 2px solid rgba(147, 197, 253, 0.95);
    outline-offset: 2px;
}

.stat-entry-team-ref-name {
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.stat-entry-team-ref-empty {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.stat-entry-team {
    margin-bottom: 16px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(8, 13, 28, 0.36);
}

.stat-entry-team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
    color: var(--text-primary);
    font-weight: 700;
}

.stat-entry-table-wrap {
    overflow-x: auto;
}

.stat-entry-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
}

.stat-entry-table th,
.stat-entry-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    vertical-align: middle;
}

.stat-entry-table th:first-child,
.stat-entry-table td:first-child {
    text-align: left;
}

.stat-entry-table th {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.18);
}

.stat-entry-player {
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 600;
}

.stat-entry-input {
    width: 74px;
    min-height: 32px;
    padding: 5px 7px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--text-primary);
}

.stat-entry-number-control {
    display: inline-grid;
    grid-template-columns: 28px 50px 28px;
    align-items: stretch;
    min-height: 32px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.stat-entry-number-control .stat-entry-input {
    width: 50px;
    min-height: 30px;
    padding: 5px 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
    -moz-appearance: textfield;
}

.stat-entry-number-control .stat-entry-input::-webkit-outer-spin-button,
.stat-entry-number-control .stat-entry-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.stat-entry-number-step {
    display: grid;
    place-items: center;
    min-width: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    transition:
        background 140ms ease,
        color 140ms ease,
        box-shadow 140ms ease;
}

.stat-entry-number-step--down {
    border-right: 1px solid rgba(96, 165, 250, 0.24);
}

.stat-entry-number-step--up {
    border-left: 1px solid rgba(96, 165, 250, 0.24);
}

.stat-entry-number-step:hover {
    background: rgba(37, 99, 235, 0.36);
    color: var(--text-primary);
}

.stat-entry-number-step:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid rgba(147, 197, 253, 0.95);
    outline-offset: -2px;
}

.stat-entry-number-control:focus-within {
    border-color: rgba(147, 197, 253, 0.78);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.stat-entry-input--bool {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-content: center;
    width: 24px;
    height: 24px;
    min-height: 24px;
    margin: 0 auto;
    padding: 0;
    border: 1px solid rgba(147, 197, 253, 0.48);
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
        rgba(15, 23, 42, 0.86);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.32);
    cursor: pointer;
    transition:
        background 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease,
        transform 140ms ease;
}

.stat-entry-input--bool::before {
    content: "";
    width: 6px;
    height: 11px;
    margin-top: -2px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    opacity: 0;
    transform: rotate(45deg) scale(0.72);
    transition: opacity 120ms ease, transform 120ms ease;
}

.stat-entry-input--bool:hover {
    border-color: rgba(147, 197, 253, 0.82);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 3px rgba(96, 165, 250, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.32);
}

.stat-entry-input--bool:checked {
    border-color: rgba(96, 165, 250, 0.95);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
        #2563eb;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 0 0 3px rgba(37, 99, 235, 0.18),
        0 1px 2px rgba(0, 0, 0, 0.34);
}

.stat-entry-input--bool:checked::before {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

.stat-entry-input--bool:focus-visible {
    outline: 2px solid rgba(147, 197, 253, 0.95);
    outline-offset: 2px;
}

.stat-entry-input--bool:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.stat-entry-input--text {
    width: min(180px, 28vw);
}

.stat-entry-prompt-field .stat-entry-input--text {
    width: 100%;
}

@media (max-width: 900px) {
    .stat-admin-sheet-tabs {
        display: none;
    }

    .stat-admin-sheet-select-fallback {
        display: block;
    }

    .stat-admin-table-wrap {
        --stat-admin-row-label-width: 132px;
        --stat-admin-column-width: 156px;
        --stat-admin-new-column-width: 156px;
    }

    .stat-entry-event-cards {
        grid-template-columns: 1fr;
        max-height: 320px;
    }
}

.data-table .player-name {
    font-weight: 500;
}

.data-table .player-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-accent);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-color);
}

.data-table .player-position {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.data-table .player-status {
    font-size: 0.6875rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.data-table .player-status--active {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.data-table .player-status--inactive {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

/* --- Compact Card List (for events, facilities) --- */
.compact-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--card-accent-color, var(--border-color));
    transition: all var(--transition-fast);
}

.compact-card:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: translateX(4px);
}

.compact-card--facility {
    background: color-mix(in srgb, var(--card-accent-color, #ef4444) 14%, rgba(2, 6, 23, 0.72));
    border-left-width: 5px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-accent-color, #ef4444) 28%, rgba(148, 163, 184, 0.14));
}

.compact-card--facility:hover {
    background: color-mix(in srgb, var(--card-accent-color, #ef4444) 22%, rgba(2, 6, 23, 0.7));
}

.compact-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--card-accent-color, var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.compact-card-icon--facility {
    font-size: 1.15rem;
    line-height: 1;
    color: var(--facility-icon-color, currentColor);
    text-shadow: 0 0 1px rgba(2, 6, 23, 0.6), 0 1px 2px rgba(2, 6, 23, 0.55);
    -webkit-text-stroke: 0.3px rgba(2, 6, 23, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(2, 6, 23, 0.45);
}

.compact-card-content {
    flex: 1;
    min-width: 0;
}

.compact-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.compact-card-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.compact-card-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.details-event-card-list {
    display: grid;
    justify-items: stretch;
    gap: 8px;
    width: 100%;
}

.details-event-card-list .sticky-event-item {
    --card-width: 100%;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    justify-self: stretch;
    margin-left: 0;
    padding: 8px 10px;
    border-left-width: 4px;
    background: color-mix(in srgb, var(--event-color) 10%, rgba(2, 6, 23, 0.42));
}

.details-event-card-list .sticky-event-item:hover {
    transform: translateX(3px);
}

.details-event-card-list .sticky-event-item .event-context {
    font-size: 0.68rem;
}

.details-event-card-list .sticky-event-item .event-state {
    font-size: 0.5rem;
}

.details-event-card-list .sticky-event-item .sticky-event-matchup {
    margin-top: 3px;
    font-size: 0.92rem;
    line-height: 1.3;
}

.details-event-card-list .sticky-event-item .sticky-event-foot {
    margin-top: 4px;
}

.details-event-card-list .sticky-event-item .event-info-line,
.details-event-card-list .sticky-event-item .event-countdown {
    font-size: 0.68rem;
}

.details-event-card-list .sticky-event-item .event-type-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 3px;
}

.add-facility-color-field {
    max-width: 220px;
}

.add-facility-color-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 32px;
    padding: 4px 8px 4px 4px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.32);
    cursor: pointer;
}

.add-facility-color-input {
    width: 40px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.add-facility-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.add-facility-color-input::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
}

.add-facility-color-value {
    color: var(--text-secondary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.add-facility-existing-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.add-facility-color-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    flex: 0 0 auto;
}

.facility-map-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.facility-map-preview {
    position: relative;
    display: block;
    width: min(100%, 420px);
    aspect-ratio: 16 / 9;
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(59, 130, 246, 0.12)),
        rgba(2, 6, 23, 0.48);
    text-decoration: none;
}

.facility-map-preview:hover {
    border-color: color-mix(in srgb, var(--card-accent-color, var(--accent-color)) 55%, rgba(148, 163, 184, 0.42));
    filter: brightness(1.06);
}

.facility-map-preview__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.facility-map-preview__embed {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

.facility-map-preview__cover-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.facility-map-preview__cover-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--card-accent-color, var(--accent-color)) 70%, #ffffff);
    outline-offset: -3px;
}

.facility-map-preview__cover-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.facility-map-preview__open {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 4px 7px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.84);
    color: #e5e7eb;
    font-size: 0.68rem;
    line-height: 1.2;
    text-decoration: none;
}

.facility-map-preview__open:hover {
    background: rgba(30, 41, 59, 0.92);
    color: #fff;
}

.facility-map-preview__placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.25;
}

.facility-map-preview__pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--card-accent-color, #ef4444);
    color: white;
    flex: 0 0 auto;
}

.facility-map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.facility-map-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Fixed Header Banner --- */
.fixed_header_banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    font-size: 0.75rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-color);
}

.header_top {
    --account-proxy-right: 180px;
    --account-proxy-width: 130px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    overflow: visible;
    white-space: nowrap;
}

.header_bottom {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* --- Forge Clock (banner) --- */
.forge-clock-section {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

#sticky-scope-content {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#sticky-events-wrapper {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 6px 0 10px 0;
    margin-right: calc(var(--account-proxy-right) + var(--account-proxy-width) / 2 + 80px);
}

#sticky-events-content {
    position: relative;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 0 100% 12px 0;
    --card-width: 200px;
    --card-gap: 12px;
    /* Smooth scrolling on all devices */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* Spacer no longer needed — inline-block cards naturally overflow a block container */

.forge-clock-canvas {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.forge-clock-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 78px;
}

.forge-clock-digital {
    font-size: 0.8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.forge-clock-date {
    font-size: 0.625rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.forge-clock-tz {
    font-size: 0.5625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- 24-Hour Day Progress Bar (mobile only) --- */
.forge-day-progress {
    display: none; /* hidden on desktop */
}

@media (max-width: 480px) {
    .forge-clock-canvas {
        width: 30px;
        height: 30px;
    }
    .forge-clock-text {
        min-width: 70px;
    }
    .forge-clock-digital {
        font-size: 0.6875rem;
    }

    /* Account proxy: nudge in a bit */
    .header-account-proxy {
        --account-proxy-right: 4px;
    }

    .header-proxy-dropdown {
        right: 4px;
        min-width: 180px;
    }
}

/* =============================================
   Mobile Header: Thin Context Bar + Events
   ≤700px — simplified, no analog clock
   ============================================= */
@media (max-width: 700px) {
    /* Stack header into rows: scope/clock, progress bar, events */
    .header_top {
        --mobile-header-utility-width: 122px;
        --mobile-header-utility-reserve: 138px;
        flex-wrap: wrap;
        gap: 0;
        padding: 0;
        overflow: hidden;
    }

    /* --- Row 1: Scope (left) + Clock (right) + Proxy (far right) --- */
    #sticky-scope-content {
        flex: 1;
        min-width: 0;
        order: 1;
        grid-column: 1 / -1;
        align-items: center;
        padding: 8px 10px;
    }

    /* Fallback badge when no scope selected (system root) */
    #sticky-scope-content:empty::before {
        content: 'Forge716';
        display: inline-flex;
        align-items: center;
        padding: 3px 8px;
        background: rgba(74, 158, 255, 0.12);
        border: 1px solid rgba(74, 158, 255, 0.25);
        border-radius: 4px;
        font-size: 0.6875rem;
        font-weight: 600;
        color: #4a9eff;
        letter-spacing: 0.02em;
    }

    /* Hide the analog clock canvas entirely */
    .forge-clock-canvas {
        display: none;
    }

    /* Compact stacked time display: date on top, time below */
    .forge-clock-text {
        min-width: 0;
        flex-direction: column;
        align-items: flex-end;
        gap: 0;
    }

    .forge-clock-digital {
        font-size: 0.6875rem;
        font-weight: 600;
    }

    .forge-clock-date {
        font-size: 0.5625rem;
        order: -1;
    }

    .forge-clock-tz {
        font-size: 0.5rem;
    }

    /* Clock: order 2, sits right of scope in Row 1 */
    .forge-clock-section {
        order: 2;
        flex-shrink: 0;
        border-left: none;
        border-right: none;
        padding: 8px 10px;
        margin-right: var(--mobile-header-utility-reserve);
        gap: 0;
    }

    /* --- Row 2: Progress bar (full width, thin separator) --- */
    .forge-day-progress {
        display: flex;
        align-items: center;
        flex-basis: 100%;
        order: 3;
        height: auto;
        padding: 4px 12px;
        gap: 6px;
        background: none;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .forge-day-progress__label {
        font-size: 0.5rem;
        color: rgba(255, 255, 255, 0.4);
        font-weight: 500;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        flex-shrink: 0;
        line-height: 1;
        font-variant-numeric: tabular-nums;
    }

    .forge-day-progress__track {
        flex: 1;
        height: 4px;
        border-radius: 2px;
        position: relative;
        overflow: hidden;
        /* Notch marks: 12 ticks (one per hour in a 12h cycle) */
        background-image:
            repeating-linear-gradient(
                90deg,
                transparent,
                transparent calc(100% / 12 - 1px),
                rgba(255, 255, 255, 0.15) calc(100% / 12 - 1px),
                rgba(255, 255, 255, 0.15) calc(100% / 12)
            );
        background-size: 100% 100%;
        background-color: rgba(255, 255, 255, 0.06);
    }

    .forge-day-progress__fill {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, #4caf50, #66bb6a);
        border-radius: 2px;
        transition: width 1s linear;
    }

    /* --- Row 3: Events --- */
    #sticky-events-wrapper {
        flex-basis: 100%;
        order: 4;
        padding: 6px 12px 10px 12px;
        overflow: hidden;
        margin-right: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* When no events, hide empty wrapper to tighten header */
    #sticky-events-wrapper:has(.sticky-events-empty) {
        padding: 4px 12px;
    }

    #sticky-events-wrapper:has(#sticky-events-content:empty),
    #sticky-events-wrapper:has(.sticky-events-empty) {
        display: none;
    }

    body:has(#sticky-events-content:empty),
    body:has(.sticky-events-empty) {
        padding-top: 102px;
    }

    body:has(#status-banner:not([data-state="hidden"])):has(#sticky-events-content:empty),
    body:has(#status-banner:not([data-state="hidden"])):has(.sticky-events-empty) {
        padding-top: 120px;
    }

    body.has-offline-banner:has(#sticky-events-content:empty),
    body.has-offline-banner:has(.sticky-events-empty) {
        padding-top: 130px;
    }

    body.has-offline-banner:has(#status-banner:not([data-state="hidden"])):has(#sticky-events-content:empty),
    body.has-offline-banner:has(#status-banner:not([data-state="hidden"])):has(.sticky-events-empty) {
        padding-top: 148px;
    }

    /* --- Account Proxy (absolute, pinned to Row 1 only) --- */
    .header-account-proxy {
        --account-proxy-right: 8px;
        --account-proxy-width: 30px;
        position: absolute;
        top: 8px; /* Fixed offset — aligns with Row 1 content */
        right: var(--account-proxy-right);
        width: var(--account-proxy-width);
        height: 30px;
        z-index: 10;
    }

    .header-proxy-icon-btn {
        width: 28px;
        height: 28px;
        /* Expand the touch target beyond visual bounds */
        padding: 0;
        position: relative;
    }

    .header-proxy-icon-btn::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px; /* 44px touch target via invisible expansion */
    }

    .header-proxy-icon {
        font-size: 0.75rem;
    }

    .header-proxy-greeting {
        display: none; /* Hide greeting on mobile - icon only */
    }

    .header-proxy-dropdown {
        top: 44px;
        right: 8px;
        min-width: 200px;
    }

    /* --- Header Utility Group (Mobile) --- */
    .header-utility-group {
        position: absolute;
        top: 8px;
        right: 8px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        z-index: 10;
        padding-left: 10px;
        border-left: 1px solid var(--border-color);
        width: var(--mobile-header-utility-width);
        justify-content: flex-end;
    }

    /* All utility icons: fixed width for even spacing */
    .header-utility-group > div {
        width: 28px;
    }

    .header-communications {
        display: flex;
        align-items: center;
    }

    .header-comm-btn {
        width: 28px;
        height: 28px;
        padding: 0;
        position: relative;
    }

    /* Expand touch target for mobile */
    .header-comm-btn::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
    }

    .header-comm-badge {
        top: -3px;
        right: -3px;
        min-width: 14px;
        height: 14px;
        font-size: 0.5rem;
    }

    /* Notifications (mobile) */
    .header-notifications {
        display: flex;
        align-items: center;
    }

    .header-notif-btn {
        width: 28px;
        height: 28px;
        padding: 0;
        position: relative;
    }

    .header-notif-btn::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
    }

    .header-notif-badge {
        top: -3px;
        right: -3px;
        min-width: 14px;
        height: 14px;
        font-size: 0.5rem;
    }

    /* Account proxy within utility group */
    .header-utility-group .header-account-proxy {
        position: relative;
        right: unset;
        top: unset;
        width: 28px;
        height: auto;
    }

    @media (max-width: 480px) {
        .header_top {
            --mobile-header-utility-width: 116px;
            --mobile-header-utility-reserve: 130px;
        }

        .forge-clock-section {
            padding-left: 6px;
            padding-right: 6px;
        }

        .forge-clock-digital {
            font-size: 0.625rem;
        }
    }

    /* Communications Panel (Mobile) */
    .header-comm-panel {
        top: 50px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 70px);
    }
    
    #sticky-events-content {
        /* Must re-assert scroll container properties on mobile */
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        position: relative;
        padding: 0 100% 12px 0;
        --card-width: 170px;
        --card-gap: 6px;
        /* Smooth touch scrolling */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    /* Context bar scope chip: compact inline layout */
    .sticky-events-scope {
        gap: 5px;
        padding-right: 0;
        border-right: none;
    }

    .sticky-events-scope-icon {
        width: 18px;
        height: 18px;
        font-size: 0.5rem;
        border-radius: 3px;
    }

    .sticky-events-scope-info {
        flex-direction: row;
        align-items: baseline;
        gap: 5px;
    }

    .sticky-events-scope-name {
        font-size: 0.75rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 35vw; /* Tighter cap — prevent pushing clock into proxy */
    }

    .sticky-events-scope-type {
        font-size: 0.5625rem;
        opacity: 0.65;
    }

    /* Hide the verbose status badge on mobile context bar */
    .sticky-events-scope-status {
        display: none;
    }

    /* Events label + items */
    .sticky-events-label {
        font-size: 0.625rem;
        flex-shrink: 0;
    }

    /* --- Mobile event cards: compact 3-band --- */
    .sticky-event-item {
        width: var(--card-width, 170px);
        padding: 3px 7px;
        font-size: 10px;
    }

    .sticky-event-item .sticky-event-matchup {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sticky-event-item .event-info-line {
        font-size: 8px;
    }

    .sticky-event-item .event-countdown {
        font-size: 8px;
    }

    .sticky-event-item .event-type-badge {
        font-size: 6px;
        padding: 1px 3px;
    }

    .sticky-event-item .event-context {
        font-size: 8px;
    }

    .sticky-events-empty {
        font-size: 10px;
    }
}

/* --- Extra-narrow (≤400px) --- */
@media (max-width: 400px) {
    .profile-header {
        grid-template-columns: 1fr;
    }

    .sticky-events-scope-name {
        max-width: 35vw;
    }

    .sticky-events-scope-type {
        display: none;
    }

    .forge-clock-tz {
        display: none;
    }

    #sticky-events-content {
        --card-width: 150px;
    }

    .sticky-event-item {
        width: var(--card-width, 150px);
        padding: 3px 6px;
    }

    .sticky-event-item .sticky-event-matchup {
        font-size: 9px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sticky-event-item .event-info-line {
        font-size: 7px;
    }

    .sticky-event-item .event-countdown {
        font-size: 7px;
    }

    .sticky-event-item .event-type-badge {
        font-size: 5px;
        padding: 1px 3px;
    }

    .sticky-event-item .event-context {
        font-size: 7px;
    }
}

/* --- Sticky Events Scope --- */
.sticky-events-scope {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sticky-events-scope-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: white;
}

.sticky-events-scope-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sticky-events-scope-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.sticky-events-scope-type {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sticky-events-scope-status {
    font-size: 0.5625rem;
    color: var(--text-muted);
    opacity: 0.8;
    margin-top: 2px;
    font-style: italic;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 1px 4px;
}

#sticky-events-content::-webkit-scrollbar {
    height: 4px;
}

.sticky-events-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* =======================================
   COMPACT 3-BAND EVENT CARDS
   Row 1: venue (muted)
   Row 2: matchup (bold)
   Row 3: date • time • countdown  BADGE
   ======================================= */

.sticky-event-item {
    position: relative;
    display: inline-block;
    vertical-align: top;
    white-space: normal;
    padding: 4px 8px;
    margin-left: var(--card-gap, 12px);
    background: color-mix(in srgb, var(--event-color) 8%, rgba(255, 255, 255, 0.04));
    border-left: 3px solid var(--event-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.6875rem;
    width: var(--card-width, 200px);
    cursor: pointer;
    transition: all var(--transition-fast);
    container-type: inline-size;
}

.sticky-event-item:first-child {
    margin-left: 0;
}

.sticky-event-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.sticky-event-item:focus-visible,
.sticky-event-item--details-open {
    outline: 1px solid color-mix(in srgb, var(--event-color) 78%, white 12%);
    outline-offset: 2px;
    background: color-mix(in srgb, var(--event-color) 14%, rgba(255, 255, 255, 0.06));
}

.sticky-event-details-popover {
    position: fixed;
    z-index: 12000;
    width: min(330px, calc(100vw - 20px));
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--event-color) 42%, rgba(148, 163, 184, 0.35));
    border-radius: 8px;
    background: rgba(8, 13, 24, 0.98);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
    color: var(--text-primary);
}

.sticky-event-details-popover__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.sticky-event-details-popover__title-wrap {
    min-width: 0;
}

.sticky-event-details-popover__eyebrow {
    color: color-mix(in srgb, var(--event-color) 72%, white 10%);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.sticky-event-details-popover__title {
    margin-top: 2px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
}

.sticky-event-details-popover__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
}

.sticky-event-details-popover__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sticky-event-details-popover__body {
    display: grid;
    gap: 7px;
    padding-top: 9px;
}

.sticky-event-details-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
}

.sticky-event-details-row__label {
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sticky-event-details-row__value {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Row 1: venue/location left, state right */
.sticky-event-item .sticky-event-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    line-height: 1;
}

.sticky-event-item .event-state {
    font-size: 0.3125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
}

.sticky-event-item .event-state.event-state--future {
    color: #69f0ae;
}

.sticky-event-item .event-state.event-state--past {
    color: #ff5252;
}

.sticky-event-item .event-context {
    color: var(--text-muted);
    font-size: 0.5rem;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

.sticky-event-item .event-venue-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.sticky-event-item .event-venue-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Row 2: matchup line — main content, auto-sizes to fit */
.sticky-event-item .sticky-event-matchup {
    font-weight: 700;
    font-size: clamp(0.5rem, 6cqi, 0.75rem);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
}

.sticky-event-item .event-at {
    font-weight: 400;
    opacity: 0.6;
    padding: 0 2px;
}

/* Row 3: info line + badge */
.sticky-event-item .sticky-event-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    line-height: 1;
}

.sticky-event-item .event-info-line {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.5rem;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sticky-event-item .event-type-badge {
    font-size: 0.375rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 1px 4px;
    border-radius: 2px;
    color: white;
    flex-shrink: 0;
    line-height: 1.3;
    opacity: 0.7;
}

/* Countdown inline */
.sticky-event-item .event-countdown {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.5rem;
    font-weight: 600;
    color: #ff9800;
    letter-spacing: -0.02em;
}

.sticky-event-item .event-countdown--past {
    color: #ff5252;
    opacity: 0.8;
}

.sticky-events-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Past-event card: dulled */
.sticky-event-item--past {
    opacity: 0.55;
}

.sticky-event-item--past:hover {
    opacity: 0.8;
}

/* --- Hierarchy Breadcrumb (parent entities) --- */
.hierarchy-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin: 0;
    font-size: 0.75rem;
}

.hierarchy-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
}

.hierarchy-item-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
}

.hierarchy-item-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hierarchy-separator {
    color: var(--text-muted);
    margin: 0 2px;
}

/* --- Stats Row --- */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.stat-group-scope {
    margin: -2px 0 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.stat-row-subject {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
}

.stat-row-context {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.stat-associated-table-wrap {
    --stat-associated-subject-col-width: clamp(220px, 28vw, 320px);
    --stat-associated-metric-col-width: 72px;
    --stat-associated-table-width: calc(var(--stat-associated-subject-col-width) + var(--stat-associated-metric-total-width, 0px));
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.stat-associated-graph {
    width: min(760px, 100%);
    margin: 10px auto 12px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-associated-graph-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.stat-associated-graph-head h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 800;
}

.stat-associated-graph-head span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-associated-graph-svg {
    display: block;
    width: 100%;
    height: auto;
}

.stat-associated-graph-gridline {
    stroke: rgba(148, 163, 184, 0.28);
    stroke-width: 1;
}

.stat-associated-graph-line {
    fill: none;
    stroke: rgba(56, 189, 248, 0.9);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-associated-graph-point {
    fill: #38bdf8;
    stroke: rgba(15, 23, 42, 0.95);
    stroke-width: 2;
}

.stat-associated-graph-axis-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.stat-associated-graph-axis-label--point {
    font-size: 9px;
}

.stat-associated-graph-point-label {
    fill: var(--text-primary);
    font-size: 10px;
    font-weight: 800;
    paint-order: stroke;
    stroke: rgba(2, 6, 23, 0.88);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.stat-associated-graph--empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.stat-associated-table-wrap--fit {
    --fit-table-scale: 1;
}

.stat-associated-table-wrap--fit.is-scaled {
    height: var(--fit-table-scaled-height);
    box-sizing: border-box;
    justify-content: flex-start;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-associated-table-wrap--fit .stat-associated-table-frame {
    width: var(--fit-table-natural-width, max-content);
    flex: 0 0 var(--fit-table-natural-width, max-content);
    max-width: none;
    overflow: visible;
    padding-bottom: 4px;
    transform: scale(var(--fit-table-scale));
    transform-origin: top left;
}

.stat-associated-table-wrap--fit .stat-associated-table {
    max-width: none;
}

.stat-associated-table-wrap--fit.is-scaled .stat-associated-table-frame {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.stat-associated-table-frame {
    width: fit-content;
    max-width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow-x: auto;
    overflow-y: hidden;
}

.stat-associated-table {
    width: var(--stat-associated-table-width);
    min-width: var(--stat-associated-table-width);
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: transparent;
    font-size: 0.8125rem;
    margin: 0 auto;
}

.stat-associated-table-subject-col {
    width: var(--stat-associated-subject-col-width);
}

.stat-associated-table-metric-col {
    width: var(--stat-associated-metric-col-width);
}

.stat-associated-table th,
.stat-associated-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    padding: 10px 14px;
    vertical-align: middle;
}

.stat-associated-table tbody tr:last-child td {
    border-bottom: 0;
}

.stat-associated-table th {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(15, 23, 42, 0.48);
}

.stat-associated-table-heading--sortable {
    padding: 0;
}

.stat-associated-table-sort-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    white-space: nowrap;
    min-width: 0;
}

.stat-associated-table-sort-label {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

.stat-associated-table-sort-btn:focus-visible {
    outline: 1px solid rgba(96, 165, 250, 0.65);
    outline-offset: -2px;
    border-radius: 6px;
}

.stat-associated-table-sort-indicator {
    font-size: 0.72rem;
    color: rgba(148, 163, 184, 0.9);
    min-width: 9px;
    display: inline-block;
    transform-origin: 50% 50%;
    transition: transform 0.14s ease, color 0.14s ease;
}

.stat-associated-table-sort-indicator--active {
    color: rgba(191, 219, 254, 0.98);
}

.stat-associated-table-sort-indicator--desc {
    transform: rotate(180deg);
}

.stat-associated-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-associated-table tbody tr:hover {
    background: rgba(74, 158, 255, 0.08);
}

.stat-associated-table tbody tr:focus-within {
    background: rgba(74, 158, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.32);
}

.stat-associated-table-subject-heading,
.stat-associated-table-subject-cell {
    text-align: left;
}

.stat-associated-table-metric-heading,
.stat-associated-table-metric-cell {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.stat-associated-table th.stat-associated-table-metric-heading {
    overflow-wrap: normal;
    word-break: normal;
    text-align: center;
    white-space: nowrap;
}

.stat-associated-table-heading--sorted {
    border-left: 1px dotted rgba(96, 165, 250, 0.7);
    border-right: 1px dotted rgba(96, 165, 250, 0.7);
    border-bottom: 1px dotted rgba(96, 165, 250, 0.6);
    background: rgba(37, 99, 235, 0.16);
}

.stat-associated-table-heading--sorted .stat-associated-table-sort-indicator {
    color: rgba(191, 219, 254, 0.98);
}

.stat-associated-table td.stat-associated-table-metric-cell {
    text-align: center;
    white-space: nowrap;
}

.stat-associated-table-cell--sorted {
    border-left: 1px dotted rgba(96, 165, 250, 0.55);
    border-right: 1px dotted rgba(96, 165, 250, 0.55);
}

.stat-associated-table-metric-heading {
    padding-inline: 10px;
}

.stat-associated-table-metric-cell {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding-inline: 10px;
}

.stat-associated-table th.stat-associated-table-metric-heading:last-child,
.stat-associated-table td.stat-associated-table-metric-cell:last-child {
    padding-right: 20px;
}

.stat-associated-table-subject-cell {
    vertical-align: middle;
    min-width: 0;
    padding: 11px 16px;
}

.stat-entity-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    width: 100%;
    max-width: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.stat-entity-card .child-icon {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-accent);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.stat-entity-card .child-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.stat-entity-card .child-name,
.stat-entity-card .child-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-entity-card .child-name {
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.15;
}

.stat-entity-card .child-subtitle {
    color: var(--text-muted);
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.stat-event-card {
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 4px;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 5px 8px 5px 10px;
    border-left: 3px solid var(--event-color, #4caf50);
    border-radius: 4px;
    background: color-mix(in srgb, var(--event-color, #4caf50) 9%, rgba(255, 255, 255, 0.035));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    container-type: inline-size;
}

.stat-event-card-head,
.stat-event-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    line-height: 1;
}

.stat-event-card-venue-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.stat-event-card-venue-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--facility-color, var(--event-color, #4caf50));
}

.stat-event-card-context {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.5rem;
    font-style: italic;
    opacity: 0.72;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-event-card-state {
    flex: 0 0 auto;
    font-size: 0.3125rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.stat-event-card-state--future {
    color: #69f0ae;
}

.stat-event-card-state--past {
    color: #ff5252;
}

.stat-event-card-title {
    overflow: hidden;
    color: #fff;
    font-size: clamp(0.56rem, 6cqi, 0.75rem);
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-event-card-info {
    min-width: 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.62);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-event-card-badge {
    flex: 0 0 auto;
    padding: 1px 4px;
    border-radius: 2px;
    background: var(--event-color, #4caf50);
    color: #fff;
    font-size: 0.375rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.3;
    opacity: 0.78;
    text-transform: uppercase;
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
    .profile-header {
        align-items: center;
        gap: 18px;
        text-align: center;
    }

    .profile-info-both {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .profile-avatar {
        width: 58px;
        height: 58px;
        font-size: 1.35rem;
    }

    .profile-info {
        min-width: 0;
    }

    .profile-name {
        margin-bottom: 2px;
    }

    .profile-type {
        margin-bottom: 6px;
    }
    
    .profile-meta {
        justify-content: center;
        gap: 8px 14px;
        margin-top: 4px;
    }

    .route-alias-row,
    .route-alias-link-control {
        grid-template-columns: 1fr;
    }

    .route-alias-copy-btn {
        width: 100%;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: calc(50% - 6px);
    }
    
    .data-table {
        font-size: 0.75rem;
    }

    .data-table-container--fit {
        overflow: hidden;
    }

    .data-table-container--fit.is-scaled {
        height: var(--data-table-scaled-height);
    }

    .data-table-container--fit .data-table {
        min-width: 520px;
        width: max-content;
        transform: scale(var(--data-table-scale));
        transform-origin: top left;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .data-table-container--fit .data-table th,
    .data-table-container--fit .data-table td {
        padding: 10px 12px;
    }

    .stat-associated-table-wrap {
        --stat-associated-subject-col-width: 230px;
        --stat-associated-metric-col-width: 72px;
        justify-content: flex-start;
    }

    .stat-associated-table th,
    .stat-associated-table td {
        padding: 10px 14px;
    }

    .stat-associated-table-subject-cell {
        padding: 11px 16px;
    }

    .stat-entity-card {
        gap: 8px;
    }

    .stat-entity-card .child-icon {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }

    .sticky-event-item {
        min-width: 150px;
        max-width: 190px;
        padding: 3px 7px;
    }

    .sticky-event-item .sticky-event-matchup {
        font-size: 0.6rem;
    }

    .sticky-event-item .event-info-line {
        font-size: 0.4375rem;
    }
}

/* ==============================================
   EVENT DETAIL STYLES
   Scoreboard, teams, and event-specific layouts
   ============================================== */

/* --- Event Venue Banner --- */
.event-venue {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.venue-icon {
    font-size: 1.2rem;
}

.venue-name {
    font-weight: 600;
    color: var(--text-primary);
}

.venue-location {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Event Scoreboard --- */
.event-scoreboard {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.scoreboard-matchup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.scoreboard-vs {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 12px;
    min-width: 40px;
    text-align: center;
}

.scoreboard-team {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    flex: 1;
    max-width: 280px;
}

.scoreboard-team.home {
    flex-direction: row-reverse;
    text-align: right;
}

.scoreboard-team.away .team-details {
    text-align: left;
}

.scoreboard-team.home .team-details {
    text-align: right;
}

/* Result highlighting */
.scoreboard-team.result-win {
    border-left: 3px solid var(--success, #4caf50);
}

.scoreboard-team.home.result-win {
    border-left: none;
    border-right: 3px solid var(--success, #4caf50);
}

.scoreboard-team.result-loss {
    border-left: 3px solid var(--error, #ef4444);
}

.scoreboard-team.home.result-loss {
    border-left: none;
    border-right: 3px solid var(--error, #ef4444);
}

.scoreboard-team.result-tie {
    border-left: 3px solid var(--warning, #f59e0b);
}

.scoreboard-team.home.result-tie {
    border-left: none;
    border-right: 3px solid var(--warning, #f59e0b);
}

.scoreboard-team .team-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.scoreboard-team .team-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.scoreboard-team .team-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.scoreboard-team .team-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
}

/* Non-matchup team list (practices, tournaments) */
.scoreboard-teams-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scoreboard-team-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.scoreboard-team-row.result-win {
    border-left: 3px solid var(--success, #4caf50);
}

.scoreboard-team-row.result-loss {
    border-left: 3px solid var(--error, #ef4444);
}

/* --- Event Stats Section --- */
.event-team-stats {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.team-stats-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.team-stats-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color, #4a9eff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
}

.team-stats-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

/* ==============================================
   Task 8: Admin Context Viewer Styles
   Debug-oriented viewer for permission resolution
   ============================================== */

.admin-context-viewer {
    margin-top: 16px;
    background: rgba(74, 158, 255, 0.05);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: var(--radius-sm);
}

.admin-context-viewer[open] {
    background: rgba(74, 158, 255, 0.08);
}

.acv-toggle {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    user-select: none;
}

.acv-toggle::-webkit-details-marker {
    display: none;
}

.acv-toggle::before {
    content: '▶';
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.admin-context-viewer[open] .acv-toggle::before {
    transform: rotate(90deg);
}

.acv-toggle:hover {
    background: rgba(74, 158, 255, 0.1);
}

.acv-toggle .config-context {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.acv-container {
    padding: 12px 14px;
    border-top: 1px solid rgba(74, 158, 255, 0.15);
}

/* Status badges row */
.acv-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.acv-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.acv-badge-granted {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.acv-badge-denied {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.acv-badge-direct {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.acv-badge-inherited {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.acv-badge-source {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-color, #4a9eff);
    font-family: monospace;
    font-size: 0.6875rem;
}

/* Permissions table */
.acv-section {
    margin-bottom: 12px;
}

.acv-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.acv-permissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.acv-permissions-table th,
.acv-permissions-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.acv-permissions-table th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.acv-domain {
    font-weight: 500;
}

.acv-perm-value {
    width: 60px;
    text-align: center;
    font-weight: 700;
}

.acv-perm-value.acv-granted {
    color: #22c55e;
}

.acv-perm-value.acv-denied {
    color: #ef4444;
}

.acv-perm-value.acv-na {
    color: var(--text-muted);
    font-style: italic;
}

.acv-ceiling {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Ancestor chain */
.acv-ancestor-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.acv-ancestor-item {
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.acv-ancestor-item.acv-grant-yes {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.acv-ancestor-item.acv-grant-no {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.acv-chain-arrow {
    color: var(--text-muted);
    font-size: 0.625rem;
}

/* Trace details */
.acv-trace-details,
.acv-policy-details {
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
}

.acv-trace-details summary,
.acv-policy-details summary {
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.acv-trace-details summary:hover,
.acv-policy-details summary:hover {
    background: rgba(74, 158, 255, 0.1);
}

.acv-trace-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.acv-trace-table th,
.acv-trace-table td {
    padding: 5px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.acv-trace-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    font-size: 0.625rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.acv-trace-action {
    font-family: monospace;
    color: var(--accent-color, #4a9eff);
    white-space: nowrap;
}

.acv-trace-detail {
    color: var(--text-secondary);
    word-break: break-word;
}

/* Policy JSON display */
.acv-policy-json {
    margin: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.6875rem;
    font-family: monospace;
    color: var(--text-secondary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.acv-no-policy {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.acv-error {
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #ef4444;
    font-size: 0.75rem;
    margin-bottom: 12px;
}

.team-stats-players {
    padding: 8px;
}

.player-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
}

.player-stats-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.player-jersey {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--accent-color, #4a9eff);
    min-width: 28px;
}

.player-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.player-stat-values {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(74, 158, 255, 0.15);
    border-radius: 12px;
    font-size: 0.75rem;
}

.stat-chip .stat-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    margin: 0;
}

.stat-chip .stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8125rem;
}

/* --- Event Notes --- */
.event-notes {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* --- Responsive Event Styles --- */
@media (max-width: 600px) {
    .scoreboard-matchup {
        flex-direction: column;
        gap: 12px;
    }
    
    .scoreboard-vs {
        padding: 8px 0;
    }
    
    .scoreboard-team {
        max-width: none;
        width: 100%;
    }
    
    .scoreboard-team.home {
        flex-direction: row;
        text-align: left;
    }
    
    .scoreboard-team.home .team-details {
        text-align: left;
    }
    
    .scoreboard-team.home.result-win,
    .scoreboard-team.home.result-loss,
    .scoreboard-team.home.result-tie {
        border-right: none;
        border-left: 3px solid inherit;
    }
    
    .player-stats-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .player-stat-values {
        justify-content: flex-start;
    }
}
