:root {
    color-scheme: light;
    --login-bg-color: #101828;
    --left-menu-bg-color: #001529;
    --left-menu-bg-light-color: #162033;
    --left-menu-text-color: #99a6ba;
    --left-menu-text-active-color: #ffffff;
    --top-header-bg-color: rgba(248, 250, 252, 0.88);
    --app-content-bg-color: #eef3f8;
    --panel-bg: rgba(248, 250, 252, 0.96);
    --surface-bg: #f8fafc;
    --surface-bg-raised: #f3f6fa;
    --surface-bg-soft: rgba(248, 250, 252, 0.96);
    --surface-bg-elevated: rgba(248, 250, 252, 0.98);
    --surface-bg-muted: rgba(241, 245, 249, 0.92);
    --surface-hover: #eef4fb;
    --surface-gradient: linear-gradient(180deg, #f8fafc 0%, #f2f6fb 100%);
    --surface-gradient-hover: linear-gradient(180deg, #f6f9fc 0%, #eef4fb 100%);
    --line-color: #d8e0ea;
    --line-soft: #ebf0f5;
    --text-primary: #0f172a;
    --text-secondary: #526071;
    --text-placeholder: #97a3b4;
    --primary-color: #409eff;
    --primary-hover: #1d4ed8;
    --primary-light: #eaf1ff;
    --success-color: #15803d;
    --danger-color: #dc2626;
    --danger-light: #fef2f2;
    --warning-color: #d97706;
    --warning-light: #fff7ed;
    --button-text-on-accent: #eef4ff;
    --header-height: 68px;
    --sidebar-width: 228px;
    --sidebar-width-collapsed: 78px;
    --content-padding: 24px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-card: 0 16px 40px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 22px 48px rgba(15, 23, 42, 0.1);
    --shadow-login: 0 32px 80px rgba(15, 23, 42, 0.18);
    --select-caret-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.25 5.25L7 9L10.75 5.25' stroke='%23526071' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 26%),
        linear-gradient(180deg, #f2f6fb 0%, var(--app-content-bg-color) 100%);
    color: var(--text-primary);
    font: 14px/1.6 "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body[data-theme="dark"] {
    color-scheme: dark;
    --button-text-on-accent: #e8f1ff;
    --left-menu-bg-color: #07111f;
    --left-menu-bg-light-color: #0d1b2d;
    --left-menu-text-color: #95a4bc;
    --left-menu-text-active-color: #f8fbff;
    --top-header-bg-color: rgba(10, 17, 29, 0.88);
    --app-content-bg-color: #0b1220;
    --panel-bg: rgba(10, 17, 29, 0.94);
    --surface-bg: rgba(15, 23, 36, 0.98);
    --surface-bg-raised: rgba(18, 27, 42, 0.98);
    --surface-bg-soft: rgba(15, 23, 36, 0.94);
    --surface-bg-elevated: rgba(10, 17, 29, 0.98);
    --surface-bg-muted: rgba(17, 24, 39, 0.9);
    --surface-hover: rgba(255, 255, 255, 0.05);
    --surface-gradient: linear-gradient(180deg, rgba(15, 23, 36, 0.98) 0%, rgba(10, 17, 29, 0.98) 100%);
    --surface-gradient-hover: linear-gradient(180deg, rgba(20, 30, 46, 0.98) 0%, rgba(14, 23, 37, 0.98) 100%);
    --line-color: #243244;
    --line-soft: #1a2534;
    --text-primary: #e5edf7;
    --text-secondary: #a8b6ca;
    --text-placeholder: #6f8098;
    --primary-light: rgba(64, 158, 255, 0.18);
    --danger-light: rgba(220, 38, 38, 0.16);
    --warning-light: rgba(217, 119, 6, 0.16);
    --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.28);
    --shadow-card-hover: 0 22px 48px rgba(0, 0, 0, 0.34);
    --shadow-login: 0 32px 80px rgba(0, 0, 0, 0.42);
}

body[data-sidebar-collapsed="1"] {
    --sidebar-width: var(--sidebar-width-collapsed);
}

body.dialog-open {
    overflow: hidden;
}

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

button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-color);
    border-radius: var(--radius);
    background: var(--panel-bg);
    color: var(--text-primary);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

input.is-edited,
select.is-edited,
textarea.is-edited {
    border-color: #d64545;
    box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.12);
    color: #b42318;
}

select {
    padding-right: 42px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: var(--select-caret-icon), var(--surface-gradient);
    background-repeat: no-repeat, no-repeat;
    background-position: right 14px center, center;
    background-size: 14px 14px, 100% 100%;
    cursor: pointer;
}

select:hover {
    border-color: #bfd3ea;
    background-image: var(--select-caret-icon), var(--surface-gradient-hover);
}

select::-ms-expand {
    display: none;
}

select option {
    color: var(--text-primary);
    background: var(--panel-bg);
}

.custom-select-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.custom-select-native {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.custom-select-trigger {
    position: relative;
    width: 100%;
    min-height: 42px;
    padding: 0 44px 0 14px;
    border: 1px solid var(--line-color);
    border-radius: 16px;
    background: var(--surface-gradient);
    color: var(--text-primary);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03), 0 6px 16px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, transform 0.2s ease;
    text-align: left;
    white-space: nowrap;
}

.custom-select-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 14px;
    height: 14px;
    background-image: var(--select-caret-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    pointer-events: none;
}

.custom-select-shell:hover .custom-select-trigger {
    border-color: #bfd3ea;
    background: var(--surface-gradient-hover);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03), 0 10px 22px rgba(15, 23, 42, 0.06);
}

.custom-select-shell.is-open .custom-select-trigger,
.custom-select-trigger:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.14), 0 14px 28px rgba(64, 158, 255, 0.12);
}

.custom-select-shell.is-open .custom-select-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-shell.is-disabled .custom-select-trigger {
    color: var(--text-placeholder);
    background: var(--surface-bg-raised);
    cursor: not-allowed;
}

.custom-select-shell.is-edited .custom-select-trigger {
    border-color: #d64545;
    box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.12);
    color: #b42318;
}

.custom-select-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-layer {
    position: fixed;
    inset: 0;
    z-index: 220;
}

.custom-select-layer.hidden {
    display: none;
}

.custom-select-dropdown {
    position: fixed;
    box-sizing: border-box;
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: var(--surface-bg-elevated);
    box-shadow: 0 26px 56px rgba(15, 23, 42, 0.18);
    overflow-x: hidden;
    overflow-y: auto;
}

.custom-select-option,
.custom-select-empty {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 14px;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.custom-select-option:hover:not(:disabled) {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.custom-select-option.is-selected {
    background: #409eff;
    color: #ffffff;
}

.custom-select-option.is-selected:hover:not(:disabled) {
    background: #409eff;
    color: #ffffff;
}

.custom-select-option:disabled {
    color: var(--text-placeholder);
    cursor: not-allowed;
}

.custom-select-dropdown.is-ai-tool-select {
    gap: 4px;
    padding: 8px;
    border-radius: 15px;
}

.custom-select-dropdown.is-ai-tool-select .custom-select-option,
.custom-select-dropdown.is-ai-tool-select .custom-select-empty {
    min-height: 30px;
    padding: 7px 11px;
    border-radius: 11px;
    font-size: 10px;
    line-height: 1.35;
}

input::placeholder {
    color: var(--text-placeholder);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.16);
}

textarea {
    min-height: 110px;
    padding-top: 12px;
    padding-bottom: 12px;
    resize: vertical;
}

h1,
h2,
h3,
p,
strong {
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--surface-bg-raised);
    text-align: center;
}

td {
    text-align: center;
}

