/* Refined visual shell for login, help, monitor, and diagnostics pages. */
:root {
    --shell-bg: #090b0e;
    --shell-surface: #11161b;
    --shell-surface-raised: #151a20;
    --shell-field: #0d1116;
    --shell-border: #252c34;
    --shell-border-strong: #34434b;
    --shell-text: #d7dde3;
    --shell-heading: #f0f3f5;
    --shell-muted: #87929d;
    --shell-accent: #63b6c8;
    --shell-accent-strong: #77c6d7;
    --shell-accent-soft: rgba(99, 182, 200, 0.14);
    --shell-success: #62c49c;
    --shell-danger: #df7078;
}

body.login-page-root,
body.help-refined,
body.monitor-shell,
body.websocket-refined,
body.react-monitor-refined,
body.legacy-tool-refined,
body.ops-dashboard-refined {
    background: var(--shell-bg) !important;
    color: var(--shell-text);
}

body.login-page-root ::selection,
body.help-refined ::selection,
body.monitor-shell ::selection,
body.websocket-refined ::selection {
    background: var(--shell-accent-soft);
    color: var(--shell-heading);
}

body.react-monitor-refined ::selection {
    background: var(--shell-accent-soft);
    color: var(--shell-heading);
}

body.legacy-tool-refined ::selection,
body.ops-dashboard-refined ::selection {
    background: var(--shell-accent-soft);
    color: var(--shell-heading);
}

body.login-page-root :is(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible,
body.help-refined :is(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible,
body.monitor-shell :is(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible,
body.websocket-refined :is(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
    outline: 2px solid var(--shell-accent);
    outline-offset: 2px;
}

body.react-monitor-refined :is(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
    outline: 2px solid var(--shell-accent);
    outline-offset: 2px;
}

body.legacy-tool-refined :is(button, a, input, select, textarea):focus-visible,
body.ops-dashboard-refined :is(button, a, input, select, textarea):focus-visible {
    outline: 2px solid var(--shell-accent);
    outline-offset: 2px;
}

body.login-page-root :is(button, input, select):disabled,
body.monitor-shell :is(button, input, select):disabled,
body.websocket-refined :is(button, input, select):disabled,
body.login-page-root [aria-disabled="true"],
body.monitor-shell [aria-disabled="true"],
body.websocket-refined [aria-disabled="true"] {
    opacity: 0.42;
    cursor: not-allowed;
    filter: none;
}

body.login-page-root #login-card {
    border-color: var(--shell-border) !important;
    border-radius: 8px !important;
    background: var(--shell-surface) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28) !important;
    backdrop-filter: none !important;
}

body.login-page-root #login-card:hover {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28) !important;
}

body.login-page-root #login-card .rounded-full {
    border-radius: 8px !important;
}

body.login-page-root .text-warm-accent,
body.login-page-root [class*="group-focus-within/input:text-warm-accent"] {
    color: var(--shell-accent) !important;
}

body.login-page-root .entry-mode-card,
body.login-page-root .direct-mode-tab,
body.login-page-root .direct-robot-card {
    border-color: var(--shell-border) !important;
    border-radius: 6px !important;
    background: var(--shell-field) !important;
    box-shadow: none !important;
}

body.login-page-root .direct-help-card {
    border-color: var(--shell-border) !important;
    border-radius: 6px !important;
    background: var(--shell-field) !important;
}

body.login-page-root .direct-robot-list-scroll {
    scrollbar-color: var(--shell-border-strong) transparent;
    scrollbar-width: thin;
}

body.login-page-root .direct-robot-list-scroll::-webkit-scrollbar-thumb {
    background: var(--shell-border-strong);
    border-radius: 999px;
}

body.login-page-root .direct-robot-list-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--shell-accent);
}

body.login-page-root .entry-mode-card[aria-pressed="true"],
body.login-page-root .direct-mode-tab[aria-selected="true"],
body.login-page-root .direct-robot-card.is-selected {
    border-color: var(--shell-border-strong) !important;
    background: var(--shell-accent-soft) !important;
    color: var(--shell-heading) !important;
    box-shadow: inset 0 0 0 1px var(--shell-border-strong) !important;
}

