:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #dfe5ee;
    --line-strong: #cbd4e1;
    --text: #172033;
    --muted: #68758a;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eaf1ff;
    --success: #16845b;
    --success-soft: #e8f7f0;
    --danger: #c2413a;
    --danger-soft: #fff0ee;
    --warning: #a15c12;
    --warning-soft: #fff7e7;
    --info: #176c8f;
    --info-soft: #e9f6fb;
    --shadow: 0 10px 28px rgba(23, 32, 51, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

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

button,
a.button {
    -webkit-tap-highlight-color: transparent;
}

code {
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-soft);
    color: #344054;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

[hidden] {
    display: none !important;
}

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

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

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 18px 14px 16px;
    border-right: 1px solid #e6e0f6;
    background: linear-gradient(180deg, #fbfaff 0%, #f5f2fe 55%, #efeaff 100%);
    color: #333333;
}

.sidebar .nav-label { color: #9b93c4; }

.sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0;
    padding: 11px 14px;
    border-radius: 10px;
    color: #55506b;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar .nav-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    opacity: 0.9;
    transition: opacity 0.16s ease;
}

.sidebar .nav-ico svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar .nav-link:hover .nav-ico,
.sidebar .nav-link.active .nav-ico {
    opacity: 1;
}

.sidebar .nav-link:hover {
    background: rgba(124, 92, 252, 0.10);
    color: #5b3fd6;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #8b5cf6, #6d4dfa);
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 92, 252, 0.28);
}

.sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-50%);
}