.table-wrap td > .role-chip-list,
.table-wrap td > .inline-chip-list,
.table-wrap td > .row-actions,
.table-wrap td > .status-badge,
.table-wrap td > .module-tag,
.table-wrap td > .identity-tag,
.table-wrap td > .permission-type,
.table-wrap td > .json-inline,
.table-wrap td > .muted-inline {
    margin-inline: auto;
}

.table-wrap td > .role-chip-list,
.table-wrap td > .inline-chip-list,
.table-wrap td > .row-actions {
    justify-content: center;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}

.table-sort-button::after {
    content: "↕";
    color: #a1acc0;
    font-size: 12px;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.table-sort-button:hover {
    color: var(--primary-color);
}

.table-sort-button:hover::after,
.table-sort-button.is-active::after {
    color: var(--primary-color);
}

.table-sort-button.is-active[data-sort-dir="asc"]::after {
    content: "↑";
}

.table-sort-button.is-active[data-sort-dir="desc"]::after {
    content: "↓";
}

td {
    color: var(--text-primary);
    background: var(--surface-bg-soft);
}

tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

tbody tr:hover td {
    background: var(--surface-hover);
}

.role-permission-cell {
    width: 360px;
    min-width: 360px;
}

.hidden {
    display: none !important;
}

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

.message {
    min-height: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

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

.message.success {
    color: var(--success-color);
}

.field-block {
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
}

.field-block > span {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}

.field-block.is-edited > span {
    color: #d64545;
}

.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.checkbox-field input {
    width: 14px;
    min-height: 14px;
    margin: 0;
}

.name-library-select-column {
    width: 44px;
    min-width: 44px;
    text-align: center;
}

.name-library-table th,
.name-library-table td {
    text-align: center;
}

#panel-nameLibrary .table-wrap th,
#panel-nameLibrary .table-wrap td {
    text-align: center;
}

.name-library-select {
    width: 14px;
    min-width: 14px;
    height: 14px;
    min-height: 14px;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    box-shadow: none;
}

#selectAllNameLibraryPage {
    width: 14px;
    min-width: 14px;
    height: 14px;
    min-height: 14px;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    box-shadow: none;
}

.el-button {
    min-height: 40px;
    padding: 10px 16px;
    border: 1px solid var(--line-color);
    border-radius: var(--radius);
    background: var(--surface-bg);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1;
    transition: 0.2s;
    transition-property: transform, border-color, color, background-color, box-shadow;
}

.el-button:hover {
    color: var(--primary-color);
    border-color: #c6e2ff;
    background: #ecf5ff;
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.12);
}

.el-button-primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--button-text-on-accent);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

.el-button-primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    color: var(--button-text-on-accent);
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.24);
}

.el-button.is-plain,
.el-button-primary.is-plain {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: #b3d8ff;
}

.el-button.danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--danger-color);
}

.el-button.danger:hover:not(:disabled) {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.el-button.danger:disabled {
    border-color: #e5e7eb;
    background: var(--surface-bg-raised);
    color: #9ca3af;
    box-shadow: none;
}

.el-button-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary-color);
}

.el-button-link:hover {
    color: var(--primary-hover);
    background: transparent;
}

.el-button-link.danger {
    color: var(--danger-color);
}

.el-button-link.danger:hover {
    color: #f78989;
}

.row-status-action {
    width: 72px;
    min-width: 72px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transition: 0.2s;
    transition-property: border-color, color, background-color;
}

.row-status-action.is-enable-action {
    border-color: #b3e19d;
    background: #f0f9eb;
    color: var(--success-color);
}

.row-status-action.is-enable-action:hover {
    border-color: var(--success-color);
    background: #e1f3d8;
}

.row-status-action.is-disable-action {
    border-color: #fab6b6;
    background: var(--danger-light);
    color: var(--danger-color);
}

.row-status-action.is-disable-action:hover {
    border-color: var(--danger-color);
    background: #fde2e2;
}

.login-view {
    min-height: 100vh;
    padding: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 30%),
        linear-gradient(180deg, #eef4fb 0%, #e5edf6 100%);
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 540px);
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: 32px 56px;
    color: #ffffff;
    background: rgba(41, 49, 70, 0.95);
}

.login-hero-backdrop {
    position: absolute;
    inset: 0;
    background: center / cover no-repeat url("/admin/assets/muming/login-bg.svg");
    opacity: 0.36;
}

.login-hero-header,
.login-hero-visual {
    position: relative;
    z-index: 1;
}

.login-hero-header {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 20px;
    font-weight: 700;
}

.login-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.login-hero-visual {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 24px;
    text-align: center;
}

.login-box-graphic {
    width: min(360px, 60%);
    max-width: 360px;
}

.login-hero-copy {
    max-width: 560px;
    display: grid;
    gap: 14px;
}

.login-hero-copy h1 {
    font-size: 36px;
    line-height: 1.3;
    font-weight: 700;
}

.login-hero-copy p {
    color: rgba(255, 255, 255, 0.84);
    font-size: 16px;
}

.login-panel-area {
    display: grid;
    grid-template-rows: 80px 1fr;
    padding: 20px 32px 32px;
    background: var(--surface-bg-raised);
}

.login-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.login-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--surface-bg-muted);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.login-panel {
    width: min(100%, 360px);
    margin: auto;
    padding: 36px 34px;
    border: 1px solid rgba(232, 237, 243, 0.92);
    border-radius: 28px;
    background: var(--surface-bg-soft);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
}

.login-panel-head {
    display: grid;
    gap: 10px;
    margin-bottom: 28px;
}

.login-panel-head h2 {
    font-size: 30px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.login-panel-head p {
    color: var(--text-secondary);
}

.login-mobile-brand {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form .field-block {
    width: 100%;
    justify-items: stretch;
    text-align: left;
}

.login-form .field-block > span {
    color: #8a9ab0;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.login-form input {
    min-height: 44px;
    padding: 0 14px;
    border-color: #d8e1ec;
    border-radius: 14px;
    background: var(--surface-bg);
    color: #1f2a44;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    text-align: left;
}

.login-form input::placeholder {
    color: #a1aec1;
    text-align: left;
}

.login-form input:focus {
    border-color: var(--primary-color);
    background: var(--surface-bg);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.14);
}

.login-form .password-field {
    width: 100%;
}

.login-form .password-field input {
    padding-right: 42px;
}

.login-form .toggle-password {
    color: #94a3b8;
}

.login-form .toggle-password:hover {
    color: var(--primary-color);
    background: transparent;
    box-shadow: none;
}

.login-form-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-submit {
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
}

body[data-theme="dark"] .login-view {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 28%),
        linear-gradient(180deg, #0a1422 0%, #0d1828 100%);
}

body[data-theme="dark"] .login-panel-area {
    background: linear-gradient(180deg, rgba(9, 16, 28, 0.96) 0%, rgba(11, 19, 31, 0.98) 100%);
}

body[data-theme="dark"] .login-status {
    background: rgba(148, 163, 184, 0.12);
    color: #b5c4d8;
    border: 1px solid rgba(148, 163, 184, 0.16);
}

body[data-theme="dark"] .login-panel {
    border-color: rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(16, 24, 38, 0.96) 0%, rgba(12, 20, 33, 0.98) 100%);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .login-panel-head h2,
body[data-theme="dark"] .login-mobile-brand strong {
    color: #e6eef9;
}

body[data-theme="dark"] .login-form .field-block > span {
    color: #9fb0c7;
}

body[data-theme="dark"] .login-form input {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(148, 163, 184, 0.1);
    color: #edf4ff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .login-form input::placeholder {
    color: #7f92ab;
}

body[data-theme="dark"] .login-form input:focus {
    border-color: rgba(96, 165, 250, 0.5);
    background: rgba(15, 23, 36, 0.98);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

body[data-theme="dark"] .login-form .toggle-password {
    color: #7f92ab;
}

body[data-theme="dark"] .login-form .toggle-password:hover {
    color: #9cc8ff;
}

body[data-theme="dark"] .login-submit {
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.94) 0%, rgba(59, 130, 246, 0.9) 100%);
    color: #edf4ff;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.28);
}