body.login-page-root input {
    border-color: var(--shell-border) !important;
    border-radius: 6px !important;
    background: var(--shell-field) !important;
}

body.login-page-root input:focus {
    border-color: var(--shell-accent) !important;
    box-shadow: 0 0 0 2px var(--shell-accent-soft) !important;
}

body.login-page-root #submit-btn,
body.login-page-root #direct-enter-btn {
    border-radius: 6px !important;
    background: var(--shell-accent) !important;
    color: #071013 !important;
}

body.login-page-root #submit-btn:hover,
body.login-page-root #direct-enter-btn:hover {
    background: var(--shell-accent-strong) !important;
}

body.login-page-root #direct-back-btn {
    border-color: var(--shell-border) !important;
    border-radius: 6px !important;
    background: var(--shell-field) !important;
}

body.login-page-root .login-version-meta,
body.login-page-root .login-company-footer {
    color: #71808d;
    letter-spacing: 0;
}

body.help-refined {
    --bg: var(--shell-bg);
    --panel: var(--shell-surface);
    --border: var(--shell-border);
    --text: var(--shell-text);
    --muted: var(--shell-muted);
    --accent: var(--shell-accent);
}

body.help-refined .help-top,
body.help-refined .help-nav {
    background: var(--shell-surface);
}

body.help-refined .help-nav a.active {
    border-left-color: var(--shell-accent);
    background: var(--shell-accent-soft);
    color: var(--shell-heading);
}

body.help-refined .help-prose table {
    background: var(--shell-field);
}

body.help-refined .help-prose th {
    background: var(--shell-surface-raised);
}

body.help-refined .help-prose blockquote {
    border-left-color: var(--shell-accent);
    background: var(--shell-accent-soft);
}

body.monitor-shell {
    --control-bg: var(--shell-bg);
    --control-shell-bg: var(--shell-bg);
    --control-panel-surface: var(--shell-surface);
    --control-card-surface: var(--shell-surface-raised);
    --control-field-surface: var(--shell-field);
    --control-border: var(--shell-border);
    --control-border-strong: var(--shell-border-strong);
    --control-heading: var(--shell-heading);
    --control-text: var(--shell-text);
    --control-muted: var(--shell-muted);
}

body.monitor-shell .status-bar,
body.monitor-shell .monitor-panel,
body.monitor-shell .panel-section,
body.monitor-shell .log-container {
    border-color: var(--shell-border);
    background: var(--shell-surface) !important;
    box-shadow: none !important;
}

body.monitor-shell .panel-section,
body.monitor-shell .monitor-panel,
body.monitor-shell .log-container,
body.monitor-shell .monitor-message-card,
body.monitor-shell .connection-info,
body.monitor-shell .data-card {
    border-color: var(--shell-border) !important;
    border-radius: 7px !important;
    background: var(--shell-field) !important;
    box-shadow: none !important;
}

body.monitor-shell .log-header {
    border-color: var(--shell-border);
    background: var(--shell-surface-raised) !important;
}

body.monitor-shell .video-container {
    border-color: var(--shell-border);
    border-radius: 7px;
    background: var(--shell-field);
    box-shadow: none;
}

body.monitor-shell .video-container video {
    opacity: 0.72;
    filter: saturate(0.72);
}

body.monitor-shell .monitor-audio audio {
    color-scheme: dark;
    background: var(--shell-surface-raised);
    border: 1px solid var(--shell-border);
    border-radius: 6px;
}

body.monitor-shell .connect-btn {
    border: 1px solid rgba(98, 196, 156, 0.3);
    border-radius: 7px;
    background: rgba(98, 196, 156, 0.12) !important;
    color: #92dabd !important;
}

body.monitor-shell .connect-btn.disconnected,
body.monitor-shell .connect-btn:not(.connected):not(.connecting) {
    border-color: rgba(99, 182, 200, 0.36);
    background: var(--shell-accent-soft) !important;
    color: var(--shell-accent-strong) !important;
}

body.monitor-shell .connect-btn.connected {
    border-color: rgba(223, 112, 120, 0.34);
    background: rgba(223, 112, 120, 0.12) !important;
    color: #efa2a8 !important;
}

