* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #0f172a;
    color: #e5e7eb;
}

.page {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 8px 20px 12px;
    gap: 10px;
    overflow: hidden; /* 整个页面不出现外层滚动条 */
}

.header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    padding-bottom: 4px;
}

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

.header-left {
    display: flex;
    flex-direction: column;
}

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

.header h1 {
    margin: 0;
    font-size: 20px;
}

.subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: #9ca3af;
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.user-name {
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    color: #9ca3af;
}

.user-caret {
    font-size: 10px;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    margin-top: 4px;
    min-width: 120px;
    background: #020617;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.7);
    padding: 4px 0;
    display: none;
    z-index: 20;
}

.user-menu-dropdown a {
    display: block;
    padding: 6px 10px;
    font-size: 12px;
    color: #e5e7eb;
    text-decoration: none;
}

.user-menu-dropdown a:hover {
    background: rgba(37, 99, 235, 0.2);
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.main-layout {
    flex: 1;
    display: flex;
    gap: 10px;
    min-height: 0;
    overflow: hidden; /* 左右列内部滚动，整体高度锁定在视口内 */
}

.left-column {
    flex: 0 0 32%;
    max-width: 32%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto; /* 左侧参数列如果高度不够，在内部滚动，而不是整页滚动 */
    padding-right: 4px;
}

.right-column {
    flex: 0 0 66.6667%;
    max-width: 66.6667%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel {
    background: #020617;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 6px 8px; /* 再略微收紧上下内边距，减少整体高度占用 */
}

.panel h2 {
    margin: 0 0 3px;
    font-size: 13px;
}

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 3px;
    gap: 2px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

label {
    font-size: 12px;
    color: #cbd5f5;
}

.switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.switch-text {
    font-size: 13px;
}

.switch-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 40px;
    height: 20px;
}

.switch-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.switch-slider {
    position: relative;
    width: 100%;
    height: 100%;
    background: #020617;
    border-radius: 999px;
    border: 1px solid #1f2937;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.8);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-slider::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.18s ease, background 0.18s ease;
}

.switch-toggle input[type="checkbox"]:checked + .switch-slider {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: rgba(34, 197, 94, 0.9);
}

.switch-toggle input[type="checkbox"]:checked + .switch-slider::before {
    transform: translateX(20px);
    background: #f9fafb;
}

input[type="text"],
input[type="number"],
select,
textarea {
    background: #020617;
    border-radius: 6px;
    border: 1px solid #1f2937;
    padding: 3px 6px;
    color: #e5e7eb;
    font-size: 11px;
}

input[type="file"] {
    font-size: 12px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.7);
}

button {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

button#btn_mic_stop,
button#btn_upload_cancel {
    background: linear-gradient(135deg, #f97316, #dc2626);
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: #020617;
    overflow: hidden;
    border: 1px solid #1f2937;
}

.progress-bar-inner {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #22c55e, #a855f7);
    transition: width 0.15s linear;
}

.progress-text {
    font-size: 12px;
    color: #9ca3af;
    min-width: 90px;
}

.status-text {
    margin: 2px 0 0;
    font-size: 11px;
    color: #9ca3af;
}

.transcript-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.transcript-section h2 {
    margin: 0 0 8px;
    font-size: 15px;
}

#transcript_container {
    flex: 1;
    min-height: 0;
    height: 100%;
    background: #020617;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 12px;
    overflow: auto;
}

#transcript_box {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.line-temp {
    color: #a5b4fc;
}

.line-final {
    color: #e5e7eb;
}

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }
    .left-column,
    .right-column {
        flex: 0 0 auto;
        max-width: 100%;
    }
}


