/*
 * FitCoach 全局样式表。
 * 阅读顺序：设计变量 → 通用布局 → 业务组件 → 认证页 → 运动模块 → 响应式断点。
 */
:root {
    --ink: #17211c;
    --ink-soft: #46534c;
    --muted: #6f7d75;
    --line: #dce4df;
    --line-soft: #e9eeeb;
    --canvas: #f4f7f5;
    --surface: #ffffff;
    --green-950: #102f25;
    --green-900: #123c2d;
    --green-700: #176b49;
    --green-600: #1a8a5a;
    --green-100: #e3f4eb;
    --red-600: #c23f3a;
    --red-100: #fbe9e7;
    --amber-700: #a35b09;
    --amber-100: #fff2d8;
    --blue-700: #2a5f9e;
    --blue-100: #e8f1fc;
    --shadow-sm: 0 1px 2px rgba(21, 42, 32, 0.04), 0 6px 20px rgba(21, 42, 32, 0.04);
    --shadow-md: 0 18px 45px rgba(20, 43, 33, 0.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* ===== 基础重置与全站排版 ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 8% 4%, rgba(26, 138, 90, 0.07), transparent 22rem),
        var(--canvas);
    color: var(--ink);
    font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    display: block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 100;
    left: 16px;
    top: -80px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    transition: top 160ms ease;
}

.skip-link:focus {
    top: 12px;
}

:focus-visible {
    outline: 3px solid rgba(26, 138, 90, 0.28);
    outline-offset: 2px;
}

/* ===== 顶栏、品牌和角色导航 ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(16, 47, 37, 0.97);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(10, 37, 28, 0.14);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    width: min(1240px, calc(100% - 40px));
    min-height: 70px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: #d8f2e5;
    color: var(--green-900);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.12;
}

.brand-copy strong {
    font-size: 17px;
    letter-spacing: 0.01em;
}

.brand-copy small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
}

.main-nav {
    display: flex;
    align-items: stretch;
    gap: 4px;
    align-self: stretch;
}

.main-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    color: rgba(255, 255, 255, 0.73);
    font-weight: 600;
    font-size: 14px;
    transition: color 160ms ease, background 160ms ease;
    flex: 0 0 auto;
    white-space: nowrap;
}

.main-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
}

.main-nav a.active {
    color: #fff;
}

.main-nav a.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #4ed392;
}


.nav-unread-dot {
    width: 8px;
    height: 8px;
    margin-left: 7px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    flex: 0 0 auto;
    background: #ef4b45;
    box-shadow: 0 0 0 2px rgba(239, 75, 69, 0.18);
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    font-weight: 750;
}

.avatar-small {
    width: 34px;
    height: 34px;
    font-size: 13px;
    background: var(--green-100);
    color: var(--green-700);
}

.user-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-copy strong {
    font-size: 13px;
}

.user-copy small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 11px;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.user-menu .icon-button {
    color: rgba(255, 255, 255, 0.72);
}

.user-menu .icon-button:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
}

.icon-button svg {
    width: 19px;
    height: 19px;
}

.icon-button-bordered {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
}

.icon-button-bordered:hover {
    color: var(--green-700);
    border-color: #a7cfbc;
    background: #f4fbf7;
}

/* ===== 页面消息提示 ===== */
.message-stack {
    position: fixed;
    z-index: 50;
    top: 84px;
    right: 22px;
    width: min(390px, calc(100% - 44px));
    display: grid;
    gap: 10px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    color: var(--ink-soft);
    animation: message-in 220ms ease both;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-dot {
    width: 9px;
    height: 9px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--green-600);
    flex: 0 0 auto;
}

.message-error .message-dot {
    background: var(--red-600);
}

.message-warning .message-dot {
    background: var(--amber-700);
}

/* ===== 页面容器和标题 ===== */
.page-shell {
    width: min(1240px, calc(100% - 40px));
    min-height: calc(100vh - 150px);
    margin: 0 auto;
    padding: 34px 0 64px;
}

