/* ==========================================================================
   模型接入（BYO API）面板样式 —— 2026-10-14 从 workfriend.css 抽出
   ==========================================================================
   为什么单独一个文件：这个面板**两个页面都要用**——
     · app.html（WorkFriend 对话框侧栏的「模型接入」）
     · profile.html（官网个人中心的「API 接入」）
   放在 workfriend.css 里只有 app.html 会加载，profile.html 就拿不到样式。
   ⚠️ 这里是唯一真源，**禁止**在别处再抄一份（曾因头尾两处维护漂移过，见记忆 §20）。

   命名约定：内部元素一律 `ma-` 前缀；弹窗外壳用 `ma-overlay / ma-container /
   ma-close`（**刻意不复用** `.modal-overlay` 之类通用类名 —— profile.html 自己
   也用这些类名但没定义样式，复用时行为不可控）。
   ========================================================================== */

/* ---------- 弹窗外壳（profile.html 注入的面板用；app.html 仍用它自己的） ---------- */
.ma-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 18px;
    overflow-y: auto;
    z-index: 4200;
}

.ma-container {
    position: relative;
    width: 560px;
    max-width: 100%;
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #111827);
    border: 1px solid var(--border-color, rgba(17, 24, 39, 0.12));
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.ma-close {
    position: absolute;
    top: 12px; right: 14px;
    width: 30px; height: 30px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #667085);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}
.ma-close:hover { background: rgba(127, 127, 127, 0.14); }

.ma-title {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 800;
}

.ma-sub {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-secondary, #667085);
    line-height: 1.7;
}

.ma-group-label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ==========================================================================
   模型接入（BYO API）面板 —— 2026-10-14
   ========================================================================== */
.ma-preset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ma-preset-chip {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(17, 24, 39, 0.18);
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ma-preset-chip:hover {
    border-color: #7c5cff;
    color: #6d4aff;
}

.ma-field {
    margin-bottom: 14px;
}

.ma-label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.ma-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(17, 24, 39, 0.18);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

/* 2026-10-25：模型名输入行 = 输入框 + 行内「测」按钮（每类各测各的） */
.ma-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.ma-mini-test {
    flex: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(17, 24, 39, 0.18);
    background: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.ma-mini-test:hover {
    border-color: #7c5cff;
    color: #6d4aff;
}

.ma-mini-test:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ma-input:focus {
    border-color: #7c5cff;
}

.ma-hint {
    margin-top: 5px;
    font-size: 12px;
    color: #8a8f98;
    line-height: 1.6;
}

.ma-switch {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0;
    cursor: pointer;
}

.ma-switch input {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: #7c5cff;
}

.ma-switch b {
    display: block;
    font-size: 14px;
}

.ma-switch em {
    display: block;
    font-style: normal;
    font-size: 12px;
    color: #8a8f98;
    margin-top: 2px;
}

.ma-btn-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.ma-btn-ghost,
.ma-btn-danger {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(17, 24, 39, 0.18);
    color: #374151;
    white-space: nowrap;
}

.ma-btn-danger {
    color: #d0342c;
    border-color: rgba(208, 52, 44, 0.4);
}

.ma-btn-ghost:disabled,
.ma-btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ma-result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: #f6f6fb;
}

.ma-result.is-ok {
    border-color: rgba(46, 160, 67, 0.4);
    background: rgba(46, 160, 67, 0.08);
    color: #1a7f37;
}

.ma-result.is-fail {
    border-color: rgba(208, 52, 44, 0.4);
    background: rgba(208, 52, 44, 0.08);
    color: #b42318;
}

.ma-doc {
    font-size: 12.5px;
    color: #8a8f98;
    line-height: 1.8;
}

[data-theme="dark"] .ma-preset-chip,
[data-theme="dark"] .ma-btn-ghost,
[data-theme="dark"] .ma-btn-danger,
[data-theme="dark"] .ma-mini-test {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

[data-theme="dark"] .ma-mini-test:hover {
    border-color: #a78bff;
    color: #c4b5fd;
}

[data-theme="dark"] .ma-input {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

[data-theme="dark"] .ma-result {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}