body[data-theme="dark"] .login-submit:hover {
    border-color: rgba(147, 197, 253, 0.42);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.98) 0%, rgba(96, 165, 250, 0.94) 100%);
    color: #f8fbff;
    box-shadow: 0 22px 42px rgba(37, 99, 235, 0.32);
}

.dashboard-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    background: var(--app-content-bg-color);
}

.sidebar-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 18%),
        var(--left-menu-bg-color);
    color: var(--left-menu-text-color);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 16px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo-image {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.sidebar-logo-brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapse-button {
    flex: 0 0 auto;
    width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
}

.sidebar-collapse-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--button-text-on-accent);
}

.sidebar-collapse-button-bar {
    position: relative;
    width: 12px;
    height: 10px;
    border-left: 2px solid currentColor;
}

.sidebar-collapse-button-bar::before,
.sidebar-collapse-button-bar::after {
    content: "";
    position: absolute;
    right: 0;
    width: 7px;
    height: 2px;
    background: currentColor;
}

.sidebar-collapse-button-bar::before {
    top: 1px;
}

.sidebar-collapse-button-bar::after {
    bottom: 1px;
}

body[data-sidebar-collapsed="1"] .sidebar-logo {
    padding-inline: 10px;
    justify-content: center;
}

body[data-sidebar-collapsed="1"] .sidebar-logo-brand {
    width: 100%;
    justify-content: center;
}

body[data-sidebar-collapsed="1"] .sidebar-logo-brand strong {
    width: 0;
    opacity: 0;
}

body[data-sidebar-collapsed="1"] .sidebar-tabs {
    padding-inline: 8px;
}

body[data-sidebar-collapsed="1"] .sidebar-group-title,
body[data-sidebar-collapsed="1"] .tab-button {
    justify-content: center;
    padding-inline: 8px;
}

body[data-sidebar-collapsed="1"] .sidebar-submenu .tab-button,
body[data-sidebar-collapsed="1"] .sidebar-tabs > .tab-button {
    width: 48px;
    margin-inline: auto;
}

body[data-sidebar-collapsed="1"] .sidebar-group-title {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

body[data-sidebar-collapsed="1"] .sidebar-group-title::after {
    flex-basis: 48px;
}

body[data-sidebar-collapsed="1"] .sidebar-group-title > span:first-child,
body[data-sidebar-collapsed="1"] .tab-copy {
    width: 0;
    overflow: hidden;
    opacity: 0;
}

body[data-sidebar-collapsed="1"] .tab-button.is-child {
    padding-left: 8px;
}

.sidebar-tabs {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 0;
    padding: 14px 10px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 7px;
    padding: 8px 10px 12px;
}

.sidebar-footer-button {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-footer-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--button-text-on-accent);
    transform: translateY(-1px);
}

.sidebar-footer-button-primary {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(56, 189, 248, 0.16));
    border-color: rgba(96, 165, 250, 0.3);
}

.sidebar-footer-button-icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-moon {
    display: none;
}

#themeToggleButton[data-next-theme="light"] .theme-icon-sun {
    display: none;
}

#themeToggleButton[data-next-theme="light"] .theme-icon-moon {
    display: block;
}

#sidebarCollapseButton[data-collapsed="1"] .collapse-icon {
    transform: rotate(180deg);
}

.sidebar-footer-button-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

body[data-sidebar-collapsed="1"] .sidebar-footer {
    padding-inline: 8px;
}

body[data-sidebar-collapsed="1"] .sidebar-footer-button {
    justify-content: center;
    padding-inline: 8px;
    width: 48px;
    margin-inline: auto;
}

body[data-sidebar-collapsed="1"] .sidebar-footer-button-label {
    width: 0;
    opacity: 0;
}

.sidebar-menu-group {
    display: grid;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.sidebar-menu-group-static {
    gap: 5px;
}

.sidebar-group-title {
    width: 100%;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 11px 2px;
    background: transparent;
    color: rgba(255, 255, 255, 0.64);
    font-size: 10px;
    letter-spacing: 0.06em;
    font-weight: 600;
    text-align: left;
}

.sidebar-group-title::after {
    content: "";
    flex: 0 0 68px;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-submenu {
    display: grid;
    gap: 5px;
    padding: 0;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 11px;
    color: inherit;
    text-align: left;
    border-left: 0;
    border-radius: 11px;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.sidebar-tabs > .tab-button {
    width: 100%;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.tab-button.is-child {
    padding-left: 12px;
}

.tab-button:hover {
    color: var(--left-menu-text-active-color);
    background: rgba(255, 255, 255, 0.07);
}

.tab-button.active {
    color: var(--left-menu-text-active-color);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.24), rgba(255, 255, 255, 0.06));
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.24);
}

.tab-icon-wrap {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.92;
}

.tab-copy {
    font-size: 13px;
    line-height: 1;
}

.workspace-shell {
    min-width: 0;
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
    background: var(--top-header-bg-color);
    backdrop-filter: blur(16px);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    min-width: 0;
}

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

.topbar-theme-button {
    min-height: 32px;
    padding: 6px 12px;
    white-space: nowrap;
}

.topbar-account-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: min(560px, 52vw);
    min-height: 40px;
    padding: 4px 5px 4px 12px;
    border: 1px solid rgba(216, 224, 234, 0.92);
    border-radius: 14px;
    background: var(--panel-bg);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-items: end;
    min-width: 0;
}

.topbar-user-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

.topbar-user-main strong {
    overflow: hidden;
    max-width: 150px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 11px;
}

.current-role-list {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.topbar-role-list {
    max-width: 230px;
    overflow: hidden;
}

.topbar-role-list .role-chip-list {
    flex-wrap: nowrap;
    overflow: hidden;
}

.topbar-role-list .role-chip {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-logout-button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 12px;
    white-space: nowrap;
}

.workspace-content {
    min-width: 0;
    height: calc(100vh - var(--header-height));
    padding: clamp(12px, 1vw, 18px);
    overflow: hidden;
}

.workspace-content-inner {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    margin: 0 auto;
    padding-inline: 0;
}

.tab-panels {
    height: 100%;
    min-height: 0;
    display: grid;
    gap: 12px;
}

.tab-panel {
    display: none;
    gap: 14px;
    align-content: start;
    grid-auto-rows: max-content;
}

.tab-panel.active {
    display: grid;
}

#panel-home {
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
}

.home-ai-tools {
    height: 100%;
    min-height: 0;
    display: block;
}