body.monitor-shell .progress-fill,
body.monitor-shell .data-card .progress-fill {
    background: var(--shell-accent) !important;
}

body.websocket-refined {
    --primary-color: var(--shell-heading);
    --secondary-color: var(--shell-accent);
    --success-color: var(--shell-success);
    --danger-color: var(--shell-danger);
    --bg-color: var(--shell-bg);
    --card-bg: var(--shell-surface);
    --border-color: var(--shell-border);
    padding: 20px;
}

body.websocket-refined .container {
    gap: 12px;
}

body.websocket-refined .websocket-tool-header {
    display: flex;
    min-height: 72px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 4px 10px;
}

body.websocket-refined .websocket-tool-eyebrow {
    margin: 0 0 3px;
    color: var(--shell-muted);
    font-size: 11px;
    font-weight: 650;
}

body.websocket-refined .websocket-tool-version {
    flex: 0 0 auto;
    margin-bottom: 3px;
    padding: 3px 7px;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    color: var(--shell-muted);
    font-size: 11px;
}

body.websocket-refined .section-card {
    border-color: var(--shell-border);
    border-radius: 7px;
    background: var(--shell-surface);
    box-shadow: none;
}

body.websocket-refined .section-title {
    border-bottom: 1px solid var(--shell-border);
    color: var(--shell-heading);
}

body.websocket-refined h1 {
    margin: 0;
    color: var(--shell-heading);
    font-size: 1.4rem;
    font-weight: 650;
    letter-spacing: 0;
    text-wrap: balance;
}

body.websocket-refined .page-subtitle {
    color: var(--shell-muted);
}

body.websocket-refined .auth-mode-selection {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(120px, 1fr));
    gap: 8px;
    margin: 10px 0 14px;
}

body.websocket-refined .auth-mode-option {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
    cursor: pointer;
    line-height: 1.35;
}

body.websocket-refined .auth-mode-option input {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    accent-color: var(--shell-accent);
}

body.websocket-refined .auth-mode-option:has(input:checked) {
    border-color: var(--shell-border-strong);
    background: var(--shell-accent-soft);
    color: var(--shell-heading);
}

body.websocket-refined .btn {
    border: 1px solid var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
    box-shadow: none;
}

body.websocket-refined .btn-primary,
body.websocket-refined .type-btn.active,
body.websocket-refined .mode-btn.active {
    border-color: var(--shell-border-strong);
    background: var(--shell-accent-soft) !important;
    color: var(--shell-accent-strong) !important;
}

body.websocket-refined .btn-success {
    border-color: rgba(98, 196, 156, 0.3);
    background: rgba(98, 196, 156, 0.14);
    color: #92dabd;
}

body.websocket-refined .btn-danger {
    border-color: rgba(223, 112, 120, 0.3);
    background: rgba(223, 112, 120, 0.12);
    color: #f3b7bc;
}

body.websocket-refined .form-control,
body.websocket-refined input,
body.websocket-refined select,
body.websocket-refined textarea,
body.websocket-refined .message-container,
body.websocket-refined .input-section {
    border-color: var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
}

body.websocket-refined .form-control:focus,
body.websocket-refined input:focus,
body.websocket-refined select:focus,
body.websocket-refined textarea:focus {
    border-color: var(--shell-accent);
    box-shadow: 0 0 0 2px var(--shell-accent-soft);
}

body.help-refined,
body.monitor-shell,
body.websocket-refined,
body.react-monitor-refined {
    scrollbar-color: #323a43 transparent;
    scrollbar-width: thin;
}

body.react-monitor-refined .ui-card,
body.react-monitor-refined .ui-debug-dock {
    border-color: var(--shell-border);
    border-radius: 7px;
    background: var(--shell-surface);
    box-shadow: none;
}

body.react-monitor-refined .react-monitor-title {
    color: var(--shell-heading);
    font-size: 1.45rem;
    letter-spacing: 0;
}

body.react-monitor-refined .ui-section-title {
    color: var(--shell-heading);
    letter-spacing: 0;
}

body.react-monitor-refined .ui-status-pill {
    border-color: var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
}

