:root {
    --viewport-height: 100vh;
    --viewport-top: 0px;
    --viewport-bottom-offset: 0px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    color-scheme: light;
    --bg: #eef4fb;
    --panel: #ffffff;
    --panel-soft: #f7faff;
    --text: #1f2a37;
    --muted: #6b7280;
    --line: #d8e2ee;
    --primary: #1d74f5;
    --primary-dark: #155bc2;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 18px 44px rgba(48, 77, 109, 0.12);
}

@supports (height: 100dvh) { :root { --viewport-height: 100dvh; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.has-modal { overflow: hidden; }

* {
    box-sizing: border-box;
}

.auction-profile-entry {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: #eaf2ff;
    padding: 9px 14px;
    border-radius: 8px;
}

.homeland-extreme-estimate {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 8px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.homeland-extreme-estimate small { color: var(--muted); }

.simulation-slots-panel { margin-bottom: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.simulation-slots-heading, .simulation-slot-heading, .simulation-slot-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.simulation-slots-heading { flex-wrap: wrap; margin-bottom: 14px; }
.simulation-slots-heading h2 { margin: 0 0 6px; font-size: 18px; }
.simulation-slots-heading small { color: var(--muted); font-weight: 500; }
.simulation-slots-panel .hint { margin: 5px 0; overflow-wrap: anywhere; }
.simulation-slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.simulation-slot { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.simulation-slot-name { margin: 12px 0 4px; font-weight: 600; overflow-wrap: anywhere; }
.simulation-slot-actions { margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
#slotBindRole { width: 100%; min-width: 0; margin: 8px 0; }
@media (max-width: 480px) {
    .simulation-slots-panel { padding: 14px; }
    .simulation-slots-heading > button { width: 100%; }
}

body {
    margin: 0;
    padding-inline: var(--safe-left) var(--safe-right);
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(29, 116, 245, 0.13), transparent 38%),
        linear-gradient(315deg, rgba(22, 163, 74, 0.10), transparent 42%),
        var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    min-height: 36px;
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button.ghost {
    color: var(--primary);
    background: #eaf2ff;
}

button.ghost:hover {
    background: #dceaff;
}

button.danger {
    background: var(--danger);
}

button.danger:hover {
    background: #b91c1c;
}

button.success {
    background: var(--success);
}

button.success:hover {
    background: #15803d;
}

input,
select,
textarea {
    min-width: 0;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    outline: none;
}

textarea {
    height: auto;
    min-height: 110px;
    resize: vertical;
    padding: 10px 12px;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 116, 245, 0.14);
}

/* Shared dropdown menu. Keep the original field layout and form/event bindings. */
.custom-select-popup {
    position: fixed; inset: auto; z-index: 1300; margin: 0; padding: 6px;
    display: flex; flex-direction: column; gap: 6px; box-sizing: border-box;
    min-width: 0; border: 1px solid var(--line, #dce5ef); border-radius: 10px;
    color: var(--text, #334b69); background: var(--panel, #fff);
    box-shadow: 0 8px 28px #243e6426; font-size: 14px; line-height: 1.5;
    animation: custom-select-appear .12s ease-out;
}
.custom-select-popup input.custom-select-search {
    flex: 0 0 auto; width: 100%; min-width: 0; min-height: 36px; height: 36px;
    box-sizing: border-box; margin: 0; padding: 6px 10px; font-size: 16px;
    border: 1px solid var(--line, #dce5ef); border-radius: 6px; background: #fff;
}
.custom-select-search[hidden] { display: none !important; }
.custom-select-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; outline: none; }
.custom-select-option {
    position: relative; min-height: 38px; box-sizing: border-box; padding: 9px 30px 9px 10px;
    border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; white-space: normal;
}
.custom-select-option[aria-selected="true"] { color: var(--primary, #1d74f5); font-weight: 600; }
.custom-select-option[aria-selected="true"]::after { content: "✓"; position: absolute; right: 10px; top: 9px; }
.custom-select-option.is-active, .custom-select-option:not([aria-disabled="true"]):hover { background: #eaf2ff; color: var(--primary, #1d74f5); }
.custom-select-option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.custom-select-group { padding: 7px 10px 3px; color: var(--muted, #718198); font-size: 12px; }
.custom-select-empty { margin: 0; padding: 14px 10px; color: var(--muted, #718198); text-align: center; }
@keyframes custom-select-appear { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .custom-select-popup { animation: none; } }

.site-banners {
    position: fixed;
    z-index: 1000;
    top: 78px;
    left: 50%;
    width: min(420px, calc(100vw - 20px));
    transform: translateX(-50%);
    display: grid;
    gap: 6px;
    max-height: calc(100vh - 92px);
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 1px 1px 4px;
    filter: drop-shadow(0 8px 16px rgba(31, 42, 55, 0.18));
}

@media (min-width: 921px) {
    .site-banners.has-two-banners {
        width: min(850px, calc(100vw - 28px));
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        align-items: start;
    }
}

.announcement-banner,
.featured-notice-banner {
    min-width: 0;
    border: 1px solid #bfd2ea;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fff;
}

.featured-notice-banner {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: #e5a862;
    border-radius: 12px;
    padding: 8px 12px;
    color: #643118;
    background:
        radial-gradient(circle at 90% 10%, rgba(253, 179, 159, 0.55), transparent 42%),
        linear-gradient(125deg, #fff8d7, #ffecd5 52%, #ffe6ed);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    animation: featured-notice-enter 0.35s ease-out;
}

.featured-notice-banner::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.65) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: featured-notice-shine 5s ease-in-out 3;
    pointer-events: none;
}

.featured-notice-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.featured-notice-spark {
    color: #ba5c12;
    font-size: 18px;
    line-height: 1;
}

.featured-notice-banner .featured-notice-heading strong {
    border-radius: 999px;
    padding: 3px 8px;
    color: #fff;
    background: linear-gradient(110deg, #b45210, #b12a53);
    font-size: 13px;
}

.featured-notice-banner .announcement-heading .icon-button {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    color: #713418;
    background: rgba(255, 255, 255, 0.65);
}

.featured-notice-banner .icon-button:hover {
    background: #fff;
}

.featured-notice-banner .announcement-content {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.45;
    max-height: 160px;
    max-height: min(20dvh, 160px);
}

@keyframes featured-notice-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes featured-notice-shine {
    0%, 65% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .featured-notice-banner,
    .featured-notice-banner::before {
        animation: none;
    }
}

.announcement-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.announcement-heading strong {
    font-size: 16px;
}

.announcement-heading .icon-button {
    flex: 0 0 36px;
}

.announcement-content {
    margin: 10px 0 8px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.65;
    max-height: 240px;
    max-height: min(26dvh, 240px);
    overflow-y: auto;
}

.announcement-banner small {
    display: block;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.5;
}

.banner-dismiss-today {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    cursor: pointer;
}

.banner-dismiss-today input { width: 14px; height: 14px; min-height: 0; margin: 0; accent-color: #657bd4; }

.announcement-admin-card > label {
    display: block;
    margin: 12px 0 6px;
    color: var(--muted);
    font-size: 13px;
}

.announcement-admin-card .announcement-admin-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.announcement-admin-toggle input {
    width: 18px;
    height: 18px;
}

.announcement-admin-card textarea {
    width: 100%;
}

.announcement-admin-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 24px;
    border-right: 1px solid rgba(216, 226, 238, 0.85);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: block;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 10px 24px rgba(29, 116, 245, 0.24);
}

.brand h1,
.brand p,
.topbar h2,
.hero-panel h3,
.section-title h3,
.empty-state h3 {
    margin: 0;
}

.brand h1 {
    font-size: 18px;
}

.brand p,
.hint,
.meta-line,
.pid,
.metric small,
.eyebrow {
    color: var(--muted);
}

.brand p,
.hint,
.metric small,
.pid {
    font-size: 12px;
}

.auth-panel,
.role-list,
.hero-panel,
.metric,
.action-panel,
.log-panel,
.empty-state {
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 14px;
}

.auth-panel label {
    display: block;
    margin: 10px 0 6px;
    color: var(--muted);
    font-size: 13px;
}

.auth-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.auth-header span {
    font-weight: 800;
}

.auth-header small {
    color: var(--muted);
}

.auth-panel input,
.auth-panel button {
    width: 100%;
}

.auth-panel input.locked {
    border-color: #c9d5e3;
    color: #526175;
    background: #eef2f7;
    cursor: not-allowed;
}

.auth-panel button {
    margin-top: 12px;
}

.password-field { position: relative; width: 100%; min-width: 0; }
.password-field input { display: block; width: 100%; min-width: 0; padding-right: 48px; }
.password-field input::-ms-reveal { display: none; }
.password-field .password-visibility-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
}
.password-field .password-visibility-toggle:hover { color: var(--primary); background: rgba(99, 122, 155, 0.08); }
.password-field .password-visibility-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.password-visibility-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility-toggle[aria-pressed="false"] .password-eye-slash { display: none; }

/* Compatibility for the login page issued before the layout was embedded. */
.auth-account-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-account-row input {
    flex: 1;
    min-width: 0;
}

.auth-account-row #loginAccountToggle,
.auth-account-list button {
    min-height: 44px;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text);
}

.auth-account-row #loginAccountToggle {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
}

#loginAccountToggle::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

#loginAccountToggle[aria-expanded="true"]::before {
    margin-top: 4px;
    transform: rotate(225deg);
}

.auth-account-list {
    position: absolute;
    z-index: 5;
    inset: calc(100% + 6px) 0 auto;
    max-height: 264px;
    max-height: min(264px, 45dvh);
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 20px rgb(23 37 54 / 14%);
}

.auth-account-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
}

.auth-account-list button[data-login-account] {
    min-width: 0;
    overflow: hidden;
    padding: 0 10px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-account-list button[data-remove-login-account] {
    padding: 0;
    font-size: 19px;
    color: var(--muted);
}

.auth-account-row #loginAccountToggle:enabled:hover,
.auth-account-list button:hover,
.auth-account-list button[aria-current="true"] {
    background: rgba(99, 122, 155, 0.10);
}

.auth-account-list button[data-remove-login-account]:hover {
    color: var(--danger);
}

.auth-account-row button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.auth-panel .auth-remember-password {
    display: flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    margin: 12px 0 0;
    cursor: pointer;
}

.auth-remember-password input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

.auth-captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

.email-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-code-row input { flex: 1; min-width: 0; }
.email-code-row button:disabled, #confirmRegistrationEmailSendBtn:disabled {
    color: #6b7280;
    background: #e5e7eb;
    border-color: #d1d5db;
    opacity: 1;
}
.email-code-row button, .auth-panel .email-code-row button {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 12px;
    white-space: nowrap;
}

.auth-panel .auth-forgot-password { margin-top: 6px; font-size: 13px; }
.email-modal label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
.email-modal input { width: 100%; }
.profile-email-status { overflow-wrap: anywhere; }
.email-binding-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; flex: 0 0 auto; border-radius: 50%; background: #ef4444; vertical-align: middle; }
.user-avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.user-avatar-wrap .email-binding-dot { position: absolute; top: -1px; right: -1px; margin: 0; box-shadow: 0 0 0 2px var(--card-bg, white); pointer-events: none; }

.auth-captcha-row input {
    flex: 1;
    min-width: 0;
    width: 0;
    margin: 0;
}

.auth-captcha-row img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.auth-captcha-row button,
.email-modal .auth-captcha-row button,
.auth-panel .auth-captcha-row button {
    width: 44%;
    max-width: 160px;
    min-height: 44px;
    flex: 0 0 auto;
    margin: 0;
    padding: 2px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.hint {
    margin: 8px 0 0;
    line-height: 1.5;
}

.password-hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.password-hint.error {
    color: var(--danger);
}

.password-hint.ok {
    color: var(--success);
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 8px;
}

.tab {
    color: var(--muted);
    background: #edf3fb;
}

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

.role-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.role-list-header button {
    min-height: 30px;
    padding: 0 10px;
    color: var(--primary);
    background: #eaf2ff;
}

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

.role-list {
    overflow: auto;
    flex: 1 1 auto;
    min-height: 180px;
    max-height: none;
    padding: 8px;
}

.modal.game-code-modal { width: min(480px, calc(100vw - 28px)); height: fit-content; border: 1px solid var(--line); border-radius: 12px; padding: 18px; color: var(--text); background: var(--panel); }
.game-code-modal[open] { display: grid; gap: 12px; }
.game-code-modal::backdrop { background: rgba(15, 23, 42, .45); }
.game-code-modal textarea, .game-code-entry textarea { box-sizing: border-box; width: 100%; resize: vertical; margin: 8px 0; }
.game-code-modal textarea { margin: 0; min-height: 100px; max-height: 240px; }
.game-code-modal .modal-header h3 { min-width: 0; margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.game-code-modal .modal-header .icon-button { flex: 0 0 32px; min-width: 32px; min-height: 32px; }
.game-code-modal .modal-actions, .game-code-modal .hint { margin: 0; }
.game-code-modal .hint { white-space: pre-line; overflow-wrap: anywhere; }
.game-code-entry { display: grid; gap: 6px; }
.game-code-entry button { justify-self: start; }
.game-code-warning { margin: 0; padding: 12px; border-radius: 10px; background: rgba(245, 158, 11, .1); color: #b45309; font-size: 13px; line-height: 1.6; }
.game-code-accept { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; }
.game-code-accept input { flex: 0 0 16px; width: 16px; height: 16px; padding: 0; margin: 2px 0 0; }

.role-card {
    display: grid;
    gap: 6px;
    width: 100%;
    margin: 0 0 8px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    text-align: left;
    background: transparent;
}

.role-card:hover,
.role-card.active {
    border-color: #b9d4fb;
    background: #f1f7ff;
}

.role-card strong,
.role-card span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-card span {
    color: var(--muted);
    font-size: 12px;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
}

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

.topbar h2 {
    font-size: 22px;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#toolsBtn {
    min-width: 72px;
    font-weight: 800;
}

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

.connection {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.8);
}

.connection.ok {
    color: #166534;
    background: #dcfce7;
}

.connection.bad {
    color: #991b1b;
    background: #fee2e2;
}

.network-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px auto;
    padding: 10px 14px;
    width: min(960px, calc(100% - 24px));
    border: 1px solid #f0c88d;
    border-radius: 10px;
    background: #fff8e8;
    color: #744512;
    font-size: 13px;
    line-height: 1.6;
}

.network-notice button {
    flex-shrink: 0;
}
.website-verification-dialog { width: min(520px, calc(100vw - 24px)); }
.website-verification-dialog iframe { display: block; width: 100%; height: min(520px, 65vh); border: 0; }
.website-verification-dialog iframe[hidden] { display: none; }

.view {
    display: none;
}

.view.active {
    display: block;
}

.hidden {
    display: none !important;
}

.homeland-priority-dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-sizing: border-box; overflow: auto; }
.homeland-priority-dialog > p { font-size: 13px; color: var(--muted); }
.homeland-priority-list { max-height: min(55dvh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.homeland-priority-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px 34px; align-items: center; gap: 6px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.homeland-priority-row button { padding: 4px; min-width: 30px; min-height: 34px; }
.homeland-priority-handle { touch-action: none; cursor: grab; font-size: 22px; }
.homeland-priority-open { margin-top: 8px; font-size: 13px; }

.role-detail {
    display: grid;
    gap: 10px;
}

.config-detail {
    display: grid;
    gap: 16px;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 74px;
    padding: 12px 14px;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 118px;
    padding: 22px;
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.config-header h3 {
    margin: 0;
    font-size: 26px;
}

.config-header > div {
    min-width: 0;
    max-width: 100%;
}

#configRoleMeta {
    overflow-wrap: anywhere;
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.config-expand-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.config-hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.config-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.config-toolbar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 12;
    align-self: start;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: #f8fafd;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    /* Keep stacked sticky bars out of backdrop-filter compositing on mobile. */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.config-category-bar {
    display: flex;
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.config-search {
    position: relative;
    display: flex;
    flex: 0 1 280px;
    min-width: 190px;
    align-items: center;
}

.config-search-icon {
    position: absolute;
    left: 12px;
    width: 13px;
    height: 13px;
    border: 2px solid #64748b;
    border-radius: 50%;
    pointer-events: none;
}

.config-search-icon::after {
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 6px;
    height: 2px;
    border-radius: 2px;
    background: #64748b;
    content: "";
    transform: rotate(45deg);
}

.config-search input {
    width: 100%;
    min-height: 36px;
    padding-left: 36px;
    background: #fff;
}

.config-category-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 14px;
    color: #334155;
    background: #fff;
    font-weight: 800;
}

.config-update-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.config-update-count[hidden] { display: none; }

.config-field-update {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #ef4444;
}

.config-field-update[hidden] { display: none; }
.config-update-guide[hidden] { display: none; }
.config-update-guide { flex: 0 0 auto; min-height: 44px; }
.config-guide-target { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
.war-revive-exports { grid-column: 1 / -1; justify-self: start; flex-wrap: wrap; }
.war-revive-exports button, [data-union-export] { min-height: 44px; }
.personal-ranking-identity .personal-ranking-level { font-variant-numeric: tabular-nums; }


.config-category-tab:hover {
    color: var(--primary);
    border-color: #8bb7f3;
    background: #f7fbff;
}

.config-category-tab.active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 8px 16px rgba(29, 116, 245, 0.18);
}

.config-section-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.config-section {
    overflow: hidden;
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.config-section-toggle {
    display: flex;
    width: 100%;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
    color: var(--text);
    background: #fff;
    text-align: left;
}

.config-section-toggle:hover,
.config-section-toggle:focus-visible {
    color: var(--primary);
    background: #f7fbff;
}

.config-section-toggle h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 16px;
}

.config-section-chevron {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 160ms ease;
}

.config-section.expanded .config-section-chevron {
    transform: rotate(225deg);
}

.config-section-content {
    border-top: 1px solid #e6edf6;
}

.config-section-description {
    margin: 0;
    padding: 13px 16px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.config-search-empty {
    padding: 24px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    text-align: center;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
}

.config-field {
    display: grid;
    min-width: 0;
    gap: 8px;
    align-content: start;
    min-height: 78px;
    padding: 12px;
    border: 1px solid #e6edf6;
    border-radius: 8px;
    background: var(--panel-soft);
}

.config-field.disabled {
    opacity: 0.62;
    background: #f8fafc;
}

.config-field.wide {
    grid-column: 1 / -1;
}

.config-field > span:first-child {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.config-tooltip {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
    margin-left: 5px;
    padding: 0;
    border: 1px solid #94a3b8;
    border-radius: 50%;
    color: #475569;
    background: #fff;
    font: 700 11px/1 sans-serif;
    vertical-align: middle;
    cursor: help;
}

.config-tooltip::after {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    width: min(320px, 72vw);
    padding: 9px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #f8fafc;
    background: #1f2937;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.55;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.config-tooltip:hover::after,
.config-tooltip:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.config-field small,
.battle-preset-row small,
.challenge-task-control small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.challenge-task-row {
    min-height: 0;
}

.challenge-task-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 1fr);
    gap: 12px;
    align-items: end;
}

.challenge-task-control {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.challenge-task-control > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.competition-task-row {
    grid-template-columns: minmax(190px, 0.7fr) minmax(0, 2fr);
    gap: 14px;
    min-height: 0;
}

.competition-task-toggle,
.competition-task-types {
    display: grid;
    gap: 8px;
    min-width: 0;
    align-content: start;
}

.competition-task-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding-right: 14px;
    border-right: 1px solid #dbe5f1;
}

.competition-task-toggle > span,
.competition-task-types > span {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.competition-task-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.config-text-input {
    width: 100%;
}

.config-message {
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
    background: #fff;
}

.config-message.error {
    color: #991b1b;
    background: #fee2e2;
}

.config-section-empty {
    grid-column: 1 / -1;
    min-height: 58px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    background: #f8fafc;
    font-size: 13px;
}

.switch-control {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 72px;
    min-height: 34px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    padding: 0;
    color: #64748b;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.9);
}

.switch-control:hover {
    border-color: #9bbced;
    color: var(--primary);
    background: #f8fbff;
}

.switch-control .switch-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    width: 28px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transition: transform 0.18s ease, background 0.18s ease;
}

.switch-label {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
}

.switch-label.on {
    color: #94a3b8;
}

.switch-label.off {
    color: #475569;
}

.switch-control.on {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.switch-control.on:hover {
    background: var(--primary-dark);
}

.switch-control.on .switch-thumb {
    background: #fff;
    transform: translateX(36px);
}

.switch-control.on .switch-label.on {
    color: var(--primary);
}

.switch-control.on .switch-label.off {
    color: rgba(255, 255, 255, 0.8);
}

.number-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-wrap input {
    width: min(180px, 100%);
}

.config-select {
    width: min(220px, 100%);
}

.config-time-input {
    width: min(220px, 100%);
}

.config-select-sequence {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.config-select-sequence label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.config-select-sequence label > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.config-select-sequence .config-select {
    width: 100%;
}

.field-suffix {
    color: var(--muted);
    font-size: 12px;
}

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

.choice-row.compact {
    gap: 5px;
}

.config-searchable-options { min-width: 0; width: 100%; }
.config-options-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.config-options-toolbar input { flex: 1; min-width: 0; width: 100%; }
.config-options-toolbar small { flex-shrink: 0; color: var(--muted); }
.config-options-list { max-height: 220px; overflow-y: auto; padding: 2px; align-content: flex-start; }
.config-options-list .choice-chip[hidden] { display: none; }

.choice-row.disabled {
    opacity: 0.72;
}

.choice-chip {
    min-height: 32px;
    border: 1px solid #c7d8ef;
    border-radius: 6px;
    padding: 0 12px;
    color: #1e3a5f;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.choice-row.compact .choice-chip {
    min-height: 26px;
    border-radius: 5px;
    padding: 0 8px;
    font-size: 12px;
}

.choice-chip:hover {
    color: var(--primary);
    border-color: #8bb7f3;
    background: #f7fbff;
}

.choice-chip.selected {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
    box-shadow: 0 6px 14px rgba(29, 116, 245, 0.18);
}

.choice-chip.selected:hover {
    color: #fff;
    background: var(--primary-dark);
}

.homeland-rules-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.homeland-schedules {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 12px;
}

.homeland-schedule {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 12px;
    padding: 12px;
    border: 1px solid #cbd8e8;
    border-radius: 8px;
    background: #f8fbff;
}

.homeland-schedule-header {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) auto 42px;
    align-items: center;
    gap: 10px;
}

.homeland-schedule-time {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.homeland-schedule-time input {
    width: 126px;
}

.homeland-schedule-delete {
    min-width: 42px;
    min-height: 42px;
    color: #b42318;
    font-size: 22px;
}

.homeland-schedule-add {
    justify-self: start;
    min-height: 42px;
}

.homeland-schedule-empty {
    padding: 14px;
    border: 1px dashed #cbd8e8;
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.homeland-rule-card {
    display: grid;
    gap: 10px;
    min-height: 78px;
    padding: 10px;
    border: 1px solid #d7e3f2;
    border-radius: 8px;
    background: #fff;
}

.homeland-rule-name,
.homeland-rule-level {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.homeland-rule-name {
    align-items: flex-start;
    justify-content: flex-start;
    color: #1f2937;
    font-size: 13px;
    font-weight: 800;
}

.homeland-rule-name > span,
.homeland-rule-level > span:first-child {
    min-width: 0;
}

.homeland-rule-name small,
.homeland-rule-level small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
}

.homeland-rule-name input {
    width: 16px;
    height: 16px;
}

.homeland-rule-level span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.homeland-rule-level input {
    width: 48px;
    min-width: 48px;
    border: 0;
    border-radius: 0;
    padding: 0 2px;
    text-align: center;
    appearance: textfield;
}

.homeland-rule-level input::-webkit-inner-spin-button,
.homeland-rule-level input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.homeland-level-stepper {
    display: grid;
    grid-template-columns: 42px 48px 42px;
    align-items: stretch;
    overflow: hidden;
    min-height: 42px;
    border: 1px solid #cbd8e8;
    border-radius: 6px;
    background: #fff;
    flex: 0 0 auto;
    width: 134px;
    box-sizing: border-box;
}

.homeland-level-stepper button {
    min-width: 42px;
    min-height: 42px;
    border: 0;
    border-radius: 0;
    padding: 0;
    color: #1e5fa8;
    background: #edf5ff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.homeland-level-stepper button:first-child {
    border-right: 1px solid #cbd8e8;
}

.homeland-level-stepper button:last-child {
    border-left: 1px solid #cbd8e8;
}

.homeland-level-stepper button:active {
    background: #dbeafe;
}

.battle-preset-card {
    display: grid;
    gap: 10px;
    align-content: start;
    min-height: 0;
    padding: 12px;
    border: 1px solid #cfe0f6;
    border-radius: 8px;
    background: linear-gradient(180deg, #f8fbff, #eef6ff);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.battle-preset-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    padding-bottom: 7px;
}

.battle-preset-title strong {
    color: #1e3a5f;
    font-size: 13px;
}

.battle-preset-title span {
    color: var(--muted);
    font-size: 12px;
}

.battle-preset-controls {
    display: grid;
    gap: 7px;
}

.battle-preset-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 8px;
}

.battle-preset-row.disabled {
    opacity: 0.58;
}

.battle-preset-row > span {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.time-list {
    display: grid;
    gap: 10px;
}

.inline-add {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-add input {
    width: 132px;
}

.hero-panel h3 {
    font-size: 20px;
}

.meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
}

.hero-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 10px;
    color: #374151;
    background: #e5e7eb;
    font-weight: 700;
    font-size: 12px;
}

.status-pill.running {
    color: #166534;
    background: #dcfce7;
}

.status-pill.stopped {
    color: #475569;
    background: #e2e8f0;
}

.status-pill.crashed,
.status-pill.kicked,
.status-pill.rateLimited,
.status-pill.error {
    color: #991b1b;
    background: #fee2e2;
}

.status-pill.starting,
.status-pill.waitingMemory,
.status-pill.waitingRestart,
.status-pill.stopping {
    color: #92400e;
    background: #fef3c7;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.metric {
    min-height: 76px;
    padding: 10px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metric strong {
    display: block;
    margin: 5px 0;
    font-size: 21px;
    line-height: 1;
}

.action-panel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
}

.auto-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
}

.auto-refresh input {
    width: 16px;
    height: 16px;
    min-height: 0;
    padding: 0;
}

.log-panel {
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(219, 234, 254, 0.72), rgba(238, 242, 255, 0.68)),
        #edf4fc;
    backdrop-filter: blur(12px);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
}

.section-title h3 {
    font-size: 16px;
}

.log-layout {
    display: grid;
    grid-template-columns: 152px minmax(0, 1fr);
    height: clamp(480px, calc(100vh - 330px), 760px);
    border-top: 1px solid #e5eaf1;
    background: rgba(239, 246, 255, 0.58);
}

.log-tag-filter {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-right: 1px solid #e5eaf1;
    background: rgba(226, 238, 252, 0.68);
    backdrop-filter: blur(10px);
}

.log-tag {
    min-height: 24px;
    border: 1px solid var(--tag-border, rgba(148, 163, 184, 0.28));
    border-radius: 6px;
    padding: 0 7px;
    color: var(--tag-color, #cbd5e1);
    text-align: left;
    background: var(--tag-bg, transparent);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.3;
}

.log-tag:hover,
.log-tag.active {
    color: var(--tag-color, var(--primary));
    border-color: var(--tag-color, var(--primary));
    background: var(--tag-bg, rgba(37, 99, 235, 0.10));
    box-shadow: inset 3px 0 0 var(--tag-color, var(--primary));
}

.tools-view {
    display: grid;
    gap: 14px;
}

.tool-shell {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
}

.tool-list {
    display: grid;
    align-content: start;
    gap: 8px;
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.tool-list-item {
    width: 100%;
    color: var(--muted);
    text-align: left;
    background: #edf3fb;
}

.tool-list-item.active {
    color: #fff;
    background: var(--primary);
}

.merchant-path-view {
    display: grid;
    gap: 14px;
}

.activity-tree-view {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.activity-tree-panel {
    padding: 16px;
}

.activity-tree-panel h4 {
    margin: 0 0 12px;
    font-size: 16px;
}

.activity-tree-controls,
.activity-tree-gifts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.activity-tree-controls label,
.activity-tree-gift {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.activity-tree-controls input,
.activity-tree-controls select,
.activity-tree-gift input {
    width: 100%;
}

#activityTreeReverseControls {
    margin-top: 12px;
    align-items: end;
}

.war-season-damage-controls label { min-width: 0; align-content: start; }
.war-season-damage-value { display: grid; grid-template-columns: minmax(0, 1fr) 82px; gap: 8px; }
.war-season-damage-value input { min-width: 0; }
.war-season-damage-controls small { font-weight: 400; }

.mountain-query-form { display: grid; gap: 8px; }
.mountain-query-form > div { display: flex; gap: 8px; }
.mountain-query-form input { flex: 1; min-width: 0; }
.mountain-query-form button { flex-shrink: 0; }
.mountain-query-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.mountain-query-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.mountain-query-grid > * { padding: 8px; overflow-wrap: anywhere; }
.mountain-catalog-list { display: grid; gap: 8px; }
.mountain-catalog-list > details { min-width: 0; border: 1px solid var(--line); border-radius: 10px; }
.mountain-catalog-list > details > summary { padding: 12px; cursor: pointer; font-size: 14px; overflow-wrap: anywhere; }
.mountain-catalog-list > details > div { padding: 0 12px 12px; }
.mountain-server-btn { display: grid; gap: 4px; min-height: 48px; text-align: left; }
.mountain-server-btn small { font-size: 11px; font-weight: 400; }
.mountain-server-btn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.mountain-server-unions:not(:empty) { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.mountain-server-unions h3 { margin: 0; font-size: 16px; }
.mountain-union-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 12px 0; }
.mountain-union-list article { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); overflow-wrap: anywhere; }
.mountain-union-list dl { display: grid; gap: 6px; margin: 10px 0; font-size: 13px; }
.mountain-union-list dl div { display: flex; gap: 12px; justify-content: space-between; }
.mountain-union-list dt { flex-shrink: 0; color: var(--muted); }
.mountain-union-list dd { margin: 0; text-align: right; }
.agent-record-section > summary,
.admin-add-agent > summary { cursor: pointer; font-size: 16px; font-weight: 700; }
.agent-record-section { min-width: 0; }
.agent-invitation-summary { margin: 12px 0 8px; font-size: 12px; color: var(--muted); }
.agent-invitation-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; list-style: none; padding: 0; margin: 0; }
.agent-invitation-card { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow-wrap: anywhere; }
.agent-invitation-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.agent-invitation-card .agent-invitation-name strong { margin: 0; font-size: 14px; }
.agent-invitation-name small { color: var(--primary); font-size: 11px; }
.agent-invitation-card .agent-invitation-roles { color: var(--text); font-size: 12px; }
.agent-invitation-card .agent-invitation-date { color: var(--muted); font-size: 11px; }
.agent-invitation-status:not(:empty) { margin-top: 10px; }
.agent-admin-tree { margin-top: 8px; width: 100%; }
.agent-admin-tree > summary { cursor: pointer; color: var(--primary); }
.agent-admin-row:has(.agent-admin-tree[open]) { display: block; }
.agent-admin-row:has(.agent-admin-tree[open]) .agent-admin-controls { margin-top: 12px; }
@media (max-width: 600px) {
    .agent-invitation-list { max-height: 300px; }
}
.agent-record-controls { display: flex; gap: 8px; margin: 12px 0; }
.agent-record-controls:empty { margin: 0; }
.agent-quota-grant-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.agent-quota-grant-fields label { display: grid; gap: 6px; min-width: 0; flex: 1 1 180px; }
.agent-quota-grant-fields input { width: 100%; min-width: 0; box-sizing: border-box; }
.agent-quota-grant-fields > button { flex: 0 0 auto; }
@media (max-width: 540px) {
    .agent-quota-grant-fields > button { width: 100%; }
}
.agent-network-overview { border-color: #cddcf0; background: linear-gradient(135deg, #f5f9ff, #fff); }
.agent-network-overview > .section-title { flex-wrap: wrap; gap: 6px 12px; margin-bottom: 12px; }
.agent-network-overview > .section-title > span { color: var(--muted); font-size: 12px; }
.agent-network-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.agent-network-stats > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.agent-network-stats dt { color: var(--muted); font-size: 12px; }
.agent-network-stats dd { margin: 7px 0 0; color: var(--text); font-size: 21px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.agent-network-stats > .agent-network-spend { border-color: #c9daf4; background: #eaf2ff; }
.agent-network-spend dd { color: var(--primary-dark); font-size: 25px; }
.agent-network-overview > details { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 700px) {
    .agent-network-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .agent-network-stats > div { padding: 10px; }
    .agent-network-stats dd { font-size: 19px; }
    .agent-network-spend dd { font-size: 22px; }
}
.admin-add-agent { margin: 12px 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.admin-add-agent > input { width: min(100%, 320px); margin-bottom: 12px; }
.agent-record-section .agent-money-table { width: 100%; }

.activity-tree-gifts {
    margin-top: 20px;
}

.activity-tree-gifts h4 {
    grid-column: 1 / -1;
    margin: 0;
}

.activity-tree-gift {
    grid-template-columns: minmax(0, 1fr) 90px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.activity-tree-gift small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
}

.activity-tree-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.activity-tree-metrics div {
    border-left: 3px solid var(--primary);
    padding: 4px 10px;
}

.activity-tree-metrics small {
    display: block;
    color: var(--muted);
}

.activity-tree-metrics strong {
    display: block;
    margin-top: 3px;
    font-size: 20px;
}

.activity-tree-tiers {
    margin-top: 16px;
}

.activity-tree-tiers summary {
    color: var(--primary);
    cursor: pointer;
    font-weight: 700;
}

.activity-tree-tiers table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.activity-tree-tiers th,
.activity-tree-tiers td {
    border-bottom: 1px solid var(--line);
    padding: 8px;
}

.union-power-view {
    display: grid;
    min-width: 0;
    gap: 14px;
}

.holy-land-groups-view {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
}
.holy-land-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.holy-land-heading h2 { margin: 0; font-size: 21px; }
.holy-land-heading button { flex: 0 0 auto; }
.holy-land-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.holy-land-tabs button { min-height: 42px; border: 1px solid #dce4e8; background: #fff; color: #66747c; }
.holy-land-tabs button.active { border-color: #316d69; background: #e6efed; color: #194f4b; }
.holy-land-controls { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 10px; align-items: center; }
.holy-land-controls select { width: 100%; min-height: 42px; }
.holy-land-halves { display: flex; border: 1px solid #dce4e8; border-radius: 6px; overflow: hidden; }
.holy-land-halves button { min-height: 40px; min-width: 90px; border: 0; border-radius: 0; background: #f5f7f8; color: #6b777e; }
.holy-land-halves button.active { background: #205b58; color: #fff; }
.holy-land-halves button:disabled { opacity: .45; cursor: not-allowed; }
.holy-land-period { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; border: 1px solid #e0e6e8; border-radius: 6px; background: #f7f9fa; padding: 12px; }
.holy-land-period select { min-width: min(100%, 290px); min-height: 38px; font-size: 14px; }
.holy-land-period span { color: var(--muted); font-size: 12px; }
.holy-land-group-list { display: grid; gap: 12px; }
.holy-land-group { min-width: 0; border: 1px solid #dde4e7; border-radius: 8px; background: #fff; overflow: hidden; }
.holy-land-group > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; background: #f8faf9; }
.holy-land-group > summary::after { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-right: 1.5px solid #87949a; border-bottom: 1.5px solid #87949a; transform: rotate(-45deg); }
.holy-land-group[open] > summary::after { transform: rotate(45deg); }
.holy-land-group > summary::-webkit-details-marker,
.holy-land-union > summary::-webkit-details-marker { display: none; }
.holy-land-group > summary strong { color: #8d7740; font-size: 16px; }
.holy-land-group > summary span { color: var(--muted); font-size: 13px; }
.holy-land-unions { padding: 0 16px; }
.holy-land-union { min-width: 0; border-top: 1px solid #e7ebec; }
.holy-land-union > summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 12px; align-items: center; gap: 10px; min-height: 62px; padding: 8px 0; cursor: pointer; list-style: none; }
.holy-land-union > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid #8b9699; border-bottom: 1.5px solid #8b9699; transform: rotate(-45deg); }
.holy-land-union[open] > summary::after { transform: rotate(45deg); }
.holy-land-place { color: #7a878a; font-size: 14px; text-align: center; }
.holy-land-union-main { display: grid; gap: 3px; min-width: 0; }
.holy-land-union-main strong { overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.holy-land-union-main small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.holy-land-score { color: #927e42; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.holy-land-members { display: grid; padding: 0 0 10px 38px; }
.holy-land-union-detail { padding: 0 0 10px 38px; min-width: 0; }
.holy-land-union-detail h4 { margin: 12px 0 6px; font-size: 13px; }
.holy-land-union-detail .holy-land-members { padding: 0; }
.holy-land-match-scores { width: 100%; font-size: 12px; border-collapse: collapse; }
.holy-land-match-scores th, .holy-land-match-scores td { padding: 7px 8px; white-space: nowrap; text-align: left; border-bottom: 1px solid #edf1f2; }
.holy-land-members > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid #edf1f2; font-size: 12px; }
.holy-land-members > div span { overflow-wrap: anywhere; }
.holy-land-members > div strong { flex: 0 0 auto; }
.holy-land-members p { margin: 6px 0; color: var(--muted); font-size: 12px; }
.holy-land-member { border-top: 1px solid #edf1f2; min-width: 0; }
.holy-land-member > summary { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; cursor: pointer; font-size: 12px; }
.holy-land-member > summary span { overflow-wrap: anywhere; }
.holy-land-member > summary strong { flex: 0 0 auto; }
.holy-land-rank-list { min-width: 0; padding: 0 16px; }
.holy-land-rank-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 60px; padding: 8px 4px; border-top: 1px solid #e3e9eb; }
@media (max-width: 700px) {
    .holy-land-controls { grid-template-columns: minmax(0, 1fr) auto; }
    .holy-land-halves button { min-width: 68px; }
    .holy-land-period { display: grid; }
    .holy-land-unions, .holy-land-rank-list { padding: 0 10px; }
}
@media (max-width: 500px) {
    .holy-land-controls { grid-template-columns: 1fr; }
    .holy-land-halves button { flex: 1; }
    .holy-land-union-detail { padding-left: 0; }
    .holy-land-match-scores th, .holy-land-match-scores td { padding: 7px 4px; }
}

.union-power-header,
.union-power-panel {
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.union-power-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
}

.union-power-header h3 {
    margin: 0;
    font-size: 24px;
}

.union-power-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.union-access-note {
    width: fit-content;
    max-width: 100%;
    margin: 10px 0 0;
    border-left: 3px solid #94a3b8;
    padding: 5px 9px;
    color: #64748b;
    background: #f8fafc;
    font-size: 12px;
    line-height: 1.55;
}

.union-power-view.union-power-advanced .union-power-header,
.union-power-view.union-power-advanced .union-power-panel {
    border-color: rgba(202, 138, 4, 0.35);
    box-shadow: 0 10px 24px rgba(161, 98, 7, 0.08);
}

.management-badge { color: #854d0e; background: #fef3c7; border-radius: 5px; padding: 1px 5px; }
#adminManagementPanel { display: grid; gap: 16px; }
#adminManagementPanel.hidden { display: none; }
.topup-duration-controls { flex-wrap: wrap; }
.topup-duration-controls select { min-width: 120px; }
#managementRenewalCode { width: 100%; resize: vertical; overflow-wrap: anywhere; }
@media (max-width: 600px) {
    #adminManagementPanel .admin-list-heading { flex-wrap: wrap; }
    #adminManagementSearch { width: 100%; }
    .topup-duration-controls select { width: 100%; }
}

.union-power-view.union-power-advanced .union-power-header {
    background: #fffbeb;
}

.union-power-view.union-power-advanced .union-access-note {
    border-left-color: #ca8a04;
    color: #854d0e;
    background: #fef3c7;
}

.union-power-view.union-power-advanced .union-power-toolbar,
.union-power-view.union-power-advanced .union-power-table th {
    background: #fffdf5;
}

.union-power-status {
    flex: 0 0 auto;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--muted);
    background: #f8fafc;
    font-weight: 750;
}

.union-power-status.ok {
    border-color: #86efac;
    color: #15803d;
    background: #f0fdf4;
}

.union-power-status.warn {
    border-color: #fcd34d;
    color: #a16207;
    background: #fffbeb;
}

.union-power-status.bad {
    border-color: #fca5a5;
    color: #b91c1c;
    background: #fef2f2;
}

.union-power-panel {
    overflow: hidden;
}

.union-power-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 300px) auto;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid #e6edf6;
}

.union-power-toolbar select,
.union-power-toolbar input {
    width: 100%;
}

.union-power-table-wrap {
    overflow-x: auto;
}

.union-power-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    table-layout: fixed;
}

.union-power-table th,
.union-power-table td {
    overflow: hidden;
    border-bottom: 1px solid #e6edf6;
    padding: 10px 12px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.union-power-table th {
    color: #475569;
    background: #f8fafc;
    font-size: 12px;
}

.union-power-table tbody tr:last-child td {
    border-bottom: 0;
}

.union-power-table th:first-child,
.union-power-table .union-rank {
    width: 68px;
    color: var(--muted);
}

.union-power-table .union-name {
    width: 30%;
    font-weight: 750;
}

.union-power-table .union-power {
    width: 24%;
    font-variant-numeric: tabular-nums;
}

.union-power-table .missing {
    color: #a16207;
}

.union-power-empty {
    padding: 30px !important;
    color: var(--muted);
    text-align: center !important;
}

.union-history-tabs { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--surface-line, #e6edf6); }
.union-history-tabs button { padding: 6px 14px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #657891; box-shadow: none; }
.union-history-tabs button.active { border-color: #ead9ae; background: #fff5d9; color: #926a21; }
#toolsView .union-power-toolbar.union-history-toolbar { grid-template-columns: minmax(0, 1fr); }
.union-history-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 14px 4px; }
.union-history-controls label { display: grid; gap: 5px; min-width: 110px; color: #657891; font-size: 12px; }
.union-history-controls select { width: 100%; min-height: 36px; }
.union-history-controls .union-history-member { flex: 1; min-width: 150px; max-width: 360px; }
.union-history-controls button { min-height: 36px; }
.union-history-note { margin: 10px 14px; font-size: 12px; line-height: 1.7; color: #738298; }
.union-history-empty { padding: 20px 14px; margin: 0; color: #738298; font-size: 13px; }
.union-history-stat, .union-history-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 14px; font-size: 12px; color: #657891; }
.union-history-stat strong { color: #274466; font-size: 14px; }
.union-history-chart { position: relative; margin: 0 14px; overflow-x: auto; scrollbar-width: thin; }
.union-history-chart svg { display: block; width: 100%; }
.union-history-chart text { font-size: 12px; fill: #738298; }
.union-chart-grid { stroke: #e9edf3; stroke-width: 1; stroke-dasharray: 4 4; }
.union-history-chart circle { cursor: pointer; stroke: #fff; stroke-width: 1.5; }
.union-history-chart circle:hover, .union-history-chart circle:focus { stroke: #274466; stroke-width: 2; outline: none; }
.union-history-point-detail { position: absolute; z-index: 4; box-sizing: border-box; width: max-content; max-width: min(320px, calc(100% - 16px)); max-height: 260px; overflow: auto; padding: 12px 28px 12px 12px; border: 1px solid #e0e7ef; border-radius: 10px; background: #fff; box-shadow: 0 5px 20px #20395826; color: #657891; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.union-history-point-detail[hidden] { display: none; }
.union-history-tooltip-close { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #738298; font-size: 18px; box-shadow: none; }
.union-history-point-detail strong { font-weight: 500; color: #274466; }
.union-history-point-values { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.union-history-point-detail ul { margin: 8px 0 0; padding-left: 18px; }
.union-history-point-detail small { display: block; color: #738298; }
.union-history-join { color: #438c7a; }
.union-history-leave { color: #ba6865; }
@media (max-width: 600px) {
    .union-history-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 12px 12px 4px; }
    .union-history-controls label, .union-history-controls .union-history-member { min-width: 0; max-width: none; }
    .union-history-note { margin: 10px 12px; }
    .union-history-chart { margin: 0 8px; }
    .union-history-stat { gap: 5px 12px; }
}

.union-insight-view {
    min-width: 0;
}

.union-insight-demo-notice {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid #e7bd61;
    border-radius: 10px;
    background: #fff7e3;
    color: #714e16;
    font-size: 13px;
    line-height: 1.65;
}

.union-insight-demo-notice p {
    margin: 4px 0 0;
}

.union-insight-heading,
.union-insight-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.union-insight-heading h3 {
    margin: 0 0 4px;
    font-size: 21px;
}

.union-insight-heading p,
.union-insight-heading small,
.union-insight-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.union-insight-toolbar {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(150px, 1fr) auto;
    margin: 14px 0;
}

.union-insight-toolbar select,
.union-insight-toolbar input {
    width: 100%;
}

.union-insight-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.union-insight-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 8px 2px;
    background: transparent;
    color: var(--muted);
}

.union-insight-tabs button.active {
    border-bottom-color: #0f766e;
    color: #0f766e;
    font-weight: 700;
}

.union-insight-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.union-insight-actions span {
    flex: 1;
    min-width: 160px;
    color: var(--muted);
    font-size: 13px;
}

.union-insight-actions select {
    flex: 1;
    min-width: 180px;
}

.union-insight-note {
    margin-bottom: 12px;
}

.union-insight-list {
    display: grid;
    gap: 8px;
}

.union-insight-member {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.union-insight-member summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 9px 12px;
    cursor: pointer;
    list-style: none;
}

.union-insight-member summary::-webkit-details-marker {
    display: none;
}

.union-insight-member summary strong {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.union-insight-tag {
    flex: 0 0 auto;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 3px 6px;
    color: #475569;
    background: #f8fafc;
    font-size: 12px;
}

.union-insight-tag.ok {
    border-color: #86efac;
    color: #166534;
    background: #f0fdf4;
}

.union-insight-tag.warn {
    border-color: #fca5a5;
    color: #b91c1c;
    background: #fef2f2;
}

.union-insight-tag.gold {
    border-color: #fcd34d;
    color: #92400e;
    background: #fffbeb;
}

.union-insight-expand {
    color: var(--muted);
    transition: transform 0.15s ease;
}

.union-insight-member[open] .union-insight-expand {
    transform: rotate(180deg);
}

.union-insight-details {
    border-top: 1px solid var(--line);
    padding: 8px 12px 12px;
    font-size: 13px;
    line-height: 1.6;
}

.union-insight-details p {
    margin: 4px 0;
}

.union-insight-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.union-insight-detail-grid section {
    min-width: 0;
}

.union-insight-detail-grid h4 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 14px;
}

.union-insight-detail-grid h4 span {
    color: #0f766e;
}

.union-insight-table-wrap {
    overflow-x: auto;
}

.union-insight-table-wrap table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 12px;
}

.union-insight-table-wrap th,
.union-insight-table-wrap td {
    border-bottom: 1px solid var(--line);
    padding: 5px 6px;
    text-align: left;
    white-space: nowrap;
}

.union-insight-table-wrap th {
    color: var(--muted);
    font-weight: 600;
}

.union-insight-overview table {
    min-width: 680px;
}

.union-insight-overview td {
    vertical-align: top;
    padding: 10px 8px;
}

.union-insight-overview td:first-child {
    min-width: 150px;
}

.union-insight-overview small {
    display: block;
    color: var(--muted);
    white-space: normal;
    line-height: 1.4;
}

.union-insight-score-low {
    color: #b91c1c;
}

.union-insight-metric {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 12px;
}

.union-insight-event {
    margin-top: 8px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.union-insight-event > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.union-insight-event small {
    color: var(--muted);
}

@media (max-width: 1100px) {
    .union-insight-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .union-insight-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .union-insight-toolbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .union-insight-toolbar select {
        grid-column: 1 / -1;
    }

    .union-insight-detail-grid {
        grid-template-columns: 1fr;
    }
}

.merchant-path-header,
.merchant-tool-panel {
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.merchant-path-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
}

.merchant-path-header h3 {
    margin: 0;
    font-size: 24px;
}

.merchant-path-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.merchant-import-role {
    display: grid;
    gap: 6px;
    min-width: 0;
    max-width: 260px;
    font-size: 13px;
    color: var(--muted);
}

.merchant-import-role select {
    width: 100%;
    min-width: 0;
}

.merchant-chevron-open {
    transform: rotate(225deg);
}

.merchant-mobile-prices {
    display: none;
}

.merchant-price-shop-selector {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.merchant-mobile-price-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}

.merchant-mobile-price-table th,
.merchant-mobile-price-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #e6edf6;
    text-align: left;
}

.merchant-mobile-price-table .merchant-price-input {
    width: 100%;
    min-height: 42px;
}

.merchant-warning {
    position: sticky;
    top: 0;
    z-index: 10;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 11px 14px;
    color: #991b1b;
    background: #fee2e2;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(153, 27, 27, 0.12);
}

.merchant-tool-panel {
    overflow: hidden;
}

.merchant-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
}

.merchant-controls label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.merchant-controls input,
.merchant-controls select {
    width: 100%;
}

.merchant-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.merchant-price-table,
.merchant-result-table {
    width: 100%;
    min-width: 1780px;
    border-collapse: collapse;
    font-size: 13px;
}

.merchant-result-table {
    min-width: 760px;
}

.merchant-price-table th,
.merchant-price-table td,
.merchant-result-table th,
.merchant-result-table td {
    border-bottom: 1px solid #e6edf6;
    padding: 8px;
    text-align: left;
    vertical-align: middle;
}

.merchant-price-table thead th,
.merchant-result-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #334155;
    background: #f8fafc;
    font-weight: 800;
}

.merchant-price-table tbody th {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.merchant-price-table .merchant-sticky-col {
    position: sticky;
    z-index: 2;
    background: #fff;
}

.merchant-price-table thead .merchant-sticky-col {
    z-index: 3;
    background: #f8fafc;
}

.merchant-id-col {
    left: 0;
    width: 76px;
    min-width: 76px;
}

.merchant-shop-col {
    left: 76px;
    width: 132px;
    min-width: 132px;
    box-shadow: 1px 0 0 #e6edf6;
}

.merchant-price-table small,
.merchant-result-table small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.merchant-name-text {
    display: block;
    min-width: 120px;
    color: #0f172a;
    font-weight: 800;
    white-space: nowrap;
}

.merchant-price-input {
    width: 92px;
    text-align: right;
}

.merchant-result-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #e6edf6;
    background: #f8fafc;
}

.merchant-result-summary span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border: 1px solid #dbe6f3;
    border-radius: 6px;
    padding: 0 10px;
    color: var(--muted);
    background: #fff;
}

.merchant-result-summary strong {
    color: #0f172a;
}

.merchant-path-result-empty {
    padding: 16px;
    color: var(--muted);
    background: #fff;
}

#logContent {
    overflow: auto;
    height: 100%;
    margin: 0;
    padding: 12px 14px;
    color: #27364a;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.68), rgba(245, 243, 255, 0.58)),
        rgba(241, 245, 249, 0.78);
    backdrop-filter: blur(10px);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.72;
    white-space: pre-wrap;
}

.log-line {
    min-height: 19px;
    border-bottom: 1px solid #f1f4f8;
    white-space: pre-wrap;
}

.log-inline-tag {
    display: inline-block;
    border: 1px solid var(--tag-border, rgba(148, 163, 184, 0.32));
    border-radius: 5px;
    padding: 0 4px;
    color: var(--tag-color, #cbd5e1);
    background: var(--tag-bg, rgba(148, 163, 184, 0.14));
    font-weight: 700;
    line-height: 1.35;
}

.admin-detail {
    display: grid;
    gap: 16px;
}

.admin-section-nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    border-bottom: 1px solid #dbe4ef;
    padding: 0 2px 8px;
    scrollbar-width: thin;
}

.admin-section-nav button {
    flex: 0 0 auto;
    border: 1px solid transparent;
    padding: 8px 14px;
    color: #526174;
    background: transparent;
    box-shadow: none;
}

.admin-section-nav button:hover {
    border-color: #dbe5f1;
    color: #1f4f8f;
    background: #f5f8fc;
}

.admin-section-nav button.active {
    border-color: #cbdcf2;
    color: #164c8c;
    background: #eaf3ff;
}

.admin-panel {
    min-width: 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-card {
    overflow: hidden;
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.admin-card-wide {
    grid-column: 1 / -1;
}

.admin-content {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.admin-list-heading {
    align-items: flex-end;
    padding: 14px;
}

.admin-list-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.admin-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-search {
    width: min(320px, 38vw);
}

.topup-duration-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.topup-generator textarea {
    width: 100%;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

.topup-generator-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topup-generator-actions .hint {
    margin: 0;
}

.admin-scroll-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-stats div,
.credential-box {
    border: 1px solid #e6edf6;
    border-radius: 8px;
    padding: 10px;
    background: var(--panel-soft);
}

.union-group-editor {
    border: 1px solid #e6edf6;
    border-radius: 8px;
    background: var(--panel-soft);
}

.union-group-summary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 12px;
    padding: 10px 42px 10px 12px;
    cursor: pointer;
    list-style: none;
}

.union-group-summary::-webkit-details-marker {
    display: none;
}

.union-group-summary::after {
    position: absolute;
    right: 18px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.16s ease;
    content: "";
}

.union-group-editor[open] > .union-group-summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
}

.union-group-summary > span {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 10px;
}

.union-group-summary strong {
    overflow: hidden;
    color: #0f172a;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.union-group-summary small {
    flex: 0 0 auto;
    color: var(--muted);
}

.union-group-body {
    display: grid;
    gap: 12px;
    border-top: 1px solid #e6edf6;
    padding: 12px;
}

.union-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.union-group-heading > input {
    width: min(360px, 100%);
}

.union-group-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.union-group-option {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    border: 1px solid #dbe5f1;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
}

.union-group-option input {
    flex: 0 0 auto;
}

.union-group-option span {
    min-width: 0;
    overflow: hidden;
    color: #334155;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.union-group-option small {
    color: var(--muted);
}

.invite-code {
    display: inline-flex;
    margin: 2px 0 6px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 6px;
    padding: 5px 8px;
    color: #1d4ed8;
    background: #eff6ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.admin-role-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.admin-role-item {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-soft);
}

.admin-role-expiry {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-role-expiry input {
    width: 190px;
}

.reset-password-box {
    display: inline-flex;
    margin: 6px 0 2px;
    border: 1px solid rgba(22, 163, 74, 0.22);
    border-radius: 6px;
    padding: 5px 8px;
    color: #15803d;
    background: #ecfdf5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.admin-stats span,
.admin-row span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.admin-stats strong {
    display: block;
    margin-top: 4px;
    font-size: 16px;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    border: 1px solid #e6edf6;
    border-radius: 8px;
    padding: 12px;
    background: var(--panel-soft);
}

.admin-row strong {
    display: block;
    margin-bottom: 4px;
}

.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.credential-box {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    color: #334155;
    font-size: 13px;
    word-break: break-all;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 280px;
    padding: 36px;
    text-align: center;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: calc(var(--viewport-bottom-offset) + 20px + var(--safe-bottom));
    z-index: 1110;
    max-width: min(420px, calc(100vw - 40px));
    border-radius: 8px;
    padding: 12px 14px;
    color: #fff;
    background: #1f2937;
    box-shadow: var(--shadow);
}

.toast.error {
    background: var(--danger);
    top: max(16px, env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.toast.success {
    background: var(--success);
}

.toast.config-save {
    top: max(16px, env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 50%;
    z-index: 1110;
    transform: translateX(-50%);
    text-align: center;
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.onboarding-focus {
    position: fixed;
    z-index: 301;
    border: 2px solid #f3b638;
    border-radius: 8px;
    box-shadow: 0 0 0 100vmax rgba(13, 25, 39, 0.58), 0 0 0 4px rgba(243, 182, 56, 0.2);
    pointer-events: none;
}

.onboarding-card {
    position: fixed;
    z-index: 302;
    width: min(340px, calc(100vw - 32px));
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 18px;
    color: var(--text);
    background: #fff;
    box-shadow: 0 18px 48px rgba(13, 25, 39, 0.3);
    max-height: calc(var(--viewport-height) - var(--safe-top) - var(--safe-bottom) - 32px);
    overflow-y: auto;
}

.onboarding-progress {
    color: var(--muted);
    font-size: 12px;
}

.onboarding-card h2 {
    margin: 7px 0 8px;
    font-size: 19px;
}

.onboarding-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.tutorial-fab {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: calc(var(--viewport-bottom-offset) + max(20px, var(--safe-bottom)));
    z-index: 15;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--primary);
    background: var(--panel);
    box-shadow: 0 4px 16px rgba(48, 77, 109, 0.18);
    font-size: 24px;
    font-weight: 600;
}

.tutorial-fab:hover {
    background: #eaf2ff;
}

.tutorial-fab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.tutorial-window {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: calc(var(--viewport-bottom-offset) + max(20px, var(--safe-bottom)) + 56px);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    width: min(560px, calc(100vw - 40px));
    height: min(620px, calc(var(--viewport-height) - 160px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 40px rgba(48, 77, 109, 0.22);
}

.tutorial-window-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.tutorial-window-header h2 {
    flex: 1;
    margin: 0;
    font-size: 16px;
}

.tutorial-window-header a {
    flex-shrink: 0;
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
}

.tutorial-window-header a:hover {
    text-decoration: underline;
}

.tutorial-window-header button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.tutorial-window iframe {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 0;
    background: #fff;
}

.modal-backdrop {
    position: fixed;
    inset: var(--viewport-top) 0 auto;
    height: var(--viewport-height);
    z-index: 1050;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    place-items: center;
    padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left));
    background: rgba(15, 23, 42, 0.36);
}

.modal {
    width: min(480px, 100%);
    border: 1px solid rgba(216, 226, 238, 0.92);
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    min-width: 0;
    min-height: 0;
    overflow-wrap: anywhere;
    scroll-padding-block: 12px;
}

.modal-backdrop > .modal { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.site-action-backdrop { z-index: 1200; }
.site-action-dialog p { white-space: pre-wrap; line-height: 1.7; }
.site-action-dialog textarea { width: 100%; min-height: 100px; font-size: 16px; resize: vertical; }
dialog:not([open]), #promotionsDialog[hidden] { display: none !important; }
dialog.modal {
    position: fixed;
    top: calc(var(--viewport-top) + var(--safe-top) + 12px);
    bottom: calc(100% - var(--viewport-top) - var(--viewport-height) + var(--safe-bottom) + 12px);
    left: var(--safe-left);
    right: var(--safe-right);
    margin: auto;
    max-width: calc(100% - var(--safe-left) - var(--safe-right) - 24px);
    max-height: calc(var(--viewport-height) - var(--safe-top) - var(--safe-bottom) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-header,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-header > div { min-width: 0; }
.modal-header > .icon-button { flex: 0 0 36px; }
.modal input:not([type="checkbox"]):not([type="radio"]), .modal select, .modal textarea { min-width: 0; max-width: 100%; }

.no-video-notice-modal, .cast-sword-target-notice-modal { width: min(480px, calc(100% - 32px)); color: var(--text); }
.no-video-notice-modal::backdrop, .cast-sword-target-notice-modal::backdrop { background: rgba(15, 23, 42, 0.36); }
.no-video-notice-modal .modal-header h3, .cast-sword-target-notice-modal .modal-header h3 { font-size: 18px; }
.no-video-notice-modal p, .cast-sword-target-notice-modal p { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.icon-button {
    min-width: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
}

.form-grid {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.form-grid label {
    color: var(--muted);
    font-size: 13px;
}

.form-grid button {
    margin: 6px 0 8px;
}

.account-server-picker { min-width: 0; }
.account-server-picker .account-server-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    color: var(--text);
    background: var(--panel);
    text-align: left;
}
.account-server-trigger > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.account-server-trigger:hover, .account-server-trigger[aria-expanded="true"] { border-color: var(--primary); background: var(--panel-soft); }
.account-server-trigger:disabled { color: var(--muted); background: var(--panel-soft); }
.account-server-chevron { flex: 0 0 auto; color: var(--muted); }
.account-server-menu { margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.account-server-menu input { width: 100%; min-height: 40px; font-size: 16px; }
.account-server-options { max-height: min(240px, 30vh); overflow-y: auto; overscroll-behavior: contain; margin-top: 6px; }
.account-server-options .account-server-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px;
    color: var(--text);
    background: transparent;
    text-align: left;
    overflow-wrap: anywhere;
}
.account-server-option small { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.account-server-option:hover, .account-server-option:focus, .account-server-option[aria-selected="true"] { color: var(--primary); background: #eaf2ff; }
.account-server-empty { padding: 8px; }

.modal-actions {
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}

.modal-actions > button { max-width: 100%; min-height: 40px; height: auto; padding: 8px 12px; white-space: normal; overflow-wrap: anywhere; }

.topup-role-name {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.topup-auto-renew { margin-top: 16px; padding: 12px; border: 1px solid var(--border, #dbe7f4); border-radius: 12px; }
.topup-auto-renew button[aria-pressed="true"] { color: var(--accent, #1d74f5); }
.topup-auto-renew .hint { margin-bottom: 0; }

.topup-preview {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    border: 1px solid #dbe7f4;
    border-radius: 8px;
    padding: 12px;
    background: #f7faff;
}

.topup-preview > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.topup-preview span {
    color: var(--muted);
}

.topup-preview strong {
    text-align: right;
}

.quota-purchase-section {
    display: grid;
    gap: 8px;
}

.quota-purchase-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.quota-purchase-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.quota-purchase-links a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-width: 0;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 11px;
    border: 1px solid #d9e3ee;
    border-radius: 7px;
    color: var(--text);
    background: #f8fafc;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease;
}

.quota-purchase-links a:hover,
.quota-purchase-links a:focus-visible {
    border-color: #8db9f5;
    outline: none;
    background: #eef5ff;
}

.quota-purchase-links a strong {
    font-size: 14px;
}

.quota-purchase-links a span {
    color: var(--muted);
    font-size: 12px;
}

.fortune-heading {
    align-items: center;
}

.fortune-day {
    flex: 0 0 auto;
    border: 1px solid #d8e2ee;
    border-radius: 6px;
    padding: 8px 12px;
    color: #64748b;
    background: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.fortune-content {
    width: min(760px, 100%);
    margin: 0 auto;
}

.fortune-stage {
    display: grid;
    justify-items: center;
    gap: 22px;
    min-height: 470px;
    border: 1px solid #e0d6c5;
    border-radius: 8px;
    padding: 44px clamp(18px, 5vw, 54px);
    background:
        linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
        #f2eadb;
    box-shadow: 0 18px 44px rgba(84, 65, 38, 0.10);
}

.fortune-stage.undrawn {
    align-content: center;
}

.fortune-slip-preview {
    display: grid;
    width: 96px;
    height: 180px;
    place-items: center;
    border: 1px solid #cfae78;
    border-radius: 4px;
    color: #9b2c2c;
    background: #fffaf0;
    box-shadow: 0 10px 24px rgba(91, 65, 33, 0.14);
}

.fortune-slip-preview span {
    border: 2px solid currentColor;
    padding: 8px;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 30px;
    font-weight: 800;
}

.fortune-lead {
    margin: 0;
    color: #584b3a;
    font-size: 17px;
}

.fortune-primary {
    min-width: 180px;
    min-height: 44px;
    background: #a33131;
}

.fortune-primary:hover {
    background: #842525;
}

.fortune-stage small {
    color: #7c7162;
    text-align: center;
}

.fortune-result {
    position: relative;
    display: grid;
    width: min(360px, 100%);
    min-height: 215px;
    place-items: center;
    align-content: center;
    gap: 5px;
    border: 1px solid #d7ba86;
    border-radius: 4px;
    padding: 28px 48px;
    color: #533c25;
    background: #fffaf0;
    box-shadow: 0 12px 30px rgba(91, 65, 33, 0.12);
}

.fortune-result p,
.fortune-result h2,
.fortune-result blockquote {
    margin: 0;
}

.fortune-result p {
    color: #8a7355;
    font-size: 13px;
}

.fortune-result h2 {
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 48px;
    font-weight: 800;
}

.fortune-result blockquote {
    max-width: 250px;
    margin-top: 6px;
    color: #665642;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
}

.fortune-seal {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    transform: rotate(5deg);
    border: 2px solid #b83a32;
    color: #b83a32;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 12px;
    font-weight: 800;
}

.fortune-reward {
    margin-top: 8px;
    color: #9b2c2c;
    font-size: 16px;
}

.fortune-guidance {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 14px;
}

.fortune-advice {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    border-top: 1px solid #ded3c1;
    border-bottom: 1px solid #ded3c1;
    padding: 14px 10px;
}

.fortune-advice > span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #28845d;
    font-weight: 800;
}

.fortune-advice.unsuitable > span {
    background: #a64343;
}

.fortune-advice ul {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fortune-advice li {
    color: #534a3e;
    overflow-wrap: anywhere;
}

.fortune-claimed,
.fortune-claim-note,
.fortune-claim-box,
.fortune-admin-draw {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 18px;
    border: 1px solid #d8dfd7;
    border-radius: 6px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.76);
}

.fortune-claimed,
.fortune-claim-note,
.fortune-claim-box > div,
.fortune-admin-draw > div {
    min-width: 0;
}

.fortune-claimed span,
.fortune-claim-note span,
.fortune-claim-box span,
.fortune-admin-draw span {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.fortune-claimed {
    border-color: #b7dbc7;
    color: #166534;
    background: #f0fdf4;
}

.fortune-admin-draw {
    border-color: #d8c690;
    background: #fffbeb;
}

.fortune-claim-box.multiple {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto;
}

.fortune-claim-box label {
    font-weight: 700;
}

.fortune-inline-error,
.fortune-message.error {
    color: var(--danger);
}

.fortune-message {
    padding: 48px 20px;
    color: var(--muted);
    text-align: center;
}

.fortune-rewards {
    margin-top: 22px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}

.fortune-rewards h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.fortune-reward-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
    gap: 8px;
}

.fortune-reward-list > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 10px;
    border-radius: 10px;
    background: var(--panel-soft);
    font-size: 13px;
}

.fortune-reward-list span {
    color: var(--muted);
}

.fortune-history {
    margin-top: 22px;
    border-top: 1px solid #d8e2ee;
    padding-top: 20px;
}

.fortune-history-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.fortune-history-heading h2 {
    margin: 0;
    font-size: 18px;
}

.fortune-history-heading span {
    color: var(--muted);
    font-size: 12px;
}

.fortune-history-row {
    display: grid;
    grid-template-columns: 92px 44px minmax(0, 1fr) minmax(150px, 0.8fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    border-bottom: 1px solid #e7ecf2;
    padding: 13px 4px;
}

.fortune-history-row time {
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.fortune-history-tier {
    color: #9b2c2c;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 17px;
    font-weight: 800;
}

.fortune-history-copy,
.fortune-history-role {
    min-width: 0;
}

.fortune-history-copy strong,
.fortune-history-role strong,
.fortune-history-copy small,
.fortune-history-role small {
    display: block;
    overflow-wrap: anywhere;
}

.fortune-history-copy strong,
.fortune-history-role strong {
    font-size: 13px;
}

.fortune-history-copy small,
.fortune-history-role small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.fortune-history-role.pending strong {
    color: var(--warning);
}

.fortune-history-role.disabled strong {
    color: var(--muted);
}

.fortune-history-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
}

.fortune-history-actions select {
    flex: 1 1 120px;
    width: 0;
    min-width: 0;
    max-width: 100%;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
}

.fortune-history-actions button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 5px 12px;
    font-size: 12px;
}

.fortune-history-empty {
    margin: 0;
    padding: 22px 0;
    color: var(--muted);
    text-align: center;
}

@media (min-width: 921px) {
    #dashboardView.active {
        min-height: 0;
    }

    .role-detail {
        grid-template-rows: auto auto auto minmax(0, 1fr);
        height: calc(100vh - 96px);
        min-height: 0;
    }

    .log-panel {
        display: flex;
        min-height: 0;
        flex-direction: column;
    }

    .log-layout {
        flex: 1;
        min-height: 360px;
        height: auto;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid rgba(216, 226, 238, 0.85);
    }

    .role-list {
        flex: 0 1 auto;
        max-height: 240px;
    }

    .main {
        padding: 18px;
    }

    .topbar,
    .hero-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-status {
        align-items: flex-start;
    }

    .config-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .merchant-path-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .union-power-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .tool-shell {
        grid-template-columns: 1fr;
    }

    .tool-list {
        display: flex;
        overflow-x: auto;
    }

    .tool-list-item {
        flex: 0 0 auto;
        width: auto;
    }

    .merchant-path-actions {
        justify-content: flex-start;
    }

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

    .activity-tree-controls,
    .activity-tree-gifts {
        grid-template-columns: 1fr;
    }

    .merchant-controls button {
        width: 100%;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .challenge-task-controls {
        grid-template-columns: minmax(0, 1fr) minmax(130px, 1fr);
    }

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

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

    .admin-grid,
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .log-layout {
        height: min(58vh, 520px);
        grid-template-columns: 1fr;
    }

    .log-tag-filter {
        overflow-x: auto;
        overflow-y: hidden;
        flex-direction: row;
        max-height: 58px;
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    }

    .log-tag {
        flex: 0 0 auto;
        text-align: center;
        white-space: nowrap;
    }

    .auto-refresh {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 520px) {
    .sidebar,
    .main {
        padding: 14px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .homeland-rules-grid {
        grid-template-columns: 1fr;
    }

    .homeland-schedule-header {
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .homeland-schedule-time {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: space-between;
    }

    .homeland-schedule-time input {
        flex: 1 1 0;
        width: 0;
        max-width: 138px;
        padding: 0 4px;
    }

    .homeland-rule-level {
        flex-wrap: wrap;
    }

    .homeland-rule-level > span:first-child {
        flex: 1 1 120px;
    }

    .battle-preset-row {
        grid-template-columns: 1fr;
    }

    .competition-task-row {
        grid-template-columns: 1fr;
    }

    .competition-task-toggle {
        padding-right: 0;
        padding-bottom: 12px;
        border-right: 0;
        border-bottom: 1px solid #dbe5f1;
    }

    .topbar-actions {
        align-items: stretch;
        width: 100%;
        flex-direction: column;
    }

    .merchant-path-actions,
    .merchant-controls {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .merchant-path-actions button {
        width: 100%;
    }

    .union-power-toolbar,
    .union-group-options {
        grid-template-columns: 1fr;
    }

    .union-group-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-row {
        grid-template-columns: 1fr;
    }

    .admin-row-actions {
        justify-content: flex-start;
    }

    .admin-list-heading,
    .admin-list-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-list-actions,
    .admin-search {
        width: 100%;
    }

    .announcement-admin-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topup-duration-controls {
        grid-template-columns: minmax(0, 1fr) 86px;
    }

    .topup-duration-controls button {
        grid-column: 1 / -1;
    }

    .topup-generator-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Role hub layout */
body {
    background: #f4f7fb;
}

body.drawer-open {
    overflow: hidden;
}

.auth-screen {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(29, 116, 245, 0.10), transparent 30%),
        #f4f7fb;
}

.auth-shell {
    display: grid;
    width: min(420px, 100%);
    gap: 24px;
}

.auth-shell > .brand {
    justify-content: center;
}

.auth-shell .auth-panel {
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(31, 42, 55, 0.10);
}

.app-shell {
    display: block;
    min-height: 100vh;
}

.site-header {
    position: -webkit-sticky;
    position: sticky;
    z-index: 100;
    top: 0;
    padding-top: var(--safe-top);
    border-bottom: 1px solid #e4eaf2;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.header-inner {
    display: flex;
    align-items: center;
    width: min(1440px, 100%);
    min-height: 68px;
    margin: 0 auto;
    padding: 0 28px;
}

.brand-button {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0;
    color: var(--text);
    text-align: left;
    background: transparent;
}

.brand-button:hover {
    background: transparent;
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand-copy strong {
    font-size: 17px;
}

.brand-copy small {
    color: var(--muted);
    font-size: 11px;
}

.desktop-nav {
    display: flex;
    align-self: stretch;
    gap: 6px;
    margin-left: 48px;
}

.nav-link {
    position: relative;
    min-width: 76px;
    border-radius: 0;
    color: #536174;
    background: transparent;
    font-weight: 700;
}

.nav-link:hover {
    color: var(--primary);
    background: #f5f8fd;
}

.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--primary);
    content: "";
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.quota-indicator {
    display: flex;
    align-items: center;
    min-height: 36px;
    gap: 7px;
    padding: 3px 4px 3px 10px;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    color: #526175;
    background: #fff;
    font-size: 12px;
    white-space: nowrap;
}

.quota-indicator strong {
    margin-left: 3px;
    color: var(--text);
    font-size: 14px;
}

.quota-redeem-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
}

.ticket-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ticket-toolbar input { flex: 1; min-width: 150px; }
.ticket-toolbar select { min-width: 110px; }
.ticket-counts { margin: 12px 0; }
.ticket-workspace { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.ticket-list-panel, .ticket-detail-panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.ticket-list-item { display: flex; flex-direction: column; width: 100%; text-align: left; gap: 7px; padding: 12px; margin-bottom: 8px; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
.ticket-list-item:hover, .ticket-list-item.active { border-color: var(--primary); background: rgba(29, 116, 245, 0.06); }
.ticket-list-title, .ticket-detail-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.ticket-list-title { font-weight: 600; }
.ticket-list-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.ticket-status { flex-shrink: 0; border-radius: 20px; padding: 3px 9px; font-size: 12px; font-weight: 500; color: #9a6700; background: #fff6d8; }
.ticket-notification { position: absolute; top: -3px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 10px; background: #ef4444; color: white; font-size: 10px; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--card-bg, white); pointer-events: none; }
.benefit-launcher { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--viewport-bottom-offset) + var(--promotion-float-clearance, 112px) + var(--safe-bottom)); z-index: 39; filter: drop-shadow(0 5px 12px #5c62b42b); }
.benefit-launcher-open { display: flex; align-items: center; gap: 7px; padding: 12px 14px; border: 1px solid #ffffffb8; border-radius: 16px; background: linear-gradient(125deg, #5975e4, #9063c7); color: #fff; font-size: 12px; font-weight: 600; }
.benefit-launcher-open:hover { background: linear-gradient(125deg, #4563d0, #7f4eb8); }
.benefit-launcher-open { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.benefit-launcher.is-dragging .benefit-launcher-open { cursor: grabbing; }
.benefit-launcher-open svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.benefit-launcher-toggle { position: absolute; top: -7px; right: -5px; min-height: 22px; width: 22px; padding: 0; border: 1px solid #e4e6f4; border-radius: 50%; background: #fff; color: #776393; line-height: 20px; font-size: 15px; }
.benefit-launcher-toggle:hover { background: #f3efff; }
.benefit-launcher.is-compact .benefit-launcher-open { padding: 10px; border-radius: 50%; }
.benefit-launcher.is-compact .benefit-launcher-open span { display: none; }
.promotion-dialog { width: min(660px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: 86dvh; padding: 0; border: 1px solid #ffffffcf; border-radius: 22px; overflow: hidden; background: #f5f6fc; box-shadow: 0 22px 70px #29375a45; }
.promotion-dialog[open] { display: flex; flex-direction: column; z-index: 1100; animation: promotion-appear .22s ease-out; }
.promotion-dialog::backdrop { background: #17254373; backdrop-filter: blur(4px); }
.promotion-hero { position: relative; flex: 0 0 auto; padding: 26px 30px 24px; overflow: hidden; color: #fff; background: radial-gradient(ellipse at 100% 0, #c3acff66, transparent 60%), linear-gradient(120deg, #4168cd, #7760b4); }
.promotion-hero::before { content: ""; position: absolute; width: 220px; height: 220px; right: -60px; top: -100px; border: 1px solid #ffffff26; border-radius: 50%; box-shadow: 0 0 0 30px #ffffff06, 0 0 0 60px #ffffff06; pointer-events: none; }
.promotion-eyebrow { display: inline-block; font-size: 11px; color: #e8e8ff; letter-spacing: 2px; }
.promotion-hero h3 { position: relative; margin: 8px 0; font-size: 29px; font-weight: 700; letter-spacing: 2px; }
.promotion-hero p { position: relative; margin: 0; font-size: 13px; color: #edf0ff; }
.promotion-hero-gift { position: absolute; width: 110px; height: 110px; right: 48px; bottom: 8px; fill: #ffffff10; stroke: #f7ddae; stroke-width: 2; stroke-linejoin: round; transform: rotate(10deg); pointer-events: none; }
.promotion-hero-gift .promotion-spark { stroke: #fff4d8; }
.promotion-close { position: absolute; right: 12px; top: 12px; width: 32px; min-height: 32px; padding: 0; border-radius: 50%; background: #ffffff20; color: #fff; font-size: 24px; line-height: 1; }
.promotion-close:hover { background: #ffffff38; }
.promotion-body { overflow: auto; overscroll-behavior: contain; padding: 18px 22px 22px; min-height: 0; scrollbar-width: thin; }
.promotion-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: #737b95; font-size: 12px; }
.promotion-toolbar button { min-height: 28px; padding: 0 10px; font-size: 12px; }
.promotion-cards { display: grid; gap: 14px; }
.promotion-card { padding: 18px; border: 1px solid #e4e8f5; border-radius: 15px; background: #fff; box-shadow: 0 3px 10px #6572b008; overflow-wrap: anywhere; }
.promotion-card-firstTopup { background: linear-gradient(120deg, #fff, #fcf8ee); border-color: #eee3cb; }
.promotion-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.promotion-tag { padding: 4px 8px; border-radius: 6px; background: #eef0ff; color: #6d60a5; font-size: 11px; font-weight: 600; }
.promotion-card-firstTopup .promotion-tag { color: #987032; background: #f7edda; }
.promotion-deadline { color: #9196a7; font-size: 11px; }
.promotion-card h4 { margin: 14px 0 8px; font-size: 17px; color: #354465; }
.campaign-card { position: relative; overflow: hidden; }
.campaign-newcomer { background: linear-gradient(135deg, #fffaf1, #fff 70%); border-color: #efe3c8; }
.campaign-newcomer .promotion-tag { color: #986125; background: #f9ebcf; }
.campaign-bundle { background: linear-gradient(140deg, #f0f4ff, #fff 70%); }
.campaign-trio { background: linear-gradient(145deg, #f9f4ff, #fff 75%); border-color: #e7dcf4; }
.campaign-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; color: #9f692e; }
.campaign-price > strong { font-size: 52px; line-height: 1.1; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.campaign-price > span { font-size: 22px; font-weight: 600; }
.campaign-price > del { color: #9299aa; font-size: 13px; }
.campaign-price > em { margin-left: auto; padding: 5px 9px; border-radius: 7px; background: #f8ebd7; font-size: 11px; font-style: normal; }
.campaign-bundle .campaign-price { color: #526cc7; }
.campaign-bundle .campaign-price > em { background: #eaf0ff; }
.campaign-cta { display: block; width: 100%; padding: 12px 14px; border: 1px solid #ffffffb0; border-radius: 11px; color: #fff; background: linear-gradient(110deg, #527bcf, #8869bb); box-shadow: 0 5px 14px #6376bc20; font-size: 13px; font-weight: 600; transition: filter .15s; }
.campaign-cta:hover { filter: brightness(1.06); }
.campaign-newcomer .campaign-cta { background: linear-gradient(105deg, #bb8648, #d2a164); }
.campaign-cta:disabled { background: #edf0f5; color: #9097aa; box-shadow: none; cursor: default; }
.campaign-rules { margin-top: 14px; padding-top: 10px; border-top: 1px solid #e8eaf3; }
.campaign-rules summary { color: #8790a4; font-size: 11px; cursor: pointer; }
.campaign-rules p { margin-bottom: 0; }
.campaign-benefits { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.campaign-benefits > div { display: flex; flex: 1; flex-direction: column; gap: 9px; min-width: 0; padding: 14px; border: 1px solid #e2e8f6; border-radius: 12px; background: #ffffffa8; }
.campaign-benefits span { font-size: 12px; color: #7d88a0; }
.campaign-benefits strong { font-size: 28px; color: #526bc0; }
.campaign-benefits small { margin-left: 6px; font-size: 11px; font-weight: 400; }
.campaign-benefits > b { color: #9caacc; font-size: 20px; }
.campaign-purchase { display: flex; flex-wrap: wrap; gap: 10px; }
.campaign-purchase select { flex: 1 1 150px; min-width: 0; width: 100%; border-radius: 10px; }
.campaign-purchase .campaign-cta { flex: 1 1 150px; }
.campaign-friends { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.campaign-friend { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 15px 5px; border: 1px dashed #ded5ec; border-radius: 12px; color: #8a809b; background: #fcfaff; font-size: 11px; }
.campaign-friend.is-host { border-style: solid; background: #f1ebfb; }
.campaign-friend.is-ready { border-style: solid; border-color: #cfc0e7; }
.campaign-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #a393bf; background: #ece7f4; font-size: 15px; font-weight: 600; }
.is-ready .campaign-avatar { color: #fff; background: linear-gradient(135deg, #758acb, #a585c5); }
.campaign-friend strong { color: #7961ad; font-size: 24px; letter-spacing: -1px; }
.campaign-friend small { display: inline; margin-left: 3px; font-size: 10px; font-weight: 400; letter-spacing: 0; }
.campaign-friend em { text-align: center; font-style: normal; font-size: 10px; color: #9990a5; }
.campaign-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.campaign-stats > div { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: #f4f6fd; color: #6377af; }
.campaign-stats strong { font-size: 22px; }
.campaign-stats small, .campaign-stats span { color: #8994ad; font-size: 12px; }
.campaign-adjust { display: grid; gap: 12px; }
.campaign-adjust label { display: grid; gap: 8px; }
.campaign-adjust .campaign-check { display: flex; align-items: flex-start; font-size: 12px; }
.campaign-check input { width: auto; flex: 0 0 auto; }
.promotion-card p { margin: 8px 0 12px; color: #7a8193; font-size: 12px; line-height: 1.8; }
.benefit-card { position: relative; padding: 22px; }
.community-card { background: radial-gradient(ellipse at 100% 0, #e1e9ff 0, transparent 48%), linear-gradient(145deg, #fff, #f6f8ff); border-color: #d8e1fa; }
.benefit-card h4 { font-size: 21px; letter-spacing: .3px; color: #283e71; }
.benefit-card .benefit-intro { color: #687eaa; margin-top: 4px; }
.community-score { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 20px 0 12px; flex-wrap: wrap; }
.community-score > div { display: flex; align-items: baseline; gap: 9px; }
.community-score strong { font-size: 38px; line-height: 1; letter-spacing: -1px; color: #3b5ac2; font-variant-numeric: tabular-nums; }
.community-score span { color: #6a7a9d; font-size: 12px; }
.community-score .community-total { padding: 6px 10px; border-radius: 20px; background: #e7edff; color: #536caa; }
.community-total b { color: #344da5; font-size: 17px; }
.community-progress { display: block; width: 100%; height: 12px; border: 0; border-radius: 8px; overflow: hidden; background: #e5eafa; appearance: none; }
.community-progress::-webkit-progress-bar { background: #e5eafa; border-radius: 8px; }
.community-progress::-webkit-progress-value { border-radius: 8px; background: linear-gradient(90deg, #6484ec, #9d81d8); }
.community-progress::-moz-progress-bar { border-radius: 8px; background: linear-gradient(90deg, #6484ec, #9d81d8); }
.community-next { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; color: #6f7da1; font-size: 12px; }
.community-next > span { font-size: 10px; color: #8994af; }
.community-path { overflow-x: auto; overscroll-behavior-x: contain; padding: 14px 2px 7px; scrollbar-width: thin; scrollbar-color: #bac9ed transparent; }
.community-tiers { display: grid; grid-template-columns: repeat(8, minmax(103px, 1fr)); gap: 10px; min-width: 894px; position: relative; padding-bottom: 18px; }
.community-tiers::after { content: ""; height: 3px; background: #dfe6f7; position: absolute; bottom: 5px; left: 50px; right: 50px; }
.community-milestone { display: flex; flex-direction: column; align-items: center; gap: 7px; border: 1px solid #dfe5f4; background: #ffffffc9; border-radius: 12px; padding: 12px 7px; position: relative; }
.milestone-points { font-size: 11px; color: #7d8bab; }
.community-milestone > strong { font-size: 25px; line-height: 1.2; color: #6679ac; }
.community-milestone small { font-size: 10px; margin-left: 2px; font-weight: 500; }
.milestone-cumulative { color: #8591ad; font-size: 10px; }
.community-milestone button { width: 100%; padding: 7px 4px; min-height: 32px; font-size: 11px; border-radius: 7px; background: #617ede; border: 0; color: white; }
.community-milestone button:disabled { opacity: 1; background: #eef1f9; color: #8c97b0; }
.community-milestone > i { position: absolute; width: 11px; height: 11px; border: 3px solid #e7edf9; background: #b9c7e7; border-radius: 50%; bottom: -18px; z-index: 1; box-sizing: content-box; }
.community-milestone.is-unlocked { border-color: #a8b9ee; background: linear-gradient(160deg, #fff, #edf2ff); }
.community-milestone.is-unlocked > strong { color: #4665c5; }
.community-milestone.is-unlocked > i { background: #6380db; }
.community-milestone.is-claimed button { color: #5a7894; background: #e8f1f7; }
.benefit-card .benefit-eligibility { font-size: 11px; color: #7082a9; margin: 10px 0 16px; }
.community-feed { border: 1px solid #e3e9f6; border-radius: 12px; background: #ffffffa6; overflow: hidden; }
.community-feed-title { display: flex; align-items: center; gap: 6px; padding: 10px 12px; font-size: 12px; color: #52678f; border-bottom: 1px solid #edf0f8; }
.community-feed-title > span:last-child { margin-left: auto; color: #9aa5bc; font-size: 10px; }
.community-live-dot { width: 6px; height: 6px; background: #76b3ac; border-radius: 50%; }
.community-feed-scroll { max-height: 120px; overflow-y: auto; scrollbar-width: thin; }
.community-feed-row { display: grid; grid-template-columns: 75px minmax(70px, 1fr) 55px; gap: 5px; padding: 9px 12px; color: #7e8ba7; font-size: 11px; border-bottom: 1px solid #f0f3fa; }
.community-feed-row > span:first-child { color: #50658e; }
.community-feed-row strong { color: #8b6cbd; text-align: right; font-weight: 600; }
.community-feed-row time { grid-column: 1 / -1; font-size: 10px; color: #9ba5ba; }
.community-feed-empty { padding: 20px 10px; color: #9aa5bc; font-size: 11px; text-align: center; }
.gift-card { background: radial-gradient(ellipse at 100% 0, #f5e7cd 0, transparent 52%), linear-gradient(145deg, #fffcf6, #fff8ee); border-color: #efdfbf; }
.gift-card .promotion-tag { background: #f3e7cf; color: #a17b36; }
.gift-card h4 { color: #6f542f; }
.gift-showcase { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 24px 0; }
.gift-showcase > div:last-child { display: flex; flex-direction: column; gap: 9px; }
.benefit-eyebrow { font-size: 11px; color: #aa8a55; letter-spacing: 2px; }
.gift-showcase strong { color: #9d7131; font-size: 31px; line-height: 1.1; }
.gift-showcase strong small { font-size: 13px; margin-left: 5px; }
.gift-showcase p { margin: 0; font-size: 11px; color: #a38c68; }
.gift-box { width: 82px; height: 78px; position: relative; flex: 0 0 auto; filter: drop-shadow(0 12px 13px #b88b4c22); }
.gift-box::before, .gift-box::after { content: ""; position: absolute; top: -6px; width: 29px; height: 22px; border: 6px solid #d79e47; border-radius: 20px 20px 0 20px; transform: rotate(20deg); left: 11px; }
.gift-box::after { left: 37px; transform: scaleX(-1) rotate(20deg); }
.gift-box i { position: absolute; inset: 29px 5px 0; border-radius: 0 0 9px 9px; background: linear-gradient(110deg, #eed1a0, #dba654); }
.gift-box b { position: absolute; height: 23px; top: 17px; left: 0; right: 0; border-radius: 5px; background: linear-gradient(110deg, #f3d8ad, #e1b36a); box-shadow: 0 3px 5px #9d713125; }
.gift-box span { position: absolute; width: 14px; top: 17px; bottom: 0; left: 34px; background: linear-gradient(90deg, #b58138, #d7a352); }
.gift-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 13px 6px; border: 1px solid #eedfc6; border-radius: 12px; background: #fffdf8c9; text-align: center; }
.gift-counts span { font-size: 11px; color: #ac9675; }
.gift-counts strong { display: block; margin-top: 5px; font-size: 22px; color: #876633; }
.gift-card .gift-open { margin-top: 15px; width: 100%; color: #fffaf1; background: linear-gradient(110deg, #b58b48, #d3a15a); border-color: transparent; box-shadow: 0 4px 12px #b58b4825; }
.gift-card .gift-open:disabled { opacity: .6; box-shadow: none; }
.benefit-card .benefit-caption { text-align: center; font-size: 10px; color: #ac9675; }
.gift-result { margin-top: 12px; padding: 12px; color: #99712f; text-align: center; background: #f8edd9; border-radius: 10px; font-size: 12px; }
.gift-result strong { font-size: 22px; margin: 0 4px; }
.gift-probabilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.gift-probabilities > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #fffaf1; border: 1px solid #efe3ce; border-radius: 8px; padding: 8px; font-size: 11px; color: #a58e69; }
.gift-probabilities strong { color: #8d713f; }
.gift-probabilities small { font-size: 9px; font-weight: 400; margin-left: 3px; }
.benefit-admin-note { padding: 12px; border-radius: 8px; background: #f1f4fc; color: #687caa; font-size: 12px; line-height: 1.7; }
.benefit-ended-notice { margin: 14px 0; padding: 14px 16px; border: 1px solid #e8b768; border-left: 4px solid #b76b17; border-radius: 10px; background: #fff4df; color: #75400e; }
.benefit-ended-notice[hidden] { display: none; }
.benefit-ended-notice > strong { display: block; font-size: 18px; line-height: 1.4; }
.benefit-ended-notice > p { margin: 6px 0 0; font-size: 12px; line-height: 1.7; }
@media (max-width: 480px) {
    .benefit-card { padding: 16px 13px; }
    .benefit-card h4 { font-size: 18px; }
    .community-score strong { font-size: 32px; }
    .community-score > div { gap: 6px; }
    .community-score .community-total { font-size: 10px; padding: 5px 7px; }
    .gift-showcase { gap: 18px; }
    .gift-showcase strong { font-size: 27px; }
    .gift-box { transform: scale(.85); }
    .gift-probabilities { grid-template-columns: repeat(2, 1fr); }
}
.promotion-highlight { display: flex; align-items: baseline; gap: 12px; color: #a97d3c; font-size: 12px; }
.promotion-highlight > strong { font-size: 44px; line-height: 1.3; font-weight: 700; }
.promotion-highlight > strong span { margin-left: 4px; font-size: 19px; }
.promotion-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.promotion-offer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 13px 8px; min-width: 0; border: 1px solid #dfe5fb; border-radius: 10px; background: #f5f7ff; color: #5d68a6; font-size: 11px; }
.promotion-offer:hover { background: #edf0ff; border-color: #a5b3e6; }
.promotion-offer > strong { color: #586cbe; font-size: 19px; line-height: 1.2; }
.promotion-offer small { margin-right: 2px; font-size: 12px; }
.promotion-offer:disabled { opacity: .65; color: #858a9c; background: #f5f6f9; border-color: #e6e8ef; }
.promotion-progress-label { display: flex; justify-content: space-between; margin: 12px 0 8px; color: #7a8193; font-size: 11px; }
.promotion-progress-label strong { color: #7961b6; }
.promotion-progress { display: block; width: 100%; height: 5px; margin-bottom: 16px; border: 0; border-radius: 5px; overflow: hidden; background: #edeef6; accent-color: #8270c9; }
.promotion-progress::-webkit-progress-bar { background: #edeef6; }
.promotion-progress::-webkit-progress-value { background: linear-gradient(90deg, #6285dd, #ad81c9); border-radius: 5px; }
.promotion-progress::-moz-progress-bar { background: #8270c9; }
.promotion-records { margin-top: 16px; padding: 0 16px; border: 1px solid #e4e8f5; border-radius: 15px; background: #fff; color: #657089; font-size: 12px; }
.promotion-records summary { cursor: pointer; font-weight: 600; }
.promotion-records input { flex: 1 1 140px; min-width: 0; width: 100%; }
.promotion-records button { font-size: 12px; }
.promotion-reward { flex-wrap: wrap; gap: 8px; }
.promotion-reward > .admin-row-actions { flex-basis: 100%; }
.promotion-empty { padding: 26px 12px; color: #7a8193; text-align: center; font-size: 13px; }
.promotion-empty strong { color: #69789d; }
.promotion-empty p { margin: 10px 0 0; font-size: 12px; line-height: 1.8; }
.promotion-loading { display: inline-block; width: 20px; height: 20px; border: 2px solid #dfe4f2; border-top-color: #8270c9; border-radius: 50%; animation: promotion-spin .8s linear infinite; }
@keyframes promotion-appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes promotion-spin { to { transform: rotate(360deg); } }
.promotion-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.promotion-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.promotion-form input, .promotion-form select { width: 100%; min-width: 0; }
.promotion-form .promotion-wide { grid-column: 1 / -1; }
.promotion-tiers { display: flex; flex-direction: column; gap: 8px; }
.promotion-tier { display: flex; gap: 8px; align-items: center; }
.promotion-tier input { min-width: 0; width: 100%; }
.promotion-tier label { flex: 1; }
.promotion-item { padding: 14px 0; border-bottom: 1px solid var(--border-color, #e5e7eb); }
.promotion-item:last-child { border-bottom: 0; }
.promotion-item .admin-row-actions { flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ticket-status-processing { color: #2563eb; background: #eff6ff; }
@media (max-width: 560px) {
    .campaign-price > strong { font-size: 44px; }
    .campaign-friends { gap: 6px; }
    .campaign-friend { padding: 12px 3px; }
    .campaign-friend strong { font-size: 22px; }
    .campaign-benefits { gap: 6px; }
    .campaign-benefits > div { padding: 12px 8px; }
    .promotion-form { grid-template-columns: 1fr; }
    .promotion-tier { flex-wrap: wrap; }
    .promotion-tier label { flex-basis: 35%; }
    .benefit-launcher { right: 12px; }
    .benefit-launcher-open { padding: 10px; font-size: 11px; }
    .promotion-dialog { border-radius: 18px; max-height: 88dvh; }
    .promotion-hero { padding: 22px 20px; }
    .promotion-hero h3 { font-size: 26px; }
    .promotion-hero-gift { width: 82px; height: 82px; right: 22px; opacity: .8; }
    .promotion-body { padding: 14px 12px; }
    .promotion-card { padding: 14px; }
    .promotion-offers { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
    .promotion-offer > strong { font-size: 17px; }
    .promotion-records { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .promotion-dialog[open], .promotion-loading { animation: none; } }
.ticket-status-resolved { color: #15803d; background: #f0fdf4; }
.ticket-empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.ticket-pagination, .ticket-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ticket-pagination { font-size: 12px; margin-top: 12px; }
.ticket-pagination button { padding: 6px 10px; }
.ticket-compose { display: grid; gap: 12px; }
.ticket-compose label { display: grid; gap: 6px; }
.ticket-compose textarea { resize: vertical; width: 100%; min-height: 90px; }
.ticket-thread { display: grid; gap: 10px; margin: 16px 0; max-height: 55vh; overflow-y: auto; }
.ticket-message { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.ticket-message.from-admin { background: rgba(99, 102, 241, 0.04); border-color: rgba(99, 102, 241, 0.25); }
.ticket-message-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.ticket-message p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; margin: 8px 0 0; }
.ticket-filter .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 720px) {
    .ticket-workspace { grid-template-columns: 1fr; }
    .ticket-list-panel { max-height: 38vh; overflow-y: auto; }
    .ticket-toolbar input { order: 1; flex-basis: 100%; }
    .ticket-list-panel, .ticket-detail-panel { padding: 10px; }
}

.user-menu-wrap {
    position: relative;
}

.user-trigger {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 8px;
    padding: 4px 8px 4px 5px;
    color: var(--text);
    background: transparent;
}

.user-trigger:hover {
    background: #f1f5fa;
}

.user-avatar {
    position: relative;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #1d74f5, #4b93fa);
    font-weight: 800;
}

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

.chevron {
    color: var(--muted);
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.user-menu-profile {
    display: grid;
    gap: 4px;
    padding: 15px 16px;
    border-bottom: 1px solid #edf1f6;
}

.user-menu-profile small {
    color: var(--muted);
}

.user-menu-item {
    width: 100%;
    min-height: 42px;
    border-radius: 0;
    padding: 0 16px;
    color: var(--text);
    text-align: left;
    background: #fff;
}

.user-menu-item:hover {
    background: #f5f8fd;
}

.danger-text {
    color: var(--danger);
}

.header-icon,
.mobile-menu-button,
.mobile-drawer,
.drawer-backdrop {
    display: none;
}

.main {
    display: block;
    width: min(1440px, 100%);
    min-width: 0;
    margin: 0 auto;
    padding: 30px 28px 48px;
}

.page-heading,
.detail-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.detail-heading {
    align-items: center;
    justify-content: flex-start;
}

.page-heading h1,
.detail-heading h1 {
    margin: 0;
    font-size: 26px;
}

.page-description {
    margin: 6px 0 0;
    color: var(--muted);
}

.page-actions {
    display: flex;
    gap: 10px;
}

.back-button {
    min-height: 42px;
}

.roles-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.role-search {
    display: grid;
    flex: 1 1 280px;
    min-width: 0;
    gap: 6px;
}

.role-search > span,
.role-batch-hint {
    color: var(--muted);
    font-size: 13px;
}

.role-search input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
}

.role-batch-actions {
    display: flex;
    gap: 10px;
}

.role-batch-hint {
    flex-basis: 100%;
    margin: 0;
}

.role-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.role-card {
    display: grid;
    min-width: 0;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border: 1px solid #e0e7f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(31, 42, 55, 0.06);
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.role-card:hover,
.role-card:focus-visible {
    border-color: #a9c9f8;
    outline: none;
    background: #fff;
    box-shadow: 0 12px 30px rgba(29, 116, 245, 0.12);
    transform: translateY(-2px);
}

.role-card.busy {
    border-color: #a9c9f8;
}

.onboarding-demo-card {
    border-style: dashed;
    border-color: #9bb7d7;
    background: #f9fbfe;
    cursor: default;
}

.onboarding-demo-card:hover {
    border-color: #9bb7d7;
    background: #f9fbfe;
    box-shadow: 0 7px 22px rgba(31, 42, 55, 0.06);
    transform: none;
}

.onboarding-demo-card button:disabled {
    cursor: default;
    opacity: 1;
}

.onboarding-demo-label {
    margin-left: 5px;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

.role-card-heading,
.role-card-title {
    display: flex;
    align-items: center;
    gap: 11px;
}

.role-card-heading {
    justify-content: space-between;
}

.role-card-title {
    min-width: 0;
}

.role-card-title > div {
    min-width: 0;
}

.role-card-avatar {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: #eaf2ff;
    font-size: 16px;
    font-weight: 800;
}

.role-card h2,
.role-card p {
    overflow: hidden;
    margin: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-card h2 {
    font-size: 15px;
}

.role-card p,
.role-card-meta {
    color: var(--muted);
    font-size: 11px;
}

.role-card-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.role-topup-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 6px;
    font-size: 19px;
    line-height: 1;
}

.role-card-meta {
    display: flex;
    min-height: 16px;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.role-card-identity {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 4px 12px;
    color: #718096;
    font-size: 10px;
}

.role-card-identity span {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-card-meta .role-expiry-reminder {
    padding: 3px 7px;
    border-radius: 6px;
    background: #fff4db;
    color: #946014;
    font-weight: 600;
}

.expired-text {
    color: var(--danger);
}

.role-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.role-card-stats > div {
    min-width: 0;
    border-radius: 6px;
    padding: 7px 8px;
    background: #f7f9fc;
}

.role-card-stats span,
.role-card-stats strong {
    display: block;
}

.role-card-stats span {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 9px;
}

.role-card-stats strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.role-card-controls {
    display: grid;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid #edf1f6;
    cursor: default;
}

.role-runtime-actions,
.role-page-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.role-page-actions.has-share {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#configShareCode {
    width: 100%;
    overflow-wrap: anywhere;
}

#roleShareCurrent {
    margin: 14px 0 0;
}

.role-card-controls button {
    min-width: 0;
    min-height: 34px;
    padding: 0 8px;
}

.role-card-controls .page-entry {
    color: #fff;
    background: var(--primary);
}

.role-card-controls .page-entry:hover {
    background: var(--primary-dark);
}

.danger-soft {
    color: #b42318;
    background: #fff0ee;
}

.danger-soft:hover {
    background: #ffe1dd;
}

.empty-state {
    border: 1px dashed #cbd7e6;
    border-radius: 12px;
    background: #fff;
    box-shadow: none;
}

.empty-state p {
    margin-bottom: 18px;
}

.empty-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: #eaf2ff;
    font-size: 20px;
    font-weight: 800;
}

.role-detail {
    max-width: none;
}

@media (min-width: 921px) {
    .role-detail {
        grid-template-rows: auto minmax(0, 1fr);
        height: calc(100vh - 160px);
        min-height: 520px;
    }
}

.config-detail,
.tools-view,
.admin-detail {
    max-width: none;
}

@media (max-width: 1100px) {
    .role-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .merchant-mobile-prices {
        display: block;
    }

    .merchant-price-matrix {
        display: none;
    }

    .merchant-import-role {
        width: 100%;
        max-width: none;
    }
    button {
        min-height: 44px;
    }

    .header-inner {
        min-height: 60px;
        padding: 0 14px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .header-inner .brand-copy,
    .header-actions > .connection,
    .user-name,
    .chevron {
        display: none;
    }

    .header-inner > .brand {
        margin-right: 6px;
    }

    .header-inner .brand-mark {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
    }

    .header-icon,
    .mobile-menu-button {
        display: flex;
    }

    .header-inner .mobile-menu-button {
        display: none;
    }

    .desktop-nav {
        gap: 6px;
        margin-left: 0;
    }

    .nav-link,
    .desktop-nav #toolsBtn {
        min-width: 48px;
        min-height: 60px;
        padding: 0 10px;
        font-size: 15px;
    }

    .nav-link.active::after {
        right: 8px;
        left: 8px;
    }

    .header-actions {
        gap: 6px;
    }

    .mobile-menu-button {
        width: 36px;
        min-height: 42px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0;
        color: var(--text);
        background: #f1f5fa;
    }

    .mobile-menu-button span {
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .user-trigger {
        min-height: 42px;
        padding: 4px;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
    }

    .drawer-backdrop {
        position: fixed;
        z-index: 150;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, .38);
    }

    .mobile-drawer {
        position: fixed;
        z-index: 160;
        top: var(--viewport-top);
        right: 0;
        display: grid;
        width: min(310px, 86vw);
        height: var(--viewport-height);
        overflow-y: auto;
        align-content: start;
        gap: 8px;
        padding: 18px;
        background: #fff;
        box-shadow: -16px 0 42px rgba(15, 23, 42, .18);
        transform: translateX(105%);
        transition: transform .2s ease;
    }

    .mobile-drawer.open {
        transform: translateX(0);
    }

    .drawer-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #edf1f6;
    }

    .drawer-link {
        width: 100%;
        justify-content: flex-start;
        color: var(--text);
        text-align: left;
        background: #f5f8fc;
    }

    .drawer-link.active {
        color: var(--primary);
        background: #eaf2ff;
    }

    .main {
        padding: 22px 14px 36px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 18px;
    }

    .page-heading h1,
    .detail-heading h1 {
        font-size: 22px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions button {
        flex: 1 1 0;
    }

    .detail-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .role-list {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .role-search,
    .role-batch-actions {
        flex-basis: 100%;
    }

    .role-batch-actions button {
        flex: 1 1 0;
        min-height: 44px;
    }

    .role-card {
        gap: 10px;
        padding: 13px;
    }

    .role-card:hover {
        transform: none;
    }

    .role-card-controls button {
        min-height: 44px;
    }

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

    .action-panel > button {
        flex: 1 1 calc(50% - 10px);
    }

    .config-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .config-actions > button {
        min-width: 0;
        padding-inline: 8px;
    }

    .config-expand-control {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .config-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .config-category-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .config-search {
        flex-basis: auto;
        width: 100%;
        min-width: 0;
    }

    .config-category-tab {
        flex: 0 0 auto;
    }

    .config-section-toggle {
        min-height: 52px;
        padding: 12px 14px;
    }

    .fortune-stage {
        min-height: 430px;
        gap: 18px;
        padding: 28px 16px;
    }

    .fortune-guidance {
        grid-template-columns: 1fr;
    }

    .fortune-claimed,
    .fortune-claim-note,
    .fortune-claim-box,
    .fortune-claim-box.multiple,
    .fortune-admin-draw {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .fortune-claim-box button,
    .fortune-claim-box select {
        width: 100%;
    }

    .fortune-history-row {
        grid-template-columns: 1fr auto;
        gap: 7px 12px;
        padding: 14px 2px;
    }

    .fortune-history-row time {
        grid-column: 1;
    }

    .fortune-history-tier {
        grid-column: 2;
        grid-row: 1;
    }

    .fortune-history-copy,
    .fortune-history-role {
        grid-column: 1 / -1;
    }

    .site-banners {
        top: 70px;
        max-height: calc(100vh - 84px);
        max-height: calc(100dvh - 84px);
    }

    .featured-notice-banner .announcement-heading .icon-button {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
        min-height: 32px;
    }
}

.profile-content {
    display: grid;
    gap: 16px;
}

.community-card { display: block; padding: 0; min-height: 0; overflow: hidden; border: 1px solid #d6e5f7; border-radius: 14px; background: #f3f8ff; box-shadow: 0 3px 14px #305f9a0c; cursor: pointer; }
.community-card:hover { border-color: #9abde9; background: #eaf3ff; }
.community-card:focus-visible { outline: 3px solid #a3c3eb; outline-offset: 3px; }
.community-card img { display: block; width: 100%; height: auto; border-radius: inherit; }
.community-card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 12px 16px 0; color: #416389; text-align: left; }
.community-card-heading strong { color: #285b9e; font-size: 18px; font-weight: 700; }
.community-card-heading > span { font-size: 12px; }
.profile-community { width: min(440px, 100%); margin: 0 0 18px; }
.qq-community-dialog { width: min(480px, calc(100vw - 24px)); }
.qq-community-dialog .community-card { width: 100%; }
.qq-community-dialog .modal-header h3 { font-size: 18px; }
.qq-community-dialog .hint { margin: 12px 0 0; text-align: center; }

.profile-summary-grid,
.profile-record-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.first-topup-promotion {
    padding: 12px 16px;
    border: 1px solid #f0d297;
    border-radius: 8px;
    background: linear-gradient(110deg, #fff8df, #fff1df);
    color: #8a4a11;
    font-weight: 600;
    line-height: 1.6;
}

.first-topup-badge {
    color: #a45a12;
    font-weight: 600;
}

.agent-admin-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.agent-admin-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-admin-controls input[type="number"] {
    width: 110px;
}

.agent-code-detail summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 12px;
}

.agent-code-detail code {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.agent-money-table {
    overflow-x: auto;
}

.agent-money-table table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 13px;
}

.agent-money-table th,
.agent-money-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

@media (max-width: 640px) {
    .agent-admin-row { flex-direction: column; align-items: stretch; }
    .agent-admin-controls { justify-content: flex-start; }
}

.profile-panel {
    min-width: 0;
    padding: 18px;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(31, 42, 55, 0.05);
}

.profile-panel-wide {
    grid-column: 1 / -1;
}

.profile-summary-grid .profile-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px 16px;
}

.profile-summary-grid .profile-panel > span,
.profile-summary-grid .profile-panel > strong,
.profile-summary-grid .profile-panel > small {
    grid-column: 1;
}

.profile-summary-grid .profile-panel > strong {
    color: #172033;
    font-size: 30px;
    line-height: 1.15;
}

.profile-summary-grid .profile-panel > small,
.profile-summary-grid .profile-panel > span {
    color: var(--muted);
}

.profile-summary-grid .profile-panel > button {
    grid-column: 2;
    grid-row: 1 / span 3;
}

.rebate-panel {
    border-color: #eadcb6;
    background: #fffdf7;
}

.invite-panel {
    display: grid;
    gap: 14px;
}

.invite-field {
    display: grid;
    gap: 6px;
}

.invite-field label {
    color: var(--muted);
    font-size: 12px;
}

.invite-field > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.invite-field code {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #243248;
    background: #f7f9fc;
    overflow-wrap: anywhere;
}

.profile-history {
    display: grid;
}

.profile-role-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid #edf1f6;
}

.profile-role-row:last-child {
    border-bottom: 0;
}

.profile-role-row > div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.profile-role-row strong,
.profile-role-row span {
    overflow-wrap: anywhere;
}

.profile-role-row span {
    color: var(--muted);
    font-size: 12px;
}

.profile-role-row button {
    flex: 0 0 auto;
}

.profile-history-row {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid #edf1f6;
}

.profile-history-row:last-child {
    border-bottom: 0;
}

.profile-history-row > div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.profile-history-row span {
    color: var(--muted);
    font-size: 12px;
}

.record-status {
    flex: 0 0 auto;
    text-align: right;
}

.success-text {
    color: #12805c !important;
}

@media (max-width: 760px) {
    .quota-purchase-links {
        grid-template-columns: 1fr;
    }

    .profile-summary-grid,
    .profile-record-grid {
        grid-template-columns: 1fr;
    }

    .profile-panel-wide {
        grid-column: auto;
    }

    .quota-indicator {
        gap: 4px;
        padding-left: 7px;
    }

    .quota-indicator > span {
        font-size: 12px;
    }

    .quota-indicator strong {
        margin-left: 2px;
        font-size: 12px;
    }
}

@media (max-width: 420px) {
    .header-actions {
        gap: 4px;
    }

    .nav-link,
    .desktop-nav #toolsBtn {
        min-width: 42px;
        padding-inline: 7px;
        font-size: 14px;
    }

    .mobile-menu-button {
        width: 32px;
    }

    .user-trigger {
        padding: 2px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .quota-indicator > span {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        max-width: 54px;
        line-height: 15px;
    }

    .quota-indicator strong {
        font-size: 11px;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .quota-indicator {
        gap: 3px;
        padding-left: 5px;
    }

    .quota-redeem-button {
        width: 24px;
        min-width: 24px;
    }
}

@media (max-width: 390px) {
    .profile-summary-grid .profile-panel {
        grid-template-columns: 1fr;
    }

    .profile-summary-grid .profile-panel > button {
        grid-column: 1;
        grid-row: auto;
        margin-top: 8px;
    }

    .profile-history-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .profile-role-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .record-status {
        text-align: left;
    }
    .brand-copy strong {
        font-size: 15px;
    }

    .role-card-heading {
        align-items: flex-start;
    }

    .role-runtime-actions {
        grid-template-columns: 1fr 1fr;
    }

    .role-runtime-actions button:last-child {
        grid-column: 1 / -1;
    }

    .log-layout {
        height: min(62vh, 520px);
    }

}

/* Role hall and configuration: readable cards and compact supporting controls. */
#rolesView, #configView { --surface-line: #e3eaf3; --soft-blue: #f0f5fc; }
#configView { max-width: 1120px; margin-inline: auto; }
#rolesView { padding-bottom: calc(112px + var(--safe-bottom)); }
#rolesView .role-search { gap: 8px; }
#rolesView .role-search input { border-radius: 7px; background: #f8fafc; min-height: 38px; }
#rolesView .role-batch-actions { gap: 8px; }
#rolesView .role-batch-actions button { flex: 1; min-height: 36px; border-radius: 7px; }
.role-hall-dock { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--viewport-bottom-offset) + 12px + var(--safe-bottom)); z-index: 40; display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; max-width: calc(100vw - 24px); padding: 5px; border: 1px solid #dce5ef; border-radius: 15px; background: #fffffff5; box-shadow: 0 4px 20px #304d6d20; }
.role-hall-dock > * { flex: 0 0 48px; min-width: 0; }
.role-hall-dock > .hall-dock-controls { display: flex; align-items: center; gap: inherit; flex: 0 1 auto; }
#roleHallDock { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: min(250px, calc(100vw - 24px)); }
#roleHallDock .hall-dock-community { grid-column: 1 / -1; width: 100%; min-height: 26px; padding: 4px 8px; border: 0; border-radius: 7px; background: #edf4ff; color: #416b9e; font-size: 12px; line-height: 1.4; box-shadow: none; }
#roleHallDock .hall-dock-community:hover { background: #e3efff; color: #285b9e; }
#roleHallDock.is-collapsed .hall-dock-community { display: none; }
#roleHallDock.is-collapsed { width: auto; grid-template-columns: auto; }
.hall-dock-controls > * { flex: 0 0 48px; min-width: 0; }
.role-hall-dock .hall-dock-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 48px; height: 46px; min-height: 46px; padding: 4px; border: 0; border-radius: 10px; color: #536a88; background: transparent; font-size: 10px; line-height: 1.2; white-space: nowrap; cursor: pointer; appearance: none; -webkit-appearance: none; }
.role-hall-dock svg { display: block; flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.role-hall-dock :is(.hall-dock-action:hover, .hall-dock-action[aria-expanded="true"]:not(.hall-dock-collapse), .has-query) { background: #edf4ff; color: #2567b8; }
.role-hall-dock .hall-dock-collapse { flex: 0 0 32px; width: 32px; }
.role-hall-dock.is-collapsed { padding: 3px; border-radius: 12px; }
.role-hall-dock.is-collapsed .hall-dock-collapse { flex-basis: 40px; width: 40px; height: 40px; min-height: 40px; }
.role-hall-dock.is-collapsed .hall-dock-collapse svg { transform: rotate(180deg); }
.role-hall-dock button:focus-visible { outline: 3px solid #a3c3eb; outline-offset: 2px; }
.role-hall-dock #addAccountBtn { color: #2567b8; }
.hall-dock-panel { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(310px, calc(100vw - 24px)); padding: 14px; display: grid; gap: 10px; border: 1px solid #dce5ef; border-radius: 12px; background: #fff; box-shadow: 0 6px 24px #304d6d26; }
.hall-dock-panel .hint { margin: 0; font-size: 12px; line-height: 1.6; }
.hall-dock-panel button { font-size: 12px; }
.hall-dock-panel > button { justify-self: start; }
#rolesView .role-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: start; gap: 14px; }
#rolesView .role-card { position: relative; grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 10px 12px; border: 1px solid var(--surface-line); border-radius: 10px; box-shadow: 0 2px 10px #19385c05; background: #fff; }
#rolesView .role-card.is-running { border-top: 2px solid #72bda3; padding-top: 9px; }
#rolesView .role-card.is-crashed { border-top: 2px solid #dfa778; padding-top: 9px; }
#rolesView .role-card:hover { border-color: #afc8e9; box-shadow: 0 8px 24px #294d7d0c; }
#rolesView .role-card:focus-visible { outline: 3px solid #91b9f2; outline-offset: 3px; }
#rolesView .role-card.union-power-advanced {
    border-color: #d9b45d;
    background: linear-gradient(110deg, #fff2c9, #fffaf0 85%);
    box-shadow: 0 4px 16px #a9751520;
}
#rolesView .role-card.union-power-advanced:hover { border-color: #c99835; box-shadow: 0 6px 20px #a9751530; }
#rolesView .role-card.union-power-advanced::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 1px #e7c777, 0 3px 16px #dcae4b35;
    opacity: .3;
    animation: management-card-glow 4s ease-in-out infinite;
}
#rolesView .union-power-advanced .management-badge { display: inline-flex; align-items: center; gap: 4px; color: #78510b; background: #f9e7ac; font-weight: 500; }
#rolesView .union-power-advanced .management-badge::before { content: "✦"; color: #af7915; }
@keyframes management-card-glow { 0%, 100% { opacity: .25; } 50% { opacity: .8; } }
@media (prefers-reduced-motion: reduce) {
    #rolesView .role-card.union-power-advanced::before { animation: none; opacity: .4; }
}
#rolesView .role-card h2 { font-size: 14px; font-weight: 600; line-height: 1.4; }
#rolesView .role-card-title p { font-size: 11px; margin-top: 2px; }
#rolesView .role-card-title { flex: 1; }
#rolesView .role-card .status-pill { font-size: 11px; padding: 4px 8px; white-space: nowrap; }
#rolesView .role-card-heading-actions { gap: 5px; }
#rolesView .role-favorite-button { display: grid; place-items: center; flex: 0 0 30px; width: 30px; min-height: 30px; padding: 4px; border: 0; border-radius: 6px; background: transparent; color: #8493a6; box-shadow: none; }
#rolesView .role-favorite-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; pointer-events: none; }
#rolesView .role-favorite-button:hover { background: #fff7df; color: #a97913; }
#rolesView .role-favorite-button.is-favorite { color: #b27d16; }
#rolesView .role-favorite-button.is-favorite svg { fill: #f6c65b; }
#rolesView .role-topup-button { min-height: 30px; width: 30px; height: 30px; border-radius: 7px; }
#rolesView .role-card-meta { min-height: 0; font-size: 11px; gap: 4px 8px; }
#rolesView .role-card-meta span { white-space: normal; line-height: 1.5; }
#rolesView .role-card-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px 0; border: 0; background: transparent; }
#rolesView .role-card-stats > div { display: grid; align-content: start; gap: 2px; padding: 0; border-radius: 0; background: transparent; }
#rolesView .role-card-stats span { margin: 0; font-size: 11px; color: #708098; }
#rolesView .role-card-stats strong { font-size: 12px; font-weight: 600; color: #273e5b; font-variant-numeric: tabular-nums; white-space: normal; overflow-wrap: anywhere; }
#rolesView .role-extra { min-width: 0; cursor: default; }
#rolesView .role-extra summary { display: flex; justify-content: space-between; align-items: center; min-height: 24px; color: #71839a; font-size: 11px; cursor: pointer; list-style: none; }
#rolesView .role-extra summary::-webkit-details-marker { display: none; }
#rolesView .role-extra summary > span { transition: transform .15s; }
#rolesView .role-extra[open] summary > span { transform: rotate(180deg); }
#rolesView .role-extra-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 0; }
#rolesView .role-extra-stats > div { display: flex; justify-content: space-between; gap: 6px; min-width: 0; color: #6c7c92; font-size: 11px; }
#rolesView .role-extra-stats > .role-extra-stat-wide { grid-column: 1 / -1; }
#rolesView .role-extra-stats strong { font-weight: 600; }
#rolesView .role-extra-stats :is(span, strong) { min-width: 0; overflow-wrap: anywhere; }
#rolesView .role-card-identity { padding-top: 6px; font-size: 11px; }
#rolesView .role-card-identity > div { display: flex; gap: 6px; }
#rolesView .role-card-controls { gap: 6px; padding-top: 6px; }
#rolesView .role-runtime-actions, #rolesView .role-page-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#rolesView .role-runtime-actions button:last-child { grid-column: auto; }
#rolesView .role-card-controls button { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
#rolesView .role-main-actions { display: flex; align-items: center; gap: 6px; }
#rolesView .role-main-actions > button { flex: 0 0 auto; }
#rolesView .role-main-actions > button.ghost { color: #64748b; background: transparent; }
#rolesView .role-main-actions .page-entry { color: #245da8; background: #f0f5fc; }
#rolesView .role-main-actions > .role-actions-menu { margin-left: auto; }
#rolesView .role-actions-menu { position: relative; }
#rolesView .role-actions-menu > summary { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: transparent; color: #60748f; font-size: 18px; line-height: 1; cursor: pointer; list-style: none; }
#rolesView .role-actions-menu > summary::-webkit-details-marker { display: none; }
#rolesView .role-actions-popover { position: absolute; top: calc(100% + 5px); right: 0; z-index: 5; display: grid; gap: 4px; min-width: 120px; padding: 5px; background: #fff; border: 1px solid #dce5f2; border-radius: 9px; box-shadow: 0 8px 24px #243e6420; }
#rolesView .role-card:has(.role-actions-menu[open]) { z-index: 2; }
#rolesView .role-page-actions:not(.has-share) { grid-template-columns: 1fr 1fr; }
#rolesView .role-page-actions .page-entry { background: #eaf2ff; color: #245da8; }
#rolesView .role-page-actions .page-entry:hover { background: #dceafd; }
#rolesView #rolePagination { font-size: 12px; color: #718096; gap: 8px; }
#rolesView .role-list-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 16px; margin-top: 14px; }
#rolesView .role-list-footer .hint { margin: 0; font-size: 12px; }
#rolesView .role-list-footer #rolePagination { margin: 0; justify-content: center; }
#rolesView .role-list-footer button { min-height: 30px; font-size: 12px; }
#dashboardView { padding-bottom: 0; }
.log-view-tabs { display: flex; padding: 3px; gap: 3px; border-radius: 8px; background: #eef3fa; }
.log-view-tabs button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; font-size: 12px; background: transparent; color: #60748e; box-shadow: none; }
.log-view-tabs button[aria-pressed="true"] { color: #245da8; background: #fff; box-shadow: 0 1px 4px #28436814; }
.log-search-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; padding: 6px 12px; border-bottom: 1px solid #e3eaf4; background: #f8fafd; }
.log-search-bar .log-new-button { min-height: 28px; padding: 3px 8px; margin-left: auto; font-size: 12px; color: #2868af; }
.log-search-field { display: flex; align-items: center; flex: 1; min-width: 0; max-width: 460px; border: 1px solid #dce5ef; border-radius: 7px; background: #fff; }
.log-search-field:focus-within { border-color: #89afe0; box-shadow: 0 0 0 2px #dceafb; }
.log-search-field input { flex: 1; min-width: 0; width: 100%; height: 30px; min-height: 30px; padding: 4px 9px; border: 0; border-radius: 7px; background: transparent; color: #334b69; font-size: 13px; }
.log-search-field input:focus { outline: none; box-shadow: none; }
.log-search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.log-search-field button { flex: 0 0 30px; width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 6px; color: #6f8198; font-size: 20px; background: transparent; box-shadow: none; }
.log-search-count { flex-shrink: 0; color: #71839a; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.runtime-panel { padding: 8px; color: #304966; }
.runtime-panel-heading { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.runtime-panel-heading small, .runtime-card-note, .runtime-panel-note { color: #73829a; font-size: 12px; font-weight: 400; line-height: 1.7; }
.runtime-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; align-items: start; }
.runtime-card { min-width: 0; padding: 0; border: 1px solid #e3eaf4; border-radius: 9px; background: #fff; }
.runtime-card[hidden] { display: none; }
.runtime-card[open] { grid-column: 1 / -1; }
.runtime-card > summary { display: grid; grid-template-columns: minmax(80px, .7fr) minmax(0, 1fr) auto 12px; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; list-style: none; }
.runtime-card > summary::-webkit-details-marker { display: none; }
.runtime-card > summary:focus-visible { outline: 2px solid #78a8e8; outline-offset: -2px; border-radius: 9px; }
.runtime-card-title { color: #274a75; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.runtime-summary-metrics { display: flex; flex-wrap: wrap; gap: 3px 10px; color: #7a8a9f; font-size: 10px; }
.runtime-summary-metrics b { color: #385e8a; font-size: 11px; font-weight: 500; }
.runtime-status { font-size: 10px; color: #6b8ba7; max-width: 95px; overflow-wrap: anywhere; }
.runtime-chevron { color: #8aa2bf; transition: transform .15s; }
.runtime-card[open] .runtime-chevron { transform: rotate(180deg); }
.runtime-card-body { padding: 10px; border-top: 1px solid #edf1f7; }
.runtime-card:not([open]) .runtime-card-body { display: none; }
.runtime-card-wide { grid-column: 1 / -1; }
.runtime-card h2 { margin: 0 0 12px; font-size: 15px; color: #274a75; }
.runtime-card h3 { margin: 10px 0 5px; font-size: 12px; font-weight: 600; }
.runtime-card h4 { margin: 0 0 8px; font-size: 12px; }
.runtime-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; margin-bottom: 8px; }
.runtime-card-wide > .runtime-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.runtime-metric { display: grid; align-content: start; gap: 4px; min-width: 0; }
.runtime-metric > span, .runtime-metric small { color: #76879b; font-size: 11px; overflow-wrap: anywhere; }
.runtime-metric strong { color: #2d5688; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.runtime-empty { margin: 6px 0; padding: 7px 9px; border-radius: 6px; background: #f7f9fc; color: #7a8a9f; line-height: 1.6; font-size: 11px; }
.runtime-table-wrap { overflow-x: auto; }
.runtime-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.runtime-table th, .runtime-table td { padding: 5px 6px; border-bottom: 1px solid #edf1f7; text-align: right; }
.runtime-table :is(th, td):first-child { text-align: left; }
.runtime-table th { font-size: 11px; color: #7a8a9f; font-weight: 500; }
.runtime-table td small { display: block; margin-top: 3px; color: #8d9aae; font-size: 10px; }
.runtime-task-list > div { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0; font-size: 12px; }
.runtime-task-list > div > :last-child { flex-shrink: 0; color: #7a8a9f; }
.runtime-equipment-body { margin: 8px 0; }
.runtime-equipment-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; max-width: 600px; }
.runtime-equipment-slot { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 5px; border: 1px solid #dce7f5; border-radius: 6px; background: #f7faff; color: #476689; }
.runtime-equipment-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1px 4px; font-size: 10px; }
.runtime-equipment-top small { color: #9c783d; font-size: 10px; }
.runtime-equipment-slot strong { font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.runtime-equipment-slot.is-empty { border-style: dashed; background: #fafbfd; color: #95a1b1; }
.runtime-equipment-attributes { display: grid; gap: 1px; margin: 0; font-size: 10px; line-height: 1.35; }
.runtime-equipment-attributes > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 3px; min-width: 0; }
.runtime-equipment-attributes dt, .runtime-equipment-pending { color: #76879b; font-size: 10px; overflow-wrap: anywhere; }
.runtime-equipment-attributes dd { margin: 0; min-width: 0; max-width: 100%; color: #305b8d; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.scroll-top-button { position: fixed; z-index: 41; right: 6px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; place-items: center; width: 30px; height: 34px; min-height: 34px; padding: 5px; border: 1px solid #dce5ef; border-radius: 9px; background: #fffffff0; color: #6d87a6; box-shadow: 0 2px 9px #304d6d18; opacity: .75; }
.scroll-top-button[hidden] { display: none; }
.scroll-top-button:hover, .scroll-top-button:focus-visible { opacity: 1; color: #2567b8; background: #edf4ff; }
.scroll-top-button:focus-visible { outline: 2px solid #78a8e8; outline-offset: 2px; }
.scroll-top-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.runtime-progress { height: 5px; margin: 10px 0; background: #eef3f9; border-radius: 5px; overflow: hidden; }
.runtime-progress i { display: block; height: 100%; background: #78a8e8; border-radius: inherit; }
.runtime-current-task { background: #f4f8ff; padding: 10px 12px; border-radius: 9px; font-size: 12px; }
.runtime-current-task h3 { margin: 0 0 6px; }
.runtime-current-task p { margin: 6px 0; }
.runtime-current-task small { color: #7588a1; }
.runtime-rank-list { list-style: none; padding: 0; margin: 0; }
.runtime-rank-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 0; font-size: 12px; border-bottom: 1px solid #f0f3f8; }
.runtime-rank-list li > span { overflow-wrap: anywhere; }
.runtime-rank { color: #8b9fb9; font-variant-numeric: tabular-nums; }
.runtime-order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.runtime-order { min-width: 0; padding: 8px; border: 1px solid #e8edf5; border-radius: 7px; }
.runtime-order > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; }
.runtime-order > div strong { white-space: nowrap; font-weight: 500; }
.runtime-order .is-ready strong { color: #329783; }
.runtime-order .is-short strong { color: #c48438; }
.runtime-plot-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.runtime-plot { display: grid; gap: 4px; padding: 8px 6px; min-width: 0; border-radius: 7px; border: 1px solid #dfe9f7; background: #f4f8ff; text-align: center; }
.runtime-plot :is(small, span) { font-size: 11px; color: #788ca5; font-variant-numeric: tabular-nums; }
.runtime-plot strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.runtime-plot.is-empty { background: #fafbfd; border-style: dashed; }
.runtime-plot.is-mature { background: #effaf5; border-color: #d4ebe0; }
.runtime-plot.is-mature span { color: #429278; }
.runtime-panel-note { margin: 16px 0 0; }
.runtime-count-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; font-size: 11px; }
.runtime-count-list > div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #f0f3f8; padding: 4px 0; }
.runtime-count-list span { overflow-wrap: anywhere; }
.runtime-count-list strong { white-space: nowrap; font-weight: 500; text-align: right; }
.runtime-count-list small { display: block; font-size: 10px; color: #8d9aae; }
.runtime-reward-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 5px; font-size: 11px; }
.runtime-reward-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; padding: 5px 7px; border-radius: 5px; background: #f4f8fd; }
.runtime-reward-grid span { min-width: 0; overflow-wrap: anywhere; }
.runtime-reward-grid strong { flex-shrink: 0; white-space: nowrap; font-weight: 500; }
.runtime-reward-grid small, .runtime-card-body h3 > small { color: #8d9aae; font-size: 10px; font-weight: 400; }
.runtime-pill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.runtime-pill-grid > div { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 6px 8px; border-radius: 6px; background: #f4f8fd; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.runtime-pill-grid strong { color: #466b98; font-weight: 500; }
.runtime-pill-grid span { color: #76879b; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .runtime-pill-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.runtime-talent-line { max-width: 100%; overflow-wrap: anywhere; padding: 4px 0; font-size: 11px; line-height: 1.7; }
.runtime-talent-line strong { color: #466b98; font-weight: 500; white-space: nowrap; }
.runtime-usage { margin-top: 10px; padding-top: 8px; border-top: 1px solid #edf1f7; }
.runtime-ball-levels, .runtime-lineup { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 6px; }
.runtime-ball-levels > div, .runtime-lineup > div { display: grid; gap: 4px; text-align: center; padding: 7px 4px; border-radius: 6px; background: #f3f7fe; border: 1px solid #e1eaf7; font-size: 12px; }
.runtime-ball-levels b, .runtime-lineup strong { font-size: 11px; color: #466b98; overflow-wrap: anywhere; }
.runtime-ball-levels small, .runtime-lineup span { color: #7a8a9f; font-size: 10px; }
.runtime-road-board { display: grid; grid-template-columns: repeat(var(--board-columns), minmax(0, 1fr)); width: 100%; max-width: 360px; gap: 2px; padding: 5px; box-sizing: border-box; background: #e8eef6; border-radius: 8px; }
.runtime-road-cell { display: flex; flex-direction: column; justify-content: center; align-items: center; aspect-ratio: 1; min-width: 0; box-sizing: border-box; border: 1px solid transparent; border-radius: 3px; font-size: 11px; line-height: 1.3; }
.runtime-road-cell.has-unit { color: hsl(var(--unit-hue), 35%, 32%); background: hsl(var(--unit-hue), 55%, 92%); }
.runtime-road-cell.has-top { border-top-color: hsl(var(--unit-hue), 35%, 72%); }
.runtime-road-cell.has-right { border-right-color: hsl(var(--unit-hue), 35%, 72%); }
.runtime-road-cell.has-bottom { border-bottom-color: hsl(var(--unit-hue), 35%, 72%); }
.runtime-road-cell.has-left { border-left-color: hsl(var(--unit-hue), 35%, 72%); }
.runtime-road-cell strong { max-width: 100%; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.runtime-road-cell span { font-size: 10px; }
.runtime-road-cell.is-empty { background: #f9fbfe; border: 1px dashed #c8d6e7; }
.runtime-road-cell.is-locked { background: #dce4ef; }
.runtime-2048 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 280px; padding: 7px; background: #dde7f4; border-radius: 8px; }
.runtime-2048 > div { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; min-width: 0; background: #f3f6fb; border-radius: 5px; font-size: clamp(12px, 3vw, 19px); color: #365982; font-weight: 600; }
.runtime-2048 .has-tile { background: hsl(calc(220 - var(--tile-shade) * 8) 58% calc(96% - var(--tile-shade) * 3%)); }
@media (max-width: 650px) {
    .runtime-panel { padding: 6px; }
    .runtime-card-grid { grid-template-columns: minmax(0, 1fr); }
    .runtime-card { padding: 0; }
    .runtime-card > summary { grid-template-columns: minmax(0, 1fr) auto 12px; padding: 8px; gap: 4px 8px; }
    .runtime-summary-metrics { grid-row: 2; grid-column: 1 / 4; }
    .runtime-status { grid-column: 2; grid-row: 1; }
    .runtime-chevron { grid-column: 3; grid-row: 1; }
    .runtime-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .runtime-count-list { grid-template-columns: minmax(0, 1fr); }
    .runtime-reward-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .runtime-plot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .runtime-equipment-slot { padding: 4px 3px; }
    .runtime-plot { padding: 7px 4px; }
    #dashboardView .log-heading .log-view-tabs { order: 2; }
}
#dashboardView .role-detail { position: relative; display: block; height: auto; min-height: 0; }
#dashboardView .log-panel { position: relative; display: block; overflow: visible; box-shadow: 0 2px 10px #19385c05; }
#dashboardView :is(.log-layout, .runtime-panel) { height: calc(var(--viewport-height) - 226px); min-height: 160px; }
#dashboardView .log-layout { border-top: 0; grid-template-rows: minmax(0, 1fr); }
#dashboardView .runtime-panel { overflow-y: auto; overscroll-behavior-y: contain; overflow-anchor: none; scrollbar-gutter: stable; scroll-behavior: auto; }
.log-heading { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border-bottom: 1px solid #dce5ef; border-radius: 8px 8px 0 0; background: #ffffffdb; }
.log-heading h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font-size: 14px; font-weight: 650; }
.log-heading button { min-height: 36px; padding: 0 10px; font-size: 13px; }
.log-heading > button { flex: 0 0 auto; }
.log-timestamp-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; flex-shrink: 0; color: #71839a; font-size: 12px; cursor: pointer; white-space: nowrap; }
.log-timestamp-toggle input { width: 15px; height: 15px; min-height: 0; margin: 0; accent-color: #397aca; cursor: pointer; }
.log-timestamp { color: #8090a4; font-weight: 400; font-variant-numeric: tabular-nums; }
#dashboardView .log-tag { font-size: 14px; min-height: 32px; }
#dashboardView #logContent { min-width: 0; padding: 12px 14px; border-radius: 0 0 8px 0; overflow-wrap: anywhere; overflow-anchor: none; scrollbar-gutter: stable; }
#dashboardView .log-tag-filter { border-radius: 0 0 0 8px; }
#logDock { position: relative; right: auto; bottom: auto; flex-direction: row; gap: 2px; padding: 2px; border: 0; border-radius: 8px; background: #f1f5fb; box-shadow: none; backdrop-filter: none; }
#logDock > * { flex: 0 0 auto; }
#logDock .hall-dock-controls > * { flex: 0 0 auto; }
#logDock .hall-dock-action { flex-direction: row; gap: 5px; width: auto; height: 32px; min-height: 32px; padding: 0 8px; border-radius: 6px; font-size: 12px; }
#logDock .hall-dock-collapse { flex-basis: 32px; width: 32px; padding: 0; }
#logDock svg { width: 16px; height: 16px; flex-basis: 16px; }
#logDock .hall-dock-panel { right: 0; top: calc(100% + 8px); bottom: auto; width: min(310px, calc(100vw - 50px)); }
#logActionsPanel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: calc(var(--viewport-height) - 150px); overflow-y: auto; }
#logActionsPanel > button { width: 100%; min-height: 40px; justify-self: stretch; }
#logActionsPanel .auto-refresh { grid-column: 1 / -1; margin-left: 0; min-height: 32px; font-size: 12px; }
#configView { --config-control-columns: minmax(0, 2fr) minmax(0, 3fr); }
#configView .detail-heading { gap: 12px; margin-bottom: 12px; }
#configView .detail-heading h1 { font-size: 19px; }
#configView .back-button { font-size: 13px; min-height: 40px; border-radius: 9px; }
#configView .config-detail { gap: 10px; }
#configView .config-header { min-height: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--surface-line); box-shadow: none; background: linear-gradient(100deg, #f2f7ff, #fff 60%); flex-direction: row; align-items: center; }
#configView .config-header h3 { font-size: 17px; color: #274466; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#configView .config-actions { display: flex; width: auto; gap: 16px; flex-wrap: wrap; }
#configView .config-expand-control { gap: 8px; font-size: 12px; }
.config-utilities { position: relative; }
.config-utilities summary { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 1px solid #dae5f2; border-radius: 9px; color: #51657e; background: #fff; font-size: 13px; cursor: pointer; list-style: none; }
.config-utilities summary::-webkit-details-marker { display: none; }
.config-utilities-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; display: grid; width: 164px; gap: 4px; padding: 6px; background: #fff; border: 1px solid #e0e8f2; border-radius: 12px; box-shadow: 0 10px 35px #243e641a; }
.config-utilities-menu [data-config-filter-state] { margin-inline-start: .4em; color: var(--muted, #526174); }
.config-utilities-menu [aria-checked="true"] [data-config-filter-state] { color: #176c53; font-weight: 700; }
.config-utilities-menu button { width: 100%; text-align: left; min-height: 42px; border-radius: 7px; padding: 0 12px; font-size: 13px; }
#configView .config-hint { font-size: 12px; line-height: 1.6; color: #79879a; padding: 0 2px; }
#configView .config-toolbar { top: 78px; padding: 10px; border-radius: 12px; border-color: var(--surface-line); background: #f8fafd; box-shadow: 0 3px 10px #223b5e05; gap: 12px; }
#configView .config-category-bar { gap: 4px; }
#configView .config-category-tab { min-height: 40px; padding: 0 16px; border-radius: 8px; border: 0; background: transparent; font-size: 14px; font-weight: 500; color: #667991; box-shadow: none; }
#configView .config-category-tab.active { background: #fff; color: #2465b7; font-weight: 700; box-shadow: 0 2px 7px #264b7820; }
#configView .config-search { flex-basis: 230px; }
#configView .config-search input { min-height: 40px; border-radius: 8px; font-size: 14px; }
#configView .config-section-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
#configView .config-section { border-color: var(--surface-line); border-radius: 9px; box-shadow: 0 2px 5px #203e5f03; }
#configView .config-section.expanded { overflow: visible; }
#configView .config-section.expanded > .config-section-toggle { position: -webkit-sticky; position: sticky; top: var(--config-card-top, 150px); z-index: 11; border-radius: 8px 8px 0 0; box-shadow: 0 3px 6px #203e5f0a; }
#configView .config-section-toggle { min-height: 48px; padding: 8px 12px; gap: 10px; }
#configView .config-section-toggle h3 { flex: 1; font-size: 14px; font-weight: 600; }
#configView .config-section-chevron { width: 8px; height: 8px; color: #94a3b8; }
#configView .expanded .config-section-toggle { background: #fbfdff; }
#configView .config-section-description { padding: 10px 12px 0; font-size: 12px; color: #728199; line-height: 1.6; }
#configView .config-grid { grid-template-columns: minmax(0, 1fr); padding: 10px 12px 12px; gap: 8px; }
#configView .config-related-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; align-items: start; }
#configView .config-related-row > .config-field { grid-column: auto; height: 100%; }
#configView .config-related-row > .config-field:only-child { grid-column: 1 / -1; }
#configView .config-related-row > .config-field.wide { grid-column: 1 / -1; }
#configView .config-row-label { grid-column: 1 / -1; padding: 5px 2px 0; color: #667991; font-size: 12px; font-weight: 600; text-align: center; }
#configView .config-field { padding: 8px 10px; border-color: #eaf0f6; background: #f8fafc; border-radius: 8px; min-height: 0; grid-template-columns: var(--config-control-columns); gap: 6px 12px; align-items: center; text-align: left; }
#configView :is(.config-field, .battle-preset-row, .challenge-task-control, .competition-task-toggle, .competition-task-types) > :is(span:first-child, .config-field-heading) { justify-self: stretch; text-align: right; }
#configView :is(.config-field, .battle-preset-row, .challenge-task-control, .competition-task-toggle, .competition-task-types) > :nth-child(2) { justify-self: start; min-width: 0; max-width: 100%; }
#configView .config-field > :is(span:first-child, .config-field-heading) { font-size: 13px; font-weight: 600; line-height: 1.55; overflow-wrap: anywhere; }
#configView .config-field-help { display: inline; font-weight: 400; }
#configView .config-field-help > summary { display: inline-grid; vertical-align: middle; place-items: center; width: 24px; height: 24px; margin-left: 2px; border-radius: 50%; color: #7185a0; cursor: pointer; list-style: none; }
#configView .config-field-help > summary > span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid #bac9dc; border-radius: 50%; background: #f5f8fc; font: 600 10px/1 sans-serif; }
#configView .config-field-help > summary::-webkit-details-marker { display: none; }
#configView .config-field-help > summary:hover, #configView .config-field-help[open] > summary { background: #e6eef9; color: #2465b7; }
#configView .config-field-help > small { white-space: pre-line; }
#configView .battle-preset-row > .config-field-heading { color: #334155; font-size: 13px; font-weight: 600; min-width: 0; }
#configView .config-field small { color: #64748b; font-size: 12px; line-height: 1.65; font-weight: 400; }
#configView .config-field :is(input, select) { min-width: 0; max-width: 100%; min-height: 30px; height: 30px; border-radius: 6px; background-color: #fff; font-size: 12px; padding-inline: 7px; }
#configView .field-select > select { width: min(220px, 100%); }
#configView .number-wrap { min-width: 0; width: min(120px, 100%); }
#configView .number-wrap input { width: 100%; }
#configView .number-wrap > span { white-space: nowrap; flex-shrink: 0; }
#configView .choice-row { gap: 4px; justify-content: flex-start; }
#configView .config-field > :is(.config-text-input, .game-code-entry, .config-select-sequence, .config-searchable-options, .homeland-schedules) { width: 100%; }
#configView .config-field > .config-text-input { max-width: 420px; }
#configView .config-field > :is(.homeland-schedules, .homeland-rules-grid, .homeland-extreme-estimate) { grid-column: 1 / -1; width: 100%; }
#configView .config-field.challenge-task-row { grid-template-columns: minmax(0, 1fr); }
#configView .challenge-task-row > span:first-child { text-align: center; }
#configView .challenge-task-controls { width: 100%; grid-template-columns: minmax(0, 1fr); }
#configView .competition-task-row { grid-template-columns: minmax(0, 1fr); }
#configView .competition-task-toggle { padding-right: 0; border-right: 0; }
#configView :is(.challenge-task-control, .competition-task-toggle, .competition-task-types) { display: grid; width: 100%; grid-template-columns: var(--config-control-columns); gap: 6px 12px; align-items: center; }
#configView .choice-chip { min-height: 26px; border-radius: 5px; padding: 3px 7px; font-size: 12px; white-space: normal; line-height: 1.4; height: auto; box-shadow: none; }
#configView .battle-preset-card { border-radius: 10px; box-shadow: none; }
#configView .battle-preset-controls { width: 100%; }
#configView .battle-preset-row { grid-template-columns: var(--config-control-columns); gap: 6px 12px; text-align: left; }
#configView .battle-preset-row .choice-row { justify-content: flex-start; }
#configView .battle-preset-title { justify-content: center; flex-wrap: wrap; text-align: center; }
#configView .switch-control { width: 40px; min-width: 40px; height: 22px; min-height: 22px; background: #d8e1ed; border: 1px solid #d0dae7; box-shadow: none; }
#configView .switch-control .switch-thumb { top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #172e5320; }
#configView .switch-control .switch-label { display: none; }
#configView .switch-control.on { background: #397aca; border-color: #397aca; }
#configView .switch-control.on .switch-thumb { transform: translateX(18px); }
#configView .switch-control:focus-visible { outline: 3px solid #a3c3eb; outline-offset: 3px; }
.config-save-bar { position: sticky; bottom: calc(var(--viewport-bottom-offset) + 12px + var(--safe-bottom)); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid #dbe5f2; border-radius: 10px; background: rgba(255,255,255,.97); box-shadow: 0 -4px 24px #2b496810; }
.config-save-bar > div { display: grid; min-width: 0; gap: 3px; }
.config-save-bar strong { font-size: 13px; font-weight: 600; color: #718297; }
.config-save-bar small { font-size: 12px; color: #8090a4; }
.config-save-bar button { min-width: 108px; min-height: 38px; border-radius: 7px; }
.config-save-bar.has-changes { border-color: #a8c7ee; }
.config-save-bar.has-changes strong { color: #2565b6; }
.config-bounded-time { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; column-gap: 4px; min-width: 0; width: 100%; }
.config-bounded-time .config-select { width: 100%; min-width: 0; }
.config-bounded-time small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.config-time-picker { display: grid; min-width: 0; width: min(220px, 100%); }
#configView .config-time-picker > input[type="time"] { width: 100%; max-width: 100%; }
.config-time-popover { display: block; position: fixed; inset: auto; z-index: 100; margin: 0; padding: 12px; width: 240px; max-width: calc(100vw - 24px); border: 1px solid #dbe5f2; border-radius: 10px; color: #334b69; background: #fff; box-shadow: 0 8px 28px #243e6424; }
.config-time-popover[hidden] { display: none; }
.config-time-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.config-time-popover-heading strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
#configView .config-time-popover-heading button { min-height: 28px; padding: 0 10px; font-size: 12px; }
.config-time-sliders { display: grid; }
#configView .config-time-slider { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 400; }
#configView .config-time-slider input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; min-width: 0; max-width: 100%; height: 24px; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: 3px; background: transparent; box-shadow: none; cursor: pointer; }
#configView .config-time-slider input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: #c7d6e8; }
#configView .config-time-slider input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 1px solid #fff; border-radius: 50%; background: #397aca; box-shadow: 0 1px 3px #234d7930; }
#configView .config-time-slider input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #c7d6e8; }
#configView .config-time-slider input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 1px solid #fff; border-radius: 50%; background: #397aca; box-shadow: 0 1px 3px #234d7930; }
#configView .config-time-slider input[type="range"]:focus-visible { outline: 2px solid #8bb5e8; outline-offset: 1px; }
#configView .config-time-slider input[type="range"]:disabled { cursor: default; opacity: .45; }
.homeland-schedule-time > .config-time-picker { flex: 1 1 0; width: 126px; max-width: 138px; }
.inline-add > .config-time-picker { width: 132px; }
@media (min-width: 761px) {
    #rolesView .role-main-actions > button { flex: 1 1 0; }
    #rolesView .role-main-actions > button.ghost { background: #f6f8fb; }
}
@media (max-width: 1000px) and (min-width: 761px) {
    #rolesView .role-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #configView .config-toolbar { flex-direction: column; align-items: stretch; }
    #configView .config-search { flex-basis: auto; width: 100%; }
}
@media (max-width: 920px) {
    #dashboardView .log-layout { grid-template-rows: auto minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .header-inner { padding-inline: 8px; }
    .main { padding: 14px 12px 24px; }
    .role-hall-dock { right: 12px; }
    #rolesView .role-search input { font-size: 16px; min-height: 40px; }
    #rolesView .role-batch-actions { width: auto; gap: 6px; }
    #rolesView .role-batch-actions button { flex: 1; min-height: 40px; font-size: 12px; padding-inline: 8px; white-space: nowrap; }
    #rolesView .role-list { gap: 10px; }
    #rolesView .role-main-actions > button { flex: 1 1 0; min-width: 0; min-height: 42px; padding-inline: 6px; font-size: 13px; }
    #rolesView .role-main-actions > button.ghost { background: #f6f8fb; }
    #rolesView .role-actions-menu > summary { width: 36px; height: 42px; }
    #rolesView .role-actions-popover button { min-height: 42px; }
    .log-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title back" "tabs tabs" "time actions"; gap: 2px 8px; padding: 6px 10px; }
    .log-view-tabs { grid-area: tabs; justify-self: start; margin: 4px 0; }
    .log-heading h1 { grid-area: title; }
    .log-heading > button { grid-area: back; justify-self: end; }
    .log-timestamp-toggle { grid-area: time; }
    #logDock { grid-area: actions; justify-self: end; }
    #logDock .hall-dock-action { width: 36px; height: 34px; min-height: 34px; padding: 0; }
    #logDock .hall-dock-action > span { display: none; }
    .log-search-bar { gap: 8px; padding-inline: 10px; }
    .log-search-field input { font-size: 16px; }
    #dashboardView :is(.log-layout, .runtime-panel) { height: calc(var(--viewport-height) - 236px); }
    #dashboardView #logContent { padding: 10px 12px; border-radius: 0 0 8px 8px; }
    #dashboardView .log-tag-filter { border-radius: 0; }
    #configView .detail-heading { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    #configView .detail-heading h1 { font-size: 15px; }
    #configView .config-header { padding: 8px 10px; flex-wrap: nowrap; gap: 10px; }
    #configView .config-header h3 { font-size: 14px; }
    #configView .config-actions { width: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
    #configView .config-expand-control { gap: 4px; font-size: 11px; white-space: nowrap; }
    #configView .config-utilities summary { padding-inline: 8px; font-size: 12px; gap: 4px; min-height: 36px; }
    #configView .config-hint { font-size: 11px; }
    #configView .config-toolbar { top: 68px; padding: 6px; gap: 6px; }
    #configView .config-category-tab { min-height: 32px; padding-inline: 10px; font-size: 12px; }
    #configView .config-search { flex-basis: auto; }
    #configView .config-search input { font-size: 13px; min-height: 34px; height: 34px; }
    #configView .config-section-toggle { min-height: 38px; padding: 7px 10px; }
    #configView .config-section-toggle h3 { font-size: 13px; }
    #configView .config-section-description { padding: 8px 10px 0; }
    #configView .config-grid { grid-template-columns: minmax(0, 1fr); padding: 8px; gap: 6px; }
    #configView .config-field { padding: 6px 8px; }
    #configView .config-field > :is(span:first-child, .config-field-heading), #configView .battle-preset-row > .config-field-heading { font-size: 12px; font-weight: 500; }
    #configView :is(.config-field, .battle-preset-row) :is(input, select) { min-height: 30px; height: 30px; font-size: 12px; }
    #configView .choice-chip { min-height: 26px; padding: 3px 7px; font-size: 12px; }
    #configView .switch-control, #configView .switch-control.on { height: 32px; min-height: 32px; background: transparent; border: 0; }
    #configView .switch-control::before { content: ""; position: absolute; inset: 5px 0; border-radius: 11px; background: #d8e1ed; transition: background .18s; }
    #configView .switch-control .switch-thumb { top: 8px; left: 3px; }
    #configView .switch-control.on::before { background: #397aca; }
    #configView .config-save-bar { bottom: calc(var(--viewport-bottom-offset) + 8px); padding: 7px 10px; margin-bottom: env(safe-area-inset-bottom, 0px); gap: 8px; }
    #configView .config-save-bar button { min-width: 96px; padding-inline: 10px; }
    #configView .config-save-bar strong { font-size: 12px; }
    #configView .config-save-bar small { font-size: 11px; }
}
@media (max-width: 760px) {
    #configView [data-config-section="danRealm"] :is(.field-multiOption, .field-selectSequence) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    #configView [data-config-section="danRealm"] :is(.field-multiOption, .field-selectSequence) > .config-field-heading { text-align: left; }
    #configView [data-config-section="danRealm"] :is(.choice-row, .config-select-sequence, .config-searchable-options) { width: 100%; grid-column: 1 / -1; }
    #configView [data-config-section="danRealm"] .config-select-sequence { gap: 8px; }
    #configView [data-config-section="danRealm"] .choice-row { gap: 6px; }
    #configView [data-config-section="danRealm"] .choice-chip { min-height: 32px; padding: 5px 10px; }
    #configView [data-config-section="danRealm"] .competition-task-types { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    #configView [data-config-section="danRealm"] .competition-task-types > .config-field-heading { text-align: left; }
    #configView [data-config-section="danRealm"] .competition-task-types .choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #configView [data-config-section="danRealm"] .competition-task-types .choice-chip { padding-inline: 4px; }
    [data-runtime-key="danRealm"] .runtime-order > div { align-items: start; }
    [data-runtime-key="danRealm"] .runtime-order > div > span { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
    [data-runtime-key="danRealm"] .runtime-plot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 359px) {
    #rolesView .role-card { padding-inline: 12px; }
    #rolesView .role-card-heading { gap: 6px; }
    #rolesView .role-card-title { gap: 8px; }
    #rolesView .role-card .status-pill { padding-inline: 6px; font-size: 10px; }
}

.maintenance-scope-card { grid-column: 1 / -1; }
.maintenance-scope-card h3 { margin: 0; font-size: 16px; }
.maintenance-scope-options { display: flex; flex-wrap: wrap; gap: 8px; }
.maintenance-scope-options button { min-height: 38px; flex: 1 1 130px; max-width: 200px; }
.maintenance-scope-options button[aria-pressed="true"] { color: #164c8c; border-color: #91b6e2; background: #eaf3ff; box-shadow: inset 0 0 0 1px #91b6e2; }
.maintenance-scope-options button[data-maintenance-scope="all"] { margin-left: auto; }
[data-maintenance-scope-label] { display: inline-block; color: var(--primary); font-size: 13px; font-weight: 500; }
.maintenance-scope-card .hint { white-space: pre-line; }

/* Tools follow the compact cards used in the role hall and configuration. */
#toolsView { --surface-line: #e3eaf3; --soft-blue: #f0f5fc; --primary: #397aca; --primary-dark: #2867b4; --muted: #71839a; }
#toolsView .tool-shell { grid-template-columns: 160px minmax(0, 1fr); align-items: start; gap: 14px; }
#toolsView .tool-shell > * { min-width: 0; }
.activity-guide-view { display: grid; gap: 8px; }
.activity-guide-header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 12px; padding: 8px 12px; border: 1px solid var(--surface-line); border-radius: 10px; background: var(--panel); }
.activity-guide-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.activity-guide-header h3 { margin: 0; color: #274466; font-size: 16px; }
.activity-guide-header .hint { margin: 0; }
#toolsView .activity-guide-header button, #toolsView .activity-guide-reader-actions button { min-height: 30px; padding: 5px 8px; white-space: nowrap; }
.activity-guide-promotion { min-width: 0; font-size: 12px; }
.activity-guide-promotion[open] { grid-column: 1 / -1; }
.activity-guide-promotion > summary { width: fit-content; padding: 6px 0; color: var(--primary); cursor: pointer; }
.activity-guide-promotion-content { display: grid; justify-items: start; gap: 12px; padding-top: 10px; }
.activity-guide-poster { display: grid; gap: 10px; width: min(100%, 520px); margin-inline: auto; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; text-decoration: none; }
.activity-guide-poster img { display: block; width: 100%; height: auto; border-radius: 10px; }
.activity-guide-poster:focus-visible { outline: 3px solid #a3c3eb; outline-offset: 4px; border-radius: 10px; }
.activity-guide-browser { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: clamp(520px, 76vh, 850px); height: clamp(520px, 76dvh, 850px); overflow: hidden; border: 1px solid var(--surface-line); border-radius: 10px; background: #fff; }
.activity-guide-browser.directory-collapsed { grid-template-columns: minmax(0, 1fr); }
.activity-guide-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; border-right: 1px solid var(--surface-line); background: #f8fafd; }
.activity-guide-sidebar[hidden] { display: none; }
.activity-guide-search { display: grid; gap: 6px; color: #334b69; font-size: 12px; }
.activity-guide-search input { width: 100%; }
.activity-guide-sidebar > .hint { margin: 8px 0; }
.activity-guide-directory { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.activity-guide-category { margin-bottom: 6px; }
.activity-guide-category > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px; border-radius: 6px; color: #334b69; font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.activity-guide-category > summary::-webkit-details-marker { display: none; }
.activity-guide-category > summary::before { content: "›"; font-size: 17px; line-height: 1; }
.activity-guide-category[open] > summary::before { transform: rotate(90deg); }
.activity-guide-category > summary small { margin-left: auto; color: var(--muted); font-weight: 400; }
.activity-guide-category > summary:hover { background: #edf3fb; }
#toolsView .activity-guide-article { display: grid; gap: 5px; width: 100%; min-height: 48px; margin: 3px 0; padding: 9px 10px; border: 1px solid transparent; color: #4c6380; background: transparent; text-align: left; line-height: 1.6; overflow-wrap: anywhere; }
#toolsView .activity-guide-article small { color: var(--muted); font-size: 11px; }
#toolsView .activity-guide-article:hover { background: #edf3fb; }
#toolsView .activity-guide-article.active { color: #2867b4; border-color: #dce8f7; background: #edf4ff; }
.activity-guide-reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.activity-guide-reader-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 6px 10px; border-bottom: 1px solid var(--surface-line); }
.activity-guide-reader-header h4 { min-width: 0; margin: 0; color: #274466; font-size: 13px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-guide-reader-actions { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.activity-guide-reader-actions a { color: var(--primary); text-decoration: none; white-space: nowrap; }
.activity-guide-load-status { grid-column: 1 / -1; min-width: 0; margin: 0; }
.activity-guide-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
@media (max-width: 760px) {
    .activity-guide-browser { grid-template-columns: minmax(0, 1fr); height: auto; }
    .activity-guide-sidebar { max-height: 280px; border-right: 0; border-bottom: 1px solid var(--surface-line); }
    .activity-guide-directory { max-height: 180px; }
    .activity-guide-reader { height: 76vh; height: 76dvh; min-height: 440px; }
    .activity-guide-header { gap: 6px 8px; padding: 6px 8px; }
    .activity-guide-title .hint { display: none; }
}
#toolsView .tool-list { position: sticky; top: calc(84px + var(--safe-top)); max-height: calc(var(--viewport-height) - 100px - var(--safe-top) - var(--safe-bottom)); overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; gap: 4px; padding: 6px; border-color: var(--surface-line); border-radius: 10px; background: #fff; box-shadow: 0 2px 10px #19385c05; }
#toolsView .tool-list-item { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; color: #647b98; background: transparent; font-size: 13px; line-height: 1.4; }
#toolsView .tool-list-item svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#toolsView .tool-list-item:hover { color: #2867b4; background: #f5f8fd; }
#toolsView .tool-list-item.active { color: #2867b4; border-color: #dce8f7; background: #edf4ff; box-shadow: inset 3px 0 #80a9dd; font-weight: 600; }
#toolsView button { font-size: 12px; border-radius: 7px; }
#toolsView button:focus-visible, #logDock button:focus-visible { outline: 3px solid #a3c3eb; outline-offset: 2px; }
#toolsView :is(input, select) { min-width: 0; max-width: 100%; min-height: 36px; border: 1px solid #dce5ef; border-radius: 7px; padding: 6px 9px; color: #334b69; background-color: #fff; font-size: 13px; }
#toolsView :is(input, select):focus { border-color: #89afe0; outline: 2px solid #dceafb; outline-offset: 1px; }
#toolsView .hint { color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
#toolsView :is(.merchant-path-header, .merchant-tool-panel, .union-power-header, .union-power-panel, .holy-land-heading, .union-insight-view) { min-width: 0; border: 1px solid var(--surface-line); border-radius: 10px; background: #fff; box-shadow: 0 2px 10px #19385c05; }
#toolsView :is(.merchant-path-header, .union-power-header, .holy-land-heading) { padding: 14px 16px; background: linear-gradient(100deg, #f2f7ff, #fff 65%); }
#toolsView :is(.merchant-path-header, .union-power-header) > div:first-child { min-width: 0; }
#toolsView :is(.merchant-path-header h3, .union-power-header h3, .holy-land-heading h2, .union-insight-heading h3, .activity-tree-panel > h2) { margin: 0; color: #274466; font-size: 18px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
#toolsView .activity-tree-panel > h2 + .hint { margin-bottom: 14px; }
#toolsView .activity-tree-panel { padding: 14px 16px; }
#toolsView .activity-tree-panel h4 { color: #334b69; font-size: 14px; font-weight: 600; }
#toolsView :is(.activity-tree-controls label, .activity-tree-gift, .merchant-controls label, .mountain-query-form > label) { color: #334b69; font-size: 13px; font-weight: 500; }
#toolsView .activity-tree-controls label { min-width: 0; }
#toolsView .activity-tree-gifts { margin-top: 16px; gap: 8px 12px; }
#toolsView .activity-tree-gift { grid-template-columns: minmax(0, 1fr) 74px; gap: 10px; padding: 9px 10px; border: 1px solid #edf1f6; border-radius: 8px; background: #f8fafc; }
#toolsView .activity-tree-gift small { font-size: 11px; line-height: 1.6; }
#toolsView .activity-tree-gift input { text-align: right; }
#toolsView .activity-tree-full-gift { justify-self: end; align-self: center; color: #2e609b; font-size: 12px; white-space: nowrap; }
#activityTreeReverseBtn { align-self: end; }
#toolsView .activity-tree-metrics { gap: 10px; }
#toolsView .activity-tree-metrics > div { min-width: 0; padding: 12px; border: 1px solid #e3ebf6; border-radius: 8px; background: #f5f8fd; }
#toolsView .activity-tree-metrics small { font-size: 12px; }
#toolsView .activity-tree-metrics > div > span { color: var(--muted); font-size: 12px; }
#toolsView .activity-tree-metrics strong { margin-top: 6px; color: #2e609b; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#toolsView :is(.activity-tree-tiers, #mountainServerList) { border: 1px solid var(--surface-line); border-radius: 8px; background: #fff; }
#toolsView .activity-tree-tiers > summary { min-height: 40px; padding: 10px 12px; color: #536b89; font-size: 12px; font-weight: 500; cursor: pointer; }
#toolsView .activity-tree-tiers[open] > summary { border-bottom: 1px solid var(--surface-line); background: #f8fafd; }
#toolsView .activity-tree-tiers { overflow-x: auto; }
#toolsView .activity-tree-tiers table { margin-top: 0; }
#toolsView :is(th, td) { border-bottom-color: #e9eef5; font-size: 12px; }
#toolsView th { color: #647b98; background: #f6f9fd; font-weight: 500; }
#toolsView tbody tr:hover { background: #f5f9ff; }
#toolsView :is(.merchant-table-wrap, .union-power-table-wrap, .union-insight-table-wrap, .activity-tree-tiers) { scrollbar-width: thin; scrollbar-color: #cbd8e9 transparent; }
#toolsView .merchant-import-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; }
#toolsView .merchant-import-role { width: 100%; max-width: none; gap: 6px; font-size: 12px; }
#toolsView .merchant-import-footer { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
#toolsView .merchant-import-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#toolsView .merchant-import-pagination .hint { margin: 0 6px 0 0; }
#toolsView .merchant-import-pagination button { min-height: 30px; padding-inline: 10px; }
#toolsView .merchant-warning { position: static; padding: 10px 14px; border-color: #f1dfbd; border-radius: 8px; color: #93703e; background: #fffbf2; box-shadow: none; font-size: 12px; font-weight: 400; line-height: 1.6; }
#toolsView .merchant-controls { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; padding: 14px 16px; }
#toolsView .merchant-prices .config-section-toggle { min-height: 44px; padding: 10px 16px; color: #334b69; background: #fff; }
#toolsView .merchant-prices .config-section-toggle:hover { background: #f6f9fd; }
#toolsView .merchant-prices .config-section-toggle h3 { font-size: 14px; font-weight: 600; }
#toolsView .merchant-name-text { font-size: 12px; font-weight: 500; }
#toolsView .merchant-price-table .merchant-sticky-col { background: #fff; }
#toolsView .merchant-price-table thead .merchant-sticky-col { background: #f6f9fd; }
#toolsView .merchant-result-summary { padding: 10px 14px; background: #f6f9fd; }
#toolsView .merchant-result-summary span { font-size: 12px; border-color: #e3ebf6; }
#toolsView .merchant-result-summary strong { color: #2e609b; font-weight: 600; }
#toolsView .merchant-tool-panel .section-title { padding: 12px 14px; }
#toolsView .merchant-tool-panel .section-title h3 { color: #334b69; font-size: 14px; font-weight: 600; }
#toolsView .merchant-tool-panel .section-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
#toolsView .merchant-path-result-empty { font-size: 12px; }
#toolsView .union-power-meta { gap: 5px 14px; font-size: 12px; }
#toolsView .union-power-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; padding: 12px 14px; background: #f8fafd; }
#toolsView .union-power-status { font-size: 11px; font-weight: 500; padding: 4px 8px; }
#toolsView #unionPowerMembers > .hint { margin: 0; padding: 10px 14px; }
#toolsView .union-power-member-error { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
#toolsView .union-power-member-error .hint { margin: 0; }
#toolsView .union-power-table .union-name { font-weight: 600; }
#toolsView .union-power-advanced :is(.union-power-header, .union-power-panel) { border-color: #ecdfbf; box-shadow: 0 2px 10px #916c1808; }
#toolsView .union-power-advanced .union-power-header { background: linear-gradient(100deg, #fff9e9, #fff 75%); }
.power-monitor-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px; padding: 14px; border: 1px solid #e3ebf6; border-radius: 8px; background: #f8fafd; }
.power-monitor-form label { display: grid; gap: 7px; color: #536b89; font-size: 13px; min-width: 0; }
.power-monitor-form :is(input, select) { width: 100%; min-width: 0; }
.power-monitor-amount { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 6px; }
.power-monitor-form-actions { display: flex; gap: 8px; grid-column: 1 / -1; }
.power-monitor-form > .hint { grid-column: 1 / -1; margin: 0; }
.power-monitor-table { width: 100%; min-width: 640px; font-size: 13px; }
.power-monitor-table :is(th, td) { padding: 10px 12px; text-align: left; border-bottom: 1px solid #edf1f6; }
.power-monitor-table th { color: #536b89; background: #f8fafd; }
.power-monitor-table td { white-space: nowrap; }
.power-monitor-table td small { display: block; margin-top: 4px; }
.power-monitor-status { display: inline-block; border-radius: 6px; padding: 3px 6px; background: #eef3f9; color: #536b89; white-space: nowrap; }
.power-monitor-status.near { background: #fff5dc; color: #936500; }
.power-monitor-status.over { background: #fff0ee; color: #bd4237; }
.power-monitor-unread { color: #bd4237; }
.power-monitor-actions button { padding: 5px 7px; font-size: 12px; margin: 2px; }
.power-monitor-editing { background: #f8fafd; }
.power-monitor-table tr[data-monitor-watch-id] { scroll-margin-block: 80px; }
.power-monitor-highlight { background: #fff2c7; animation: power-monitor-highlight 900ms ease-in-out 4; outline: 2px solid #d8a73c; outline-offset: -2px; }
@keyframes power-monitor-highlight { 50% { background: #ffdf88; } }
@media (prefers-reduced-motion: reduce) { .power-monitor-highlight { animation: none; } }
.toast.actionable { cursor: pointer; }
.toast.actionable:focus-visible { outline: 2px solid #d8a73c; outline-offset: 3px; }
.power-monitor-inline-editor { display: grid; gap: 8px; min-width: 220px; max-width: 300px; white-space: normal; scroll-margin: 12px; }
.power-monitor-inline-amount { min-width: 180px; }
.power-monitor-inline-amount :is(input, select) { width: 100%; min-width: 0; }
.power-monitor-inline-near { display: flex; align-items: center; gap: 4px; color: #536b89; font-size: 12px; }
.power-monitor-inline-near input { width: 64px; }
.power-monitor-inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 100px; }
.power-monitor-inline-error { flex-basis: 100%; margin: 4px 0 0; color: #bd4237; font-size: 12px; }
.power-monitor-empty { padding: 18px; color: var(--muted); font-size: 13px; }
.power-monitor-reminder { position: fixed; bottom: calc(var(--viewport-bottom-offset) + 18px + var(--safe-bottom)); left: max(18px, var(--safe-left)); z-index: 90; border: 1px solid #e8c778; border-radius: 20px; background: #fff5dc; color: #805500; box-shadow: 0 4px 16px #916c1825; padding: 9px 14px; font-size: 13px; }
@media (max-width: 760px) {
    .power-monitor-form { grid-template-columns: minmax(0, 1fr); padding: 10px; margin: 10px; }
    .power-monitor-reminder { bottom: calc(var(--viewport-bottom-offset) + 12px + var(--safe-bottom)); left: max(12px, var(--safe-left)); max-width: calc(100vw - 80px); }
}
#toolsView .union-power-advanced .union-access-note { background: #fff5d9; }
#toolsView :is(.holy-land-tabs, .holy-land-controls, .holy-land-period) { min-width: 0; border: 1px solid var(--surface-line); border-radius: 10px; background: #fff; padding: 10px 12px; }
#toolsView .holy-land-heading + .hint { margin: 0 2px; }
#toolsView .holy-land-tabs { gap: 4px; padding: 4px; }
#toolsView .holy-land-tabs button { min-height: 36px; border-color: transparent; color: #71839a; background: transparent; }
#toolsView .holy-land-tabs button.active { border-color: #dce8f7; color: #2867b4; background: #edf4ff; }
#toolsView .holy-land-halves { border-color: #dce5ef; border-radius: 7px; }
#toolsView .holy-land-halves button { min-height: 36px; color: #71839a; background: #f8fafd; }
#toolsView .holy-land-halves button.active { color: #2867b4; background: #edf4ff; }
#toolsView .holy-land-period { align-items: center; gap: 8px 12px; background: #f8fafd; }
#toolsView .holy-land-period select { min-width: 0; max-width: 100%; font-size: 12px; }
#toolsView .holy-land-group { border-color: var(--surface-line); border-radius: 10px; box-shadow: 0 2px 10px #19385c05; }
#toolsView .holy-land-group > summary { min-height: 44px; padding: 10px 14px; background: #f8fafd; }
#toolsView .holy-land-group > summary strong { font-size: 14px; font-weight: 600; }
#toolsView .holy-land-score { font-size: 14px; }
#toolsView .holy-land-union > summary:hover { background: #f8fafd; }
#toolsView .mountain-query-grid { margin: 0; padding: 10px; }
#toolsView .mountain-query-grid > span { border-radius: 7px; color: #71839a; background: #f8fafc; font-size: 12px; }
#toolsView .mountain-server-btn { border: 1px solid #e3ebf6; background: #f5f8fd; color: #536b89; }
#toolsView .mountain-server-btn[aria-pressed="true"] { border-color: #9cbbe3; color: #2867b4; background: #edf4ff; }
#toolsView .mountain-union-list article { border-color: #e3ebf6; border-radius: 8px; background: #f8fafd; }
#toolsView .union-insight-view { padding: 14px 16px; }
#toolsView .union-insight-heading { align-items: flex-start; }
#toolsView .union-insight-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding: 10px; border: 1px solid #e8eef6; border-radius: 8px; background: #f8fafd; }
#toolsView .union-insight-tabs { gap: 6px; padding-bottom: 6px; }
#toolsView .union-insight-tabs button { border: 1px solid transparent; border-radius: 7px; padding: 6px 12px; color: #71839a; background: transparent; }
#toolsView .union-insight-tabs button.active { border-color: #dce8f7; color: #2867b4; background: #edf4ff; font-weight: 600; }
#toolsView .union-insight-demo-notice { border-radius: 8px; border-color: #dce8f7; background: #f5f8fd; font-size: 12px; }
#toolsView .union-insight-member { border-color: var(--surface-line); border-radius: 8px; }
#toolsView .union-insight-member > summary:hover { background: #f8fafd; }
#toolsView .union-insight-member > summary strong { font-size: 13px; font-weight: 600; }
#toolsView .union-insight-tag { border-radius: 5px; font-size: 11px; }
#toolsView .union-insight-overview { border: 1px solid var(--surface-line); border-radius: 8px; }
#toolsView .union-insight-overview th { padding: 10px 8px; }
#toolsView .union-insight-member-name { display: flex; align-items: center; gap: 6px; max-width: 220px; }
#toolsView .union-insight-member-name strong { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#toolsView .union-insight-basis-btn { flex: 0 0 28px; width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid #dce5ef; border-radius: 50%; color: #647b98; background: #f5f8fd; font-size: 13px; line-height: 1; }
#toolsView .union-insight-basis-btn:hover { color: #2867b4; border-color: #9cbbe3; background: #edf4ff; }
.union-insight-basis-modal { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; color: #334b69; }
.union-insight-basis-modal::backdrop { background: rgba(15, 23, 42, 0.36); }
.union-insight-basis-modal .modal-header h3 { min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.union-insight-basis-modal h4 { margin: 18px 0 6px; font-size: 13px; }
.union-insight-basis-modal p { margin: 0; color: #71839a; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
#toolsView .config-message { border-radius: 8px; font-size: 12px; line-height: 1.6; }
@media (max-width: 1100px) {
    #toolsView .merchant-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    #toolsView .tool-shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    #toolsView .tool-list { position: static; display: flex; flex-wrap: nowrap; max-height: none; max-width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; overscroll-behavior-y: auto; scroll-padding-inline: 6px; scrollbar-gutter: auto; padding: 5px; gap: 4px; scrollbar-width: thin; }
    #toolsView .tool-list-item { flex: 0 0 auto; width: auto; min-height: 44px; padding: 8px 10px; white-space: nowrap; }
    #toolsView .tool-list-item.active { box-shadow: none; }
}
@media (max-width: 760px) {
    #toolsView :is(.merchant-path-header, .union-power-header) { flex-direction: row; align-items: flex-start; gap: 10px; }
    #toolsView :is(.merchant-path-header, .union-power-header, .holy-land-heading, .activity-tree-panel, .merchant-import-controls, .union-insight-view) { padding: 12px; }
    #toolsView :is(.merchant-path-header h3, .union-power-header h3, .holy-land-heading h2, .union-insight-heading h3, .activity-tree-panel > h2) { font-size: 16px; }
    #toolsView .merchant-path-header > div:first-child { flex: 1; }
    #toolsView .merchant-path-actions { flex-shrink: 0; width: auto; }
    #toolsView .merchant-path-actions button { width: auto; }
    #toolsView .merchant-import-controls { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    #toolsView .merchant-import-footer { gap: 8px; }
    #toolsView .merchant-import-footer > button { width: 100%; }
    #toolsView .merchant-controls { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    #toolsView .union-power-toolbar { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
    #toolsView .union-power-toolbar select { grid-column: 1 / -1; }
    #toolsView .union-power-toolbar #unionPowerSearch { grid-column: 1 / -1; }
    #toolsView .union-insight-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
    #toolsView .union-insight-toolbar select { grid-column: 1 / -1; }
    #toolsView .union-insight-actions { gap: 6px; }
    #toolsView .union-insight-actions select { width: 100%; min-width: 0; flex-basis: 100%; }
    #toolsView .activity-tree-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    #toolsView .activity-tree-metrics > div { padding: 10px; }
    #toolsView .activity-tree-metrics strong { font-size: 18px; }
}

/* Operations workspace: bounded lists and stable form panels. */
.admin-workspace { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-workspace .admin-section-nav { display: flex; flex-direction: column; position: sticky; top: 20px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; gap: 6px; }
.admin-workspace .admin-section-nav button { text-align: left; width: 100%; }
.admin-workspace-content { min-width: 0; }
.admin-nav-toggle { display: none; }
.ops-heading, .ops-node header, .ops-role-row, .ops-event, .ops-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ops-heading h3 { margin: 4px 0 12px; }
.ops-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.ops-totals { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.ops-metric { padding: 12px; background: var(--panel-soft); border-radius: 8px; min-width: 0; }
.ops-metric span, .ops-node small, .ops-role-row small, .ops-event small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.ops-metric strong { font-size: 15px; overflow-wrap: anywhere; }
.ops-node-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.ops-node { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--panel); min-width: 0; }
.ops-node-warning { border-color: #f4c583; }
.ops-node > button { margin-top: 12px; }
.ops-badge { font-size: 12px; padding: 5px 8px; color: #166534; background: #e8f8ee; border-radius: 6px; white-space: nowrap; }
.ops-badge-danger { color: #b91c1c; background: #fee2e2; }
.ops-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 20px 0; }
.ops-controls label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; min-width: 120px; }
.ops-controls input, .ops-controls select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; min-height: 38px; padding: 8px; max-width: 100%; }
.ops-warning { background: #fff7ed; color: #9a3412; padding: 12px; border-radius: 8px; }
.ops-version { overflow-wrap: anywhere; }
.ops-pagination { justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; font-size: 13px; }
.ops-role-row, .ops-event { border-bottom: 1px solid var(--line); padding: 14px 0; }
.ops-role-row > div, .ops-event > div { min-width: 0; overflow-wrap: anywhere; }
.ops-event time { font-size: 12px; color: var(--muted); }
#adminSystem details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
#adminSystem summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.ops-chart { margin: 20px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.ops-chart svg { display: block; width: 100%; height: auto; margin-top: 12px; }
.ops-chart text { font-size: 10px; fill: var(--muted); }
#rolePagination { justify-content: flex-end; margin: 14px 0; }
.account-provider { margin-bottom: 14px; }
.account-provider-help { width: 22px; height: 22px; padding: 0; margin-left: 6px; border-radius: 50%; vertical-align: middle; }
.qq-conversion-link { display: inline-block; margin-top: 8px; color: var(--primary); }
#accountModal { z-index: 1050; }
.alipay-auth-panel { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; text-align: center; }
.alipay-auth-panel canvas { width: min(100%, 320px); height: auto; border-radius: 8px; image-rendering: pixelated; }
.alipay-auth-panel .hint { margin: 0; }
.alipay-device-fields { width: 100%; display: grid; gap: 10px; text-align: left; }
.alipay-device-list { display: grid; gap: 8px; }
.alipay-device-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); cursor: pointer; }
.alipay-device-row input { width: auto; flex-shrink: 0; }
.alipay-device-row span { min-width: 0; overflow-wrap: anywhere; }
.alipay-device-row small { display: block; margin-top: 4px; color: var(--muted); }
.role-alipay-auth { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 8px 10px; border-radius: 8px; background: var(--panel-soft); color: var(--muted); font-size: 12px; }
.role-alipay-auth span { min-width: 0; overflow-wrap: anywhere; }
.role-alipay-auth button { flex-shrink: 0; padding: 5px 8px; font-size: 12px; }
.role-alipay-auth.expiring { background: #fff7ed; color: #9a3412; }
.role-alipay-auth.expired { background: #fff1f2; color: #be123c; }
@media (max-width: 760px) {
    .admin-workspace { display: block; }
    .admin-nav-toggle { display: block; margin-bottom: 12px; }
    .admin-workspace .admin-section-nav { display: none; position: static; margin-bottom: 16px; }
    .admin-workspace .admin-section-nav.mobile-open { display: flex; }
    .ops-controls label { flex: 1 1 130px; }
    .ops-controls input, .ops-controls select { width: 100%; }
    .ops-role-row, .ops-event { flex-wrap: wrap; }
    .ops-role-row > div:first-child { flex-basis: 100%; }
    .ops-node { padding: 12px; }
    .ops-metrics { gap: 8px; }
    .ops-metric { padding: 10px; }
    .ops-heading { align-items: flex-start; }
}
/* War-season inventory: compact summary and details loaded only for the selected union. */
#warSeasonReviveContent .war-revive-toolbar { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; }
.war-revive-selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
#warSeasonReviveContent .war-revive-selectors select { grid-column: auto; min-width: 0; }
.war-revive-actions { display: flex; justify-content: flex-end; gap: 8px; }
.war-revive-actions button { white-space: nowrap; }
.war-revive-history { display: flex; align-items: center; justify-self: end; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
#warSeasonReviveContent .war-revive-history input { flex: 0 0 16px; width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--primary); }
.war-revive-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 12px 0; font-size: 13px; }
.war-revive-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.war-revive-table th, .war-revive-table td { border-bottom: 1px solid #edf1f6; padding: 10px 12px; text-align: left; }
.war-revive-table th { color: #536b89; background: #f8fafd; font-weight: 500; }
.war-revive-sort { display: inline-flex; align-items: center; gap: 5px; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.war-revive-sort > span[aria-hidden] { font-size: 11px; color: #8093ab; }
.war-revive-label-short { display: none; }
.war-revive-table th[aria-sort="ascending"] .war-revive-sort,
.war-revive-table th[aria-sort="descending"] .war-revive-sort { color: #2870ca; }
.war-revive-sort:hover { color: #2870ca; background: transparent; }
.war-revive-sort:focus-visible { outline: 2px solid #2870ca; outline-offset: 3px; border-radius: 3px; }
.war-revive-table { min-width: 500px; }
.war-revive-table th:nth-child(2), .war-revive-table td:nth-child(2),
.war-revive-table th:nth-child(3), .war-revive-table td:nth-child(3),
.war-revive-table th:nth-child(4), .war-revive-table td:nth-child(4) { text-align: right; white-space: nowrap; }
#warSeasonReviveContent .union-power-panel > .hint,
#warSeasonReviveContent #warReviveMessage,
#warSeasonReviveContent #warReviveMembers { padding-inline: 12px; }
@media (max-width: 760px) {
    #warSeasonReviveContent .war-revive-toolbar { grid-template-columns: minmax(0, 1fr); }
    .war-revive-selectors { grid-template-columns: minmax(0, 1fr); }
    .war-revive-actions button { flex: 1; }
    .war-revive-history { justify-self: start; }
}
@media (max-width: 600px) {
    #warSeasonReviveContent #warReviveMembers { padding-inline: 6px; }
    .war-revive-summary { gap: 5px 10px; padding-block: 8px; font-size: 12px; }
    .war-revive-table { min-width: 0; table-layout: fixed; font-size: 12px; }
    .war-revive-table th, .war-revive-table td { padding: 7px 3px; }
    .war-revive-table td:nth-child(n+2) { white-space: normal; overflow-wrap: anywhere; }
    .war-revive-table th:nth-child(2) { width: 40px; }
    .war-revive-table th:nth-child(3) { width: 65px; }
    .war-revive-table th:nth-child(4):not(:last-child) { width: 47px; }
    .war-revive-table th:last-child { width: 70px; }
    .war-revive-table th:last-child, .war-revive-table td:last-child { font-size: 11px; white-space: normal; }
    .war-revive-member-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .war-revive-member-time { overflow-wrap: anywhere; }
    .war-revive-label-full { display: none; }
    .war-revive-label-short { display: inline; }
    .war-revive-sort { gap: 2px; min-width: 0; }
}

.dao-query-view { min-width: 0; }
.dao-toolbar, .dao-heading, .dao-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.dao-toolbar select { width: auto; max-width: 100%; min-width: 140px; }
.dao-toolbar form { display: flex; gap: 8px; flex: 1; min-width: 180px; }
.dao-toolbar input { min-width: 0; width: 100%; }
.dao-toolbar button, .dao-pages button, .dao-heading button { white-space: nowrap; }
.dao-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); gap: 10px; margin: 14px 0; }
.dao-player { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 14px; text-align: left; color: var(--text, #27364b); background: var(--surface, #fff); border: 1px solid var(--border, #dbe3ee); border-radius: 12px; min-width: 0; overflow-wrap: anywhere; }
.dao-player:hover { border-color: #5289cd; background: #f4f8ff; }
.dao-player:disabled { opacity: .6; cursor: default; }
.dao-player strong { font-size: 15px; }
.dao-player span { font-size: 12px; }
.dao-player small { font-size: 11px; color: #718096; }
.dao-power { color: #3676bd; font-weight: 600; }
.dao-progress { display: flex; flex-wrap: wrap; gap: 8px; }
.dao-progress > span { padding: 7px 10px; border-radius: 8px; background: #eef5ff; color: #46678c; font-size: 12px; }
.dao-progress small { display: block; margin-top: 4px; }
.dao-pages { justify-content: center; margin: 18px 0; font-size: 12px; }
.dao-heading h3, .dao-heading p { margin: 3px 0; }
.dao-body, .dao-variant { margin: 10px 0; padding: 12px; border: 1px solid var(--border, #dbe3ee); border-radius: 12px; background: var(--surface, #fff); }
.dao-body > summary, .dao-variant > summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.dao-body > summary > span, .dao-variant > summary > span { display: inline-block; margin-left: 12px; color: #718096; font-size: 12px; font-weight: 400; }
.dao-attributes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.dao-attributes > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; padding: 7px 8px; background: #f5f7fb; border-radius: 7px; font-size: 12px; overflow-wrap: anywhere; }
.dao-attributes span { color: #718096; }
.dao-more > summary { cursor: pointer; font-size: 12px; color: #567695; }
.dao-loadout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.dao-loadout > section { padding: 10px; border-radius: 9px; background: #f8faff; min-width: 0; overflow-wrap: anywhere; }
.dao-loadout h4 { margin: 0 0 8px; font-size: 13px; color: #718096; }
.dao-loadout strong, .dao-loadout span, .dao-loadout p { font-size: 12px; }
.dao-loadout div > span { margin-left: 8px; color: #718096; }
.dao-loadout p { margin: 5px 0 10px; }
.dao-loadout .dao-attributes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dao-chip { display: inline-block; margin: 3px 5px 3px 0; padding: 4px 6px; border-radius: 5px; background: #eaf0f8; }
@media (max-width: 640px) {
    .dao-toolbar select { flex: 1; }
    .dao-toolbar form { flex-basis: 100%; order: 2; }
    .dao-attributes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dao-loadout { grid-template-columns: minmax(0, 1fr); }
    .dao-body, .dao-variant { padding: 9px; }
    .dao-variant > summary > span { margin: 5px 0 0; display: block; }
}
.config-sync-targets { display: grid; gap: 8px; max-height: min(42vh, 360px); overflow-y: auto; padding: 4px; }
.config-sync-sections { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); max-height: min(26vh, 200px); }
.config-sync-section-picker { display: grid; gap: 4px; }
.config-sync-section-picker .hint { margin: 0; padding-inline: 4px; }
.config-sync-target, .config-sync-all { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; }
.config-sync-target { border: 1px solid var(--line); border-radius: 10px; }
.config-sync-target input, .config-sync-all input { width: 18px; height: 18px; flex-shrink: 0; }

/* 购物页使用独立的商店导航和商品货架。 */
.config-expand-control[hidden] { display: none; }
.shop-workspace { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: start; }
.shop-nav { display: grid; gap: 6px; padding: 12px 8px; border: 1px solid var(--surface-line); border-radius: 12px; background: #f7f9fc; }
.shop-nav-caption { padding: 2px 10px 10px; font-size: 11px; color: #8492a5; letter-spacing: .06em; }
.shop-nav-item { display: grid; gap: 6px; width: 100%; min-width: 0; padding: 12px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #54667d; text-align: left; }
.shop-nav-item > span { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.shop-nav-item small { font-size: 11px; font-weight: 400; color: #8795a7; }
.shop-nav-item:hover { background: #edf2f8; }
.shop-nav-item.active { background: #fff; border-color: #dbe6f5; color: #2563a7; box-shadow: 0 3px 9px #28456909; }
.shop-nav-item.active small { color: #537eaf; }
.shop-nav-gifts { margin-top: 6px; border-top-color: #e4eaf2; }
#configView .shop-panel { min-width: 0; border-radius: 12px; background: #fff; }
.shop-activity-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px; border-bottom: 1px solid #edf1f6; scrollbar-width: thin; overscroll-behavior-x: contain; }
.shop-activity-tab { display: grid; flex: 0 0 auto; gap: 5px; min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #65778e; }
.shop-activity-tab > span { display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; font-size: 13px; }
.shop-activity-tab small { color: #8795a7; font-size: 10px; }
.shop-activity-tab:hover, .shop-activity-tab.active { border-color: #dbe6f5; background: #eff5fc; color: #2563a7; }
.shop-activity-tab.active > span { font-weight: 600; }
.shop-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid #edf1f6; }
.shop-heading > div { min-width: 0; }
.shop-heading h3 { margin: 0 0 8px; color: #2b405b; font-size: 18px; }
.shop-heading p { margin: 0; font-size: 12px; line-height: 1.7; color: #7b899d; }
.shop-selection-total { flex-shrink: 0; padding: 5px 10px; border-radius: 6px; background: #eff5fc; color: #4677ad; font-size: 12px; white-space: nowrap; }
#configView .shop-content { display: block; padding: 18px 22px 22px; }
.shop-products { min-width: 0; }
.shop-tools { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.shop-search { position: relative; display: flex; align-items: center; flex: 1; max-width: 340px; min-width: 0; }
.shop-search input { width: 100%; min-width: 0; min-height: 38px; padding-left: 36px; border-radius: 8px; font-size: 13px; background: #f9fbfd; }
.shop-selected-filter { flex-shrink: 0; padding: 9px 12px; min-height: 38px; border: 1px solid #dfe6ef; border-radius: 8px; color: #73829a; background: #fff; font-size: 12px; }
.shop-selected-filter.active { border-color: #9dbde4; background: #f0f6ff; color: #2865ab; }
.shop-selected-filter:hover { border-color: #a8bfdc; background: #f0f6ff; color: #2865ab; }
.shop-categories { display: flex; flex-wrap: wrap; gap: 6px; padding: 16px 0 4px; }
.shop-category { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; min-height: 34px; border: 0; border-radius: 7px; color: #6d7d93; background: #f4f6f9; font-size: 12px; }
.shop-category > span { font-size: 10px; opacity: .7; }
.shop-category.active { color: #2865ab; background: #eaf2fd; font-weight: 600; }
.shop-category:hover { color: #2865ab; background: #eaf2fd; }
.shop-product-groups { display: grid; gap: 16px; padding-top: 14px; }
.shop-group-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.shop-group-heading h4 { display: flex; align-items: center; gap: 8px; margin: 0; color: #546980; font-size: 13px; font-weight: 600; }
.shop-group-heading h4::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: #a8bfdc; }
.shop-group-heading > span { font-size: 11px; color: #8a99ad; }
.shop-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.shop-product-card { position: relative; min-width: 0; }
.shop-product { position: relative; display: grid; grid-template-rows: 1fr auto; gap: 7px; align-content: start; width: 100%; height: 100%; min-width: 0; padding: 10px; border: 1px solid #e4eaf2; border-radius: 8px; text-align: left; color: #3a4e68; background: #fff; transition: border-color 120ms ease, background 120ms ease; }
.shop-product:hover { border-color: #a4bfdc; background: #fbfdff; }
.shop-product.selected { border-color: #98b8df; background: #f6faff; }
.shop-product-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; min-width: 0; padding-right: 20px; }
.shop-product-title strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.shop-product-quantity { font-size: 11px; color: #91a0b1; }
.shop-product-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; padding-right: 20px; color: #476d9b; font-size: 15px; font-weight: 650; }
.shop-product-price small { color: #8a98aa; font-size: 11px; font-weight: 400; }
.shop-product-price.free { color: #37927b; font-size: 14px; }
.shop-product-check { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border: 1px solid #cdd8e6; border-radius: 4px; background: #fff; }
.shop-product.selected .shop-product-check { background: #4b7db7; border-color: #4b7db7; }
.shop-product.selected .shop-product-check::after { content: ""; width: 7px; height: 4px; border: solid #fff; border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg) translateY(-1px); }
.shop-product:disabled { opacity: .55; cursor: not-allowed; }
.shop-product-help > summary { position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 26px; height: 26px; list-style: none; color: #8b9bb0; cursor: pointer; border-radius: 5px; }
.shop-product-help > summary::-webkit-details-marker { display: none; }
.shop-product-help > summary > span { display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid #bdcbdc; border-radius: 50%; font: 600 10px/1 sans-serif; }
.shop-product-help > summary:hover, .shop-product-help[open] > summary { color: #376eaf; background: #eaf2fd; }
.shop-product-hint { position: absolute; z-index: 20; left: 0; right: 0; bottom: calc(100% + 5px); display: grid; gap: 5px; padding: 10px; border: 1px solid #dce6f2; border-radius: 8px; color: #6d8199; background: #fff; box-shadow: 0 5px 18px #29466d24; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.shop-product-hint strong { font-size: 12px; color: #3a4e68; font-weight: 600; }
.shop-product-help > summary:focus-visible { outline: 2px solid #6797d3; outline-offset: 1px; }
.shop-workspace button:focus-visible { outline: 2px solid #6797d3; outline-offset: 2px; }
.shop-empty { padding: 35px 10px; text-align: center; font-size: 13px; color: #8a99ab; line-height: 1.7; }
.shop-product-card[hidden], .shop-product[hidden], .shop-product-group[hidden], .shop-empty[hidden] { display: none; }

.alliance-view { min-width: 0; }
.alliance-tool { padding: 22px; border: 1px solid var(--surface-line); border-radius: 14px; background: var(--surface, #fff); }
.alliance-header, .alliance-section-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.alliance-header { align-items: flex-start; margin-bottom: 20px; }
.alliance-header h3 { margin: 4px 0 8px; font-size: 22px; color: #2c425e; overflow-wrap: anywhere; }
.alliance-header .eyebrow { margin: 0; font-size: 11px; color: #8a9bb0; }
.alliance-header .hint { margin: 0; }
.alliance-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.alliance-tool button, .alliance-review-card button { min-height: 34px; font-size: 12px; }
.alliance-list-search, .alliance-picker-toolbar { display: flex; gap: 8px; margin: 12px 0; }
.alliance-list-search input, .alliance-picker-toolbar input, .alliance-review-actions input { flex: 1; min-width: 0; }
.alliance-tool input, .alliance-tool select, .alliance-tool textarea, .alliance-review-actions input { font-size: 13px; border-radius: 8px; }
.alliance-picker-toolbar select { width: auto; max-width: 92px; }
.alliance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 16px 0; }
.alliance-card { display: grid; gap: 7px; padding: 17px; border: 1px solid #e2e9f2; border-radius: 11px; text-align: left; background: linear-gradient(135deg, #fff, #f8fafd); color: #425772; transition: border-color .15s; }
.alliance-card:hover { border-color: #94b3d9; }
.alliance-card > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alliance-card strong { font-size: 16px; overflow-wrap: anywhere; }
.alliance-card p { margin: 1px 0 7px; font-size: 12px; color: #70829a; }
.alliance-card small { color: #8997a9; font-size: 11px; }
.alliance-card b { font-size: 20px; font-weight: 600; color: #436c9c; }
.alliance-card-arrow { font-size: 23px; color: #9caec2; }
.alliance-badge { display: inline-flex; align-items: center; width: max-content; padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 500; white-space: nowrap; background: #eef3f8; color: #617b9a; }
.alliance-badge.pending { background: #fff5df; color: #a57b2c; }
.alliance-badge.approved { background: #edf6f1; color: #49856a; }
.alliance-badge.rejected { background: #f9eff0; color: #a96670; }
.alliance-overview { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; padding: 17px 18px; margin-bottom: 16px; background: #f7f9fc; border-radius: 10px; }
.alliance-overview > div { display: grid; gap: 6px; }
.alliance-overview small { color: #8595a8; font-size: 11px; }
.alliance-overview strong { color: #3c5f8a; font-size: 20px; }
.alliance-unions { display: grid; gap: 8px; }
.alliance-union { display: grid; grid-template-columns: minmax(120px, 1.5fr) minmax(70px, 1fr) minmax(80px, 1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 12px; border: 1px solid #e8edf4; border-radius: 9px; font-size: 13px; color: #445c79; }
.alliance-union-name, .alliance-union-master, .alliance-union-power { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.alliance-union-name strong { font-weight: 600; }
.alliance-union-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 4px 6px; color: var(--primary); background: #f0f6ff; text-align: left; overflow-wrap: anywhere; }
.alliance-union-link strong { min-width: 0; }
.alliance-union-link span { flex-shrink: 0; }
.alliance-union-link:hover { background: #e3efff; }
.alliance-union small { color: #8a99ac; font-size: 11px; }
.alliance-union-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alliance-submit-panel { display: grid; gap: 10px; padding: 18px; margin: 16px 0; border: 1px solid #dbe6f4; border-radius: 11px; background: #fbfcff; }
.alliance-section-title h4 { margin: 0; font-size: 15px; color: #39577c; }
.alliance-submit-panel > label { display: grid; gap: 8px; font-size: 12px; color: #71839b; }
.alliance-submit-panel .hint { margin: 0; font-size: 11px; }
.alliance-submit-panel > button { justify-self: end; }
.alliance-picker-results { display: grid; gap: 7px; max-height: 360px; overflow: auto; overscroll-behavior: contain; }
.alliance-selected { display: flex; flex-wrap: wrap; gap: 6px; }
.alliance-selected button { padding: 5px 8px; min-height: 29px; background: #eef4fc; color: #4d719d; border: 1px solid #dce7f5; }
.alliance-selected span { margin-left: 6px; }
.alliance-submit-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alliance-submit-footer button { flex-shrink: 0; }
.alliance-pagination { display: flex; align-items: center; gap: 7px; margin-top: 18px; }
.alliance-pagination span { flex: 1; color: #8b99ac; font-size: 12px; }
.alliance-history { margin-top: 20px; border-top: 1px solid #edf0f5; padding-top: 14px; font-size: 12px; color: #71839b; }
.alliance-history > summary { cursor: pointer; padding: 5px 0; }
.alliance-history article { padding: 12px 0; border-bottom: 1px solid #edf0f5; }
.alliance-history article p { margin: 7px 0; overflow-wrap: anywhere; }
.alliance-error { padding: 10px 12px; border-radius: 8px; background: #fff2f1; color: #a55d59; font-size: 12px; }
.alliance-review-card { padding: 16px; margin-top: 12px; border: 1px solid #e2e9f3; border-radius: 11px; }
.alliance-review-card .alliance-section-title > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.alliance-review-card .alliance-section-title span { font-size: 12px; color: #7c8da3; }
.alliance-review-unions { display: grid; gap: 6px; max-height: 370px; overflow: auto; }
.alliance-review-unions .alliance-union { grid-template-columns: minmax(120px, 1.5fr) minmax(70px, 1fr) minmax(80px, 1fr); }
.alliance-review-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
@media (max-width: 760px) {
    .alliance-tool { padding: 15px; }
    .alliance-header { flex-direction: column; gap: 12px; }
    .alliance-header-actions { justify-content: flex-start; }
    .alliance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .alliance-card { padding: 12px; }
    .alliance-card strong { font-size: 14px; }
    .alliance-card b { font-size: 16px; }
    .alliance-union, .alliance-review-unions .alliance-union { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .alliance-union-name { grid-column: 1 / -1; }
    .alliance-union-actions, .alliance-picker-results .alliance-union > button { grid-column: 1 / -1; justify-self: start; }
    .alliance-submit-panel { padding: 12px; }
    .alliance-submit-footer { flex-direction: column; align-items: flex-start; }
    .alliance-submit-footer button { align-self: flex-end; }
    .alliance-review-actions { flex-wrap: wrap; }
    .alliance-review-actions input { flex-basis: 100%; }
}
@media (max-width: 760px) {
    .shop-workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .shop-activity-tabs { padding: 8px 10px; gap: 4px; }
    .shop-activity-tab { padding: 8px 10px; }
    .shop-nav { display: flex; overflow-x: auto; gap: 6px; padding: 6px; scrollbar-width: thin; }
    .shop-nav-caption { display: none; }
    .shop-nav-item { flex: 0 0 auto; width: auto; gap: 5px; padding: 10px 12px; text-align: center; }
    .shop-nav-item > span { white-space: nowrap; }
    .shop-nav-item small { font-size: 10px; }
    .shop-nav-gifts { margin-top: 0; margin-left: 4px; border-top-color: transparent; border-left-color: #e4eaf2; }
    .shop-heading { padding: 16px; gap: 10px; }
    .shop-heading h3 { font-size: 16px; }
    #configView .shop-content { padding: 14px 16px 18px; }
    .shop-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .shop-product { padding: 9px; gap: 6px; }
    .shop-product-title strong { font-size: 12px; }
    .shop-category { padding-inline: 8px; }
}
@media (max-width: 360px) {
    .shop-heading { padding: 12px; }
    #configView .shop-content { padding: 12px; }
    .shop-product { padding: 8px; }
    .shop-selection-total { padding: 4px 7px; }
}
.config-sync-target span { min-width: 0; overflow-wrap: anywhere; }
.config-sync-target small { display: block; opacity: .65; margin-top: 3px; }
/* 多时段复用现有紧凑时间框与弹出滑条。 */
.config-time-ranges { display: grid; gap: 8px; min-width: 0; width: 100%; }
#configView .config-field > .config-time-ranges { grid-column: 1 / -1; }
.config-time-range { display: grid; grid-template-columns: auto minmax(0, 160px) auto minmax(0, 160px) auto; align-items: center; gap: 8px; }
.config-time-range-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.config-time-range > .config-time-picker { width: 100%; }
.config-time-range > .ghost { justify-self: end; white-space: nowrap; }
.config-time-ranges > .ghost { justify-self: start; }
@media (max-width: 760px) {
    .config-time-range { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
    .config-time-range-label { grid-column: 1 / 3; }
    .config-time-range > .config-time-picker { grid-row: 2; }
    .config-time-range > .config-time-picker:nth-child(2) { grid-column: 1; }
    .config-time-range > span:not(.config-time-range-label) { grid-row: 2; grid-column: 2; color: var(--muted); }
    .config-time-range > .config-time-picker:nth-child(4) { grid-column: 3; }
    .config-time-range > .ghost { grid-row: 1; grid-column: 3; min-height: 32px; padding: 4px 10px; font-size: 12px; }
    .homeland-schedule-header { grid-template-columns: minmax(0, 1fr) 42px; }
    .homeland-schedule-time { grid-column: 1 / -1; grid-row: 2; }
    .homeland-schedule-time > .config-time-picker { width: 100%; max-width: none; }
    #configView .config-field > .time-list { grid-column: 1 / -1; width: 100%; }
    .time-list .inline-add > .config-time-picker { flex: 0 1 132px; }
    #configView .config-time-picker > input[type="time"] { min-width: 0; padding-inline: 4px; }
    #configView .config-time-picker > input[type="time"]::-webkit-date-and-time-value { min-width: 0; text-align: center; }
    #configView .config-time-picker > input[type="time"]::-webkit-datetime-edit { min-width: 0; padding: 0; }
    #configView .config-time-slider { grid-template-columns: 16px minmax(0, 1fr); gap: 6px; }
    #configView .config-time-slider input[type="range"] { height: 36px; min-height: 36px; touch-action: pan-y; }
    #configView .config-time-slider input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6.5px; }
    #configView .config-time-slider input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; }
}

.personal-ranking-heading, .personal-profile-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.personal-ranking-heading > span, .personal-ranking-actions > span { font-size: 12px; color: var(--text-secondary, #64748b); }
.personal-ranking-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.personal-ranking-search input { flex: 1 1 180px; min-width: 0; }
.personal-ranking-search select { flex: 0 1 110px; min-width: 0; }
.personal-ranking-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.personal-ranking-board { border: 1px solid #94a3b82b; border-radius: 16px; overflow: hidden; background: #ffffff24; }
.personal-ranking-columns, .personal-ranking-row { display: grid; grid-template-columns: 42px minmax(130px, 1.2fr) minmax(110px, .8fr) minmax(175px, 1fr) 14px; align-items: center; gap: 12px; }
.personal-ranking-columns { padding: 12px 16px; background: #94a3b80b; color: var(--text-secondary, #64748b); font-size: 12px; }
.personal-ranking-list { list-style: none; padding: 0; margin: 0; }
.personal-ranking-list > li + li { border-top: 1px solid #94a3b824; }
.personal-ranking-row { width: 100%; padding: 15px 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; text-align: left; line-height: 1.5; cursor: pointer; }
.personal-ranking-row:hover { background: #7283d908; }
.personal-ranking-row:focus-visible { outline: 2px solid var(--accent, #6979e8); outline-offset: -3px; }
.personal-ranking-place { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 10px; color: #7a869d; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.personal-ranking-place.is-top-1 { background: #f5b83b20; color: #ac7511; }
.personal-ranking-place.is-top-2 { background: #8999b71c; color: #667792; }
.personal-ranking-place.is-top-3 { background: #c28a6320; color: #a46e48; }
.personal-ranking-identity, .personal-ranking-value, .personal-ranking-reference { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.personal-ranking-identity > strong { font-size: 15px; }
.personal-ranking-row small { font-weight: 400; font-size: 11px; color: var(--text-secondary, #64748b); }
.personal-ranking-identity .personal-ranking-union { color: var(--text-secondary, #64748b); }
.personal-ranking-value { font-variant-numeric: tabular-nums; }
.personal-ranking-value > strong { font-size: 17px; color: var(--accent, #6979e8); }
.personal-ranking-value > small:first-child { display: none; }
.personal-ranking-reference { font-size: 12px; }
.personal-ranking-arrow { color: #94a3b8; font-size: 24px; font-weight: 400; }
.personal-ranking-empty { padding: 24px 16px; text-align: center; color: var(--text-secondary, #64748b); }
.union-ranking-detail-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-block: 12px; }
.union-ranking-detail-heading > p { flex: 1 1 200px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) {
    .personal-ranking-columns { display: none; }
    .personal-ranking-row { grid-template-columns: 30px minmax(0, 1fr) minmax(88px, .65fr) 10px; gap: 6px 10px; padding: 12px; }
    .personal-ranking-place { grid-row: 1 / 3; }
    .personal-ranking-identity { grid-column: 2; grid-row: 1; }
    .personal-ranking-value { grid-column: 3; grid-row: 1; align-items: flex-end; text-align: right; }
    .personal-ranking-value > small:first-child { display: block; }
    .personal-ranking-reference { grid-column: 2 / 4; grid-row: 2; flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 3px 12px; }
    .personal-ranking-arrow { grid-column: 4; grid-row: 1 / 3; }
}
.personal-region { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.personal-region select { min-width: 0; max-width: 100%; flex: 1; }
.personal-profile-dialog { box-sizing: border-box; width: min(760px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: 90vh; max-height: 90dvh; padding: 0; border: 1px solid rgba(140, 153, 187, .25); border-radius: 20px; background: var(--surface, #fff); color: var(--text, #253049); box-shadow: 0 20px 80px #18264640; overflow: auto; overscroll-behavior: contain; }
.personal-profile-dialog::backdrop { background: #101b3e66; backdrop-filter: blur(4px); }
.personal-profile-header { position: sticky; top: 0; z-index: 1; background: inherit; padding: 14px 20px; border-bottom: 1px solid #94a3b830; }
.personal-profile-header h3 { margin: 0; overflow-wrap: anywhere; }
.personal-profile-header button { flex-shrink: 0; }
.personal-profile-body { padding: 8px 20px 20px; }
.personal-compare { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.personal-compare select { flex: 1 1 180px; min-width: 0; max-width: 100%; }
.personal-radar { display: block; width: min(100%, 430px); height: auto; margin: 0 auto; overflow: visible; }
.personal-radar-grid polygon, .personal-radar-grid line { fill: none; stroke: #94a3b84d; }
.personal-radar-grid text { stroke: none; fill: currentColor; font-size: 13px; }
.personal-radar-shape { stroke: currentColor; stroke-width: 2; fill: currentColor; fill-opacity: .09; pointer-events: none; }
.personal-radar circle { fill: currentColor; }
.personal-radar-wrap { position: relative; max-width: 430px; margin: auto; }
.personal-radar-point { cursor: pointer; outline: none; }
.personal-radar-point .personal-radar-hit { fill: transparent; pointer-events: all; }
.personal-radar-point:focus circle:last-child, .personal-radar-point:hover circle:last-child { stroke: currentColor; stroke-width: 4; }
.personal-radar-tooltip { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); box-sizing: border-box; width: min(280px, calc(100% - 16px)); padding: 10px 12px; border: 1px solid #94a3b860; border-radius: 12px; background: var(--surface, #fff); box-shadow: 0 5px 22px #18264630; font-size: 12px; pointer-events: none; overflow-wrap: anywhere; }
.personal-radar-tooltip > span { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.personal-radar-tooltip b { flex-shrink: 0; }
.personal-metric-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.personal-metric-table :is(th, td) { border-bottom: 1px solid #94a3b830; padding: 10px 6px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.personal-profile-body .dao-attributes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.personal-profile-body .dao-attributes > div { min-width: 0; overflow-wrap: anywhere; }
.personal-radar-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; font-size: 12px; }
.personal-radar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.personal-radar-legend i { width: 9px; height: 9px; border-radius: 50%; }
.personal-member-link { padding: 2px 0; background: transparent; color: var(--accent, #6979e8); border: 0; text-align: left; box-shadow: none; }
.personal-member-damage { display: block; color: var(--text-secondary, #64748b); font-size: 11px; white-space: normal; }
.ui-loading { min-width: 0; padding: 22px 20px; margin: 12px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--muted); font-size: 12px; overflow: hidden; }
.ui-loading-heading { display: flex; align-items: center; gap: 13px; min-width: 0; }
.ui-loading-copy { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.ui-loading-copy strong { font-size: 14px; font-weight: 600; color: var(--text); }
.ui-loading-copy small { font-size: 12px; opacity: .8; }
.ui-loading-orbit { position: relative; flex: 0 0 32px; width: 32px; height: 32px; border: 3px solid var(--line); border-radius: 50%; box-sizing: border-box; }
.ui-loading-orbit::after { content: ""; position: absolute; inset: -3px; border: 3px solid transparent; border-top-color: var(--primary); border-right-color: var(--primary); border-radius: 50%; animation: ui-loading-spin .9s linear infinite; }
.ui-loading-track { height: 3px; margin-top: 18px; border-radius: 3px; background: var(--line); overflow: hidden; }
.ui-loading-track i { display: block; height: 100%; width: 38%; border-radius: inherit; background: var(--primary); animation: ui-loading-travel 1.5s cubic-bezier(.45,0,.2,1) infinite; }
.ui-loading-lines { display: grid; gap: 12px; margin-top: 18px; }
.ui-loading-lines i { display: block; position: relative; overflow: hidden; height: 30px; border-radius: 8px; background: var(--line); opacity: .6; }
.ui-loading-lines i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 15%, #ffffffa6 50%, transparent 85%); animation: ui-loading-shimmer 1.8s ease-in-out infinite; }
.ui-loading-lines i:nth-child(2) { width: 88%; }
.ui-loading-lines i:nth-child(3) { width: 72%; }
.ui-loading-chart { height: 180px; display: flex; align-items: flex-end; gap: 8%; padding: 0 8%; border-bottom: 1px solid var(--line); }
.ui-loading-chart i { flex: 1; width: auto !important; height: 48%; border-radius: 7px 7px 0 0; }
.ui-loading-chart i:nth-child(2) { height: 72%; }
.ui-loading-chart i:nth-child(3) { height: 60%; }
.ui-loading-chart i:nth-child(4) { height: 88%; }
.ui-loading-chart i:nth-child(5) { height: 78%; }
.ui-loading-compact { padding: 10px 12px; margin: 8px 0; border-radius: 10px; }
.ui-loading-compact .ui-loading-orbit { width: 20px; height: 20px; flex-basis: 20px; border-width: 2px; }
.ui-loading-compact .ui-loading-orbit::after { inset: -2px; border-width: 2px; }
.ui-loading-compact .ui-loading-copy strong { font-size: 12px; }
.personal-ranking-board > .ui-loading { margin: 12px; }
.personal-ranking-board[aria-busy="true"] { min-height: 220px; }
#roleList > .ui-loading { grid-column: 1 / -1; min-height: 160px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.personal-profile-progress { padding: 0 20px; }
.personal-profile-progress[hidden] { display: none; }
@keyframes ui-loading-spin { to { transform: rotate(360deg); } }
@keyframes ui-loading-travel { 0% { transform: translateX(-110%); } 100% { transform: translateX(370%); } }
@keyframes ui-loading-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
    .ui-loading-orbit::after, .ui-loading-track i, .ui-loading-lines i::after { animation: none; }
    .ui-loading-lines i::after { display: none; }
}
@media (max-width: 480px) {
    .personal-ranking-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
    .personal-profile-body .dao-attributes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .personal-profile-body .dao-attributes > div { flex-direction: column; align-items: flex-start; gap: 4px; }
    .personal-metric-table, .personal-metric-table tbody { display: block; }
    .personal-metric-table thead { display: none; }
    .personal-metric-table tr { display: block; padding: 10px; margin: 8px 0; border: 1px solid #94a3b830; border-radius: 10px; }
    .personal-metric-table :is(th, td) { display: block; padding: 4px 0; border: 0; }
    .personal-metric-table td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
    .personal-metric-table td::before { content: attr(data-label); color: var(--text-secondary, #64748b); }
    .personal-profile-body { padding: 8px 12px 16px; }
    .personal-profile-header { padding: 12px; }
    .personal-ranking-tabs { gap: 5px; }
    .personal-ranking-tabs button { flex: 1 1 40%; padding: 8px; }
    .personal-ranking-search { gap: 6px; }
}

.config-section-category { margin-left: auto; padding: 3px 8px; border-radius: 6px; background: var(--panel-soft); color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; }

/* 妖盟评级和合区规划 */
.union-grade { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.union-grade-4 { color: #a82c42; background: #fce5e9; }
.union-grade-3 { color: #806004; background: #fbf1c9; }
.union-grade-2 { color: #7340a4; background: #f0e5fb; }
.union-grade-1 { color: #245fa1; background: #e2effd; }
.union-grade-0 { color: #23714a; background: #e1f3e7; }
.union-grade-unknown { color: #626c7a; background: #eef0f4; }
.union-grade-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.union-merge-view { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.union-merge-view > .union-power-panel { padding: 18px; }
.union-merge-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.union-merge-heading h3 { margin: 0 0 8px; }
.union-merge-heading h3 small { font-size: 12px; color: var(--text-muted, #737f91); font-weight: 400; }
.union-merge-heading p { margin: 0; }
.union-merge-selection { margin-top: 16px; }
.union-merge-selection summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.union-merge-selection > input { margin: 10px 0; width: 100%; }
.union-merge-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 290px; overflow: auto; margin-bottom: 12px; }
.union-merge-choices label { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #dce3ec; border-radius: 12px; cursor: pointer; }
.union-merge-choices label > span { min-width: 0; overflow-wrap: anywhere; }
.union-merge-choices label.selected { border-color: #7f9fe3; background: #edf3ff80; }
.union-merge-choices label[hidden] { display: none; }
.union-merge-choices small, .union-merge-table td small { display: block; font-size: 11px; margin-top: 5px; color: var(--text-muted, #737f91); white-space: normal; }
.union-merge-choices input[type=checkbox], .union-merge-table input[type=checkbox] { width: 16px; height: 16px; min-height: 0; flex-shrink: 0; }
.union-merge-setting-group + .union-merge-setting-group { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.union-merge-setting-group h4 { margin: 0 0 12px; font-size: 14px; }
.union-merge-setting-group > .hint { margin: 8px 0 0; line-height: 1.65; }
.union-merge-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.union-merge-growth-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.union-merge-fields label { display: flex; flex-direction: column; align-items: stretch; min-width: 0; gap: 7px; font-size: 12px; }
.union-merge-fields input, .union-merge-fields select { width: 100%; min-width: 0; box-sizing: border-box; min-height: 40px; }
.union-merge-fields select { text-overflow: ellipsis; }
.union-merge-capacities { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.union-merge-capacities label { display: flex; flex-direction: column; align-items: stretch; min-width: 0; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 12px; }
.union-merge-capacities input { width: 100%; min-width: 0; box-sizing: border-box; padding: 7px 8px; min-height: 36px; }
.union-merge-rules { margin: 16px 0; font-size: 12px; }
.union-merge-rules summary { cursor: pointer; color: var(--text-muted, #737f91); padding: 5px 0; }
.union-merge-rules .hint { line-height: 1.7; }
.union-merge-heading .union-merge-occupancy { margin: 4px 0 8px; font-size: 13px; font-weight: 500; }
.union-merge-actions, .union-merge-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.union-merge-toolbar { margin-bottom: 14px; }
.union-merge-toolbar label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.union-merge-toolbar > input { min-width: 140px; flex: 1; }
.union-merge-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.union-merge-slots > div { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.union-merge-slots span, .union-merge-slots small { font-size: 11px; }
.union-merge-table { min-width: 1260px; }
.union-merge-table td { vertical-align: top; }
.union-merge-table td:nth-child(2) { min-width: 130px; }
.union-merge-table input[type=text] { width: 110px; min-height: 34px; padding: 6px 8px; }
.union-merge-table select { min-width: 50px; min-height: 34px; padding: 6px; }
.union-merge-table td:nth-last-child(1) { min-width: 200px; white-space: normal; }
.union-merge-table td small.union-merge-ok { color: #23714a; }
.union-merge-table td small.union-merge-blocked { color: #ae4250; }
@media (max-width: 650px) {
    .union-merge-view > .union-power-panel { padding: 14px; }
    .union-merge-fields { grid-template-columns: 1fr; }
    .union-merge-choices { grid-template-columns: 1fr; }
    .union-merge-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .union-merge-slots > div:last-child { grid-column: 1 / -1; }
    .union-merge-actions button { flex: 1; }
    .union-merge-capacities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .union-merge-toolbar > input { flex-basis: 100%; }
}
.union-merge-grade-plan { margin: 20px 0; }
.union-merge-lines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.union-merge-lines > div { display: grid; gap: 6px; padding: 12px; border-radius: 10px; overflow-wrap: anywhere; }
.union-merge-lines span { font-size: 17px; font-weight: 600; }
.union-merge-lines small { font-size: 12px; }
.union-merge-tier { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.union-merge-tier summary { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; cursor: pointer; padding: 12px; background: var(--panel-soft); }
.union-merge-tier summary > span:last-child { font-size: 12px; color: var(--muted); }
.union-merge-tier-members { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 9px; padding: 12px; }
.union-merge-tier-member { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; overflow-wrap: anywhere; }
.union-merge-tier-member small { color: var(--muted); font-size: 11px; }
.union-merge-tier-member > span { font-size: 12px; }
.union-merge-members > summary { cursor: pointer; font-weight: 600; }
.union-merge-members[open] > summary { margin-bottom: 16px; }
.union-merge-controls > summary { cursor: pointer; font-weight: 600; }
.union-merge-controls[open] > summary { margin-bottom: 18px; }
.union-merge-month-result > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.union-merge-month-result h3 { margin: 0; font-size: 16px; }
.union-merge-month-result > header > span { font-size: 12px; color: var(--muted); }
.union-merge-month-result > .hint { margin: 10px 0 14px; line-height: 1.7; }
.union-merge-month-scroll { max-height: 600px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.union-merge-month-table { min-width: 860px; width: 100%; border-collapse: separate; border-spacing: 0; }
.union-merge-month-table :is(th, td) { padding: 12px 14px; text-align: left; white-space: nowrap; }
.union-merge-month-table thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-soft); }
.union-merge-month-table :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.union-merge-month-table thead th:first-child { z-index: 3; background: var(--panel-soft); }
.union-merge-month-table :is(th, td):first-child { width: 180px; white-space: normal; overflow-wrap: anywhere; }
.union-merge-month-table th:nth-child(2) { width: 150px; }
.union-merge-month-table th:nth-child(3) { width: 180px; }
.union-merge-month-table td:nth-child(3) { white-space: normal; overflow-wrap: anywhere; }
.union-merge-month-table th:nth-child(4) { width: 240px; }
.union-merge-month-table th:nth-child(5) { width: 110px; }
.union-merge-month-table tbody tr:nth-child(even) td { background: var(--panel-soft); }
.union-merge-month-table td:nth-child(2), .union-merge-month-table td:nth-child(4) { font-variant-numeric: tabular-nums; }
.union-merge-month-table .union-grade { padding: 4px 8px; }
.union-merge-month-table td.union-merge-range-cell { white-space: normal; overflow-wrap: anywhere; }
.union-merge-range-cell small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.union-merge-range-cell small.union-merge-range-tight { color: #a65b16; }
.union-merge-target-mark { margin-left: 6px; color: #b58516; font-size: 11px; }
.union-merge-month-rules { display: grid; gap: 10px; margin-bottom: 12px; }
.union-merge-month-rules > div { display: grid; grid-template-columns: 60px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.union-merge-month-rules label { display: grid; gap: 7px; min-width: 0; font-size: 12px; }
.union-merge-month-rules input { width: 100%; min-width: 0; box-sizing: border-box; }
.union-merge-persons { margin-top: 12px; max-height: 380px; }
@media (max-width: 650px) {
    .union-merge-month-rules > div { grid-template-columns: 1fr; gap: 10px; }
    .union-merge-lines { grid-template-columns: 1fr; }
    .union-merge-tier-members { grid-template-columns: 1fr; }
}

.union-merge-months { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.union-merge-months strong { font-size: 13px; font-weight: 500; color: var(--text-muted, #657386); }

.union-merge-selected { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.union-merge-selected > span { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); font-size: 12px; overflow-wrap: anywhere; }
#toolsView .union-merge-selected button { flex-shrink: 0; width: 26px; min-height: 26px; padding: 0; font-size: 17px; }

.union-merge-cooperation { min-width: 180px; white-space: normal; }
.union-merge-cooperation > div { padding: 7px 9px; border-radius: 7px; background: var(--panel-soft); }
.union-merge-cooperation > div + div { margin-top: 7px; }
.union-merge-cooperation strong, .union-merge-cooperation span { display: block; font-size: 11px; line-height: 1.6; }

.union-merge-table select.union-merge-leave-select { min-width: 116px; }

.union-merge-strength { display: grid; gap: 7px; margin-top: 14px; padding: 12px 14px; border: 1px solid #dbe8f8; border-radius: 9px; background: #f5f9ff; font-size: 13px; overflow-wrap: anywhere; }
.union-merge-strength small { color: var(--muted); }
.union-merge-roster-title { margin: 12px 0 8px; font-size: 14px; }
.union-merge-table td small.union-merge-source { display: inline-block; max-width: 220px; padding: 4px 7px; border-radius: 6px; }
.union-merge-source-0 { color: #245fa1 !important; background: #e2effd; }
.union-merge-source-1 { color: #7340a4 !important; background: #f0e5fb; }
.server-merge-info { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin: 5px 0; color: var(--muted, #728099); font-size: 12px; font-weight: 400; text-align: left; }
.server-merge-info small { white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.server-merge-badge { display: inline-block; flex-shrink: 0; padding: 2px 7px; border: 1px solid rgba(128, 144, 166, .24); border-radius: 6px; background: rgba(128, 144, 166, .07); color: inherit; }
.mountain-query-grid .mountain-server-btn { min-width: 0; height: auto; align-items: flex-start; text-align: left; padding: 12px; }
.mountain-server-btn .server-merge-info { display: flex; flex-direction: column; align-items: flex-start; }
.personal-ranking-identity .server-merge-info { margin-bottom: 0; }
@media (max-width: 600px) {
    .mountain-query-grid:has(.mountain-server-btn) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .personal-ranking-identity .server-merge-info { align-items: flex-start; flex-direction: column; gap: 3px; }
}

/* Account workspaces: shared, restrained glass surfaces and readable ledgers. */
:is(#profileView, #agentView, #adminView) { --workspace-surface: rgba(255, 255, 255, .8); }
:is(#profileContent, #agentContent) { min-width: 0; gap: 20px; }
:is(#profileView, #agentView, #adminView) :is(.profile-panel, .admin-card) {
    border-radius: 16px; border: 1px solid var(--line); background: var(--workspace-surface);
    box-shadow: 0 4px 18px rgba(48, 77, 109, .035);
}
:is(#profileView, #agentView) .page-heading { margin-bottom: 20px; }
#profileView .profile-community { width: min(320px, 100%); margin-bottom: 20px; }
#profileView .community-card-heading { padding: 10px 14px; }
.workspace-tabs {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line);
    background: var(--workspace-surface); border-radius: 14px; width: fit-content; max-width: 100%;
}
.workspace-tabs button { min-height: 38px; padding: 9px 17px; border-radius: 9px; font-size: 13px; }
.workspace-tabs button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.workspace-tabs button.ghost:hover { color: var(--primary); background: var(--panel-soft); }
.workspace-tabs button.active { box-shadow: 0 3px 8px rgba(29, 116, 245, .13); }
.workspace-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.workspace-metric {
    display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-width: 0; padding: 22px;
    border: 1px solid var(--line); border-radius: 15px; background: var(--workspace-surface);
}
.workspace-metric > span { font-size: 13px; color: var(--muted); }
.workspace-metric > strong { font-size: clamp(21px, 2.2vw, 29px); letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.workspace-metric > small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.workspace-quick-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.workspace-quick-actions h3 { margin: 0; font-size: 16px; }
.workspace-quick-actions p { margin-bottom: 0; }
.workspace-actions, .workspace-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.workspace-actions { flex-shrink: 0; }
.workspace-toolbar { margin: 16px 0; }
.workspace-toolbar:empty { display: none; }
.workspace-search { display: grid; gap: 7px; flex: 1 1 260px; min-width: 0; margin-bottom: 14px; }
.workspace-search > span, .workspace-filter { font-size: 12px; color: var(--muted); }
.workspace-search input { width: 100%; min-height: 40px; }
.workspace-toolbar .workspace-search { margin: 0; }
.workspace-filter { display: grid; gap: 7px; flex: 0 1 160px; }
.workspace-filter select { min-height: 40px; max-width: 100%; }
.workspace-caption { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.workspace-status { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; line-height: 1.5; color: var(--muted); background: var(--panel-soft); }
.workspace-status.is-success { color: #1d7753; background: #edf8f1; }
.workspace-status.is-danger { color: #b13f4e; background: #fff0f1; }
.workspace-role-tags { display: flex; flex-wrap: wrap; align-items: start; gap: 7px; min-width: 0; }
.workspace-role-tag { display: inline-flex; flex-direction: column; gap: 3px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.workspace-role-tag strong { color: var(--text); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.workspace-role-tag small, .workspace-user-name small { font-size: 11px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.workspace-user-name { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.workspace-user-name > strong { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.workspace-money { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.workspace-money small { display: block; font-size: 10px; font-weight: normal; line-height: 1.6; }
.workspace-date { font-size: 12px; color: var(--muted); line-height: 1.7; }
.workspace-empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.workspace-records > summary { font-weight: 600; color: var(--text); cursor: pointer; font-size: 14px; padding: 3px 0; }
.workspace-records[open] > summary { margin-bottom: 14px; }
.workspace-user-detail { border-bottom: 1px solid var(--line); }
.workspace-user-detail:last-child { border-bottom: 0; }
.workspace-user-detail > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px 4px; cursor: pointer; list-style: none; }
.workspace-user-detail > summary::-webkit-details-marker { display: none; }
.workspace-user-detail > summary::after { content: '⌄'; color: var(--muted); font-size: 16px; margin-left: auto; }
.workspace-user-detail[open] > summary::after { transform: rotate(180deg); }
.workspace-user-detail > summary:hover { background: var(--panel-soft); border-radius: 9px; }
.workspace-user-detail > summary:focus-visible, .workspace-records > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
.workspace-invite-preview { flex: 1 1 220px; min-width: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.workspace-detail-body { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); margin-bottom: 12px; min-width: 0; }
.workspace-detail-meta { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.workspace-detail-role-status { font-size: 12px; color: var(--muted); }
.workspace-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 16px; }
.workspace-pagination > span { font-size: 12px; color: var(--muted); }
.workspace-pagination > div { display: flex; gap: 8px; }
.workspace-pagination button { min-height: 34px; font-size: 12px; padding: 7px 12px; }
.workspace-ledger-heading, .workspace-ledger-grid { display: grid !important; grid-template-columns: minmax(135px, 1.1fr) minmax(180px, 1.65fr) minmax(100px, .8fr) minmax(100px, .8fr) minmax(115px, .9fr); gap: 16px !important; }
.workspace-ledger-heading { color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); padding: 12px 4px; }
.workspace-ledger-grid > span { min-width: 0; }
.workspace-ledger-grid::after { display: none; }
.workspace-ledger-user[open] > summary { background: var(--panel-soft); }
.workspace-ledger-user .workspace-role-tag { padding: 5px 7px; }
.workspace-admin-heading, .workspace-admin-grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.8fr) minmax(100px, .7fr) minmax(150px, 1fr); align-items: start; gap: 20px; min-width: 0; }
.workspace-admin-heading { color: var(--muted); font-size: 12px; padding: 10px 18px 14px; }
.workspace-admin-user, .workspace-agent-card { border: 1px solid var(--line); border-radius: 14px; background: var(--workspace-surface); padding: 20px; margin-bottom: 14px; min-width: 0; }
.workspace-admin-grid > div { min-width: 0; }
.workspace-admin-detail { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.workspace-danger-actions { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.workspace-danger-actions button { font-size: 12px; }
.workspace-agent-card > .workspace-metrics { margin: 18px 0; }
.workspace-agent-card .workspace-metric { padding: 16px; background: var(--panel-soft); }
.workspace-agent-card .workspace-metric > strong { font-size: 20px; }
.workspace-agent-card > details + details { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.workspace-tree-user { min-width: 0; }
.workspace-tree-user .workspace-detail-meta { margin: 12px 0; }
#adminView .admin-workspace { gap: 22px; }
#adminView .admin-section-nav { border-radius: 14px; padding: 10px; }
#adminView .admin-section-nav button { border-radius: 9px; }
#adminView .admin-card { min-width: 0; }
#adminView .admin-role-item > span { line-height: 1.9; overflow-wrap: anywhere; }
#adminView .admin-role-expiry { gap: 8px; }
#adminView .admin-role-expiry input { max-width: 100%; min-width: 0; }
#adminView .admin-role-expiry button { font-size: 12px; }
#agentView .agent-network-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#agentView .workspace-responsive-table table { table-layout: fixed; white-space: normal; }
#agentView .workspace-responsive-table td { overflow-wrap: anywhere; line-height: 1.7; }
:is(#profileView, #agentView) .profile-history-row { gap: 16px; }
:is(#profileView, #agentView) .profile-history-row > div { min-width: 0; overflow-wrap: anywhere; }
:is(#profileView, #agentView) .profile-history-row > strong { flex-shrink: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 1200px) {
    .workspace-ledger-heading, .workspace-ledger-grid { grid-template-columns: minmax(110px, 1fr) minmax(145px, 1.5fr) minmax(80px, .8fr) minmax(80px, .8fr) minmax(95px, .9fr); gap: 10px !important; }
    .workspace-admin-heading, .workspace-admin-grid { grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.4fr) minmax(85px, .7fr) minmax(130px, 1fr); gap: 12px; }
    .workspace-metric { padding: 18px; }
}
@media (max-width: 900px) {
    .workspace-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-ledger-heading, .workspace-admin-heading { display: none !important; }
    .workspace-ledger-grid, .workspace-admin-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px !important; }
    .workspace-ledger-grid > :first-child, .workspace-ledger-grid > [data-label="角色区服"], .workspace-admin-grid > :first-child, .workspace-admin-grid > [data-label="角色区服"] { grid-column: 1 / -1; }
    :is(.workspace-ledger-grid, .workspace-admin-grid) [data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: normal; color: var(--muted); margin-bottom: 6px; }
    .workspace-ledger-user { padding: 6px 0; }
    .workspace-quick-actions { align-items: flex-start; flex-wrap: wrap; }
    #agentView .agent-network-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-responsive-table :is(table, tbody, tr, td) { display: block; width: 100%; }
    .workspace-responsive-table thead { display: none; }
    .workspace-responsive-table tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
    .workspace-responsive-table td { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; border: 0; padding: 6px 0; }
    .workspace-responsive-table td::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
}
@media (max-width: 480px) {
    :is(#profileContent, #agentContent) { gap: 14px; }
    .workspace-tabs { width: 100%; gap: 4px; }
    .workspace-tabs button { flex: 1 1 auto; padding: 8px 10px; font-size: 12px; min-height: 36px; }
    .workspace-metrics { gap: 10px; }
    .workspace-metric { padding: 16px 12px; gap: 8px; }
    .workspace-metric > strong { font-size: 22px; }
    .workspace-metric > span { font-size: 12px; }
    .workspace-metric > small { font-size: 11px; }
    :is(#profileView, #agentView) .profile-panel { padding: 16px; }
    .workspace-admin-user, .workspace-agent-card { padding: 14px; }
    .workspace-admin-grid { gap: 14px !important; }
    .workspace-detail-body { padding: 12px; }
    .workspace-actions { width: 100%; }
    .workspace-actions button { flex: 1; min-width: 0; }
    .workspace-toolbar { gap: 10px; }
    .workspace-filter { flex: 1 1 100%; }
    .workspace-role-tag { padding: 6px 8px; }
    :is(#profileView, #agentView) .profile-role-row { align-items: flex-start; gap: 12px; }
    .workspace-pagination { align-items: flex-start; }
    .workspace-pagination > div { margin-left: auto; }
    .workspace-danger-actions button { flex: 1 1 auto; }
    #adminView .agent-admin-controls { align-items: stretch; gap: 12px; }
    #adminView .agent-admin-controls label { flex-wrap: wrap; }
}

/* 排行、合区协作和活跃度 */
.merge-workbench-heading{display:flex;align-items:center;gap:16px;flex-wrap:wrap}.merge-workbench-heading h3{margin:0 0 6px}.merge-workbench-heading p{margin:0;color:var(--muted,#64748b)}.merge-workbench-heading>div:first-child{flex:1;min-width:180px}.merge-workbench-heading label,.merge-lines label,.merge-settings label,.merge-search,.insight-filters label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:#56647a;min-width:0}.merge-workbench-heading select{max-width:290px}.merge-save-status{width:100%;color:#64748b}.merge-actions,.merge-months,.merge-board-toolbar,.merge-capacity{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.merge-controls{display:grid;gap:16px}.merge-months{overflow:auto;flex-wrap:nowrap;padding-bottom:4px}.merge-months button{white-space:nowrap}.merge-lines{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.merge-lines input,.merge-settings input,.merge-search input,.merge-member input,.merge-member select{width:100%;min-width:0;box-sizing:border-box}.merge-board-toolbar{justify-content:space-between}.merge-capacity small{background:#edf2f9;padding:5px 9px;border-radius:7px}.merge-settings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:12px}.merge-scope{padding:14px 16px;border:1px solid #e1e7f0;border-radius:12px;margin:12px 0;background:#f9fbff}.merge-scope>div{display:flex;gap:10px 18px;flex-wrap:wrap}.merge-scope label{display:flex;align-items:center;gap:5px;font-size:13px}.merge-conflict{color:#a14432;background:#fff1eb;border-radius:7px;padding:7px 9px;font-size:12px;line-height:1.6;overflow-wrap:anywhere}.merge-search{max-width:460px;margin:16px 0}.merge-board{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;align-items:start}.merge-lane{min-width:0;padding:10px;border:1px solid #dee6ef;border-radius:14px;background:#f2f6fc}.merge-lane>header{display:flex;justify-content:space-between;align-items:center;padding:2px 4px 10px;font-size:12px;color:#64748b}.merge-lane h4{margin:0;color:#334155}.merge-lane-cards{display:flex;gap:10px;align-items:flex-start;overflow-x:auto;overscroll-behavior-x:contain;padding:2px 2px 10px;scroll-padding-inline:2px;-webkit-overflow-scrolling:touch}.merge-lane-cards>.merge-member{flex:0 0 270px;box-sizing:border-box}.merge-lane-cards>.merge-lane-empty{flex:1;margin:0}.merge-lane-navigation{display:flex;align-items:center;gap:6px}.merge-lane-navigation>span{margin-right:6px}.merge-lane-navigation button{padding:3px 10px;font-size:20px;line-height:1.2;box-shadow:none}.merge-lane-cards:focus-visible{outline:2px solid #5f8ec8;outline-offset:2px}.merge-lane-empty{font-size:12px;line-height:1.8;color:#7c899b;text-align:center;padding:20px 4px}.merge-member{padding:12px;border-radius:10px;background:#fff;border:1px solid #e2e8f0;box-shadow:0 2px 5px #20305005;min-width:0;overflow-wrap:anywhere}.merge-member.has-conflict{border-color:#e9b5a5}.merge-member-heading{display:flex;justify-content:space-between;gap:5px;align-items:start}.merge-member-heading strong{font-size:14px}.merge-member>small{display:block;color:#748298;font-size:11px;line-height:1.6;margin-top:4px}.merge-member-power{display:flex;flex-direction:column;gap:4px;font-size:12px;margin:10px 0 5px}.merge-member-range{font-size:14px;color:#365e8c;line-height:1.6;margin:12px 0 6px}.merge-member-arrangement{font-size:12px;color:#45664f;margin:0 0 12px}.merge-settings input[readonly]{background:#edf2f8;color:#56647a}.merge-settings label>small{font-size:11px;color:#748298}.merge-member>small.merge-conflict{color:#a14432}.merge-move{display:flex;align-items:center;gap:8px;font-size:12px}.merge-move select{flex:1;padding:6px}.merge-member-details{font-size:12px;margin-top:10px}.merge-member-details>div{display:grid;gap:10px;padding-top:6px}.merge-member-details label{display:grid;gap:5px}.merge-member-order{display:flex;gap:8px}.merge-member-order button{padding:5px 9px;font-size:11px}.merge-mobile-lanes{display:none}.merge-suggestion-diff{max-height:240px;overflow:auto;font-size:12px}.merge-comparison{border:1px solid #e2b862}.insight-filters{display:grid;grid-template-columns:1fr 2fr 1fr 1fr;gap:10px;margin:12px 0}.insight-filters select{width:100%;min-width:0}.insight-matrix{max-width:100%;isolation:isolate}.insight-matrix table{border-collapse:separate;border-spacing:0;min-width:100%;width:max-content}.insight-matrix th{min-width:170px;max-width:230px;white-space:normal}.insight-matrix th small{display:block;font-weight:normal;font-size:11px;color:#718096;margin-top:4px}.insight-matrix th:first-child{position:sticky;left:0;z-index:2;background:#f7f9fe;min-width:160px;max-width:180px;box-shadow:2px 0 4px #20305008}.insight-matrix thead th:first-child{z-index:3}.insight-evidence{display:flex;flex-direction:column;align-items:start;gap:6px;text-align:left;padding:10px;border-radius:10px;border:1px solid #e2e8f0;background:#f6f8fb;color:#627083;min-width:170px;width:100%;font-size:12px;box-shadow:none}.insight-evidence small{font-size:11px}.insight-evidence.is-paid{background:#eaf6f0;border-color:#c1e4d2;color:#28644d}.insight-evidence.is-unknown{background:#fff8ec;border-color:#efdfba;color:#8a6b36}.personal-ranking-tabs{flex-wrap:wrap}.union-insight-overview td small{font-size:11px;line-height:1.8}.merge-board button:focus-visible,.insight-evidence:focus-visible{outline:3px solid #5f8ec8;outline-offset:2px}
@media(max-width:1100px){.insight-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.merge-workbench-heading{gap:12px}.merge-workbench-heading>label{width:100%}.merge-workbench-heading select{max-width:100%;width:100%}.merge-workbench-heading>.merge-actions{width:100%}.merge-lines{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.merge-settings{grid-template-columns:repeat(2,minmax(0,1fr))}.merge-board{display:block}.merge-lane{display:none}.merge-lane.is-mobile-active{display:block}.merge-mobile-lanes{display:flex;gap:6px;overflow-x:auto;margin:12px 0;padding-bottom:6px;max-width:100%}.merge-mobile-lanes button{white-space:nowrap;font-size:12px;padding:8px 10px;flex-shrink:0}.merge-lane-cards>.merge-member{flex-basis:88%;max-width:300px}.merge-member{padding:12px}.merge-member-power{flex-direction:row;justify-content:space-between}.merge-capacity{font-size:12px;gap:6px}.merge-capacity small{padding:4px 6px}.insight-filters{gap:8px}.insight-matrix th:first-child{min-width:125px;max-width:145px}.insight-matrix th,.insight-evidence{min-width:155px}.merge-search{max-width:none}.union-insight-table-wrap{max-width:100%;overflow:auto}.personal-ranking-tabs button{font-size:12px}}
.merge-suggestion [data-preserve="suggestion-powers"] .union-insight-table-wrap{max-height:360px;overflow:auto;margin:12px 0}.merge-suggestion .union-insight-table td small{display:block;color:var(--muted,#64748b);font-size:11px;line-height:1.8}.merge-suggestion .union-insight-table th{position:sticky;top:0;z-index:1;background:#f3f6fb}

/* 手机端表格：减少空白，宽表在容器内滑动，成员名称保持可辨认。 */
@media (max-width: 600px) {
    #toolsView :is(.merchant-table-wrap, .union-power-table-wrap, .union-insight-table-wrap),
    .runtime-table-wrap { min-width: 0; max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
    #toolsView :is(th, td) { padding: 6px 4px; line-height: 1.45; }
    #toolsView .union-power-table { min-width: 0; font-size: 12px; }
    #toolsView .union-power-table th:first-child, #toolsView .union-power-table .union-rank { width: 32px; }
    #toolsView .union-power-table th:nth-child(3) { width: 65px; }
    #toolsView .union-power-table th:nth-child(4) { width: 34px; }
    #toolsView .union-power-table th:nth-child(5) { width: 38px; }
    #toolsView .union-power-table th:nth-child(6) { width: 52px; }
    #toolsView .union-power-table :is(.union-name, .union-power) { width: auto; }
    #toolsView .union-power-table :is(th, td):nth-child(n+3) { white-space: normal; overflow-wrap: anywhere; }
    #toolsView .union-power-table .personal-member-link { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #toolsView .union-power-table .personal-member-damage { font-size: 10px; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
    #toolsView .union-power-table .union-grade { padding: 2px 3px; font-size: 11px; }
    #toolsView .union-insight-table-wrap:not(.union-insight-overview):not(.insight-matrix) table:not([class]),
    #toolsView .merchant-table-wrap > table:not([class]),
    #toolsView .holy-land-match-scores { width: 100%; min-width: 0; }
    #toolsView :is(.merchant-table-wrap > table:not([class]), .holy-land-match-scores) :is(th, td),
    #toolsView .union-insight-table-wrap:not(.union-insight-overview):not(.insight-matrix) table:not([class]) :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
    #toolsView .union-insight-overview table { min-width: 540px; }
    #toolsView .union-insight-overview td:first-child { min-width: 95px; max-width: 110px; position: sticky; left: 0; background: var(--panel, #fff); z-index: 1; }
    #toolsView .union-insight-member-name { max-width: 105px; gap: 3px; }
    #toolsView .union-insight-member-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #toolsView .insight-matrix th:first-child { min-width: 96px; max-width: 110px; }
    #toolsView .insight-matrix th:not(:first-child), #toolsView .insight-evidence { min-width: 125px; }
    #toolsView .insight-matrix th:first-child > strong { display: block; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #toolsView .insight-evidence { padding: 7px; gap: 4px; }
    #toolsView .power-monitor-table { min-width: 480px; }
    #toolsView .merchant-result-table { min-width: 580px; }
    #toolsView .union-merge-table { min-width: 960px; }
    #toolsView .union-merge-month-table { min-width: 640px; }
    #toolsView .union-merge-month-table :is(th, td):first-child { width: 110px; max-width: 110px; }
}

/* The target roster remains independent from the shared rating board. */
.merge-roster { margin: 16px 0; min-width: 0; }
.merge-roster h4 { margin: 0; font-size: 15px; }
.merge-roster h4 span { margin-left: 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.merge-roster header p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.merge-roster-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; overscroll-behavior: contain; margin: 12px 0 0; padding: 2px; list-style: none; }
.merge-roster-list > li { display: flex; gap: 8px; align-items: center; min-width: 0; padding: 10px; border: 1px solid #dce7df; border-radius: 10px; background: #f6faf7; }
.merge-roster-position { color: #71857b; font-size: 12px; min-width: 18px; }
.merge-roster-list > li > div:first-of-type { flex: 1; min-width: 0; }
.merge-roster-list strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.merge-roster-list small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; color: #64748b; overflow-wrap: anywhere; }
.merge-roster-actions { display: flex; gap: 3px; flex-shrink: 0; }
.merge-roster-actions button { padding: 5px 7px; min-width: 28px; font-size: 12px; }
.merge-roster-toggle { width: 100%; margin: 8px 0 10px; padding: 6px 8px; font-size: 12px; }
.merge-member > small.merge-roster-badge { color: #347154; }
.merge-all-heading { margin: 20px 0 0; font-size: 15px; }
.merge-roster button:focus-visible { outline: 3px solid #5f8ec8; outline-offset: 2px; }
@media (max-width: 600px) {
    .merge-roster-list { max-height: 300px; }
    .merge-roster-list > li { flex-wrap: wrap; padding: 9px; }
    .merge-roster-list > li > div:first-of-type { flex-basis: calc(100% - 32px); }
    .merge-roster-actions { margin-left: auto; }
    .merge-roster-actions button { min-height: 34px; min-width: 34px; }
}
.page-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.page-jump input[data-page-jump] {
    width: 4.2em;
    min-width: 0;
    max-width: 4.2em;
    padding: 5px 3px;
    margin: 0;
    text-align: center;
    font: inherit;
    border-radius: 8px;
}
.page-jump > [hidden] { display: none !important; }

.quota-recharge-option { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.quota-recharge-option input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; margin: 0; }
 .quota-recharge-option[hidden] { display: none; }

.reborn-event-dialog { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; }
.reborn-event-list { display: grid; gap: 12px; }
.reborn-event-row { padding: 12px; border: 1px solid #dce5f2; border-radius: 10px; }
.reborn-event-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.reborn-event-heading label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.reborn-event-heading input { width: auto; }
.reborn-event-row .config-select-sequence { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reborn-event-row .config-select-sequence label { min-width: 0; }
.reborn-event-row .config-select-sequence select { width: 100%; min-width: 0; }
#configView .reborn-event-advanced-open { padding: 3px 8px; min-height: 26px; margin-left: 6px; font-size: 12px; }
@media (max-width: 480px) { .reborn-event-row { padding: 10px; } .reborn-event-row .config-select-sequence { gap: 5px; } .reborn-event-row .config-select-sequence label > span { font-size: 11px; } }
.payment-record-card { min-width: 0; overflow-wrap: anywhere; }
.payment-record-card > p { margin: 8px 0; white-space: pre-wrap; }
#adminPaymentsContent > form { flex-wrap: wrap; margin: 14px 0; }
#adminPaymentsContent > form input { flex: 1 1 220px; min-width: 0; }
#adminPaymentsContent > form select { max-width: 100%; }
#adminPaymentsContent [data-payment-record-status] { color: var(--muted); font-size: 13px; }
/* 丹界羁绊优先级在窄屏下保留完整属性名。 */
.dan-bond-targets { display: grid; gap: 12px; width: 100%; }
.dan-bond-row { display: grid; grid-template-columns: auto minmax(130px, 1fr) 80px auto; align-items: center; gap: 8px; }
.dan-bond-row > * { min-width: 0; }
.dan-bond-actions { display: flex; gap: 4px; }
@media (max-width: 600px) {
    .dan-bond-row { grid-template-columns: minmax(0, 1fr) 80px; }
    .dan-bond-row > span, .dan-bond-actions { grid-column: 1 / -1; }
    .dan-bond-actions { justify-content: flex-end; }
}

/* Compact role cards and accessible icon hints. */
/* Five stable slots: heading, account state, resources, details entry, actions. */
#rolesView.compact-role-cards .role-card{grid-template-rows:40px 22px 125px 26px 36px;align-content:start;gap:4px}
#rolesView.compact-role-cards .role-card-heading{min-width:0;align-self:center}
#rolesView.compact-role-cards .role-card-title p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#rolesView.compact-role-cards .role-card-meta{display:grid;grid-template-rows:22px;gap:0;min-width:0;align-content:start}
#rolesView.compact-role-cards .role-expiry-line{display:flex;align-items:center;gap:6px;min-width:0}
#rolesView.compact-role-cards .role-expiry-line>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#rolesView.compact-role-cards .role-expiry-reminder{flex-shrink:0;padding:1px 5px}
#rolesView.compact-role-cards .role-expiry-line .management-badge{flex-shrink:0;white-space:nowrap}
#rolesView.compact-role-cards .role-autorenew-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 16px;width:16px;height:16px;color:#28846b}
#rolesView.compact-role-cards .role-autorenew-icon svg{display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#rolesView.compact-role-cards .role-autorenew-icon.is-warning{color:#a47016}
#rolesView.compact-role-cards .role-alipay-auth{flex:0 1 auto;max-width:58%;min-width:0;padding:2px 5px;margin:0;gap:4px;min-height:24px;font-size:11px}
#rolesView.compact-role-cards .role-alipay-auth span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#rolesView.compact-role-cards .role-alipay-auth button{padding:1px 4px;min-height:22px;font-size:11px;box-shadow:none}
#rolesView.compact-role-cards .role-inline-note{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#rolesView.compact-role-cards .role-card-metrics{display:grid;grid-template-rows:44px 76px;gap:5px;min-width:0}
#rolesView.compact-role-cards .role-card-stats{align-self:start}
#rolesView.compact-role-cards .role-card-stats strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#rolesView.compact-role-cards .role-extra-stats{align-content:start}
#rolesView.compact-role-cards .role-card-data-note{grid-row:1/-1;align-self:center;margin:0}
#rolesView.compact-role-cards .role-card-controls{padding-top:6px;align-self:end}
#rolesView.compact-role-cards .role-main-actions{justify-content:space-between}
#rolesView.compact-role-cards .role-main-actions>button{flex:1 1 0;min-width:0;padding-inline:4px;white-space:nowrap}
#rolesView.compact-role-cards .role-main-actions>.role-actions-menu{flex:0 0 30px;margin-left:0}

/* Detail expansion does not resize the card or push the following row away. */
#rolesView.compact-role-cards .role-card-detail-row{position:relative;display:flex;align-items:center;gap:10px;min-width:0}
#rolesView.compact-role-cards .role-extra{position:static;flex:1;min-width:0;align-self:center}
#rolesView.compact-role-cards .role-extra>summary{min-height:26px}
#rolesView.compact-role-cards .role-card-identity{position:absolute;left:0;right:0;top:100%;z-index:6;display:grid;gap:6px;max-height:240px;overflow-y:auto;overscroll-behavior:contain;padding:10px 12px;border:1px solid var(--surface-line);border-radius:8px;background:var(--panel);box-shadow:0 8px 24px #243e6420;cursor:default}
#rolesView.compact-role-cards .role-card-identity span{white-space:normal;overflow-wrap:anywhere}
#rolesView.compact-role-cards .role-card:has(.role-extra[open]),#rolesView.compact-role-cards .role-card:has(.role-actions-menu[open]){z-index:3}

/* No idle glow or repeated entrance. Only direct interaction moves a surface. */
#rolesView.compact-role-cards .role-card.union-power-advanced::before{animation:none;opacity:.3}
#rolesView.compact-role-cards .role-card{transform:none;transition:transform 160ms ease-out,border-color 160ms ease-out,box-shadow 160ms ease-out}
#rolesView.compact-role-cards :is(button,.role-actions-menu>summary,.role-extra>summary){transition:transform 140ms ease-out,background-color 140ms ease-out,border-color 140ms ease-out,color 140ms ease-out}
#rolesView.compact-role-cards :is(button,summary):focus-visible{outline:2px solid var(--primary);outline-offset:2px}
#rolesView.compact-role-cards .role-extra[open] .role-card-identity,#rolesView.compact-role-cards .role-actions-menu[open] .role-actions-popover,.role-hall-dock .hall-dock-panel:not(.hidden){animation:preview-panel-in 150ms ease-out}
#rolesView.compact-role-cards .role-favorite-button svg{transition:transform 160ms ease-out}
@keyframes preview-panel-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
@media(hover:hover) and (pointer:fine){
 #rolesView.compact-role-cards .role-card:hover{transform:translateY(-2px)}
 #rolesView.compact-role-cards button:not(:disabled):hover{transform:translateY(-1px)}

}
#rolesView.compact-role-cards button:not(:disabled):active{transform:translateY(1px) scale(.985)}
@media(max-width:760px){#rolesView.compact-role-cards .role-card{grid-template-rows:40px 22px 125px 26px 48px}}
@media(prefers-reduced-motion:reduce){#rolesView.compact-role-cards *,#rolesView.compact-role-cards *::before,#rolesView.compact-role-cards *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}#rolesView.compact-role-cards .role-card,#rolesView.compact-role-cards button{transform:none!important}}

/* Stable icon feedback avoids nested translations and rasterised text. */
#rolesView.compact-role-cards .role-card:hover { transform: none; }
#rolesView.compact-role-cards .role-card-heading-actions button:hover,
#rolesView.compact-role-cards .role-card-heading-actions button:active,
#rolesView.compact-role-cards .role-actions-menu > summary:hover { transform: none; }
#rolesView.compact-role-cards .role-favorite-button:hover svg { transform: none; }
#rolesView.compact-role-cards .role-favorite-button svg { width: 20px; height: 20px; stroke-width: 1.9; }
#rolesView.compact-role-cards .role-topup-button svg { display:block;width:18px;height:18px;margin:auto;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round; }
#rolesView.compact-role-cards .role-actions-menu > summary svg { width:18px;height:18px;fill:currentColor; }
#rolesView.compact-role-cards .role-autorenew-icon { color:#216b54; }
#rolesView.compact-role-cards .role-autorenew-icon svg { width:16px;height:16px;stroke-width:2; }
#rolesView.compact-role-cards .role-autorenew-icon.is-warning { color:#895b0b; }
#rolesView.compact-role-cards [data-role-hint]:not(button):not(summary) { cursor:help; }
#rolesView.compact-role-cards [data-role-hint]:focus-visible { outline:2px solid var(--primary);outline-offset:2px; }
.role-card-tooltip { position:fixed;z-index:120;box-sizing:border-box;width:max-content;max-width:min(280px,calc(100vw - 16px));padding:8px 11px;border:1px solid #43566c;border-radius:7px;background:#26394f;color:#fff;font-size:12px;font-weight:400;line-height:1.6;white-space:pre-line;overflow-wrap:anywhere;box-shadow:0 4px 12px #19334d20;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease-out,visibility 120ms; }
.role-card-tooltip.is-visible { opacity:1;visibility:visible;pointer-events:auto; }
@media(prefers-reduced-motion:reduce){.role-card-tooltip{transition:none}}

/* Preserve the navigation on tablets with long account names. */
.header-actions,.user-menu-wrap{min-width:0}.user-menu-wrap{flex-shrink:1}.user-trigger{max-width:100%}#userMenuName{max-width:140px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(min-width:761px) and (max-width:1000px){.desktop-nav{margin-left:20px;gap:0}.desktop-nav .nav-link{min-width:64px;padding-inline:12px}.header-actions{gap:8px}.header-inner{padding-inline:20px}.quota-indicator{gap:5px}#userMenuName{max-width:80px}.user-trigger{gap:6px}}
@media(max-width:760px){#userMenuName{max-width:70px}}
#rolesView.compact-role-cards .role-card.onboarding-demo-card{grid-template-rows:none;gap:5px}

/* Brand cards keep their own padding and compensate the existing status border. */
html[data-brand-site] #rolesView.compact-role-cards .role-card.is-running,
html[data-brand-site] #rolesView.compact-role-cards .role-card.is-crashed { padding-top:13px; }
@media(max-width:600px){html[data-brand-site] #rolesView.compact-role-cards .role-card.is-running,html[data-brand-site] #rolesView.compact-role-cards .role-card.is-crashed{padding-top:11px}}

/* Partner capacity is managed beside quota; accounts keep the common card layout. */
.simulation-slots-trigger { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.simulation-slots-trigger strong { font-variant-numeric: tabular-nums; }
.simulation-slots-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 22px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--panel); overflow: auto; }
.simulation-slots-dialog::backdrop { background: rgba(15, 23, 42, .38); }
.simulation-slots-dialog .simulation-slots-panel { padding: 0; margin: 12px 0; border: 0; background: transparent; }
.simulation-slots-dialog .modal-header h3 { margin: 0; }
.simulation-slots-dialog button:focus-visible { outline: 2px solid var(--accent, #1d74f5); outline-offset: 3px; }
@media (max-width: 480px) {
    .simulation-slots-trigger { gap: 3px; padding-inline: 5px; font-size: 11px; }
    .simulation-slots-dialog { padding: 16px; }
    html[data-brand-site] .header-inner { gap: 8px; }
    html[data-brand-site] .header-actions { gap: 4px; }
}
@media (max-width: 480px) {
    .simulation-slots-trigger { flex-direction: column; gap: 0; line-height: 14px; }
    html[data-brand-site] .desktop-nav { gap: 2px; }
}
@media (max-width: 360px) {
    html[data-brand-site] .header-inner { padding-inline: 10px; gap: 6px; }
    html[data-brand-site] .desktop-nav .nav-link,
    html[data-brand-site] .desktop-nav #toolsBtn { min-width: 38px; padding-inline: 5px; }
}

.personal-ranking-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.personal-ranking-actions button { min-height: 44px; }
.player-comparison-dialog { width: min(960px, calc(100vw - 24px)); }
.player-comparison-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.player-comparison-toolbar button { flex-shrink: 0; min-height: 44px; }
.player-comparison-searches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.player-comparison-searches > section { min-width: 0; padding: 14px; border: 1px solid #94a3b830; border-radius: 12px; }
.player-comparison-searches h4 { margin: 0 0 12px; }
.player-comparison-search { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.player-comparison-search label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-secondary, #64748b); }
.player-comparison-search :is(input, select, button) { min-width: 0; width: 100%; min-height: 44px; box-sizing: border-box; }
.player-comparison-results { list-style: none; margin: 12px 0 0; padding: 0; max-height: 240px; overflow: auto; overscroll-behavior: contain; }
.player-comparison-results li + li { margin-top: 4px; }
.player-comparison-results button { width: 100%; min-height: 52px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; text-align: left; background: transparent; color: inherit; border: 1px solid #94a3b830; box-shadow: none; }
.player-comparison-results button:hover { background: #94a3b81a; }
.player-comparison-results :is(strong, small) { max-width: 100%; overflow-wrap: anywhere; }
.player-comparison-results small, .player-comparison-person :is(span, small) { color: var(--text-secondary, #64748b); font-size: 12px; }
.player-comparison-pages { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.player-comparison-pages button { min-height: 44px; padding-inline: 8px; }
.player-comparison-person { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #94a3b830; overflow-wrap: anywhere; }
.player-comparison-empty { padding: 24px 12px; text-align: center; color: var(--text-secondary, #64748b); }
.player-comparison-table { font-variant-numeric: tabular-nums; }
.player-comparison-table th:first-child { width: 22%; }
@media (max-width: 700px) {
    .player-comparison-searches { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .personal-ranking-heading:has(.personal-ranking-actions) { flex-direction: row; align-items: center; }
    .personal-ranking-actions { gap: 6px; }
    .personal-ranking-actions > span { flex-basis: 100%; text-align: right; }
    .player-comparison-table, .player-comparison-table tbody { display: table; width: 100%; }
    .player-comparison-table tbody { display: table-row-group; }
    .player-comparison-table thead { display: table-header-group; }
    .player-comparison-table tr { display: table-row; padding: 0; margin: 0; border: 0; }
    .player-comparison-table :is(th, td) { display: table-cell; padding: 10px 3px; font-size: 11px; border-bottom: 1px solid #94a3b830; }
    .player-comparison-table td::before { content: none; }
}

.simulation-slot-bindings { display: grid; gap: 8px; margin: 10px 0; }
.simulation-slot-binding { padding: 10px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; }
.simulation-slot-binding > div { display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.simulation-slot-binding > small { display: block; margin-top: 4px; }
.simulation-slot [data-slot-binding-editor] { margin-top: 8px; }
.simulation-slot [data-slot-binding-editor] > summary { cursor: pointer; color: var(--primary); padding-block: 5px; }
.simulation-slot [data-slot-binding-form] { display: grid; gap: 8px; margin-top: 8px; }
.simulation-slot [data-slot-binding-form] label { display: grid; gap: 5px; }
.simulation-slot [data-slot-binding-form] select { width: 100%; }

/* 充值转盘沿用每日转盘，尺寸适配限时福利弹窗。 */
.recharge-wheel { display: grid; justify-items: center; text-align: center; }
.recharge-wheel .brand-wheel-shell { --wheel-size: min(300px, calc(100vw - 108px)); margin: 26px 0 20px; }
.recharge-wheel .brand-wheel-prize b { font-size: clamp(11px, 3.2vw, 15px); }
.recharge-wheel .brand-wheel-prize small { font-size: 9px; }
.recharge-wheel .brand-wheel-hub { width: 60px; height: 60px; font-size: 12px; white-space: nowrap; }
.recharge-wheel .campaign-cta { width: 100%; }
.recharge-wheel .campaign-rules { text-align: left; }
.recharge-wheel .gift-counts { width: 100%; }
.recharge-wheel .gift-result { width: 100%; }

/* 妖盟同步沿用工具页表单与按钮，窄屏逐行排列。 */
.union-sync-panel { min-width: 0; }
.union-sync-panel fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.union-sync-panel h3 { margin: 24px 0 12px; }
.union-sync-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.union-sync-toolbar [role="status"] { overflow-wrap: anywhere; }
.union-sync-toolbar label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.union-sync-panel select, .union-sync-field input:not([type="checkbox"]) { max-width: 100%; min-width: 0; }
.union-sync-request { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--border, #dbe3ee); padding: 12px 0; }
.union-sync-request small, .union-sync-member small { display: block; }
.union-sync-member { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.union-sync-member span { overflow-wrap: anywhere; }
.union-sync-member small { color: var(--muted, #64748b); }
.union-sync-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 16px 0; }
.union-sync-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.union-sync-field > input[type="checkbox"] { align-self: flex-start; }
@media(max-width:640px) { .union-sync-fields { grid-template-columns: 1fr; } .union-sync-request { align-items: flex-start; flex-direction: column; gap: 4px; } }

.union-sync-dot { position: absolute; bottom: -2px; left: -2px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--panel, white); pointer-events: none; }

/* 妖盟协作工具：复用现有表单和按钮，窄屏单列。 */
/* 妖盟组队与丹界互助：共用表单、状态和操作布局。 */
.cooperation-panel { min-width:0; padding:28px; overflow-wrap:anywhere; }
.cooperation-panel fieldset { border:0; padding:0; margin:0; min-width:0; }
.cooperation-panel .hint { color:var(--muted); font-size:13px; line-height:1.7; }
.cooperation-panel button,.cooperation-panel select { min-height:44px; }
.cooperation-panel button { transition:transform .15s ease,background-color .15s ease; }
.cooperation-panel button:not(:disabled):hover { transform:translateY(-1px); }
.cooperation-panel button:not(:disabled):active { transform:translateY(0); }
.cooperation-heading,.cooperation-title,.cooperation-toolbar,.cooperation-meta,.cooperation-team header { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.cooperation-heading { justify-content:space-between; gap:16px; margin-bottom:24px; }
.cooperation-title { gap:10px; }
.cooperation-heading h2 { margin:0; font-size:23px; letter-spacing:-.5px; }
.cooperation-heading p { margin:6px 0 0; color:var(--muted); font-size:14px; }
.cooperation-test { font-size:11px; font-weight:600; padding:3px 8px; border:1px solid #b9d5fa; border-radius:6px; color:var(--primary-dark); background:#edf5ff; }
.cooperation-selection { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; padding:16px 20px; margin-bottom:24px; border:1px solid var(--line); border-radius:12px; background:var(--panel-soft); }
.cooperation-role { display:flex; gap:14px; align-items:center; flex:1 1 300px; min-width:0; font-size:13px; font-weight:600; }
.cooperation-role > span { flex-shrink:0; }
.cooperation-role select { width:100%; max-width:420px; min-width:0; background:var(--panel); }
.cooperation-meta { font-size:12px; color:var(--muted); gap:10px; }
.cooperation-plan-state { border-radius:6px; color:#136d40; background:#e8f6ee; padding:5px 9px; font-weight:600; }
.cooperation-unsaved { color:#975300; }
.cooperation-layout { display:grid; grid-template-columns:270px minmax(0,1fr); gap:28px; align-items:start; }
.cooperation-sidebar,.cooperation-workspace { min-width:0; }
.cooperation-authorization { border:1px solid var(--line); border-radius:12px; padding:18px; background:var(--panel-soft); }
.cooperation-authorization summary { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:44px; cursor:pointer; font-size:14px; font-weight:600; list-style:none; }
.cooperation-authorization summary::-webkit-details-marker { display:none; }
.cooperation-disclosure { width:7px; height:7px; flex-shrink:0; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg); margin:0 3px 4px; }
.cooperation-authorization[open] .cooperation-disclosure { transform:rotate(225deg); margin-bottom:0; }
.cooperation-authorization > .hint { margin:6px 0 18px; }
.cooperation-modes { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
.cooperation-mode { display:flex; gap:8px; flex-direction:column; min-width:0; margin:0; font-size:13px; font-weight:500; }
.cooperation-mode select { width:100%; min-width:0; background:var(--panel); }
.cooperation-authorize { width:100%; margin-top:20px; }
.cooperation-quality { margin-top:20px !important; }
.cooperation-quality legend { font-size:13px; font-weight:600; margin-bottom:10px; }
.cooperation-quality > div { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.cooperation-quality label { display:flex; align-items:center; gap:8px; min-height:44px; margin:0; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--panel); font-size:13px; cursor:pointer; }
.cooperation-quality label:has(input:checked) { border-color:#8dbafa; background:#edf5ff; color:var(--primary-dark); }
.cooperation-quality input,.cooperation-team header input,.cooperation-enable input { width:16px; height:16px; flex-shrink:0; margin:0; accent-color:var(--primary); }
.cooperation-tabs { display:flex; align-items:center; gap:4px; width:fit-content; max-width:100%; padding:4px; margin:0 0 18px; border-radius:10px; background:var(--panel-soft); border:1px solid var(--line); overflow-x:auto; }
.cooperation-tabs button { flex-shrink:0; padding:9px 18px; white-space:nowrap; border-radius:7px; border-color:transparent; font-size:14px; }
.cooperation-tabs button.ghost { background:transparent; color:var(--muted); }
.cooperation-intro { margin:0 0 20px; }
.cooperation-toolbar { gap:10px; }
.cooperation-count { margin-left:auto; font-size:12px; color:var(--muted); }
.cooperation-teams { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr)); gap:16px; margin:18px 0 24px; }
.cooperation-team,.cooperation-herbs article,.cooperation-records article { min-width:0; border:1px solid var(--line); border-radius:12px; padding:18px; background:var(--panel); }
.cooperation-team header { justify-content:space-between; gap:8px; }
.cooperation-team h3 { display:flex; align-items:center; gap:8px; margin:0; font-size:15px; }
.cooperation-team-number { display:inline-flex; justify-content:center; align-items:center; width:30px; height:30px; border-radius:7px; color:var(--primary-dark); background:#edf5ff; font-size:13px; font-variant-numeric:tabular-nums; }
.cooperation-team header label { display:flex; align-items:center; gap:7px; min-height:44px; font-size:12px; color:var(--muted); }
.cooperation-team ol { display:grid; gap:14px; list-style:none; margin:18px 0; padding:0; }
.cooperation-team li { display:grid; gap:6px; min-width:0; }
.cooperation-team li > div { min-width:0; }
.cooperation-slot-label { color:var(--muted); font-size:12px; }
.cooperation-team li small { display:block; margin-top:6px; font-size:12px; line-height:1.6; }
.cooperation-team select { width:100%; min-width:0; font-size:13px; }
.cooperation-status { margin:0; padding:12px 0; border-top:1px solid var(--line); font-size:13px; line-height:1.7; color:var(--muted); }
.cooperation-team > button { width:100%; margin-top:8px; }
.cooperation-actions { padding-top:18px; border-top:1px solid var(--line); }
.cooperation-actions [data-coop-action=publish] { margin-left:auto; order:2; }
.cooperation-actions .cooperation-pause { order:1; color:#a32626; }
.cooperation-empty { grid-column:1 / -1; margin:0; padding:44px 24px; border:1px dashed var(--line); border-radius:12px; background:var(--panel-soft); text-align:center; line-height:1.8; font-size:14px; color:var(--muted); }
.cooperation-error,.cooperation-notice,.cooperation-readiness { padding:12px 16px; border-radius:8px; font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.cooperation-error { color:#a32626; background:#fff3f0; }
.cooperation-notice { color:#136d40; background:#e8f6ee; }
.cooperation-readiness { color:#875000; background:#fff7e5; margin-bottom:20px; }
.cooperation-herbs,.cooperation-records { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; margin:20px 0 24px; }
.cooperation-herbs article > div { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.cooperation-herbs article strong { font-size:16px; }
.cooperation-herbs article small { color:var(--muted); font-size:12px; }
.cooperation-quantity { color:var(--primary-dark); background:#edf5ff; border-radius:6px; padding:5px 10px; font-size:12px; white-space:nowrap; }
.cooperation-quantity b { margin:0 3px; font-size:16px; font-variant-numeric:tabular-nums; }
.cooperation-recipes { margin:10px 0; color:var(--muted); font-size:13px; line-height:1.7; }
.cooperation-records article { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.cooperation-records time { margin-left:auto; color:var(--muted); font-size:12px; }
.cooperation-records p { flex-basis:100%; margin:0; overflow-wrap:anywhere; color:var(--muted); font-size:12px; }
.cooperation-jobs p { padding:12px 0; border-bottom:1px solid var(--line); font-size:13px; line-height:1.8; }
.cooperation-enable { flex-direction:row; align-items:center; justify-content:space-between; min-height:44px; margin:20px 0 12px; }
@media(max-width:1000px) { .cooperation-layout { grid-template-columns:minmax(0,1fr); gap:24px; } .cooperation-modes { grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); } .cooperation-quality > div { grid-template-columns:repeat(4,minmax(0,1fr)); } .cooperation-authorize { width:auto; } }
@media(max-width:600px) { .cooperation-panel { padding:18px 12px; } .cooperation-heading { margin-bottom:18px; } .cooperation-heading h2 { font-size:21px; } .cooperation-selection { padding:14px; gap:12px; margin-bottom:18px; } .cooperation-role { flex-basis:100%; align-items:stretch; flex-direction:column; gap:8px; } .cooperation-meta { gap:8px; } .cooperation-authorization { padding:14px; } .cooperation-modes { grid-template-columns:minmax(0,1fr); gap:12px; } .cooperation-mode { flex-direction:row; align-items:center; justify-content:space-between; } .cooperation-mode select { width:58%; } .cooperation-quality > div { grid-template-columns:repeat(2,minmax(0,1fr)); } .cooperation-authorize { width:100%; margin-top:16px; } .cooperation-tabs { width:100%; } .cooperation-tabs button { flex:1 0 auto; padding-inline:12px; } .cooperation-toolbar button { flex:1 1 130px; } .cooperation-count { flex-basis:100%; margin:0; } .cooperation-actions [data-coop-action=publish] { flex-basis:100%; margin-left:0; order:0; } .cooperation-actions .cooperation-pause { order:1; } .cooperation-team { padding:14px; } .cooperation-records time { width:100%; margin-left:0; } }
@media(prefers-reduced-motion:reduce) { .cooperation-panel button { transition:none; transform:none !important; } }

/* Personal quota receipts share the account record layout. */
#profileView .profile-quota-amount { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
#profileView .profile-quota-amount strong { white-space: nowrap; }
#profileView .quota-debit { color: #b24639; }

.group-prediction { min-width: 0; }
.group-prediction-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.group-prediction-heading h2 { margin-top: 0; }
.group-prediction-heading button { flex: 0 0 auto; }
.group-prediction-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.group-prediction-tabs button { flex: 0 0 auto; text-align: left; }
.group-prediction-tabs small, .group-prediction-group td small { display: block; font-weight: normal; color: var(--muted); }
.group-prediction-tabs .active { border-color: var(--primary); color: var(--primary); }
.group-prediction-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.group-prediction-filters label { display: grid; gap: 6px; flex: 1 1 160px; min-width: 0; }
.group-prediction-filters select { width: 100%; }
.group-prediction-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.group-prediction-group { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.group-prediction-group h3 { margin: 0 0 12px; }
.group-prediction-group h3 small { font-size: 12px; color: var(--muted); font-weight: normal; }
.group-prediction-group table { width: 100%; min-width: 440px; font-variant-numeric: tabular-nums; }
.group-prediction-group td, .group-prediction-group th { padding: 10px 8px; text-align: left; }
.group-prediction-group td:nth-child(2) { min-width: 100px; }
.group-prediction-own { background: var(--accent-soft, rgba(75, 125, 115, .12)); }
.group-prediction-waiting { margin-top: 20px; }
@media (max-width: 600px) {
    .group-prediction-heading { flex-wrap: wrap; }
    .group-prediction-group { padding: 12px; }
    .group-prediction-filters label { flex-basis: 100%; }
}
.runtime-jade-ledger {
    margin: 0;
    padding: 0 8px 0 0;
    list-style: none;
    max-height: 420px;
    overflow-y: auto;
}
.runtime-jade-ledger li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 44px;
    padding: 8px 0;
    border-bottom: 1px solid var(--surface-line, #e1e8f2);
}
.runtime-jade-ledger li > span { overflow-wrap: anywhere; }
.runtime-jade-ledger time { display: block; color: var(--text-secondary, #475569); font-size: 13px; }
.runtime-jade-ledger strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