.sidebar .sidebar-user {
    border: 1px solid #eee9fc;
    background: #ffffff;
    color: #444;
    box-shadow: 0 6px 18px rgba(87, 61, 190, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar .sidebar-user:hover {
    border-color: #ded2fb;
    box-shadow: 0 10px 24px rgba(87, 61, 190, 0.14);
}

.sidebar .sidebar-admin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 13px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1a1830 0%, #2b2450 100%);
    color: #ece9ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar .sidebar-admin:hover {
    background: linear-gradient(135deg, #241f45 0%, #3a2f66 100%);
    color: #ffffff;
    transform: translateY(-1px);
}

.sidebar-admin-go {
    color: #a99cff;
    font-size: 13px;
    line-height: 1;
}

.sidebar .user-meta span { color: #7a68bd; }

.sidebar .text-button {
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #8b84a8;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sidebar .text-button:hover {
    border-color: #f6dcd8;
    background: #fff3f1;
    color: #d1573f;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 16px;
    line-height: 1.25;
}

.brand small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.side-nav {
    flex: 1;
    margin-top: 10px;
}

.nav-label {
    margin: 20px 10px 7px;
    color: #8b96a7;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.nav-link {
    display: block;
    margin: 10px 0;
    padding: 12px 30px 12px 40px;
    border-radius: 6px;
    color: #4a566a;
    font-weight: 600;
}


.nav-link:hover {
    background: #f3f6fa;
    color: var(--text);
}

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

.sidebar-user {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 11px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(140deg, #8b5cf6 0%, #6d4dfa 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(109, 77, 250, 0.28);
}

.user-meta {
    min-width: 0;
}

.user-meta strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2f2a44;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.user-meta span {
    display: inline-block;
    margin-top: 4px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f2eefe;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
}

.main {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 92px;
    padding: 18px 30px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
}

.topbar h1 {
    margin: 1px 0 0;
    font-size: 23px;
    line-height: 1.25;
    letter-spacing: 0;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.menu-toggle {
    display: none;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 0 9px;
    border: 1px solid #ded2fb;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #4a4265;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.side-nav-open .menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

body.side-nav-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

body.side-nav-open .menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.sidebar-mask {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(30, 22, 60, 0.48);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

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

.content {
    width: 100%;
    margin: 0;
    padding: 24px 30px 44px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.2;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

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

.button.secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: #344054;
}

.button.secondary:hover {
    border-color: #aeb9c8;
    background: #f8fafc;
    color: var(--text);
}

.button.wide {
    width: 100%;
}

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

.text-button {
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

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

.text-link {
    font-size: 13px;
    font-weight: 700;
}

.panel {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.content > .panel + .panel {
    margin-top: 20px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    letter-spacing: 0;
}

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

.alert {
    margin-bottom: 18px;
    padding: 11px 13px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 13px;
}

.alert-success {
    border-color: #b6e6d2;
    background: var(--success-soft);
    color: #116c4b;
}

.alert-danger {
    border-color: #f1c0bb;
    background: var(--danger-soft);
    color: #9d332e;
}

.alert-warning {
    border-color: #efd39d;
    background: var(--warning-soft);
    color: #81500f;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

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

.stat-grid.five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #6d4dfa);
    opacity: 0.85;
}

.stat-card span,
.stat-card small,
.stat-card strong {
    display: block;
}

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

.stat-card strong {
    margin: 4px 0 2px;
    font-size: 29px;
    line-height: 1.2;
}

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

.tool-layout {
    display: grid;
    grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

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

.settings-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.settings-wide {
    grid-column: 1 / -1;
}

.upload-status {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.upload-status.success {
    color: var(--success);
}

.upload-status.danger {
    color: var(--danger);
}

.model-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #cddcfb;
    border-radius: 8px;
    background: var(--primary-soft);
}

.model-display span {
    color: #526075;
    font-size: 11px;
    font-weight: 700;
}

.model-display strong {
    color: #1947a3;
    font-size: 13px;
}

.model-display code {
    margin-left: auto;
    border-color: #c6d7fb;
    background: #fff;
    color: #2458b5;
    font-weight: 700;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.image-upload-box {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 156px;
    overflow: hidden;
    border: 2px dashed #c8d4e5;
    border-radius: 8px;
    cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.reference-uploader {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    margin-top: 2px;
}

.reference-uploader .upload-file-list {
    display: contents;
}

.reference-uploader .upload-file-item {
    flex: 0 0 104px;
    width: 104px;
    height: 104px;
}

.image-upload-box.square {
    flex: 0 0 auto;
    width: 104px;
    height: 104px;
    min-height: 104px;
    margin-top: 0;
}

.image-upload-box.square .upload-placeholder {
    padding: 0;
}

.image-upload-box.square .upload-icon {
    width: auto;
    height: auto;
    margin: 0;
    border: 0;
    background: transparent;
    font-size: 30px;
}

.image-upload-box.square > img {
    width: 104px;
    height: 104px;
    object-fit: cover;
}

.upload-count {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.82);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.image-upload-box:hover,
.image-upload-box:focus,
.image-upload-box.dragover {
    border-color: #7ea6f4;
    outline: none;
    background: var(--primary-soft);
}

.image-upload-box.disabled {
    cursor: pointer;
    border-color: #d8dee8;
    background: #f3f5f8;
}

.image-upload-box.disabled .upload-icon {
    color: #8b96a7;
}

.upload-placeholder {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 22px;
    color: var(--muted);
    text-align: center;
    pointer-events: none;
}

.upload-placeholder strong {
    color: #344054;
    font-size: 13px;
}

.upload-placeholder span:last-child {
    font-size: 11px;
}

.upload-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    border: 1px solid #c8d8f7;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.image-upload-box > img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #0f172a;
}

.image-upload-box.has-image .upload-placeholder {
    display: none;
}

.compact-alert {
    margin-bottom: 0;
    padding: 9px 10px;
}

.upload-file-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.upload-file-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.upload-file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-file-item .text-button {
    position: absolute;
    right: 4px;
    bottom: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
}

.settings-page {
    padding: 0;
    overflow: hidden;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 12px 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.record-tabs {
    display: flex;
    gap: 6px;
    margin: -20px -20px 20px;
    padding: 14px 18px 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.center-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.center-tab {
    flex: 1;
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.center-tab:hover {
    background: var(--surface-soft);
    color: var(--text);
}

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

.record-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 16px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.record-tab:hover {
    color: var(--text);
}

.record-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.record-tab span {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e9edf4;
    color: #5a677a;
    font-size: 11px;
}

.record-tab.active span {
    background: var(--primary-soft);
    color: var(--primary);
}

.settings-tab:hover {
    color: var(--text);
}

.settings-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.settings-tab-panel {
    padding: 22px;
}

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

.auth-card .form-stack { gap: 32px; padding-top: 0; }

.form-grid {
    display: grid;
    gap: 12px;
}

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

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.video-params {
    grid-template-columns: minmax(84px, 0.9fr) minmax(124px, 1.45fr) minmax(76px, 0.75fr);
}

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

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

.field > span {
    color: #3c485a;
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-form input,
.filter-form select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-form input:focus,
.filter-form select:focus {
    border-color: #7ea6f4;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.textarea-counter {
    display: block;
    text-align: right;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.advanced {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.advanced summary {
    cursor: pointer;
    color: #3c485a;
    font-size: 12px;
    font-weight: 700;
}

.advanced .field {
    margin-top: 10px;
}

.quota {
    flex: none;
    padding: 5px 8px;
    border: 1px solid #cddcfb;
    border-radius: 6px;
    background: var(--primary-soft);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
}

.preview-panel {
    min-height: 620px;
}

.preview-empty,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    padding: 30px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--surface-soft);
    text-align: center;
}

.empty-state.compact {
    min-height: 210px;
}

.preview-symbol {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin-bottom: 13px;
    border: 1px solid #cddcfb;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
}

.preview-empty strong,
.empty-state strong {
    font-size: 15px;
}

.preview-empty p,
.empty-state p {
    margin: 5px 0 14px;
    color: var(--muted);
    font-size: 12px;
}

.preview-task {
    display: grid;
    gap: 15px;
}

.preview-image-wrap {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 390px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(45deg, #f6f8fb 25%, transparent 25%),
        linear-gradient(-45deg, #f6f8fb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f6f8fb 75%),
        linear-gradient(-45deg, transparent 75%, #f6f8fb 75%),
        #fff;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.preview-image-wrap img {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
}

.video-preview-wrap video {
    display: block;
    width: 100%;
    max-height: 620px;
    background: #0f172a;
    object-fit: contain;
}

.generating-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    text-align: center;
}

.generating-state p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.loader {
    width: 30px;
    height: 30px;
    margin-bottom: 12px;
    border: 3px solid #d9e3f3;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress-block {
    display: grid;
    gap: 7px;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

.progress-meta strong {
    color: var(--text);
}

.progress-track {
    height: 7px;
    overflow: hidden;
    border-radius: 4px;
    background: #e7ebf1;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.3s ease;
}

.task-prompt {
    margin: 0;
    color: #465267;
    font-size: 12px;
}

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

.status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.status.success {
    background: var(--success-soft);
    color: var(--success);
}

.status.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.status.info {
    background: var(--info-soft);
    color: var(--info);
}

.status.muted {
    background: #eef1f5;
    color: #627085;
}

.recent-strip {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.recent-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
    font-size: 12px;
}

.recent-list,
.task-list {
    display: grid;
    gap: 8px;
}

.recent-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
}

.recent-item:hover {
    border-color: #b9cdf8;
    background: #f8fbff;
    color: var(--text);
}

.recent-prompt {
    overflow: hidden;
    color: #4d596c;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid #edf0f4;
}

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

.task-row > div {
    min-width: 0;
}

.task-row p {
    overflow: hidden;
    margin: 5px 0 0;
    color: #4d596c;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-row small {
    flex: none;
    color: var(--muted);
    font-size: 11px;
}

.detail-list {
    margin: 0;
}

.detail-list > div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #edf0f4;
}

.detail-list > div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* 账号信息中的昵称行内修改 */
.detail-list .nickname-view,
.detail-list .nickname-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.detail-list .nickname-form {
    gap: 8px;
}

.detail-list .nickname-form input[type="text"] {
    width: min(220px, 100%);
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.detail-list .nickname-form input[type="text"]:focus {
    border-color: #7ea6f4;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.key-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.key-summary > div {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.key-summary span,
.key-summary strong {
    display: block;
}

.key-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.key-summary strong {
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.key-form {
    margin-top: 4px;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.danger-zone strong {
    display: block;
    font-size: 13px;
}

.danger-zone p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.danger-button {
    border-color: #efc4c0;
    color: var(--danger);
}

.danger-button:hover {
    border-color: #df9f99;
    background: var(--danger-soft);
    color: var(--danger);
}

.security-note {
    margin-top: 18px;
    padding: 13px;
    border: 1px solid #cfe5f1;
    border-radius: 8px;
    background: var(--info-soft);
}

.security-note strong {
    color: var(--info);
    font-size: 12px;
}

.security-note p {
    margin: 4px 0 0;
    color: #486a7a;
    font-size: 11px;
}

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

.gallery-item {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.gallery-media {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: #f1f4f8;
}

.gallery-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-media video {
    display: block;
    width: 100%;
    height: 100%;
    background: #0f172a;
    object-fit: contain;
}

.video-gallery-grid .gallery-media {
    aspect-ratio: 16 / 9;
}

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

.audio-history-preview {
    display: grid;
    place-items: center;
    min-height: 150px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.audio-history-preview audio {
    width: 100%;
}

.parser-history-cover video,
.parser-history-cover img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #0f172a;
}

.parser-history-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    min-height: 220px;
    background: #0f172a;
}

.parser-history-gallery img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.parser-result {
    display: grid;
    gap: 16px;
}

.parser-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.parser-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.parser-author img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.parser-author strong,
.parser-author span {
    display: block;
}

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

.parser-media {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f172a;
}

.parser-media video,
.parser-media img {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
}

.parser-media video {
    height: auto;
    aspect-ratio: 16 / 9;
}

.parser-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.parser-form-actions .button {
    min-width: 104px;
}

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

.parser-images {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.gallery-result-images {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.gallery-image-card {
    display: grid;
    gap: 8px;
}

.gallery-image-card .parser-image-button {
    width: 100%;
}

.gallery-image-download {
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
}

.script-content {
    min-height: 320px;
    max-height: 620px;
    margin: 0;
    padding: 16px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    font: 14px/1.8 "Microsoft YaHei", "PingFang SC", sans-serif;
    white-space: pre-wrap;
    word-break: break-word;
}

.script-preview {
    max-height: 180px;
    overflow: hidden;
    color: #526075;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.parser-image-button {
    overflow: hidden;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: zoom-in;
    background: var(--surface-soft);
}

.parser-image-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 680px) {
    .parser-images {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.reference-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

.video-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.video-details span {
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-soft);
    color: #526075;
    font-size: 10px;
    font-weight: 700;
}

.video-download {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
}

.speech-voice-options.clone-mode {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.speech-voice-options:not(.clone-mode) {
    grid-template-columns:
        minmax(110px, 0.95fr)
        minmax(110px, 0.95fr)
        minmax(150px, 1.35fr)
        minmax(108px, max-content)
        minmax(120px, max-content);
}

.speech-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
}

.speech-layout > .panel {
    min-width: 0;
}

.speech-layout .field,
.speech-layout .field select {
    min-width: 0;
}

.speech-layout .preview-panel {
    min-height: 460px;
}

#speech_text {
    height: 360px;
    resize: vertical;
}

.parameter-title {
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.parameter-title h3 {
    margin: 0;
    font-size: 15px;
}

.parameter-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.range-field > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.range-field > span strong {
    min-width: 28px;
    color: var(--primary);
    font-size: 12px;
    text-align: right;
}

.range-field input[type="range"] {
    width: 100%;
    min-height: 28px;
    padding: 0;
    border: 0;
    cursor: pointer;
    accent-color: var(--primary);
    box-shadow: none;
}

.audio-result-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.audio-result-card strong {
    display: block;
    font-size: 15px;
}

.audio-result-card p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

#speech-audio {
    width: 100%;
    margin: 16px 0;
}

.gallery-media-button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: zoom-in;
    background: transparent;
}

.gallery-media-button img {
    transition: transform 0.18s ease;
}

.gallery-media-button:hover img {
    transform: scale(1.025);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 28px;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: zoom-out;
    background: rgba(10, 16, 28, 0.82);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    max-width: min(1240px, 96vw);
    max-height: 90vh;
}

.lightbox-dialog img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 46px);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 700;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.media-placeholder {
    display: grid;
    place-items: center;
    gap: 7px;
    color: var(--muted);
}

.gallery-body {
    padding: 13px;
}

.gallery-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.gallery-meta time {
    color: var(--muted);
    font-size: 10px;
}

.gallery-body > p {
    display: -webkit-box;
    min-height: 42px;
    margin: 0 0 10px;
    overflow: hidden;
    color: #465267;
    font-size: 12px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.inline-error {
    margin-bottom: 9px;
    padding: 7px 8px;
    border-radius: 5px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 11px;
}

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

.search-form,
.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-form input {
    width: 230px;
}

.filter-form select {
    width: 140px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: #5e6b7f;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

td {
    color: #3f4b5e;
    font-size: 12px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td strong,
td small {
    display: block;
}

td small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.prompt-cell {
    min-width: 320px;
    max-width: 560px;
}

.error-row td {
    padding-top: 0;
    color: var(--danger);
    background: #fffafa;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
}

.pagination a {
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
}

.auth-body {
    background: #eef2f8;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(440px, 0.85fr);
    min-height: 100vh;
}

.auth-shell > *,
.auth-panel,
.auth-card,
.form-stack,
.field {
    min-width: 0;
}

.auth-intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px clamp(32px, 6vw, 90px);
    background: #182844;
    color: #fff;
}

.auth-brand {
    color: #fff;
}

.auth-brand:hover {
    color: #fff;
}

.auth-brand .brand-mark {
    background: #fff;
    color: #244b9b;
}

.auth-brand small {
    color: #aebdd5;
}

.auth-copy {
    max-width: 650px;
    padding: 70px 0;
}

.auth-copy .kicker {
    display: inline-block;
    margin-bottom: 14px;
    color: #9fc0ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-copy h1 {
    margin: 0;
    font-size: clamp(36px, 4.6vw, 64px);
    line-height: 1.11;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.auth-copy p {
    max-width: 560px;
    margin: 20px 0 0;
    color: #c4cee0;
    font-size: 15px;
}

.auth-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-points span {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: #dbe4f3;
    font-size: 12px;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 32px;
    background: #f7f9fc;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 20px 50px rgba(23, 32, 51, 0.11);
}

.auth-heading {
    margin-bottom: 22px;
}

.auth-heading h2 {
    margin: 5px 0 4px;
    font-size: 25px;
    line-height: 1.3;
}

.auth-heading > p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-switch {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

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

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

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 60;
        width: min(78vw, 296px);
        height: 100vh;
        padding: 18px 16px 16px;
        overflow-y: auto;
        border-right: 0;
        border-bottom: 0;
        transform: translateX(-102%);
        transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.3, 1);
        box-shadow: 0 18px 48px rgba(58, 40, 120, 0.32);
    }

    body.side-nav-open {
        overflow: hidden;
    }

    body.side-nav-open .sidebar {
        transform: none;
    }

    body.side-nav-open .sidebar-mask {
        opacity: 1;
        visibility: visible;
    }

    .sidebar .sidebar-user {
        padding: 8px 10px;
        border-radius: 12px;
    }

    .sidebar .sidebar-admin {
        margin-top: 12px;
    }

    .side-nav {
        display: block;
        margin-top: 12px;
        overflow: visible;
    }

    .nav-label {
        display: none;
    }

    .sidebar .nav-link {
        margin: 4px 0;
        padding: 11px 12px;
        border-radius: 10px;
        font-size: 13.5px;
    }

    .sidebar .nav-ico,
    .sidebar .nav-ico svg {
        width: 17px;
        height: 17px;
    }

    .topbar {
        min-height: 68px;
        padding: 14px 20px;
    }

    .content {
        padding: 20px;
    }

    .tool-layout,
    .center-grid,
    .admin-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .panel .detail-list.inline {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .panel .detail-list.inline > div {
        gap: 10px;
        border-bottom: 0;
        padding: 8px 0;
    }

    .panel .detail-list.inline dt {
        min-width: 68px;
    }

    .preview-panel {
        min-height: auto;
    }

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

    .auth-intro {
        min-height: 360px;
        padding: 28px;
    }

    .auth-copy {
        padding: 42px 0 30px;
    }

    .auth-copy h1 {
        font-size: 38px;
    }
}

@media (max-width: 680px) {
    .settings-tabs {
        overflow-x: auto;
    }

    .settings-tab {
        flex: none;
    }

    .record-tabs {
        margin: -15px -15px 16px;
        padding: 10px 12px 0;
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .record-tab {
        flex: 1 1 auto;
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .settings-tab-panel {
        padding: 15px;
    }

    .upload-file-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .topbar {
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .topbar-actions .button {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .content {
        padding: 15px;
    }

    .stat-grid,
    .stat-grid.four,
    .stat-grid.five {
        grid-template-columns: 1fr;
    }

    .form-grid.two,
    .form-grid.three,
    .form-grid.five {
        grid-template-columns: 1fr;
    }

    .key-summary {
        grid-template-columns: 1fr;
    }

    .danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .panel {
        padding: 15px;
    }

    .panel-heading {
        flex-direction: column;
        gap: 10px;
    }

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

    .preview-image-wrap {
        min-height: 280px;
    }

    .task-actions {
        flex-direction: column;
    }

    .task-actions .button {
        width: 100%;
    }

    .lightbox {
        padding: 16px;
    }

    .lightbox-dialog {
        max-width: 100%;
    }

    .lightbox-dialog img {
        max-height: calc(90vh - 52px);
    }

    .table-heading {
        align-items: stretch;
    }

    .search-form,
    .filter-form {
        width: 100%;
    }

    .search-form input,
    .filter-form select {
        flex: 1;
        width: auto;
    }

    .auth-intro {
        min-height: 310px;
        padding: 22px;
    }

    .auth-copy {
        padding: 34px 0 24px;
    }

    .auth-copy h1 {
        font-size: 31px;
    }

    .auth-copy p {
        font-size: 13px;
    }

    .auth-panel {
        padding: 18px;
    }

    .auth-card {
        width: calc(100vw - 36px);
        max-width: none;
        padding: 22px;
    }
}

























.settings-section { max-width: 900px; padding: 16px 24px; }
.settings-section .panel-heading { flex-wrap: wrap; }
.settings-section .button.primary { width: auto; padding: 10px 24px; }
.settings-section .button { width: auto !important; }
.settings-section .button.button-sm { min-height: 32px; padding: 5px 12px; font-size: 12px; }

.settings-section .field input, .settings-section .field select, .settings-section .field textarea { width: 100%; max-width: 400px; }





.settings-divider { border: none; border-top: 1px solid #e5e7eb; margin: 24px 0; }

.heading-actions { display: flex; align-items: center; gap: 12px; }
.readonly-fields { padding: 0; }
.readonly-fields .field input:disabled {
    background: var(--surface);
    color: var(--text);
    opacity: 1;
    -webkit-text-fill-color: var(--text);
}
.form-actions { display: flex; gap: 12px; margin-top: 16px; }

/* 会员中心 */
.detail-list.inline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail-list.inline > div { display: flex; align-items: baseline; gap: 8px; padding: 11px 0; border-bottom: 1px solid #edf0f4; }
.detail-list.inline dt { white-space: nowrap; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.plan-card.selected { border-color: #5b3fd6; box-shadow: 0 0 0 2px rgba(91, 63, 214, 0.18); }
.activate-box { margin-top: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.activate-box-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.activate-box-title strong { font-size: 15px; }
.activate-box-title span { color: var(--muted); font-size: 13px; }
.activate-box .activate-form { display: flex; align-items: flex-end; gap: 12px; max-width: 560px; }
.activate-box .activate-form .field { flex: 1; margin: 0; }
.plan-card strong { font-size: 16px; }
.plan-card .plan-price { font-size: 26px; font-weight: 800; color: #5b3fd6; }
.plan-card small { color: var(--muted); }
.plan-card p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.activate-form { max-width: 480px; }

.sidebar .nav-link.locked { color: #b3abcd; }
.sidebar .nav-link.locked:hover { background: rgba(124, 92, 252, 0.06); color: #8f86b8; transform: none; }
.sidebar .nav-link.locked::after { content: "🔒"; margin-left: auto; font-size: 11px; opacity: 0.75; }

/* 会员套餐：手机端 3 个排一行、4 个排两行两列，电脑端保持 auto-fill 不变 */
@media (max-width: 680px) {
    .plan-grid { gap: 8px; }

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

    .plan-grid.plan-cols-2 .plan-card,
    .plan-grid.plan-cols-3 .plan-card {
        padding: 12px 8px;
        gap: 4px;
        align-items: center;
        text-align: center;
    }

    .plan-grid.plan-cols-2 .plan-card strong,
    .plan-grid.plan-cols-3 .plan-card strong { font-size: 13px; }

    .plan-grid.plan-cols-2 .plan-card .plan-price,
    .plan-grid.plan-cols-3 .plan-card .plan-price { font-size: 18px; }

    .plan-grid.plan-cols-2 .plan-card small,
    .plan-grid.plan-cols-3 .plan-card small { font-size: 11px; white-space: nowrap; }
}










.speech-side {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.speech-history-list {
    display: grid;
    gap: 8px;
}

.speech-history-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.speech-history-item:hover {
    border-color: #b9cdf8;
    background: #f8fbff;
}

.speech-history-item.is-static,
.speech-history-item:disabled {
    cursor: default;
}

.speech-history-item.is-static:hover,
.speech-history-item:disabled:hover {
    border-color: var(--line);
    background: var(--surface);
}

.speech-history-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.speech-history-text {
    overflow: hidden;
    color: #4d596c;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech-history-meta {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.speech-history-item time {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

/* 网站设置：四张配置卡两列布局（左 2 / 右 2）+ 统一保存 */
.settings-page {
    padding: 20px;
}

/* 卡片内两列输入框下方的一行说明 + 网址 */
.settings-note {
    margin: 14px 0 0;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.settings-note a {
    color: var(--primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
}

.settings-page .settings-section {
    max-width: none;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.settings-page .form-grid > .field { min-width: 0; }

.settings-page .settings-section .field input,
.settings-page .settings-section .field select,
.settings-page .settings-section .field textarea {
    min-width: 0;
    max-width: none;
}

/* 半宽卡片内三列表单收成两列 */
.settings-page .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.settings-page .panel-heading { flex-wrap: wrap; }
.settings-page .heading-actions { flex-wrap: wrap; justify-content: flex-end; }

.settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.settings-actions .settings-hint {
    margin-right: auto;
    color: var(--muted);
    font-size: 12px;
}

.settings-actions .button {
    width: auto;
    min-width: 150px;
}

@media (max-width: 1220px) {
    .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .settings-page { padding: 14px; }
    .settings-grid { gap: 14px; }
    .settings-page .settings-section { padding: 16px; }
    .settings-page .form-grid.two,
    .settings-page .form-grid.three { grid-template-columns: minmax(0, 1fr); }

    .settings-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .settings-actions .settings-hint { margin-right: 0; }
    .settings-actions .button { width: 100%; }
}

/* 设置页底部唯一的「清空全部」按钮：红色背景，区分破坏性操作 */
.settings-actions .button.danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.settings-actions .button.danger:hover {
    border-color: #a83731;
    background: #a83731;
    color: #fff;
}

/* 「清空全部」自定义确认弹窗，替代浏览器原生 confirm 对话框 */
.confirm-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.46);
}

.confirm-dialog {
    width: min(420px, 100%);
    padding: 22px 22px 18px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
}

.confirm-dialog h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 17px;
}

.confirm-dialog p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.confirm-dialog .button.danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.confirm-dialog .button.danger:hover,
.confirm-dialog .button.danger:focus-visible {
    border-color: #a83731;
    background: #a83731;
    color: #fff;
}

/* 「修改密码」弹窗表单 */
.password-dialog {
    width: min(440px, 100%);
}

.password-dialog .password-form {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.password-dialog .password-form .confirm-actions {
    margin-top: 2px;
}

@media (max-width: 520px) {
    .confirm-actions .button {
        flex: 1;
    }
}

/* 密钥输入框 + 眼睛图标（显示 / 隐藏） */
.secret-field {
    position: relative;
    display: flex;
    min-width: 0;
}

.secret-field input {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 42px;
}

.secret-toggle {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    line-height: 0;
}

.secret-toggle:hover,
.secret-toggle:focus-visible {
    background: var(--primary-soft);
    color: var(--primary);
    outline: none;
}

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

.secret-toggle .ico-eye-off {
    display: none;
}

.secret-toggle.is-visible .ico-eye {
    display: none;
}

.secret-toggle.is-visible .ico-eye-off {
    display: block;
}