body.react-monitor-refined .react-monitor-video {
    min-height: 220px;
    border-color: var(--shell-border);
    border-radius: 7px;
    background: var(--shell-field);
}

body.react-monitor-refined .react-monitor-label {
    color: var(--shell-muted);
    letter-spacing: 0;
    text-transform: none;
}

body.react-monitor-refined .react-monitor-value {
    color: var(--shell-heading);
    font-size: 1.2rem;
}

body.legacy-tool-refined {
    margin: 0;
    padding: 28px 20px 48px;
    font-family: Inter, "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

body.legacy-tool-refined .container {
    max-width: 880px;
}

body.legacy-tool-refined .legacy-tool-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 0 2px;
}

body.legacy-tool-refined h1 {
    margin: 2px 0 0;
    color: var(--shell-heading);
    font-size: 1.4rem;
    font-weight: 650;
    text-align: left;
    letter-spacing: 0;
}

body.legacy-tool-refined .legacy-tool-eyebrow {
    margin: 0;
    color: var(--shell-muted);
    font-size: 11px;
    font-weight: 650;
}

body.legacy-tool-refined .legacy-tool-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    color: var(--shell-muted);
    font-size: 11px;
}

body.legacy-tool-refined .legacy-tool-notice {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 22px;
    padding: 10px 12px;
    border-left: 2px solid var(--shell-border-strong);
    background: rgba(255, 255, 255, 0.025);
    color: var(--shell-muted);
    font-size: 12px;
}

body.legacy-tool-refined .legacy-tool-notice strong {
    flex: 0 0 auto;
    color: var(--shell-text);
    font-weight: 600;
}

body.legacy-tool-refined .api-section {
    margin: 0;
    padding: 20px 2px 22px;
    border: 0;
    border-top: 1px solid var(--shell-border);
    border-radius: 0;
    background: transparent;
}

body.legacy-tool-refined .api-section h2 {
    margin-bottom: 14px;
    color: var(--shell-heading);
    font-size: 0.95rem;
    font-weight: 650;
}

body.legacy-tool-refined .form-group {
    margin: 10px 0;
}

body.legacy-tool-refined .form-group label {
    margin-bottom: 5px;
    color: var(--shell-muted);
    font-size: 12px;
    font-weight: 550;
}

body.legacy-tool-refined :is(input, textarea) {
    border-color: var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
    font: inherit;
    font-size: 13px;
}

body.legacy-tool-refined input {
    min-height: 36px;
}

body.legacy-tool-refined :is(input, textarea):focus {
    border-color: var(--shell-border-strong);
    box-shadow: 0 0 0 2px var(--shell-accent-soft);
    outline: 0;
}

body.legacy-tool-refined .btn {
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--shell-border-strong);
    border-radius: 6px;
    background: var(--shell-accent-soft);
    color: var(--shell-accent-strong);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
}

body.legacy-tool-refined .btn:hover {
    border-color: var(--shell-accent);
    background: rgba(59, 200, 191, 0.16);
}

body.legacy-tool-refined .btn-delete {
    border-color: rgba(223, 112, 120, 0.3);
    background: rgba(223, 112, 120, 0.12);
    color: #f3b7bc;
}

body.legacy-tool-refined .result {
    margin-top: 14px;
    border-color: var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
    font-size: 12px;
}

body.legacy-tool-refined .result:empty {
    display: none;
}

body.legacy-tool-refined .error {
    border-color: rgba(223, 112, 120, 0.3);
    background: rgba(223, 112, 120, 0.1);
}

