/* 青思 · 念响式布局 + 逐日计划表 */
:root {
    --qs-primary: #0ea5e9;
    --qs-primary-dark: #0284c7;
    --qs-primary-light: #e0f2fe;
    --qs-accent: #6366f1;
    --qs-bg: #f0f9ff;
    --qs-surface: #ffffff;
    --qs-border: #e2e8f0;
    --qs-text: #0f172a;
    --qs-muted: #64748b;
    --qs-success: #10b981;
    --qs-radius: 14px;
    --qs-shadow: 0 4px 24px rgba(14, 165, 233, 0.08);
    --qs-nav-h: 56px;
    --qs-max-w: 920px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--qs-text);
    background: var(--qs-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; }
a { color: var(--qs-primary-dark); text-decoration: none; }

.qs-app-main {
    max-width: var(--qs-max-w);
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
    padding: 20px 16px calc(var(--qs-nav-h) + env(safe-area-inset-bottom, 0) + 20px);
}

/* ── 首页（念响式） ── */
.qs-home { text-align: center; }
.qs-home-header { padding: 28px 0 20px; }
.qs-home-header h1 {
    font-size: 32px; font-weight: 700; letter-spacing: 0.06em;
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.qs-home-sub { font-size: 14px; color: var(--qs-muted); margin-top: 8px; }
.qs-home-muse {
    background: var(--qs-surface);
    border: 1px solid var(--qs-border);
    border-radius: var(--qs-radius);
    padding: 16px 18px;
    margin-bottom: 24px;
    text-align: left;
    box-shadow: var(--qs-shadow);
}
.qs-home-muse-label {
    display: inline-block; font-size: 11px; font-weight: 700;
    color: var(--qs-primary-dark); background: var(--qs-primary-light);
    padding: 2px 8px; border-radius: 999px; margin-bottom: 8px;
}
.qs-home-muse p { font-size: 14px; color: var(--qs-text); line-height: 1.65; }
.qs-section-title {
    text-align: left; font-size: 15px; font-weight: 700;
    color: var(--qs-muted); margin-bottom: 12px;
}
.qs-home-list { text-align: left; }

/* ── 我的 ── */
.qs-profile { max-width: 480px; margin: 0 auto; }
.qs-profile h2 { font-size: 20px; margin-bottom: 16px; }
.qs-profile-card {
    background: var(--qs-surface); border-radius: var(--qs-radius);
    padding: 20px; border: 1px solid var(--qs-border);
    margin-bottom: 16px; box-shadow: var(--qs-shadow);
}
.qs-profile-name { font-size: 18px; font-weight: 600; }
.qs-profile-desc { font-size: 13px; color: var(--qs-muted); margin-top: 6px; }
.qs-logout-btn {
    width: 100%; padding: 12px; border: 1px solid #fecaca;
    background: #fef2f2; color: #dc2626; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ── 通用组件 ── */
.qs-input, .qs-textarea, .qs-select {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--qs-border); border-radius: 10px;
    font-size: 14px; background: var(--qs-surface);
}
.qs-textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.qs-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border: none; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.qs-btn-primary { background: linear-gradient(135deg, var(--qs-primary), #38bdf8); color: #fff; }
.qs-btn-ghost { background: var(--qs-primary-light); color: var(--qs-primary-dark); }
.qs-btn-outline { background: #fff; border: 1px solid var(--qs-border); color: var(--qs-text); }
.qs-btn-sm { padding: 6px 12px; font-size: 13px; }
.qs-btn-block { width: 100%; }

.qs-card {
    background: var(--qs-surface); border: 1px solid var(--qs-border);
    border-radius: var(--qs-radius); padding: 16px 18px;
    box-shadow: var(--qs-shadow); margin-bottom: 12px;
}
.qs-card-click { cursor: pointer; transition: transform 0.15s; }
.qs-card-click:active { transform: scale(0.99); }
.qs-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.qs-card-title { font-size: 16px; font-weight: 600; }
.qs-card-meta { font-size: 12px; color: var(--qs-muted); margin-top: 6px; line-height: 1.5; }
.qs-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.qs-badge-active { background: #dbeafe; color: #1d4ed8; }
.qs-badge-done { background: #d1fae5; color: #047857; }
.qs-progress { height: 5px; background: #e2e8f0; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.qs-progress-bar { height: 100%; background: linear-gradient(90deg, var(--qs-primary), #38bdf8); }

.qs-empty { text-align: center; padding: 40px 16px; color: var(--qs-muted); }
.qs-empty i { font-size: 36px; color: #bae6fd; margin-bottom: 10px; display: block; }

.qs-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--qs-muted);
    border: none; background: none; cursor: pointer; margin-bottom: 12px;
}
.qs-page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.qs-page-head h2 { font-size: 20px; font-weight: 700; }
.qs-field { margin-bottom: 14px; }
.qs-field label { display: block; font-size: 13px; font-weight: 600; color: var(--qs-muted); margin-bottom: 6px; }
.qs-field-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* 查看模式 */
.qs-card-view { position: relative; }
.qs-card-toolbar {
    display: flex; justify-content: flex-end; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--qs-border);
}
.qs-view-text {
    font-size: 15px; line-height: 1.7; color: var(--qs-text);
    white-space: pre-wrap; word-break: break-word;
    background: #f8fafc; border-radius: 10px; padding: 12px 14px;
}
.qs-view-empty { font-size: 14px; color: var(--qs-muted); font-style: italic; padding: 8px 0; }
.qs-btn-danger-text { color: #dc2626; border-color: #fecaca; }
.qs-btn-danger-text:hover { background: #fef2f2; }

.qs-tabs {
    display: flex; gap: 6px; margin-bottom: 14px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 4px;
}
.qs-tabs::-webkit-scrollbar { display: none; }
.qs-tab {
    padding: 8px 14px; border: none; background: transparent;
    border-radius: 999px; font-size: 13px; font-weight: 600;
    color: var(--qs-muted); cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.qs-tab.active { background: var(--qs-primary-light); color: var(--qs-primary-dark); }

.qs-thought-content {
    font-size: 14px; line-height: 1.75; white-space: pre-wrap;
    background: #f8fafc; padding: 14px; border-radius: 10px;
}

.qs-app-main.qs-page-detail { max-width: 1280px; }

/* ── 逐日计划 + 教练 ── */
.qs-plan-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qs-plan-split {
    display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start;
}
.qs-plan-split.coach-open { grid-template-columns: minmax(0, 1fr) 300px; }
.qs-plan-main { min-width: 0; }

/* 电脑端：卡片式计划列表 */
.qs-plan-list { display: flex; flex-direction: column; gap: 12px; }
.qs-plan-item {
    background: var(--qs-surface); border: 1px solid var(--qs-border);
    border-radius: var(--qs-radius); overflow: hidden;
    box-shadow: var(--qs-shadow); transition: border-color 0.15s, box-shadow 0.15s;
}
.qs-plan-item:hover { border-color: #cbd5e1; }
.qs-plan-item.is-focus {
    border-color: var(--qs-primary);
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.18), var(--qs-shadow);
}
.qs-plan-item-head {
    display: grid; grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 16px; padding: 16px 18px; align-items: start;
    border-bottom: 1px solid #f1f5f9;
}
.qs-plan-item-date {
    display: block; font-size: 13px; font-weight: 700;
    color: var(--qs-primary-dark); line-height: 1.35;
}
.qs-plan-item-content { min-width: 0; }
.qs-plan-item-content .qs-plan-title-text { font-size: 15px; margin: 0; }
.qs-plan-item-side {
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0;
}
.qs-plan-item-effects {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.qs-plan-effect-col {
    padding: 14px 18px; border-right: 1px solid #f1f5f9; min-width: 0;
}
.qs-plan-effect-col:last-child { border-right: none; }
.qs-plan-effect-label {
    display: block; font-size: 11px; font-weight: 700; color: var(--qs-muted);
    letter-spacing: 0.04em; margin-bottom: 8px;
}
.qs-plan-effect-body {
    max-height: 160px; overflow-y: auto; font-size: 13px; line-height: 1.65;
    color: var(--qs-text); white-space: pre-wrap; word-break: break-word;
}
.qs-plan-desc-scroll {
    max-height: 120px; overflow-y: auto; margin-top: 8px;
    padding: 8px 10px; background: #f8fafc; border-radius: 8px;
}
.qs-plan-desc-scroll .qs-plan-desc-text { margin: 0; font-size: 13px; line-height: 1.6; }

/* 查看/状态/操作 */
.qs-plan-title-text { font-weight: 600; font-size: 14px; line-height: 1.45; color: var(--qs-text); }
.qs-plan-desc-text { font-size: 13px; color: var(--qs-muted); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.qs-plan-cell-text { font-size: 13px; line-height: 1.6; color: var(--qs-text); white-space: pre-wrap; word-break: break-word; }
.qs-plan-cell-empty { font-size: 12px; color: #cbd5e1; font-style: italic; }
.qs-plan-status {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.qs-plan-status-pending { background: #f1f5f9; color: #64748b; }
.qs-plan-status-in_progress { background: #e0f2fe; color: #0369a1; }
.qs-plan-status-done { background: #d1fae5; color: #047857; }
.qs-plan-status-skipped { background: #fef3c7; color: #b45309; }

.qs-plan-row-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qs-plan-row-actions-inline { flex-direction: row; gap: 6px; }
.qs-plan-act {
    width: 30px; height: 30px; border: none; border-radius: 8px;
    background: #f1f5f9; color: var(--qs-muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.qs-plan-act:hover { background: #e0f2fe; color: var(--qs-primary-dark); }
.qs-plan-act-save { background: #e0f2fe; color: var(--qs-primary-dark); }
.qs-plan-act-save:hover { background: var(--qs-primary); color: #fff; }
.qs-plan-act-danger:hover { background: #fef2f2; color: #dc2626; }
.qs-plan-act-cancel:hover { background: #f1f5f9; color: var(--qs-text); }

.qs-plan-empty, .qs-plan-empty-card {
    padding: 36px 16px; text-align: center; color: var(--qs-muted); font-size: 14px;
    background: var(--qs-surface); border-radius: var(--qs-radius);
    border: 1px dashed var(--qs-border);
}
.qs-plan-empty-card { margin-top: 0; }

/* 编辑模式 */
.qs-plan-item-edit .qs-plan-input {
    width: 100%; border: 1px solid var(--qs-border); background: #fff;
    border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45;
}
.qs-plan-item-edit .qs-plan-input:focus {
    border-color: var(--qs-primary); outline: none; box-shadow: 0 0 0 2px rgba(14,165,233,0.12);
}
.qs-plan-item-edit textarea.qs-plan-input { min-height: 72px; resize: vertical; margin-top: 8px; }
.qs-plan-item-edit .qs-plan-effect-col textarea.qs-plan-input { min-height: 100px; margin-top: 0; }

/* AI 教练 */
.qs-plan-coach {
    background: var(--qs-surface); border: 1px solid var(--qs-border);
    border-radius: var(--qs-radius); box-shadow: var(--qs-shadow);
    flex-direction: column; max-height: calc(100vh - 140px); min-height: 360px;
    position: sticky; top: 12px; display: none;
}
.qs-plan-split.coach-open .qs-plan-coach.is-open { display: flex; }
.qs-coach-dock {
    display: none; position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px;
    background: linear-gradient(135deg, var(--qs-primary), #38bdf8); color: #fff;
    border: none; border-radius: 12px 0 0 12px; box-shadow: -4px 0 18px rgba(14,165,233,0.28);
    cursor: pointer; z-index: 50; font-size: 11px; font-weight: 700; line-height: 1.2;
}
.qs-coach-dock i { font-size: 18px; }
.qs-coach-dock.is-hidden { display: none !important; }
.qs-coach-close-desktop { display: none; }
.qs-plan-coach-head {
    padding: 12px 14px; border-bottom: 1px solid var(--qs-border);
    font-size: 14px; font-weight: 700; color: var(--qs-primary-dark);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.qs-coach-close {
    display: none; border: none; background: #f1f5f9; color: var(--qs-muted);
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex-shrink: 0;
}
.qs-coach-close:hover { background: #e2e8f0; color: var(--qs-text); }
.qs-coach-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35);
    z-index: 199;
}
.qs-coach-backdrop.is-visible { display: block; }
body.qs-coach-open { overflow: hidden; }
.qs-coach-fab.is-hidden { display: none !important; }
.qs-plan-coach-focus { font-size: 11px; font-weight: 400; color: var(--qs-muted); }
.qs-chat-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 10px; min-height: 180px;
}
.qs-chat-msg {
    max-width: 92%; padding: 9px 12px; border-radius: 12px;
    font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.qs-chat-msg.user {
    align-self: flex-end; background: linear-gradient(135deg, var(--qs-primary), #38bdf8); color: #fff;
}
.qs-chat-msg.assistant { align-self: flex-start; background: #f1f5f9; }
.qs-chat-input-row {
    display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--qs-border);
}
.qs-chat-input-row textarea { flex: 1; min-height: 40px; max-height: 100px; font-size: 14px; }

.qs-plan-mobile-cards { display: none; }
.qs-plan-card {
    background: var(--qs-surface); border: 1px solid var(--qs-border);
    border-radius: 12px; padding: 14px; margin-bottom: 10px;
    box-shadow: var(--qs-shadow);
}
.qs-plan-card.is-focus { border-color: var(--qs-primary); background: #f0f9ff; }
.qs-plan-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.qs-plan-card-date { font-size: 13px; font-weight: 700; color: var(--qs-primary-dark); }
.qs-plan-card-body { display: flex; flex-direction: column; gap: 10px; }
.qs-plan-card-field label { font-size: 11px; color: var(--qs-muted); display: block; margin-bottom: 4px; font-weight: 600; }
.qs-plan-card-actions {
    display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--qs-border);
}
.qs-plan-card-actions .qs-plan-act { width: 36px; height: 36px; font-size: 14px; }
.qs-plan-card-edit label { font-size: 11px; color: var(--qs-muted); display: block; margin: 10px 0 4px; font-weight: 600; }
.qs-plan-card-edit .qs-input, .qs-plan-card-edit .qs-textarea { font-size: 16px; }

.qs-coach-fab {
    display: none; position: fixed; right: 16px; bottom: calc(var(--qs-nav-h) + env(safe-area-inset-bottom, 0) + 16px);
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--qs-primary), #38bdf8);
    color: #fff; font-size: 20px; box-shadow: 0 6px 20px rgba(14,165,233,0.4);
    z-index: 90; cursor: pointer;
}

/* 底部导航 */
.qs-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(var(--qs-nav-h) + env(safe-area-inset-bottom, 0));
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(255,255,255,0.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--qs-border);
    display: flex; z-index: 100;
}
.qs-bottom-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    border: none; background: transparent; font-size: 11px;
    color: var(--qs-muted); cursor: pointer; min-height: 44px;
}
.qs-bottom-btn i { font-size: 20px; }
.qs-bottom-btn.active { color: var(--qs-primary-dark); }

/* Layui 弹层 */
.layui-layer.qs-layer .layui-layer-title {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-bottom: 1px solid #bae6fd; color: #0369a1; font-weight: 600;
}
.layui-layer.qs-layer .layui-layer-btn .layui-layer-btn0 {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8); border-color: #0ea5e9;
}
.qs-layer-body .layui-form-label { width: 72px; padding: 9px 0; color: #64748b; }
.qs-layer-body .layui-input-block { margin-left: 88px; }
.qs-layer-hint { color: #64748b; font-size: 12px; margin-top: 8px; }

@media (max-width: 768px) {
    .qs-app-main { padding: 12px 12px calc(var(--qs-nav-h) + env(safe-area-inset-bottom, 0) + 16px); }
    .qs-app-main.qs-page-detail { max-width: var(--qs-max-w); }
    .qs-home-header h1 { font-size: 28px; }
    .qs-plan-split, .qs-plan-split.coach-open { grid-template-columns: 1fr; }
    .qs-plan-list { display: none; }
    .qs-plan-mobile-cards { display: block; }
    .qs-plan-coach { display: none; max-height: 70vh; position: fixed; inset: auto 0 0 0; z-index: 200; border-radius: 16px 16px 0 0; min-height: 0; }
    .qs-plan-coach.is-open { display: flex; }
    .qs-coach-close { display: flex; align-items: center; justify-content: center; }
    .qs-coach-close-mobile { display: inline; }
    .qs-coach-close-desktop { display: none; }
    .qs-coach-fab { display: flex; align-items: center; justify-content: center; }
    .qs-coach-dock { display: none !important; }
    .qs-field-actions { flex-direction: column; }
    .qs-field-actions .qs-btn { width: 100%; min-height: 44px; }
    .qs-textarea, .qs-input { font-size: 16px; }
    .qs-btn { min-height: 44px; }
    .qs-plan-toolbar .qs-btn { flex: 1; min-width: calc(50% - 4px); }
    .qs-plan-card-actions { justify-content: flex-end; }
}

@media (min-width: 769px) {
    .qs-coach-fab { display: none !important; }
    .qs-coach-dock { display: flex; }
    .qs-coach-backdrop { display: none !important; }
    body.qs-coach-open { overflow: auto; }
    .qs-coach-close { display: flex; align-items: center; justify-content: center; }
    .qs-coach-close-mobile { display: none; }
    .qs-coach-close-desktop { display: inline; }
    .qs-plan-mobile-cards { display: none; }
}

@media (max-width: 480px) {
    .qs-layer-body .layui-form-label { width: 100%; text-align: left; }
    .qs-layer-body .layui-input-block { margin-left: 0; }
}

/* Auth */
.qs-auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: linear-gradient(160deg, #e0f2fe 0%, #f0f9ff 40%, #eef2ff 100%);
}
.qs-auth-card {
    width: 100%; max-width: 400px; background: var(--qs-surface);
    border-radius: 20px; padding: 36px 28px; box-shadow: var(--qs-shadow); border: 1px solid var(--qs-border);
}
.qs-auth-brand { text-align: center; margin-bottom: 24px; }
.qs-auth-icon {
    display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--qs-primary), var(--qs-accent));
    color: #fff; border-radius: 16px; font-size: 22px; margin-bottom: 10px;
}
.qs-auth-brand h1 { font-size: 26px; font-weight: 700; }
.qs-auth-brand p { font-size: 13px; color: var(--qs-muted); margin-top: 4px; }
.qs-auth-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.qs-auth-sub { font-size: 13px; color: var(--qs-muted); margin-bottom: 20px; }
.qs-auth-form { display: flex; flex-direction: column; gap: 12px; }
.qs-auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--qs-muted); }