.ai-session-sidebar {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.ai-session-strip {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 0;
    margin-bottom: 0;
}

.ai-session-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ai-session-head strong {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ai-session-new-button {
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}

.ai-session-list {
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 8px;
    overflow: auto;
}

.ai-session-strip .ai-session-list {
    display: grid;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    max-height: min(360px, 52vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
}

.ai-session-strip .ai-session-list::-webkit-scrollbar {
    display: none;
}

.ai-session-item {
    flex: 0 1 260px;
    max-width: min(100%, 260px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.86);
    color: var(--text-primary);
    transition: 0.2s;
    transition-property: border-color, background-color, box-shadow;
}

.ai-session-strip .ai-session-item {
    width: 100%;
    max-width: 100%;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 14px;
}

.ai-session-dropdown-button {
    min-width: 78px;
}

.ai-session-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 90;
    display: none;
    width: min(280px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: var(--surface-bg-elevated);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.ai-session-strip.open .ai-session-dropdown-menu {
    display: block;
}

.ai-session-item:hover {
    border-color: rgba(64, 158, 255, 0.26);
    background: rgba(59, 130, 246, 0.08);
}

.ai-session-item.active {
    border-color: rgba(64, 158, 255, 0.38);
    background: linear-gradient(180deg, rgba(234, 241, 255, 0.96) 0%, rgba(222, 235, 255, 0.86) 100%);
    box-shadow: inset 0 0 0 1px rgba(64, 158, 255, 0.12);
}

.ai-session-main {
    min-width: 0;
    display: grid;
    gap: 4px;
    color: inherit;
    text-align: left;
}

.ai-session-strip .ai-session-main {
    gap: 1px;
}

.ai-session-main strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-session-main span {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-session-actions {
    display: grid;
    gap: 2px;
    justify-items: end;
}

.ai-session-rename-form {
    gap: 3px;
}

.ai-session-rename-input {
    width: 100%;
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 10px;
    background: var(--surface-bg-soft);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    outline: none;
}

.ai-session-rename-input:focus {
    border-color: rgba(59, 130, 246, 0.58);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ai-session-rename,
.ai-session-rename-save,
.ai-session-rename-cancel,
.ai-session-delete {
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
}

.ai-session-rename:hover,
.ai-session-rename-save:hover,
.ai-session-rename-cancel:hover,
.ai-session-delete:hover {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-hover);
}

.ai-session-delete {
    color: #fda4af;
}

.ai-session-delete:hover {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
    color: #ffe4e6;
}

.ai-chat-workspace {
    grid-area: workspace;
    min-width: 0;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
    padding: 0 0 8px;
    border: 1px solid rgba(204, 218, 235, 0.78);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.ai-chat-workspace .ai-tool-result-wrap,
.home-ai-tools .ai-tool-result-wrap {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.home-ai-tools #aiToolResult {
    min-height: 0;
    height: 100%;
    overflow: visible;
    padding-right: 0;
}

.ai-result-scroll {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: none;
}

.ai-result-scroll::-webkit-scrollbar {
    display: none;
}

.ai-chat-thread {
    display: grid;
    gap: 14px;
    padding: 2px 2px 8px;
}

.ai-tools-panel {
    align-content: stretch;
    gap: 10px;
}

.content-wrap {
    padding: 12px 14px;
    border: 1px solid #e7edf4;
    border-radius: 18px;
    background: var(--panel-bg);
    box-shadow: none;
}

body[data-theme="dark"] .content-wrap,
body[data-theme="dark"] td,
body[data-theme="dark"] .ai-session-item,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .row-more-menu,
body[data-theme="dark"] .floating-menu-panel,
body[data-theme="dark"] .custom-select-dropdown,
body[data-theme="dark"] .dialog-card,
body[data-theme="dark"] .topbar-account-card,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .el-button {
    background: var(--panel-bg);
}

body[data-theme="dark"] .el-button:not(.el-button-primary):not(.danger):not(.row-action-button):not(.row-more-trigger):not(.ai-session-restore) {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #dbe8ff;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .custom-select-trigger,
body[data-theme="dark"] .pager-button {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d7e0ec;
    box-shadow: none;
}

body[data-theme="dark"] select {
    background-image: var(--select-caret-icon), linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.04) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 14px center, center;
    background-size: 14px 14px, 100% 100%;
}

body[data-theme="dark"] .custom-select-trigger {
    background-image: none;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
    color: #8fa0b8;
}

body[data-theme="dark"] .custom-select-label {
    color: #d7e0ec;
}

body[data-theme="dark"] select:hover,
body[data-theme="dark"] .custom-select-shell:hover .custom-select-trigger,
body[data-theme="dark"] .pager-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(96, 165, 250, 0.2);
    box-shadow: none;
}

body[data-theme="dark"] .custom-select-shell.is-disabled .custom-select-trigger,
body[data-theme="dark"] .pager-button:disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    color: #6f8098;
    box-shadow: none;
}

body[data-theme="dark"] th {
    background: rgba(255, 255, 255, 0.03);
}

body[data-theme="dark"] .table-wrap {
    background: rgba(10, 17, 29, 0.94);
}

body[data-theme="dark"] .table-wrap th {
    background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .table-wrap td {
    background: rgba(10, 17, 29, 0.96);
}

body[data-theme="dark"] .table-wrap tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .ai-session-item {
    background: rgba(10, 17, 29, 0.96);
    border-color: var(--line-color);
}

body[data-theme="dark"] .ai-session-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(96, 165, 250, 0.32);
}

body[data-theme="dark"] .ai-session-item.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

body[data-theme="dark"] .ai-session-rename-input {
    background: rgba(15, 23, 36, 0.98);
    border-color: rgba(96, 165, 250, 0.32);
    color: #e7eef9;
}

body[data-theme="dark"] .ai-session-dropdown-menu {
    background: rgba(10, 17, 29, 0.98);
    border-color: var(--line-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .ai-session-delete:hover {
    background: rgba(220, 38, 38, 0.16);
}

body[data-theme="dark"] .ai-session-restore {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(96, 165, 250, 0.34);
    color: #9cc8ff;
}

body[data-theme="dark"] .ai-session-restore:hover {
    background: rgba(37, 99, 235, 0.24);
    border-color: rgba(147, 197, 253, 0.48);
    color: #dbeafe;
}

body[data-theme="dark"] .ai-tool-stage-wrap,
body[data-theme="dark"] .ai-tool-result-wrap,
body[data-theme="dark"] .ai-tool-message-user,
body[data-theme="dark"] .result-card,
body[data-theme="dark"] .ai-tool-result-wrap .result-card-list,
body[data-theme="dark"] .ai-tool-result-wrap .empty-inline-note,
body[data-theme="dark"] .ai-name-result-panel,
body[data-theme="dark"] .ai-name-result-actions {
    background: rgba(10, 17, 29, 0.96);
    border-color: var(--line-color);
}

body[data-theme="dark"] .ai-chat-workspace {
    background: linear-gradient(180deg, rgba(14, 18, 25, 0.985) 0%, rgba(10, 13, 19, 0.985) 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"] .ai-tool-result-wrap,
body[data-theme="dark"] .ai-tool-stage-wrap {
    background: transparent;
    box-shadow: none;
}

body[data-theme="dark"] .ai-tool-toolbar {
    background: transparent;
    border-top-color: transparent;
}

body[data-theme="dark"] .ai-tool-field-game-type select,
body[data-theme="dark"] .ai-tool-field-config select,
body[data-theme="dark"] .ai-tool-field-reasoning select,
body[data-theme="dark"] .ai-tool-field-game-type .custom-select-trigger,
body[data-theme="dark"] .ai-tool-field-config .custom-select-trigger,
body[data-theme="dark"] .ai-tool-field-reasoning .custom-select-trigger {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e7eef9;
}

body[data-theme="dark"] .ai-tool-field-prompt textarea {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body[data-theme="dark"] .ai-tool-stage-wrap {
    background: transparent;
    border-top-color: transparent;
}

body[data-theme="dark"] .ai-tool-field-prompt textarea:focus {
    border-color: transparent;
    box-shadow: none;
}

body[data-theme="dark"] .ai-tool-result-wrap .result-name-row span,
body[data-theme="dark"] .ai-tool-result-wrap .result-name-row p,
body[data-theme="dark"] .ai-name-result-reason {
    color: #aebed3;
}

body[data-theme="dark"] .ai-tool-result-wrap .result-name-row + .result-name-row {
    border-top-color: rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .ai-tool-result-wrap .empty-inline-note {
    background: rgba(255, 255, 255, 0.02);
}

body[data-theme="dark"] .agent-stream-card {
    background: rgba(15, 23, 36, 0.98);
    border-color: var(--line-color);
}

body[data-theme="dark"] .agent-stream-line {
    color: #aebcd0;
}

body[data-theme="dark"] .agent-stream-dot {
    background: rgba(148, 163, 184, 0.5);
}

body[data-theme="dark"] .agent-stream-text {
    border-color: rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(20, 28, 41, 0.98) 0%, rgba(16, 23, 35, 0.98) 100%);
    color: #dbe7f5;
}

body[data-theme="dark"] .ai-name-result-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .ai-name-result-table th {
    background: rgba(255, 255, 255, 0.03);
    color: #8fa0b8;
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .ai-name-result-table td {
    background: transparent;
    color: #dbe4f2;
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .ai-name-result-checkall,
body[data-theme="dark"] .ai-name-selected-summary,
body[data-theme="dark"] .muted-cell,
body[data-theme="dark"] .muted-inline {
    color: #90a1b8;
}

body[data-theme="dark"] .role-chip,
body[data-theme="dark"] .identity-tag,
body[data-theme="dark"] .permission-type-menu {
    background: rgba(37, 99, 235, 0.2);
    color: #8fc2ff;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
}

body[data-theme="dark"] .mini-chip,
body[data-theme="dark"] .module-tag {
    background: rgba(255, 255, 255, 0.06);
    color: #b5c1d4;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .mini-chip.permission-status-disabled,
body[data-theme="dark"] .status-badge.muted {
    background: rgba(255, 255, 255, 0.04);
    color: #8b9ab0;
    border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .permission-type-button {
    background: rgba(217, 119, 6, 0.16);
    color: #f8c277;
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.18);
}

body[data-theme="dark"] .status-badge.is-enabled,
body[data-theme="dark"] .status-badge.success {
    background: rgba(21, 128, 61, 0.18);
    color: #92d7a9;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.12);
}

body[data-theme="dark"] .status-badge.is-disabled {
    background: rgba(220, 38, 38, 0.16);
    color: #ff9a9a;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.12);
}

body[data-theme="dark"] .row-action-button,
body[data-theme="dark"] .row-more-trigger {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #c9d5e6;
    box-shadow: none;
}

body[data-theme="dark"] .row-action-button:hover,
body[data-theme="dark"] .row-more-trigger:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(96, 165, 250, 0.24);
    color: var(--button-text-on-accent);
}

body[data-theme="dark"] .row-action-button.danger,
body[data-theme="dark"] .row-more-item.danger {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(248, 113, 113, 0.18);
    color: #ff8f8f;
}

body[data-theme="dark"] .row-action-button.danger:hover,
body[data-theme="dark"] .row-more-item.danger:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(248, 113, 113, 0.24);
    color: #ffb0b0;
}

body[data-theme="dark"] .row-action-button:disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    color: #68778d;
}

body[data-theme="dark"] .floating-menu-panel,
body[data-theme="dark"] .row-more-menu {
    background: rgba(10, 17, 29, 0.98);
    border-color: var(--line-color);
}

body[data-theme="dark"] .search-field input,
body[data-theme="dark"] .search-field select,
body[data-theme="dark"] .search-field textarea,
body[data-theme="dark"] .search-field .custom-select-trigger,
body[data-theme="dark"] select.page-size-select,
body[data-theme="dark"] .custom-select-shell.page-size-select .custom-select-trigger {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d7e0ec;
    box-shadow: none;
}

body[data-theme="dark"] .search-field select,
body[data-theme="dark"] select.page-size-select {
    background-image: var(--select-caret-icon), linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.04) 100%);
}

body[data-theme="dark"] .search-field select:hover,
body[data-theme="dark"] select.page-size-select:hover,
body[data-theme="dark"] .search-field .custom-select-shell:hover .custom-select-trigger,
body[data-theme="dark"] .custom-select-shell.page-size-select:hover .custom-select-trigger {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(96, 165, 250, 0.2);
    box-shadow: none;
}

body[data-theme="dark"] .search-field input::placeholder,
body[data-theme="dark"] .search-field textarea::placeholder,
body[data-theme="dark"] .search-field .custom-select-label,
body[data-theme="dark"] select.page-size-select,
body[data-theme="dark"] .pagination-total,
body[data-theme="dark"] .pagination-shell {
    color: #8fa0b8;
}

body[data-theme="dark"] #deleteSelectedNameLibraryButton:disabled,
body[data-theme="dark"] .el-button.danger:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #7f8ea3;
    box-shadow: none;
}

body[data-theme="dark"] .row-more-item {
    color: #c9d5e6;
}

body[data-theme="dark"] .row-more-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--button-text-on-accent);
}

body[data-theme="dark"] .el-button:hover {
    background: rgba(64, 158, 255, 0.14);
}

body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .content-wrap,
body[data-theme="dark"] .dialog-card,
body[data-theme="dark"] .topbar-account-card,
body[data-theme="dark"] .row-more-menu,
body[data-theme="dark"] .floating-menu-panel,
body[data-theme="dark"] .custom-select-dropdown {
    border-color: var(--line-color);
}

.search-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 16px;
    align-items: end;
}

.search-form-row-wide {
    gap: 14px 16px;
}

.search-form-row-name-library {
    align-items: end;
}

.search-form-row-name-library .search-bar-actions {
    grid-column: auto;
}

.search-field {
    flex: 0 1 240px;
    display: grid;
    gap: 8px;
    min-width: 0;
    justify-items: start;
    text-align: left;
}

.search-field-fit-short {
    flex: 0 0 auto;
    width: min(100%, 168px);
}

.search-field-fit-medium {
    flex: 0 1 240px;
    width: min(100%, 240px);
}

.search-field-fit-fluid {
    flex: 1 1 320px;
    min-width: min(100%, 260px);
}

.search-field-fit-name-library-name {
    flex: 0 0 auto;
    width: min(100%, 20ch);
}

.search-field span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    text-align: left;
}

.search-field input,
.search-field select,
.search-field textarea,
.search-field .custom-select-trigger,
.search-field .custom-select-label {
    text-align: left;
}

.search-bar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding-top: 20px;
}

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

.table-summary {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: var(--surface-bg);
}

.row-empty {
    color: var(--text-secondary);
    text-align: center;
}

.muted-cell,
.muted-inline {
    color: #909399;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-actions-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-action-button {
    width: 72px;
    min-width: 72px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.row-action-button.danger {
    border-color: #fecaca;
    background: #fff5f5;
    color: var(--danger-color);
}

.row-action-button.danger:hover {
    border-color: #fda4af;
    background: #ffe4e6;
    color: var(--danger-color);
}

.row-action-button:disabled {
    border-color: var(--line-color);
    background: var(--surface-bg-raised);
    color: var(--text-placeholder);
    cursor: not-allowed;
    box-shadow: none;
}

.row-more-wrap {
    position: relative;
    display: inline-flex;
}

.row-more-trigger {
    width: 72px;
    min-width: 72px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: none;
    border: 1px solid var(--line-color);
    border-radius: 999px;
    background: var(--surface-bg);
    color: var(--primary-color);
}

.row-more-wrap.open .row-more-menu {
    display: none;
}

.floating-menu-layer {
    position: fixed;
    inset: 0;
    z-index: 160;
}

.floating-menu-layer.hidden {
    display: none;
}

.floating-menu-panel {
    position: absolute;
    min-width: 140px;
    padding: 8px 0;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: var(--surface-bg-elevated);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 161;
}

.row-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: none;
    min-width: 108px;
    padding: 8px 0;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: var(--surface-bg-elevated);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.row-more-item {
    width: calc(100% - 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 6px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-primary);
    text-align: center;
}

.row-more-item + .row-more-item {
    margin-top: 2px;
}

.row-more-item:hover {
    background: var(--surface-hover);
}

.row-more-item.danger {
    color: var(--danger-color);
}

.row-more-item:disabled {
    color: var(--text-placeholder);
    cursor: not-allowed;
    background: transparent;
}

.pagination-shell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.pagination-total {
    white-space: nowrap;
}

.page-size-select {
    width: 116px;
    background-image: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.custom-select-shell.page-size-select {
    width: 116px;
}

.custom-select-shell.page-size-select .custom-select-trigger {
    min-height: 34px;
    padding: 0 32px 0 12px;
    border-radius: 12px;
    font-size: 12px;
}

.custom-select-shell.page-size-select .custom-select-trigger::after {
    right: 10px;
}

.custom-select-shell.page-size-select .custom-select-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.pagination-buttons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pager-button {
    min-width: 34px;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line-color);
    border-radius: 12px;
    background: var(--surface-bg);
    color: var(--text-primary);
}

.pager-button:hover:not(:disabled) {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.pager-button.active {
    color: var(--button-text-on-accent);
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.pager-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination-jumper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.page-jump-input {
    width: 52px;
    min-height: 30px;
    text-align: center;
}

.dialog-mask {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.45);
}

.dialog-mask.open {
    display: flex;
}

.dialog-card {
    width: min(640px, 100%);
    max-height: min(88vh, 100%);
    overflow: auto;
    padding: 18px 18px;
    border: 1px solid rgba(232, 237, 243, 0.95);
    border-radius: 24px;
    background: var(--surface-bg-elevated);
    box-shadow: var(--shadow-login);
}

.dialog-card-wide {
    width: min(800px, 100%);
}

.dialog-card-extra-wide {
    width: min(1040px, 100%);
}

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

.dialog-head h2 {
    font-size: 18px;
    font-weight: 600;
}

.dialog-close {
    font-size: 18px;
    line-height: 1;
    color: var(--text-secondary);
}

.dialog-form {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
    justify-items: center;
    text-align: center;
}

.dialog-form .field-block {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
    text-align: left;
}

.dialog-form .field-block > span {
    width: 100%;
    text-align: left;
}

.dialog-form input,
.dialog-form textarea,
.dialog-form select,
.dialog-form .custom-select-trigger,
.dialog-form .custom-select-label {
    text-align: left;
}

.dialog-form input::placeholder,
.dialog-form textarea::placeholder {
    text-align: left;
}

.dialog-grid {
    display: grid;
    gap: 12px 12px;
    align-items: end;
}

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

.dialog-grid-form-single {
    grid-template-columns: 1fr;
}

.dialog-grid-game-type {
    grid-template-columns: 1fr;
}

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

.dialog-grid-name-library-edit {
    grid-template-columns: 1fr;
}

.dialog-grid-form-single, .dialog-grid-game-type, .dialog-grid-game-config, .dialog-grid-name-library-edit {
    width: 100%;
    min-width: 0;
}

.dialog-grid-span-2 {
    grid-column: 1 / -1;
}

.dialog-grid-game-type .dialog-grid-span-2 {
    grid-column: auto;
}

.dialog-grid-game-config .dialog-grid-span-2 {
    grid-column: auto;
}

.dialog-field-fit-short {
    width: 100%;
}

.dialog-field-fit-medium {
    width: 100%;
}

.dialog-field-fit-full {
    grid-column: 1 / -1;
    width: 100%;
}

.dialog-field-fit-full .password-field {
    width: 100%;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin-top: 2px;
}

.dialog-footer .el-button {
    min-height: 32px;
    padding: 6px 12px;
}

.modal-message {
    width: 100%;
    min-width: 0;
    margin-top: 8px;
}

.ai-tool-stage-wrap {
    position: relative;
    padding: 0;
    margin: 0 12px 12px;
    border: 0;
    border-top: 1px solid #d5e0ec;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(229, 236, 245, 0.78) 0%, rgba(218, 228, 240, 0.82) 100%);
    box-shadow: none;
    overflow: hidden;
}

.ai-tool-form {
    gap: 0;
    min-height: 100%;
    justify-items: stretch;
    text-align: left;
}

.ai-tool-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 100%;
}

.ai-tool-field {
    gap: 10px;
    justify-items: stretch;
    text-align: left;
}

.ai-tool-field > span {
    color: var(--text-secondary);
    font-size: 18px;
    letter-spacing: 0.04em;
    font-weight: 700;
    text-align: left;
}

.ai-tool-field-prompt {
    min-height: 0;
    padding: 18px 22px 12px;
    justify-items: stretch;
    text-align: left;
}

.ai-tool-field-prompt textarea {
    min-height: 78px;
    max-height: 170px;
    padding: 14px 16px 8px;
    border: 0;
    border-radius: 18px;
    background: rgba(226, 235, 246, 0.44);
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.72;
    resize: none;
    box-shadow: none;
    text-align: left;
}

.ai-tool-field-prompt textarea::placeholder {
    color: var(--text-placeholder);
    text-align: left;
}

.ai-tool-field-prompt textarea:focus {
    box-shadow: none;
}

.ai-tool-toolbar {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: end;
    justify-content: flex-end;
    justify-self: stretch;
    gap: 11px 13px;
    margin-top: auto;
    padding: 10px 14px 13px;
    border-top: 0;
    background: transparent;
}

.ai-tool-toolbar-fields {
    display: grid;
    grid-template-columns: 144px minmax(168px, 1fr) max-content;
    align-items: end;
    gap: 10px;
    min-width: 0;
}

.ai-tool-toolbar-actions {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}

.ai-tool-field-game-type,
.ai-tool-field-config {
    gap: 0;
    min-width: 0;
}

.ai-tool-field-reasoning {
    gap: 0;
    min-width: 0;
    width: max-content;
}

.ai-tool-field-game-type select,
.ai-tool-field-config select,
.ai-tool-field-game-type .custom-select-trigger,
.ai-tool-field-config .custom-select-trigger {
    min-height: 35px;
    padding: 0 35px 0 11px;
    border: 1px solid var(--line-color);
    border-radius: 13px;
    background: var(--surface-gradient);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.ai-tool-field-game-type .custom-select-trigger,
.ai-tool-field-config .custom-select-trigger,
.ai-tool-field-reasoning .custom-select-trigger {
    width: 100%;
}

.ai-tool-field-config select {
    min-height: 35px;
    padding: 0 35px 0 11px;
    border: 1px solid var(--line-color);
    border-radius: 13px;
    background: var(--surface-gradient);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.ai-tool-field-reasoning select,
.ai-tool-field-reasoning .custom-select-trigger {
    min-height: 35px;
    width: max-content;
    min-width: 90px;
    padding: 0 35px 0 11px;
    border: 1px solid var(--line-color);
    border-radius: 13px;
    background: var(--surface-gradient);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.ai-tool-field-reasoning select {
    width: max-content;
    min-width: 90px;
    padding: 0 35px 0 11px;
    border: 1px solid var(--line-color);
    border-radius: 13px;
    background: var(--surface-gradient);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.ai-tool-field-game-type select:focus,
.ai-tool-field-config select:focus,
.ai-tool-field-reasoning select:focus,
.ai-tool-field-game-type .custom-select-trigger:focus,
.ai-tool-field-config .custom-select-trigger:focus,
.ai-tool-field-reasoning .custom-select-trigger:focus {
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.ai-tool-field-game-type option,
.ai-tool-field-config option,
.ai-tool-field-reasoning option {
    color: var(--text-primary);
    font-size: 11px;
}

.ai-tool-field-game-type .custom-select-trigger::after,
.ai-tool-field-config .custom-select-trigger::after,
.ai-tool-field-reasoning .custom-select-trigger::after {
    right: 11px;
    width: 11px;
    height: 11px;
    background-size: 11px 11px;
}

#generateNameButton {
    min-width: 106px;
    min-height: 35px;
    padding: 0 18px;
    border-radius: 13px;
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.92) 0%, rgba(59, 130, 246, 0.88) 100%);
    color: #ecf6ff;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
    white-space: nowrap;
}

#generateNameButton:hover {
    border-color: rgba(147, 197, 253, 0.4);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.96) 0%, rgba(96, 165, 250, 0.92) 100%);
    color: #f8fbff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.26);
}

#generateNameButton:disabled {
    border-color: #a7cfff;
    background: #a7cfff;
    cursor: wait;
    box-shadow: none;
}