.site-footer {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0 26px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

.page-heading {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
}

.page-heading h1 {
    margin: 4px 0 6px;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.14;
    letter-spacing: -0.025em;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    display: inline-block;
    color: var(--green-700);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow-light {
    color: #bce8d2;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 12px;
    font-weight: 700;
}

.live-indicator i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #24a66e;
    box-shadow: 0 0 0 4px rgba(36, 166, 110, 0.13);
}

/* ===== 通用按钮 ===== */
.button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.button svg {
    width: 18px;
    height: 18px;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: var(--green-700);
    box-shadow: 0 8px 20px rgba(23, 107, 73, 0.18);
}

.button-primary:hover:not(:disabled) {
    background: var(--green-900);
}

.button-secondary {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.button-secondary:hover:not(:disabled) {
    color: var(--green-700);
    border-color: #afd0c0;
}

.button-quiet {
    min-height: 34px;
    color: var(--ink-soft);
    border-color: var(--line);
    background: #fff;
}

.button-small {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12px;
}

.button-block {
    width: 100%;
}

.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== 指标卡 ===== */
.metric-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.metric-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
    position: relative;
    min-height: 142px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-card::after {
    content: "";
    position: absolute;
    width: 82px;
    height: 82px;
    right: -30px;
    bottom: -34px;
    border-radius: 50%;
    background: rgba(26, 138, 90, 0.055);
}

.metric-card.metric-up::after {
    background: rgba(194, 63, 58, 0.07);
}

.metric-card.metric-down::after {
    background: rgba(26, 138, 90, 0.09);
}

.metric-card.metric-warning::after {
    background: rgba(163, 91, 9, 0.08);
}

/* 完成态统一使用绿色，避免与体重上涨/下降的方向色混用。 */
.metric-card.metric-success::after {
    background: rgba(26, 138, 90, 0.09);
}

.metric-primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(145deg, #174b38, #123c2d);
}

.metric-primary::after {
    background: rgba(255, 255, 255, 0.08);
}

.metric-primary .metric-label,
.metric-primary .metric-note {
    color: rgba(255, 255, 255, 0.68);
}

.metric-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin: 13px 0 4px;
    font-size: 31px;
    line-height: 1.05;
    letter-spacing: -0.025em;
}

.metric-card strong small {
    margin-left: 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

.metric-card .metric-delta {
    font-size: 25px;
}

.metric-note {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metric-up strong {
    color: var(--red-600);
}

.metric-down strong {
    color: var(--green-600);
}

.metric-warning strong {
    color: var(--amber-700);
}

/* 指标值沿用完成态的绿色语义。 */
.metric-success strong {
    color: var(--green-600);
}

/* ===== 内容面板和主次网格 ===== */
.panel {
    margin-bottom: 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    min-height: 76px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.panel-header h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* 教练总览中的管理员提示使用分隔线列表，避免面板内出现嵌套卡片。 */
.coach-notice-list {
    padding: 4px 20px 20px;
}

.coach-notice-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--line-soft);
}

.coach-notice-item:last-child {
    border-bottom: 0;
}

.coach-notice-content {
    color: var(--ink);
    line-height: 1.75;
}

.coach-notice-content p {
    margin: 0 0 8px;
}

.coach-notice-content p:last-child {
    margin-bottom: 0;
}

.coach-notice-item time {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.panel-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--green-100);
    color: var(--green-700);
}

.panel-icon svg {
    width: 19px;
    height: 19px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(290px, 0.75fr);
    gap: 18px;
    align-items: start;
}

.dashboard-grid .panel {
    margin-bottom: 18px;
}

.entry-panel {
    position: sticky;
    top: 92px;
}

/* 客户端录入表单位于页面信息区之前，桌面端横向排列字段。 */
.client-entry-panel {
    position: static;
    overflow: hidden;
}

.client-entry-collapsible > .client-entry-summary {
    cursor: pointer;
    list-style: none;
}

.client-entry-collapsible > .client-entry-summary::-webkit-details-marker {
    display: none;
}

.client-entry-collapsible > .client-entry-summary::marker {
    content: "";
}

.client-entry-summary-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.client-entry-summary-title {
    color: var(--ink);
    font-size: 17px;
    line-height: 1.25;
}

.client-entry-summary-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.client-entry-summary:focus-visible {
    outline: 3px solid rgba(26, 138, 90, 0.22);
    outline-offset: -3px;
}

.client-entry-collapsible:not([open]) > .client-entry-summary {
    border-bottom: 0;
}

.client-entry-toggle {
    flex: 0 0 auto;
    width: auto;
    min-width: 56px;
    padding: 6px 10px;
    border: 1px solid rgba(26, 138, 90, 0.2);
    border-radius: 999px;
    background: rgba(26, 138, 90, 0.08);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.client-entry-toggle-collapse,
.client-entry-collapsible[open] .client-entry-toggle-expand {
    display: none;
}

.client-entry-collapsible[open] .client-entry-toggle-collapse {
    display: inline;
}

.client-entry-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    align-items: end;
}

.client-entry-form .field-group + .field-group {
    margin-top: 0;
}

.client-entry-form .button {
    margin-top: 0;
}

.client-entry-form .form-alert {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.checkin-photo-field {
    min-width: 0;
}

.checkin-photo-field input[type="file"] {
    padding: 8px 10px;
}

.checkin-photo-field input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 10px;
    border: 0;
    border-radius: 7px;
    background: var(--green-100);
    color: var(--green-700);
    font-weight: 700;
    cursor: pointer;
}

.field-optional {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.checkin-photo-cell {
    width: 88px;
}

.checkin-photo-link {
    display: inline-flex;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: zoom-in;
}

.checkin-photo-thumb {
    display: block;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    background: #f3f6f4;
}

.checkin-photo-link:hover .checkin-photo-thumb,
.checkin-photo-link:focus-visible .checkin-photo-thumb {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(26, 138, 90, 0.13);
}

.photo-dialog {
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
    height: min(880px, calc(100vh - 32px));
    height: min(880px, calc(100dvh - 32px));
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #fff;
}

.photo-dialog::backdrop {
    background: rgba(7, 18, 13, 0.78);
    backdrop-filter: blur(4px);
}

.photo-dialog-shell {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: inherit;
    background: rgba(10, 24, 18, 0.92);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.photo-dialog-image {
    display: block;
    max-width: calc(100vw - 80px);
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    border-radius: 8px;
    object-fit: contain;
    background: #111;
}

.photo-dialog-close {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.photo-dialog-close:hover {
    border-color: rgba(255, 255, 255, 0.52);
    background: rgba(0, 0, 0, 0.68);
    transform: scale(1.04);
}

.photo-dialog-close svg {
    width: 20px;
    height: 20px;
}

.entry-form,
.stacked-form,
.auth-form {
    padding: 20px;
}

/* ===== 表单控件与校验状态 ===== */
.field-group + .field-group {
    margin-top: 16px;
}

.field-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
}

/* 群发客户使用复选框组，避免移动端依赖 Ctrl 键完成多选。 */
.recipient-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.recipient-fieldset legend {
    margin-bottom: 7px;
    padding: 0;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8faf9;
}

.checkbox-list > div {
    min-width: 0;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.checkbox-list label:hover {
    border-color: #afd0c0;
}

.checkbox-list label:has(input:checked) {
    border-color: #79b99d;
    background: var(--green-100);
    color: var(--green-700);
    box-shadow: 0 0 0 2px rgba(26, 138, 90, 0.08);
}

.checkbox-list input[type="checkbox"],
.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--green-600);
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    cursor: pointer;
}

.checkbox-field label:has(input:disabled) {
    color: var(--muted);
    cursor: not-allowed;
}

.checkbox-field input[type="checkbox"]:disabled {
    cursor: not-allowed;
    accent-color: #9aa49f;
    opacity: 0.65;
}

.form-control,
.auth-form input,
.search-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ccd7d1;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-control:focus,
.auth-form input:focus,
.search-form input:focus {
    border-color: #55a680;
    box-shadow: 0 0 0 4px rgba(26, 138, 90, 0.11);
}

select.form-control {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #65736b 50%), linear-gradient(135deg, #65736b 50%, transparent 50%);
    background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 38px;
}

.input-with-unit {
    position: relative;
}

.input-with-unit input {
    padding-right: 50px;
}

.input-with-unit > span {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.field-help {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.field-help ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.field-error {
    margin: 6px 0 0;
    color: var(--red-600);
    font-size: 12px;
}

.form-alert {
    margin-bottom: 16px;
    padding: 11px 12px;
    border: 1px solid #efc1bd;
    border-radius: 9px;
    background: #fff5f4;
    color: #9c2f2b;
    font-size: 13px;
}

.form-alert p {
    margin: 0;
}

.entry-form .button {
    margin-top: 22px;
}

/* ===== 体重折线图 ===== */
.chart-frame {
    padding: 18px 20px 10px;
}

.chart-summary {
    margin-bottom: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    color: var(--muted);
    font-size: 11px;
}

.chart-summary strong {
    color: var(--ink-soft);
}

.chart-canvas {
    width: 100%;
    min-height: 260px;
}

.chart-canvas svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid-line {
    stroke: #e8eeeb;
    stroke-width: 1;
    stroke-dasharray: 4 5;
}

.chart-y-label,
.chart-x-label {
    fill: #849087;
    font-size: 11px;
    font-family: inherit;
}

.chart-line {
    fill: none;
    stroke: var(--green-600);
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-dot {
    fill: #fff;
    stroke: var(--green-600);
    stroke-width: 2;
}

.chart-dot-up {
    stroke: var(--red-600);
}

.chart-dot-down {
    stroke: var(--green-600);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

/* ===== 数据表格与横向滚动容器 ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table th {
    background: #f8faf9;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fbfdfc;
}

.data-table td {
    color: var(--ink-soft);
    font-size: 13px;
}

.coach-table th:first-child,
.coach-table td:first-child {
    padding-left: 20px;
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.person-cell > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.18;
}

.person-cell strong {
    color: var(--ink);
    font-size: 13px;
}

.person-cell small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.weight-number {
    color: var(--ink);
    font-size: 15px;
}

.status-tag,
.trend-pill,
.role-badge,
.today-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.status-tag {
    min-height: 25px;
    padding: 6px 9px;
}

.status-large {
    min-height: 32px;
    padding: 8px 12px;
    font-size: 12px;
}

.status-up,
.change-up,
.trend-up {
    color: #a93430;
    background: var(--red-100);
}

.status-down,
.change-down,
.trend-down {
    color: #117047;
    background: var(--green-100);
}

.status-stable,
.change-stable,
.trend-stable,
.status-neutral {
    color: #66736c;
    background: #edf1ef;
}

.status-warning {
    color: var(--amber-700);
    background: var(--amber-100);
}

.status-ok {
    color: #117047;
    background: var(--green-100);
}

.trend-pill {
    min-height: 24px;
    padding: 5px 8px;
}

.trend-detail {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 10px;
}

.date-cell {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-weight: 700;
}

.today-badge {
    margin-left: 7px;
    padding: 4px 7px;
    color: var(--green-700);
    background: var(--green-100);
}

.change {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.row-action {
    width: 54px;
    text-align: right;
}

.record-count {
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf3f0;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
}

.table-toolbar {
    flex-wrap: wrap;
}

.search-form {
    position: relative;
    width: min(300px, 100%);
}

.search-form svg {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-form input {
    min-height: 40px;
    padding-left: 39px;
    padding-right: 48px;
    background: #f8faf9;
}

.search-form a {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--green-700);
    font-size: 11px;
    font-weight: 700;
}

/* ===== 教练页面的综合信号栏 ===== */
.signal-band {
    margin-bottom: 18px;
    padding: 13px 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 28px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.signal-copy {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-soft);
    font-size: 13px;
}

.signal-copy strong {
    color: var(--ink);
}

.signal-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 16px;
    font-weight: 800;
}

.signal-up,
.role-coach {
    color: var(--red-600);
    background: var(--red-100);
}

.signal-down,
.role-client {
    color: var(--green-700);
    background: var(--green-100);
}

.empty-state {
    min-height: 250px;
    padding: 40px 24px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.empty-state.compact {
    min-height: 160px;
}

.empty-state h3 {
    margin: 12px 0 4px;
    font-size: 16px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}


.error-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.debug-404-panel {
    overflow: hidden;
}

.debug-404-frame {
    width: 100%;
    min-height: 760px;
    border: 0;
    display: block;
    background: #fff;
}

.empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--green-100);
    color: var(--green-700);
}

.empty-icon svg {
    width: 25px;
    height: 25px;
}

.manage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
    gap: 18px;
    align-items: start;
}

.form-panel {
    position: sticky;
    top: 92px;
}

.role-badge {
    min-height: 25px;
    padding: 6px 9px;
}

.account-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
}

.account-state i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #23a16b;
    box-shadow: 0 0 0 3px rgba(35, 161, 107, 0.12);
}

.state-inactive {
    color: var(--muted);
}

.state-inactive i {
    background: #a7b0aa;
    box-shadow: none;
}

.text-muted {
    color: var(--muted);
}

.back-link {
    margin-bottom: 8px;
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 4px;
    color: var(--green-700);
    font-size: 12px;
    font-weight: 800;
}

.back-link svg {
    width: 16px;
    height: 16px;
}

/* ===== 登录页双栏布局 ===== */
.auth-layout {
    min-height: 650px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.auth-brand-panel {
    position: relative;
    min-height: 650px;
    padding: 60px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: linear-gradient(155deg, #184c38, #102f25 72%);
    color: #fff;
}

.auth-brand-panel::before {
    content: "";
    position: absolute;
    width: 470px;
    height: 470px;
    top: -210px;
    right: -150px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    right: -80px;
    bottom: -120px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 50%;
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    max-width: 520px;
}

.auth-brand-content h1 {
    margin: 14px 0 28px;
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.auth-metric-strip {
    height: 72px;
    display: flex;
    align-items: flex-end;
    gap: 9px;
}

.auth-metric-strip span {
    width: 22px;
    border-radius: 5px 5px 2px 2px;
    background: rgba(137, 229, 183, 0.34);
    border-top: 2px solid #73dba7;
}

.auth-metric-strip span:nth-child(1) { height: 31px; }
.auth-metric-strip span:nth-child(2) { height: 48px; }
.auth-metric-strip span:nth-child(3) { height: 41px; }
.auth-metric-strip span:nth-child(4) { height: 61px; }
.auth-metric-strip span:nth-child(5) { height: 54px; }
.auth-metric-strip span:nth-child(6) { height: 69px; }
.auth-metric-strip span:nth-child(7) { height: 58px; }

.auth-panel-grid {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

.auth-form-panel {
    display: grid;
    place-items: center;
    padding: 48px;
}

.auth-form-wrap {
    width: min(100%, 390px);
}

.mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 34px;
    color: var(--green-900);
}

.mobile-brand .brand-mark {
    width: 34px;
    height: 34px;
    background: var(--green-100);
}

.auth-heading {
    margin-bottom: 26px;
}

.auth-heading h2 {
    margin: 7px 0;
    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.auth-heading p,
.auth-footnote {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-form {
    padding: 0;
}

.auth-form .button {
    margin-top: 24px;
}

.auth-footnote {
    margin-top: 22px;
    text-align: center;
}

.auth-agreement-link {
    margin-top: 16px;
}

.auth-agreement-link a {
    color: var(--green-700);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ===== 用户许可协议页 ===== */
.agreement-panel {
    max-width: 820px;
    margin: 0 auto;
}

.agreement-content {
    min-height: 260px;
    padding: 40px 28px;
    display: grid;
    place-items: center;
    text-align: center;
}

.agreement-content p {
    margin: 0;
    color: var(--green-900);
    font-size: 22px;
    font-weight: 800;
}

/* ===== 详情页分区标题 ===== */
.section-heading {
    margin: 30px 0 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.section-heading:first-of-type {
    margin-top: 0;
}

.section-heading h2 {
    margin: 0;
    font-size: 19px;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.metric-type {
    font-size: 22px !important;
}

.signal-exercise {
    color: var(--blue-700);
    background: var(--blue-100);
}

.signal-neutral {
    color: #66736c;
    background: #edf1ef;
}

/* ===== 运动柱状图、类型分布和类型色板 ===== */
.exercise-bar-frame {
    padding: 18px 20px 22px;
}

.exercise-bars {
    height: 270px;
    display: grid;
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 10px;
    align-items: end;
    padding-top: 12px;
}

.exercise-bar-column {
    height: 100%;
    display: grid;
    grid-template-rows: 22px 1fr 20px 17px;
    align-items: end;
    justify-items: center;
    gap: 5px;
}

.exercise-bar-value,
.exercise-bar-label {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 750;
}

.exercise-bar-column small {
    color: var(--muted);
    font-size: 9px;
}

.exercise-bar-track {
    position: relative;
    width: min(34px, 80%);
    height: 100%;
    min-height: 120px;
    overflow: hidden;
    border-radius: 8px 8px 4px 4px;
    background: #edf3f0;
}

.exercise-bar-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 3px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #44bd80, #177a50);
}

.exercise-bar-column.is-today .exercise-bar-fill {
    background: linear-gradient(180deg, #5294d0, #2a5f9e);
}

.exercise-bar-column.is-today .exercise-bar-label {
    color: var(--blue-700);
}

.exercise-entry-panel {
    overflow: hidden;
}

.exercise-lower-grid {
    grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
}

.type-distribution {
    padding: 20px;
    display: grid;
    gap: 17px;
}

.type-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.type-row-main {
    min-width: 0;
    flex: 1;
}

.type-row-heading {
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.type-row-heading span {
    color: var(--muted);
    font-size: 11px;
}

.type-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1ef;
}

.type-progress span {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
}

.exercise-type-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.exercise-type-badge {
    display: inline-flex;
    min-height: 25px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.duration-number {
    color: var(--blue-700);
    font-size: 15px;
}

.active-days {
    display: block;
    color: var(--ink);
    font-weight: 750;
}

.icon-button-danger {
    color: var(--red-600);
}

.icon-button-danger:hover {
    background: var(--red-100);
}

.type-running,
.type-strength {
    color: #a93430;
    background: var(--red-100);
}

.type-walking,
.type-yoga {
    color: #117047;
    background: var(--green-100);
}

.type-cycling,
.type-swimming {
    color: var(--blue-700);
    background: var(--blue-100);
}

.type-ball,
.type-other {
    color: var(--amber-700);
    background: var(--amber-100);
}

.exercise-type-dot.type-running,
.exercise-type-dot.type-strength {
    background: var(--red-600);
}

.exercise-type-dot.type-walking,
.exercise-type-dot.type-yoga {
    background: var(--green-600);
}

.exercise-type-dot.type-cycling,
.exercise-type-dot.type-swimming {
    background: #4c8fd0;
}

.exercise-type-dot.type-ball,
.exercise-type-dot.type-other {
    background: #d9881c;
}

.type-progress span.type-running,
.type-progress span.type-strength {
    background: var(--red-600);
}

.type-progress span.type-walking,
.type-progress span.type-yoga {
    background: var(--green-600);
}

.type-progress span.type-cycling,
.type-progress span.type-swimming {
    background: #4c8fd0;
}

.type-progress span.type-ball,
.type-progress span.type-other {
    background: #d9881c;
}

.coach-table.exercise-table {
    min-width: 1120px;
}

/* ===== 学员互动：客户列表、对话气泡和群发表单 ===== */
.messaging-grid {
    display: grid;
    grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.7fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

/* 对话区域自身控制外边距，避免网格内出现重复留白。 */
.messaging-grid > .panel {
    margin-bottom: 0;
}

.client-conversation-list {
    max-height: 640px;
    padding: 8px;
    overflow-y: auto;
}

.conversation-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 10px 11px;
    border-radius: 11px;
    transition: background 150ms ease, box-shadow 150ms ease;
}

.conversation-link + .conversation-link {
    margin-top: 3px;
}

.conversation-link:hover {
    background: #f3f8f5;
}

.conversation-link.active {
    background: var(--green-100);
    box-shadow: inset 3px 0 0 var(--green-600);
}

.conversation-person {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.22;
}

.conversation-person strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-person small {
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: var(--red-600);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.message-thread {
    min-height: 320px;
    max-height: 620px;
    padding: 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #f7faf8;
}

.compact-thread {
    min-height: 320px;
    max-height: 430px;
    border-bottom: 1px solid var(--line-soft);
}

.chat-bubble {
    width: fit-content;
    max-width: min(76%, 680px);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.chat-message-content {
    margin-top: 7px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* 视频气泡保持略宽于普通消息，但仍保留在同一个聊天气泡内。 */
.chat-bubble:has(.bilibili-message) {
    width: min(82%, 560px);
    max-width: min(82%, 560px);
}

.bilibili-message {
    display: block;
    width: 100%;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

.chat-message-content > .bilibili-message:first-child {
    margin-top: 0;
}

.bilibili-frame {
    display: block;
    aspect-ratio: 16 / 9;
    background: #111;
}

.bilibili-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 链接继承气泡文字颜色，过长时仍可在气泡宽度内换行。 */
.chat-message-content a {
    color: inherit;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.chat-message-content a:hover {
    text-decoration-thickness: 2px;
}

.chat-mine {
    align-self: flex-end;
    border-color: transparent;
    border-bottom-right-radius: 5px;
    background: var(--green-900);
    color: #fff;
}

.chat-theirs {
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    background: #fff;
}

.chat-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    color: var(--muted);
    font-size: 11px;
}

.chat-meta strong {
    font-size: 12px;
}

.chat-meta time {
    color: inherit;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chat-mine .chat-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-mine .chat-meta strong {
    color: #fff;
}

.chat-theirs .chat-meta strong {
    color: var(--ink);
}

.chat-compose {
    margin: 0;
    border-top: 1px solid var(--line-soft);
    background: #fff;
}

.chat-compose textarea {
    min-height: 100px;
    resize: vertical;
}

/* 群发表单在宽屏下保持适中的阅读宽度。 */
.narrow-panel {
    width: min(100%, 780px);
    margin-right: auto;
    margin-left: auto;
}

/* ===== 教练主页：富文本编辑器、博客列表和详情 ===== */
.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.heading-actions form {
    margin: 0;
}

.button-danger {
    color: #fff;
    background: var(--red-600);
    box-shadow: 0 8px 20px rgba(194, 63, 58, 0.18);
}

.button-danger:hover:not(:disabled) {
    background: #a93430;
}

.button-danger-text {
    color: var(--red-600);
}

.button-danger-text:hover:not(:disabled) {
    border-color: #efc1bd;
    background: var(--red-100);
}

/* 富文本编辑器：工具栏固定在正文上方，正文区域可滚动但保持最小高度。 */
.rich-text-source {
    display: none;
}

.rich-editor {
    border: 1px solid #ccd7d1;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.rich-editor:focus-within {
    border-color: #55a680;
    box-shadow: 0 0 0 4px rgba(26, 138, 90, 0.11);
}

.rich-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--line-soft);
    background: #f8faf9;
}

.rich-tool-button {
    min-width: 34px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.rich-tool-button:hover {
    background: #e9f2ed;
    color: var(--green-700);
}

.rich-tool-button[aria-pressed="true"] {
    border-color: #b6dcc9;
    background: var(--green-100);
    color: var(--green-700);
}

.rich-tool-button svg {
    width: 17px;
    height: 17px;
}

.rich-toolbar-divider {
    width: 1px;
    height: 20px;
    margin: 0 3px;
    background: var(--line);
}

.rich-editor-surface {
    min-height: 320px;
    max-height: 640px;
    padding: 16px;
    overflow-y: auto;
    outline: none;
    line-height: 1.8;
}

.rich-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #9aa49f;
}

.rich-editor-surface h2 {
    margin: 18px 0 8px;
    font-size: 20px;
}

.rich-editor-surface h3 {
    margin: 16px 0 6px;
    font-size: 17px;
}

.rich-editor-surface blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--green-600);
    background: #f4f8f6;
    color: var(--ink-soft);
}

.rich-editor-surface blockquote > :first-child {
    margin-top: 0;
}

.rich-editor-surface blockquote > :last-child {
    margin-bottom: 0;
}

.rich-editor-surface img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.rich-editor-status {
    margin: 0;
    padding: 0 12px 10px;
    color: var(--green-700);
    font-size: 12px;
}

.rich-editor-status:empty {
    display: none;
}

.rich-editor-status-error {
    color: var(--red-600);
}

.blog-form .form-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.blog-notify-option {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}
.blog-client-picker.is-disabled {
    opacity: 0.55;
}

/* 博客列表与详情：列表行复用一套信息结构，避免卡片嵌套。 */
.blog-list {
    padding: 4px 0;
}

.blog-manage-item,
.blog-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.blog-manage-item:last-child,
.blog-list-item:last-child {
    border-bottom: 0;
}

.blog-list-item {
    transition: background 150ms ease;
}

.blog-list-item:hover {
    background: #f6faf8;
}

.blog-list-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blog-preview-link {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.blog-list-copy h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
}

.blog-preview-link:hover h3 {
    color: var(--green-700);
}

.blog-list-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.blog-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.blog-visibility-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 11px;
    font-weight: 800;
}

.blog-item-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-item-actions form {
    margin: 0;
}

.blog-list-thumb {
    width: 96px;
    height: 72px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 10px;
    background: #eef3f0;
}

.blog-list-thumb-link {
    display: block;
    flex: 0 0 auto;
    border-radius: 10px;
    line-height: 0;
}

.blog-article {
    padding: 26px 28px 18px;
}

.blog-content {
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.blog-content > :first-child {
    margin-top: 0;
}

.blog-content h2 {
    margin: 26px 0 10px;
    font-size: 21px;
}

.blog-content h3 {
    margin: 22px 0 8px;
    font-size: 18px;
}

.blog-content p {
    margin: 0 0 14px;
}

.blog-content ul,
.blog-content ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

.blog-content li {
    margin: 4px 0;
}

.blog-content blockquote {
    margin: 16px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--green-600);
    background: #f4f8f6;
    color: var(--ink-soft);
}

.blog-content blockquote > :first-child {
    margin-top: 0;
}

.blog-content blockquote > :last-child {
    margin-bottom: 0;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 10px;
}

.blog-content a {
    color: var(--green-700);
    text-decoration: underline;
}

.blog-content .bilibili-message {
    margin: 16px 0;
}

.blog-content .bilibili-message:first-child {
    margin-top: 0;
}

.blog-article-footer {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* ===== 响应式断点：平板和窄屏 ===== */
@media (max-width: 1080px) {
    .metric-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid-two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .exercise-lower-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid,
    .manage-grid {
        grid-template-columns: 1fr;
    }

    /* 教练沟通页在窄屏改为上下排列，客户列表缩短为可滚动区域。 */
    .messaging-grid {
        grid-template-columns: 1fr;
    }

    .client-conversation-list {
        max-height: 240px;
    }
    .entry-panel,
    .form-panel {
        position: static;
    }

    .auth-layout {
        grid-template-columns: 0.9fr 1.1fr;
    }

    .auth-brand-panel {
        padding: 42px;
    }
}

/* ===== 响应式断点：中等宽度下顶栏换行，避免导航和用户区横向溢出 ===== */
@media (max-width: 960px) {
    .topbar-inner {
        min-height: 64px;
        width: min(100% - 28px, 1240px);
        flex-wrap: wrap;
        gap: 10px 18px;
        padding: 10px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        min-height: 38px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    /* 导航保留横向滑动，但不显示占用高度的滚动条。 */
    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav a {
        padding: 0 10px;
        font-size: 13px;
    }

    .main-nav a.active::after {
        left: 10px;
        right: 10px;
    }
}

/* ===== 响应式断点：手机单列布局 ===== */
@media (max-width: 820px) {

    .user-copy {
        display: none;
    }

    .page-shell,
    .site-footer {
        width: min(100% - 28px, 1240px);
    }

    .message-stack {
        position: static;
        width: min(100% - 28px, 1240px);
        margin: 12px auto 0;
    }

    .debug-404-frame {
        min-height: 560px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading .button {
        align-self: stretch;
    }

    .client-entry-form {
        grid-template-columns: 1fr;
    }

    .client-entry-form .button {
        width: 100%;
    }

    .auth-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: 560px;
        padding: 34px 26px;
    }

    .mobile-brand {
        display: flex;
    }

    .coach-table {
        min-width: 940px;
    }

    .coach-table.exercise-table {
        min-width: 1120px;
    }

    .blog-manage-item,
    .blog-list-item {
        flex-direction: column;
        align-items: stretch;
    }

    /* 单列时先展示预览图，再展示标题和文字摘要。 */
    .blog-manage-item .blog-list-thumb-link,
    .blog-list-item .blog-list-thumb {
        order: -1;
    }

    .blog-item-actions {
        width: 100%;
    }

    .rich-editor-surface {
        min-height: 260px;
    }

    .blog-list-thumb {
        width: 100%;
        height: 180px;
    }

    .blog-list-thumb-link {
        width: 100%;
    }
}

/* ===== 响应式断点：小屏手机 ===== */
@media (max-width: 580px) {
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .exercise-bars {
        height: 235px;
        gap: 5px;
    }

    .exercise-bar-track {
        width: min(26px, 75%);
    }

    .exercise-bar-frame {
        padding-left: 12px;
        padding-right: 12px;
    }
    body {
        font-size: 14px;
    }

    .brand-copy small {
        display: none;
    }

    .user-menu {
        gap: 5px;
    }

    .page-shell {
        padding-top: 24px;
    }

    .metric-grid-four {
        grid-template-columns: 1fr;
    }

    .metric-grid-two {
        grid-template-columns: 1fr;
    }

    .metric-grid-three {
        grid-template-columns: 1fr;
    }

    /* 手机端每个客户单独一行，保证复选框和姓名都有足够点击面积。 */
    .checkbox-list {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 126px;
    }

    .metric-card strong {
        font-size: 28px;
    }

    .signal-band {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-header .button,
    .search-form {
        width: 100%;
    }

    .chart-frame {
        padding-left: 12px;
        padding-right: 12px;
    }

    .chart-summary {
        justify-content: flex-start;
        gap: 12px;
    }

    .chart-canvas {
        min-height: 210px;
    }

    .data-table th,
    .data-table td {
        padding-left: 13px;
        padding-right: 13px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .message-thread {
        padding: 14px;
        gap: 14px;
    }

    .chat-bubble {
        max-width: 92%;
    }

    .chat-bubble:has(.bilibili-message) {
        width: 86%;
        max-width: 86%;
    }

    .chat-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .blog-article {
        padding: 20px 18px 14px;
    }

    .heading-actions,
    .blog-form .form-actions {
        width: 100%;
    }

    .heading-actions .button,
    .heading-actions form,
    .blog-form .form-actions .button {
        width: 100%;
    }
}

/* ===== 无障碍：尊重系统减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