@media (max-width: 640px) {
    body.legacy-tool-refined {
        padding: 20px 14px 36px;
    }

    body.legacy-tool-refined .legacy-tool-header {
        align-items: flex-start;
    }

    body.legacy-tool-refined .legacy-tool-notice {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}

body.ops-dashboard-refined {
    --bg: var(--shell-bg);
    --panel: var(--shell-surface);
    --border: var(--shell-border);
    --text: var(--shell-text);
    --muted: var(--shell-muted);
    --accent: var(--shell-accent);
}

body.ops-dashboard-refined header,
body.ops-dashboard-refined .card {
    border-color: var(--shell-border);
    background: var(--shell-surface);
}

body.ops-dashboard-refined .card {
    border-radius: 7px;
}

body.ops-dashboard-refined :is(input[type="text"], input[type="password"], input[type="url"]) {
    min-height: 34px;
    padding: 7px 10px;
    border-color: var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
}

body.ops-dashboard-refined button {
    border-color: var(--shell-border-strong);
    border-radius: 6px;
    background: var(--shell-accent-soft);
    color: var(--shell-accent-strong);
}

body.ops-dashboard-refined button.secondary {
    border-color: var(--shell-border);
    background: var(--shell-field);
    color: var(--shell-text);
}

body.ops-dashboard-refined button.danger {
    color: var(--shell-muted);
}

body.ops-dashboard-refined button.danger:hover {
    border-color: rgba(223, 112, 120, 0.3);
    background: rgba(223, 112, 120, 0.08);
    color: var(--shell-danger);
}

body.ops-dashboard-refined .ops-feedback {
    width: fit-content;
    margin: 4px 0 18px;
    padding: 8px 11px 8px 26px;
    position: relative;
    border: 1px solid var(--shell-border);
    border-radius: 6px;
    background: var(--shell-field);
    color: var(--shell-text);
    font-size: 13px;
}

body.ops-dashboard-refined .ops-feedback::before {
    width: 7px;
    height: 7px;
    position: absolute;
    top: 50%;
    left: 11px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    transform: translateY(-50%);
}

body.ops-dashboard-refined .ops-feedback[data-tone="error"] {
    border-color: rgba(223, 112, 120, 0.28);
    background: rgba(223, 112, 120, 0.08);
    color: var(--shell-danger);
}

body.ops-dashboard-refined .ops-feedback[data-tone="success"] {
    border-color: rgba(98, 196, 156, 0.28);
    background: rgba(98, 196, 156, 0.08);
    color: #92dabd;
}

body.ops-dashboard-refined .ops-empty,
body.ops-dashboard-refined pre.raw.is-empty {
    color: var(--shell-muted);
    font-family: Inter, "Microsoft YaHei", sans-serif;
    font-size: 13px;
    text-align: center;
}

body.ops-dashboard-refined pre.raw.is-empty {
    min-height: 44px;
    margin: 0;
    display: grid;
    place-items: center;
}

body.ops-dashboard-refined .ops-toolbar {
    display: grid;
    grid-template-columns: minmax(190px, 0.7fr) minmax(280px, 1fr) auto;
    align-items: end;
    gap: 10px;
}

body.ops-dashboard-refined .ops-field {
    display: grid;
    min-width: 0;
    gap: 6px;
}

body.ops-dashboard-refined .ops-field input {
    width: 100%;
    min-width: 0;
}

body.ops-dashboard-refined .ops-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

@media (max-width: 960px) {
    body.ops-dashboard-refined .ops-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.ops-dashboard-refined .ops-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    body.websocket-refined {
        padding: 10px;
    }

    body.websocket-refined .section-card {
        padding: 14px;
    }

    body.websocket-refined h1 {
        font-size: 1.2rem;
        line-height: 1.35;
    }

    body.ops-dashboard-refined .ops-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    body.ops-dashboard-refined .ops-actions {
        grid-column: auto;
    }

    body.ops-dashboard-refined .ops-feedback {
        width: 100%;
    }

    body.websocket-refined .websocket-tool-header {
        min-height: 58px;
        padding: 4px 2px 6px;
    }

    body.websocket-refined .auth-mode-selection {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.websocket-refined .auth-mode-option--legacy {
        grid-column: 1 / -1;
    }

    body.react-monitor-refined .react-monitor-title {
        font-size: 1.25rem;
    }

    body.react-monitor-refined .react-monitor-value {
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.login-page-root *,
    body.login-page-root *::before,
    body.login-page-root *::after,
    body.help-refined *,
    body.help-refined *::before,
    body.help-refined *::after,
    body.monitor-shell *,
    body.monitor-shell *::before,
    body.monitor-shell *::after,
    body.websocket-refined *,
    body.websocket-refined *::before,
    body.websocket-refined *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body.react-monitor-refined *,
    body.react-monitor-refined *::before,
    body.react-monitor-refined *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