.ai-tool-result-wrap {
    min-height: 300px;
    padding: 14px 14px 12px;
    border: 0;
    border-radius: 26px 26px 0 0;
    background: transparent;
    box-shadow: none;
}

.ai-tool-result-head {
    display: grid;
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.ai-tool-result-head .table-toolbar-left {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-tool-result-actions {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    overflow: visible;
}

.ai-tool-result-action {
    min-width: 0;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border-color: var(--line-color);
    background: rgba(234, 241, 255, 0.72);
    color: var(--text-secondary);
    white-space: nowrap;
    flex: 0 0 auto;
}

.ai-tool-result-action:hover {
    border-color: rgba(96, 165, 250, 0.34);
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-hover);
}

.ai-tool-result-action.danger {
    color: #fecdd3;
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.18);
}

.ai-tool-result-action.danger:hover {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fff1f2;
}

.ai-tool-message-user {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    justify-self: end;
    max-width: min(520px, 82%);
    padding: 14px 16px;
    border: 1px solid rgba(64, 158, 255, 0.16);
    border-radius: 20px 20px 10px 20px;
    background: linear-gradient(180deg, rgba(245, 249, 255, 0.98) 0%, rgba(233, 241, 255, 0.98) 100%);
}

.ai-session-message-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.ai-session-restore {
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 999px;
    background: rgba(234, 241, 255, 0.82);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
}

.ai-session-restore:hover {
    border-color: rgba(96, 165, 250, 0.36);
    background: rgba(59, 130, 246, 0.12);
}

.ai-tool-message-user p {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.agent-stream-card {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
}

.agent-stream-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.agent-stream-line p {
    margin: 0;
}

.agent-stream-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(82, 96, 113, 0.35);
}

.agent-stream-line.is-active .agent-stream-dot {
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.agent-stream-text {
    max-height: none;
    min-height: 104px;
    margin: 0;
    padding: 12px 14px;
    overflow: visible;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.96);
    color: var(--text-primary);
    font: 12px/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-stream-text::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 1em;
    margin-left: 4px;
    border-right: 2px solid var(--primary-color);
    vertical-align: -2px;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    padding-right: 42px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.toggle-password-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toggle-password-icon-hide {
    display: none;
}

.toggle-password.is-visible .toggle-password-icon-show {
    display: none;
}

.toggle-password.is-visible .toggle-password-icon-hide {
    display: block;
}

.toast-stack {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 180;
    display: grid;
    gap: 10px;
    transform: translateX(-50%);
    pointer-events: none;
}

.toast-message {
    min-width: 260px;
    padding: 10px 16px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.78);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.toast-message.success {
    background: rgba(103, 194, 58, 0.94);
}

.toast-message.error {
    background: rgba(245, 108, 108, 0.96);
}

.role-chip-list,
.inline-chip-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.role-chip-list.compact {
    justify-content: flex-end;
}

.role-chip,
.mini-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.mini-chip {
    background: var(--surface-bg-raised);
    color: var(--text-secondary);
}

.mini-chip.permission-status-disabled {
    border: 1px dashed var(--line-color);
    background: var(--surface-bg);
    color: var(--text-placeholder);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.status-badge.success,
.status-badge.is-enabled {
    background: #f0f9eb;
    color: var(--success-color);
}

.status-badge.muted {
    background: var(--surface-bg-raised);
    color: var(--text-secondary);
}

.status-badge.is-disabled {
    background: var(--danger-light);
    color: var(--danger-color);
}

.permission-type,
.module-tag,
.identity-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.permission-type-menu {
    background: #ecf5ff;
    color: var(--primary-color);
}

.permission-type-button {
    background: var(--warning-light);
    color: var(--warning-color);
}

.module-tag {
    background: var(--surface-bg-raised);
    color: var(--text-secondary);
}

.identity-tag {
    background: var(--primary-light);
    color: var(--primary-color);
}

.json-inline {
    display: inline-block;
    max-width: 520px;
    overflow: hidden;
    color: var(--text-secondary);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.result-card {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 8px 14px;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: var(--surface-bg);
}

.result-card span {
    color: var(--text-secondary);
}

.result-card strong,
.result-card p {
    color: var(--text-primary);
}

.result-card-list {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
}

.result-name-row {
    display: grid;
    grid-template-columns: 36px minmax(120px, 1fr) 72px minmax(0, 2fr);
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
}

.result-name-row + .result-name-row {
    border-top: 1px solid var(--line-soft);
}

.result-name-row em {
    color: var(--success-color);
    font-style: normal;
    font-weight: 600;
}

.ai-tool-result-wrap .result-card-list {
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: var(--surface-bg-muted);
    overflow: hidden;
}

.ai-tool-result-wrap .result-name-row {
    grid-template-columns: 42px minmax(120px, 1fr) 84px minmax(0, 2fr);
    gap: 10px;
    padding: 12px 14px;
}

.ai-tool-result-wrap .result-name-row span {
    align-self: start;
    color: var(--text-secondary);
    font-weight: 600;
}

.ai-tool-result-wrap .result-name-row strong {
    font-size: 15px;
}

.ai-tool-result-wrap .result-name-row em {
    justify-self: start;
    min-width: 56px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f7ec;
    color: #1f9d55;
    text-align: center;
}

.ai-tool-result-wrap .result-name-row p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-tool-result-wrap .empty-inline-note {
    padding: 16px 18px;
    border: 1px dashed var(--line-color);
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.92);
    color: var(--text-secondary);
}

.ai-name-result-panel {
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    background: var(--surface-bg-soft);
    overflow: hidden;
}

.ai-name-result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(248, 250, 252, 0.92);
}

.ai-name-result-actions-right {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-name-result-checkall {
    flex: 0 0 auto;
    color: var(--text-primary);
    font-weight: 600;
}

.ai-name-result-table-wrap {
    overflow: visible;
}

.home-ai-tools .ai-name-result-table-wrap {
    scrollbar-width: none;
}

.home-ai-tools .ai-name-result-table-wrap::-webkit-scrollbar {
    display: none;
}

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

.ai-name-result-table th,
.ai-name-result-table td {
    padding: 11px 14px;
}

.ai-name-result-table th {
    font-size: 12px;
    letter-spacing: 0.04em;
}

.ai-name-result-table th:nth-child(1),
.ai-name-result-table td:nth-child(1),
.ai-name-result-table th:nth-child(2),
.ai-name-result-table td:nth-child(2),
.ai-name-result-table th:nth-child(3),
.ai-name-result-table td:nth-child(3),
.ai-name-result-table th:nth-child(4),
.ai-name-result-table td:nth-child(4) {
    text-align: center;
}

.ai-name-result-table tbody tr:hover td {
    background: rgba(64, 158, 255, 0.06);
}

.ai-name-select-col {
    width: 76px;
}

.ai-name-select,
.select-all-ai-names {
    width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    box-shadow: none;
}

.ai-name-result-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-name-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #e8f7ec;
    color: #1f9d55;
    font-size: 11px;
    font-weight: 700;
}

.ai-name-score-muted {
    background: var(--surface-bg-raised);
    color: #71717a;
    border-color: #e4e4e7;
}

.ai-name-score-band-excellent {
    background: #bbf7d0;
    color: #14532d;
    border-color: #22c55e;
}

.ai-name-score-band-great {
    background: #ccfbf1;
    color: #115e59;
    border-color: #5eead4;
}

.ai-name-score-band-good {
    background: #fef3c7;
    color: #92400e;
    border-color: #facc15;
}

.ai-name-score-band-fair {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fda4af;
}

.ai-name-score-band-low {
    background: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

.ai-name-result-reason {
    color: var(--text-secondary);
    line-height: 1.6;
}

.role-checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.role-checkbox-item,
.permission-checkbox-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: var(--surface-bg);
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.role-checkbox-item:hover,
.permission-checkbox-card:hover {
    border-color: #c6e2ff;
    background: var(--surface-hover);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.role-checkbox-item input,
.permission-checkbox-card input {
    width: 16px;
    min-height: 16px;
    margin-top: 2px;
}

.role-checkbox-copy,
.permission-checkbox-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.role-checkbox-copy strong,
.permission-checkbox-title strong {
    font-size: 14px;
    font-weight: 600;
}

.role-checkbox-copy small,
.permission-checkbox-copy span {
    color: var(--text-secondary);
    font-size: 12px;
    word-break: break-all;
}

.empty-inline-note {
    padding: 12px 14px;
    border: 1px dashed var(--line-color);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 13px;
}

.assign-role-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.assign-role-item {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: var(--surface-bg);
}

.assign-role-item span {
    color: var(--text-secondary);
    font-size: 13px;
}

.permission-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: var(--surface-bg);
}

.permission-toolbar-copy {
    display: grid;
    gap: 4px;
}

.permission-toolbar-copy span {
    color: var(--text-secondary);
    font-size: 13px;
}

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

.permission-matrix {
    display: grid;
    gap: 12px;
}

.permission-group {
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-bg);
}

.permission-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface-bg-raised);
    border-bottom: 1px solid var(--line-soft);
}

.permission-group-head span {
    color: var(--text-secondary);
    font-size: 11px;
}

.permission-group-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-column {
    padding: 12px 14px;
}

.permission-column + .permission-column {
    border-left: 1px solid var(--line-soft);
}

.permission-column h3 {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.permission-checkbox-list {
    display: grid;
    gap: 8px;
}

.permission-checkbox-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 1280px) {
    .topbar {
        padding: 0 20px;
    }

    .workspace-content-inner {
        max-width: 100%;
        padding-inline: clamp(10px, 1.5vw, 16px);
    }

    .search-form-row-name-library .search-bar-actions {
        grid-column: auto;
    }

    .search-bar-actions {
        grid-column: 1 / -1;
        padding-top: 0;
        flex-wrap: wrap;
    }

    .table-toolbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .ai-tool-toolbar {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .ai-tool-toolbar-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        flex: 1 1 620px;
    }

    .ai-tool-field-reasoning,
    .ai-tool-field-reasoning select {
        width: 100%;
    }

    .ai-tool-toolbar-actions {
        flex: 0 0 auto;
        margin-left: auto;
        justify-content: flex-end;
    }
}

@media (max-width: 1180px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-hero {
        display: none;
    }

    .login-mobile-brand {
        display: flex;
    }

    .search-form-row-name-library .search-bar-actions {
        grid-column: auto;
    }

    .search-bar-actions {
        padding-top: 0;
    }
}

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

    .sidebar-logo {
        height: auto;
        padding: 16px 18px 10px;
    }

    .sidebar-tabs {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }

    .workspace-shell {
        grid-template-rows: auto 1fr;
    }

    .topbar {
        padding: 14px 18px;
    }

    .topbar-right {
        width: 100%;
    }

    .topbar-account-card {
        width: 100%;
        max-width: none;
    }

    .tab-button {
        justify-content: flex-start;
        min-height: 40px;
        border-left: 0;
    }

    .tab-button.active {
        border-bottom-color: transparent;
    }
}

@media (max-width: 720px) {
    .login-panel-area {
        padding: 16px;
        grid-template-rows: 56px 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        min-height: auto;
        padding: 12px 16px;
    }

    .topbar-right {
        justify-content: stretch;
    }

    .topbar-account-card {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: none;
        justify-content: flex-start;
        padding: 12px;
        gap: 10px;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 6px 8px;
    }

    .topbar-user-main {
        flex-wrap: wrap;
        white-space: normal;
    }

    .topbar-user-main strong {
        max-width: 100%;
    }

    .topbar-role-list {
        max-width: 100%;
    }

    .topbar-role-list .role-chip-list {
        flex-wrap: wrap;
    }

    .current-role-list {
        justify-content: flex-start;
    }

    .topbar-logout-button {
        width: 100%;
    }

    .workspace-content {
        height: auto;
        min-height: calc(100vh - 120px);
        overflow: visible;
        padding: 12px;
    }

    .workspace-content-inner {
        height: auto;
        padding-inline: 0;
    }

    .content-wrap {
        padding: 16px;
    }

    .role-checkbox-group,
    .assign-role-meta,
    .permission-group-body {
        grid-template-columns: 1fr;
    }

    .search-form-row,
    .search-form-row-wide,
    .search-form-row-name-library {
        display: grid;
        grid-template-columns: 1fr;
    }

    .search-field,
    .search-field-fit-short,
    .search-field-fit-medium,
    .search-field-fit-fluid,
    .search-field-fit-name-library-name {
        width: 100%;
        min-width: 0;
    }

    .search-bar-actions,
    .dialog-footer,
    .permission-toolbar,
    .permission-toolbar-actions {
        flex-wrap: wrap;
    }

    .search-bar-actions > button,
    .dialog-footer > button,
    .permission-toolbar-actions > button {
        width: 100%;
    }

    .dialog-grid-2 {
        grid-template-columns: 1fr;
    }

    .dialog-grid-span-2 {
        grid-column: auto;
    }

    .ai-tool-field-prompt {
        padding: 20px 18px 16px;
    }

    .ai-tool-field-prompt textarea {
        min-height: 92px;
        max-height: 150px;
        padding: 16px 18px;
        border-radius: 20px;
    }

    .ai-tool-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 18px 18px;
        gap: 16px;
    }

    .ai-tool-toolbar-fields {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .ai-tool-toolbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        transform: none;
    }

    #generateNameButton {
        flex: 1 1 auto;
    }

    .ai-tool-result-wrap .result-name-row {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 8px 12px;
    }

    .ai-tool-result-wrap .result-name-row em,
    .ai-tool-result-wrap .result-name-row p {
        grid-column: 2;
    }

    .pagination-shell {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
        width: 100%;
    }

    .table-wrap thead {
        display: none;
    }

    .table-wrap tbody {
        display: grid;
        gap: 12px;
    }

    .table-wrap tr {
        border: 1px solid var(--line-soft);
        border-radius: 6px;
        overflow: hidden;
    }

    .table-wrap td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
        white-space: normal;
        word-break: break-word;
    }

    .role-permission-cell {
        min-width: 0;
    }

    .table-wrap td::before {
        content: attr(data-label);
        flex: 0 0 84px;
        color: var(--text-secondary);
        font-size: 12px;
    }

    .table-wrap td.row-empty {
        display: block;
        text-align: center;
    }

    .table-wrap td.row-empty::before {
        content: none;
    }

    .dialog-mask {
        align-items: end;
        padding: 0;
    }

    .dialog-card,
    .dialog-card-wide,
    .dialog-card-extra-wide {
        width: 100%;
        max-height: min(90vh, 100%);
        border-radius: 16px 16px 0 0;
        padding: 18px 16px;
    }
}
