:root {
      --bg: #f5f7f6;
      --surface: #ffffff;
      --surface-soft: #f8fbfa;
      --ink: #202a27;
      --ink-soft: #52605b;
      --muted: #7d8a85;
      --line: #dce4e0;
      --teal: #287b65;
      --teal-dark: #1e6250;
      --teal-soft: #e5f0ec;
      --coral: #d66f55;
      --coral-soft: #fbece8;
      --blue-soft: #eaf0f9;
      --blue: #5677a6;
      --warn: #bb7b1b;
      --warn-soft: #fff6df;
      --danger: #c45252;
      --danger-soft: #fff0f0;
      --radius: 8px;
      --radius-sm: 7px;
      --shadow: none;
      --font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    * { box-sizing: border-box; }
    html { min-height: 100%; background: var(--bg); }
    body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; }
    button, input, select, textarea { font: inherit; }
    button { cursor: pointer; }
    a { color: inherit; }
    .hidden { display: none !important; }

    /* Auth */
    .auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 470px; }
    .auth-intro { position: relative; overflow: hidden; background: #213b43; color: #f7fbfa; padding: clamp(36px, 7vw, 98px); display: flex; flex-direction: column; justify-content: space-between; }
    .auth-intro::after { content: none; }
    .brand-mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
    .brand-mark .mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--teal); color: #fff; border-radius: 10px; }
    .brand-mark .mark svg { width: 19px; height: 19px; }
    .auth-intro h1 { margin: 68px 0 18px; max-width: 520px; font-size: 52px; line-height: 1.12; letter-spacing: 0; font-weight: 720; }
    .auth-intro p { max-width: 440px; margin: 0; color: rgba(247, 251, 250, .72); font-size: 16px; }
    .auth-note { color: rgba(247, 251, 250, .5); font-size: 12px; }
    .auth-form-wrap { display: flex; align-items: center; padding: 40px clamp(24px, 6vw, 72px); background: var(--surface); }
    .auth-form { width: min(100%, 340px); margin: 0 auto; }
    .auth-form h2 { margin: 0 0 7px; font-size: 28px; letter-spacing: 0; }
    .auth-form .sub { margin: 0 0 28px; color: var(--muted); }
    .auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
    .auth-tabs button { flex: 1; padding: 11px 8px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; }
    .auth-tabs button.active { color: var(--teal-dark); font-weight: 700; border-bottom-color: var(--teal); }
    .form-field { margin-bottom: 16px; }
    .form-field label { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
    .form-field input, .form-field select, .form-field textarea { display: block; width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none; transition: border-color .18s, box-shadow .18s; }
    .form-field input, .form-field select { height: 43px; padding: 0 13px; }
    .form-field textarea { min-height: 92px; padding: 11px 13px; resize: vertical; }
    .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(35, 158, 148, .11); }
    .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
    .error-text { min-height: 22px; margin: 2px 0 9px; color: var(--danger); font-size: 12px; }
    .form-help { color: var(--muted); font-size: 12px; margin-top: 6px; }

    /* Shared controls */
    .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 650; transition: transform .18s, background .18s, border-color .18s, color .18s; white-space: nowrap; }
    .btn:hover { transform: translateY(-1px); }
    .btn:active { transform: translateY(0); }
    .btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
    .btn-primary { background: var(--teal); color: #fff; box-shadow: 0 7px 15px rgba(35, 158, 148, .18); }
    .btn-primary:hover { background: var(--teal-dark); }
    .btn-secondary { background: var(--teal-soft); color: var(--teal-dark); }
    .btn-outline { background: var(--surface); color: var(--ink-soft); border-color: var(--line); }
    .btn-outline:hover { border-color: var(--teal); color: var(--teal-dark); }
    .btn-quiet { min-height: 34px; padding: 0 9px; background: transparent; color: var(--ink-soft); }
    .btn-danger { color: var(--danger); background: var(--danger-soft); }
    .btn-full { width: 100%; }
    .icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); }
    .icon-btn:hover { background: var(--surface-soft); color: var(--ink); border-color: var(--line); }
    .icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
    .icon-btn svg { width: 17px; height: 17px; }
    .btn:disabled, .icon-btn:disabled { opacity: .52; cursor: not-allowed; transform: none; }
    .select-compact { height: 36px; min-width: 130px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--surface); outline: none; }
    .select-compact:focus { border-color: var(--teal); }
    .status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
    .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
    .status.active { color: var(--teal-dark); background: var(--teal-soft); }
    .status.completed { color: var(--blue); background: var(--blue-soft); }
    .status.upcoming { color: var(--warn); background: var(--warn-soft); }
    .status.none { color: var(--muted); background: #eef2f1; }
    .empty { padding: 45px 20px; color: var(--muted); text-align: center; }
    .empty svg { width: 30px; height: 30px; margin-bottom: 8px; color: #b3c4c0; }

    /* App shell */
    .app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
    .sidebar { display: flex; flex-direction: column; padding: 25px 16px 18px; background: #fff; border-right: 1px solid var(--line); }
    .sidebar .brand-mark { padding: 0 12px; }
    .sidebar-nav { display: grid; gap: 5px; margin-top: 47px; }
    .nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; padding: 0 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; text-align: left; font-weight: 620; }
    .nav-item svg { width: 18px; height: 18px; }
    .nav-item:hover { color: var(--ink); background: var(--surface-soft); }
    .nav-item.active { color: var(--teal-dark); background: var(--teal-soft); }
    .sidebar-bottom { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--line); }
    .user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
    .avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; background: #d8ece7; color: var(--teal-dark); font-size: 13px; font-weight: 750; }
    .user-mini strong { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
    .user-mini span { display: block; color: var(--muted); font-size: 11px; }
    .logout-btn { width: 100%; justify-content: flex-start; padding-left: 0; color: var(--muted); }
    .main { min-width: 0; padding: 0 clamp(18px, 4vw, 55px) 55px; }
    .topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
    .topbar-title { color: var(--muted); font-size: 12px; }
    .topbar-actions { display: flex; align-items: center; gap: 10px; }
    .today-label { color: var(--ink-soft); font-size: 12px; }
    .content { width: min(1180px, 100%); margin: 0 auto; padding-top: 38px; }
    .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
    .page-head h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: 0; line-height: 1.2; }
    .page-head p { margin: 0; color: var(--muted); }
    .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
    .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 0; }
    .panel-head h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
    .panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
    .panel-body { padding: 20px 24px 24px; }
    .section-label { margin: 0 0 13px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0; }

    /* Dashboard */
    .dashboard-top { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(270px, .78fr); gap: 18px; }
    .plan-focus { position: relative; overflow: hidden; min-height: 218px; padding: 24px; background: #27464d; color: #f7fbfa; border: 0; }
    .plan-focus::after { content: none; }
    .plan-focus .section-label { color: rgba(247, 251, 250, .58); }
    .plan-focus h2 { margin: 0; max-width: 480px; font-size: 25px; line-height: 1.2; letter-spacing: 0; }
    .plan-meta { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 14px; color: rgba(247, 251, 250, .68); font-size: 12px; }
    .plan-meta svg { width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; }
    .plan-progress { position: absolute; right: 24px; bottom: 26px; left: 24px; z-index: 1; }
    .plan-progress-row { display: flex; justify-content: space-between; margin-bottom: 7px; color: rgba(247, 251, 250, .75); font-size: 11px; }
    .progress-track { height: 6px; overflow: hidden; background: rgba(247, 251, 250, .18); border-radius: 99px; }
    .progress-track span { display: block; height: 100%; border-radius: inherit; background: #b3e4d6; }
    .quick-note { padding: 22px 24px; }
    .quick-note h2 { margin: 0 0 13px; font-size: 17px; }
    .today-check { display:flex; justify-content:space-between; gap:16px; padding:10px 0; border-bottom:1px solid var(--line); color:var(--muted); font-size:12px; }
    .today-check strong { color:var(--ink); font-size:13px; }
    .quick-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:15px; }
    .metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 13px; margin: 18px 0; }
    .metric { padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
    .metric-label { color: var(--muted); font-size: 12px; }
    .metric-value { margin: 9px 0 2px; font-size: 24px; line-height: 1.1; font-weight: 740; letter-spacing: 0; }
    .metric-value small { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 550; letter-spacing: 0; }
    .metric-hint { min-height: 18px; color: var(--muted); font-size: 11px; }
    .metric-hint.good { color: var(--teal-dark); }
    .metric-hint.warn { color: var(--warn); }
    .chart-panel { overflow: hidden; }
    .chart-wrap { position: relative; height: 295px; margin: 8px 0 0; }
    #weight-chart { display: block; width: 100%; height: 100%; }
    .chart-legend { display: flex; align-items: center; gap: 17px; padding: 0 24px 20px; color: var(--muted); font-size: 11px; }
    .legend-item { display: inline-flex; align-items: center; gap: 6px; }
    .legend-line { width: 20px; height: 2px; background: var(--teal); }
    .legend-line.target { background: var(--coral); border-top: 1px dashed var(--coral); }
    .preview-panel { margin-top: 18px; }
    .table-scroll { overflow-x: auto; }
    .data-table { width: 100%; border-collapse: collapse; text-align: left; }
    .data-table th { padding: 12px 24px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 650; white-space: nowrap; }
    .data-table td { padding: 13px 24px; color: var(--ink-soft); border-bottom: 1px solid #eef2f1; font-size: 12px; white-space: nowrap; }
    .data-table tbody tr:last-child td { border-bottom: 0; }
    .data-table tbody tr:hover { background: var(--surface-soft); }
    .weight-strong { color: var(--ink) !important; font-weight: 700; }
    .note-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
    .record-list { padding: 0 24px 10px; }
    .record-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 68px; border-bottom: 1px solid #eef2f1; }
    .record-list-row:last-child { border-bottom: 0; }
    .record-row-main { display: grid; grid-template-columns: 88px 92px minmax(0, 1fr) 22px; gap: 14px; align-items: center; min-width: 0; width: 100%; padding: 9px 0; border: 0; background: transparent; color: inherit; text-align: left; }
    .record-row-main:hover .record-weight { color: var(--teal-dark); }
    .record-date { display: grid; gap: 1px; color: var(--ink-soft); }
    .record-date strong { color: var(--ink); font-size: 12px; }
    .record-date small, .record-row-note, .record-plan { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
    .record-weight { color: var(--ink); font-size: 16px; font-weight: 760; white-space: nowrap; }
    .record-row-note { min-width: 0; }
    .record-row-actions { display: inline-flex; align-items: center; gap: 2px; }
    .record-row-actions .icon-btn { width: 30px; height: 30px; }
    .record-row-chevron { display: inline-grid; place-items: center; color: #a4b2b8; }
    .record-row-chevron svg { width: 17px; height: 17px; }
    body.detail-open { overflow: hidden; }
    .detail-layer { position: fixed; inset: 0; z-index: 50; }
    .detail-backdrop { position: absolute; inset: 0; background: rgba(24, 42, 56, .28); backdrop-filter: blur(2px); }
    .detail-sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); padding: 25px 25px 24px; overflow-y: auto; background: var(--surface); box-shadow: -16px 0 40px rgba(25, 46, 53, .16); animation: detail-in .2s ease-out; }
    .detail-close { position: absolute; top: 17px; right: 17px; }
    .detail-sheet h2 { margin: 30px 0 4px; font-size: 28px; letter-spacing: 0; }
    .detail-sheet .detail-date { color: var(--muted); font-size: 12px; }
    .detail-weight { margin: 35px 0 27px; color: var(--ink); font-size: 48px; line-height: 1; font-weight: 760; letter-spacing: 0; }
    .detail-weight small { margin-left: 7px; color: var(--muted); font-size: 14px; font-weight: 550; letter-spacing: 0; }
    .detail-block { padding: 15px 0; border-top: 1px solid var(--line); }
    .detail-block label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
    .detail-block p { min-height: 20px; margin: 0; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
    .detail-actions { display: flex; gap: 9px; margin-top: 27px; }
    .detail-actions .btn { flex: 1; }
    @keyframes detail-in { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: translateX(0); } }

    /* Record and history */
    .record-layout { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
    .record-form { padding: 25px; }
    .record-form h2 { margin: 0 0 5px; font-size: 19px; }
    .record-form > p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
    .record-form .btn { margin-top: 5px; }
    .record-tip { display: flex; gap: 9px; margin-top: 18px; padding: 12px; color: var(--ink-soft); background: var(--surface-soft); border-radius: 10px; font-size: 11px; }
    .record-tip svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--teal); }
    .weight-picker { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 218px; margin: 4px 0 20px; padding: 12px 0; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
    .picker-column { position: relative; width: 76px; }
    .picker-viewport { position: relative; height: 168px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
    .picker-viewport::-webkit-scrollbar { display: none; }
    .picker-options { padding: 63px 0; }
    .picker-option { display: grid; place-items: center; height: 42px; color: #a6b1b9; font-size: 20px; scroll-snap-align: center; transition: color .18s, transform .18s; user-select: none; }
    .picker-option.selected { color: var(--ink); font-size: 30px; font-weight: 760; transform: scale(1.02); }
    .picker-column::before, .picker-column::after { content: ""; position: absolute; right: 4px; left: 4px; z-index: 1; height: 48px; pointer-events: none; }
    .picker-column::before { top: 0; background: linear-gradient(var(--surface-soft), rgba(248,251,250,0)); }
    .picker-column::after { bottom: 0; background: linear-gradient(rgba(248,251,250,0), var(--surface-soft)); }
    .picker-highlight { position: absolute; top: 63px; right: 3px; left: 3px; z-index: 0; height: 42px; border-top: 1px solid #c7dfda; border-bottom: 1px solid #c7dfda; pointer-events: none; }
    .picker-dot { margin: 0 -5px 2px; color: var(--ink); font-size: 28px; font-weight: 750; }
    .picker-unit { align-self: center; margin-left: 3px; color: var(--muted); font-size: 14px; }
    .picker-value { margin: -7px 0 14px; color: var(--teal-dark); text-align: center; font-size: 13px; font-weight: 700; }
    .records-panel { min-width: 0; }
    .records-panel .panel-body { padding-top: 12px; }
    .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
    .filter-bar input, .filter-bar select { height: 36px; padding: 0 10px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; outline: none; }
    .filter-bar input:focus, .filter-bar select:focus { border-color: var(--teal); }
    .filter-spacer { flex: 1; }
    .table-action { display: inline-flex; align-items: center; gap: 4px; }
    .table-action .icon-btn { width: 28px; height: 28px; }
    .table-action .icon-btn svg { width: 15px; height: 15px; }

    /* Assistant */
    .assistant-grid { display: grid; grid-template-columns: minmax(270px, .82fr) minmax(0, 1.45fr); gap: 18px; align-items: start; }
    .insight-panel { padding: 24px; }
    .insight-panel h2 { margin: 0 0 6px; font-size: 19px; }
    .insight-panel > p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
    .ai-disclaimer { display: flex; gap: 9px; margin: 18px 0 0; padding: 12px; color: var(--ink-soft); background: var(--warn-soft); border-radius: 10px; font-size: 11px; }
    .ai-disclaimer svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--warn); }
    .analysis-copy { min-height: 160px; max-height: 350px; overflow: auto; margin-top: 19px; padding: 15px; color: var(--ink-soft); background: var(--surface-soft); border-radius: 11px; font-size: 13px; }
    .analysis-copy.empty { display: grid; place-items: center; min-height: 120px; padding: 12px; text-align: center; }
    .chat-panel { display: flex; flex-direction: column; min-height: 560px; overflow: hidden; }
    .chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
    .chat-head h2 { margin: 0; font-size: 17px; }
    .chat-head span { color: var(--muted); font-size: 11px; }
    .chat-messages { min-height: 390px; max-height: 510px; overflow-y: auto; padding: 22px; background: #fbfcfc; }
    .chat-empty { display: grid; place-items: center; min-height: 330px; padding: 40px; color: var(--muted); text-align: center; font-size: 12px; }
    .chat-empty svg { width: 30px; height: 30px; margin-bottom: 8px; color: #b3c4c0; }
    .chat-bubble { max-width: 84%; margin-bottom: 13px; }
    .chat-bubble.user { margin-left: auto; }
    .chat-bubble .bubble-meta { margin: 0 0 4px; color: var(--muted); font-size: 10px; }
    .chat-bubble.user .bubble-meta { text-align: right; }
    .chat-bubble .bubble-content { padding: 11px 13px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: 13px 13px 13px 3px; font-size: 13px; }
    .chat-bubble.user .bubble-content { color: #fff; background: var(--teal); border-color: var(--teal); border-radius: 13px 13px 3px 13px; }
    .chat-bubble.user .bubble-content { white-space: pre-wrap; }
    .ai-rich-text { line-height: 1.7; overflow-wrap: anywhere; }
    .ai-rich-text > :first-child { margin-top: 0; }
    .ai-rich-text > :last-child { margin-bottom: 0; }
    .ai-rich-text h2, .ai-rich-text h3, .ai-rich-text h4 { margin: 15px 0 6px; color: var(--ink); line-height: 1.35; letter-spacing: 0; }
    .ai-rich-text h2 { font-size: 16px; }
    .ai-rich-text h3, .ai-rich-text h4 { font-size: 14px; }
    .ai-rich-text p { margin: 7px 0; }
    .ai-rich-text ul, .ai-rich-text ol { margin: 7px 0; padding-left: 22px; }
    .ai-rich-text li { margin: 4px 0; }
    .ai-rich-text code { padding: 1px 4px; background: rgba(35, 158, 148, .08); border-radius: 4px; font-family: Consolas, monospace; font-size: .92em; }
    .chat-compose { display: flex; align-items: flex-end; gap: 9px; padding: 15px 17px; background: #fff; border-top: 1px solid var(--line); }
    .chat-compose textarea { flex: 1; min-height: 43px; max-height: 100px; padding: 10px 12px; resize: vertical; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; outline: none; }
    .chat-compose textarea:focus { border-color: var(--teal); }
    .chat-compose .btn { min-width: 74px; }

    /* Settings */
    .settings-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
    .settings-stack { display: grid; gap: 18px; }
    .settings-form { padding: 24px; }
    .settings-form h2 { margin: 0 0 5px; font-size: 18px; }
    .settings-form > p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
    .plan-list { display: grid; gap: 10px; margin-top: 16px; }
    .plan-row { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); }
    .plan-row-main { min-width: 0; }
    .plan-row-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .plan-row-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
    .plan-row-side { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
    .data-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
    .danger-zone { border-color: #f0dada; }
    .danger-zone .panel-head h2 { color: var(--danger); }
    .danger-copy { margin: 0; color: var(--ink-soft); font-size: 12px; }
    .profile-line { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
    .profile-line:last-child { border-bottom: 0; }
    .profile-line span { color: var(--muted); font-size: 12px; }
    .profile-line strong { max-width: 65%; overflow: hidden; color: var(--ink-soft); text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

    .mobile-nav { display: none; }
    .toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; gap: 9px; width: min(330px, calc(100vw - 36px)); }
    .toast { display: flex; align-items: flex-start; gap: 9px; padding: 12px 13px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 10px; box-shadow: 0 14px 35px rgba(31, 56, 63, .12); font-size: 12px; animation: toast-in .2s ease-out; }
    .toast svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--teal); }
    .toast.error { border-left-color: var(--danger); }
    @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
    .loading { opacity: .65; pointer-events: none; }

    @media (max-width: 930px) {
      .app-shell { grid-template-columns: 1fr; }
      .sidebar { display: none; }
      .main { padding-bottom: 87px; }
      .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 8px max(4px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-right)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); box-shadow: 0 -8px 20px rgba(34, 62, 66, .05); }
      .mobile-nav .nav-item { display: flex; flex-direction: column; gap: 2px; min-height: 48px; padding: 5px; justify-content: center; align-items: center; font-size: 10px; }
      .mobile-nav .nav-item svg { width: 18px; height: 18px; }
      .topbar { min-height: 65px; }
      .content { padding-top: 28px; }
    }
    @media (min-width: 761px) and (max-width: 1120px) {
      .metric-grid { grid-template-columns: repeat(3, 1fr); }
    }
    @media (max-width: 760px) {
      .auth-shell { display: block; }
      .auth-intro { min-height: 245px; padding: 28px 25px; }
      .auth-intro h1 { margin: 38px 0 10px; font-size: 36px; }
      .auth-intro p { font-size: 13px; }
      .auth-note { display: none; }
      .auth-form-wrap { min-height: calc(100vh - 245px); padding: 31px 25px 50px; align-items: flex-start; }
      .main { padding-right: 14px; padding-left: 14px; }
      .topbar { gap: 10px; }
      .topbar-title { display: none; }
      .today-label { font-size: 11px; }
      .page-head { align-items: flex-start; flex-direction: column; gap: 15px; margin-bottom: 22px; }
      .page-head h1 { font-size: 28px; }
      .page-head .btn { width: 100%; }
      .dashboard-top, .record-layout, .assistant-grid, .settings-grid { grid-template-columns: 1fr; }
      .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0; }
      .metric { padding: 14px; }
      .metric-value { font-size: 21px; }
      .panel-head { padding: 18px 17px 0; }
      .panel-body { padding: 17px; }
      .plan-focus { min-height: 218px; padding: 20px 18px; }
      .plan-progress { right: 18px; bottom: 20px; left: 18px; }
      .quick-note { padding: 18px; }
      .chart-wrap { height: 246px; }
      .chart-legend { padding: 0 17px 16px; }
      .data-table th { padding: 10px 14px; }
      .data-table td { padding: 11px 14px; }
      .record-list { padding: 0 13px 8px; }
      .record-list-row { gap: 6px; min-height: 64px; }
      .record-row-main { grid-template-columns: 58px 74px minmax(0, 1fr) 18px; gap: 9px; padding: 8px 0; }
      .record-weight { font-size: 15px; }
      .record-row-note { display: -webkit-box; overflow: hidden; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
      .record-row-actions .icon-btn { width: 28px; height: 28px; }
      .record-row-actions .icon-btn[data-delete-record] { display: none; }
      .detail-sheet { top: auto; width: 100%; max-height: 78vh; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; box-shadow: 0 -16px 40px rgba(25, 46, 53, .18); animation-name: detail-up; }
      .detail-sheet h2 { margin-top: 22px; }
      .detail-weight { margin: 25px 0 20px; font-size: 42px; }
      @keyframes detail-up { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
      .filter-bar { padding: 14px 16px; }
      .filter-spacer { display: none; }
      .filter-bar .btn { flex: 1; }
      .record-form { padding: 19px 17px; }
      .chat-panel { min-height: 525px; }
      .chat-messages { min-height: 350px; padding: 17px; }
      .chat-bubble { max-width: 92%; }
    }
    @media (max-width: 420px) {
      .form-grid { grid-template-columns: 1fr; }
      .topbar-actions .btn { padding: 0 10px; }
      .topbar-actions .btn span { display: none; }
      .topbar-actions .btn svg { margin: 0; }
    }
    @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
    .food-page { max-width: 940px; margin: 0 auto; }
    .food-page .page-head { margin-bottom: 16px; }
    .food-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 16px; }
    .food-metrics .metric { padding: 13px 14px; }
    .food-metrics .metric-value { margin-top: 5px; font-size: 21px; }
    .food-entry-grid { display:grid; grid-template-columns:minmax(0, 1.25fr) minmax(280px, .75fr); gap:16px; align-items:start; }
    .food-add-panel { padding: 20px; }
    .food-add-panel .panel-head { padding:0; }
    .food-add-panel .food-form { margin-top:16px; }
    .food-library { display:flex; gap:8px; align-items:end; margin:0 0 14px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); }
    .food-library .form-field { flex:1; margin:0; }
    .food-library .icon-btn { flex:0 0 auto; }
    .copy-layer { position:fixed; inset:0; z-index:60; display:grid; place-items:center; padding:18px; background:rgba(24,42,56,.28); }
    .copy-dialog { width:min(100%,360px); padding:20px; border-radius:8px; background:var(--surface); box-shadow:0 18px 42px rgba(25,46,53,.18); }
    .copy-dialog h2 { margin:0 0 5px; font-size:18px; }
    .copy-dialog p { margin:0 0 16px; color:var(--muted); font-size:12px; }
    .copy-dialog-actions { display:flex; gap:8px; justify-content:flex-end; }
    .food-add-panel h2 { margin:0 0 3px; font-size:18px; }
    .food-add-panel > p { margin:0 0 16px; color:var(--muted); font-size:12px; }
    .food-form .form-field { margin-bottom: 11px; }
    .food-form-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top: 3px; }
    .food-form-actions .btn { flex:1; min-width:120px; }
    .food-list-panel { margin-top:16px; overflow:hidden; }
    .food-meal { padding:13px 18px; border-top:1px solid var(--line); }
    .food-meal h3 { margin:0 0 6px; color:var(--teal-dark); font-size:14px; }
    .food-meal h3 small { display:block; margin-top:3px; color:var(--muted); font-size:11px; font-weight:500; }
    .food-empty { color:var(--muted); font-size:12px; margin:0; }
    .food-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:10px; align-items:center; padding:9px 0; border-bottom:1px solid #eef2f1; }
    .food-row-actions { display:flex; gap:2px; }
    .food-row:last-child { border-bottom:0; }
    .food-row-main { min-width:0; padding:0; border:0; background:transparent; color:inherit; text-align:left; }
    .food-row-main:hover strong { color:var(--teal-dark); }
    .food-row strong,.food-row small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .food-row small { color:var(--muted); margin-top:2px; font-size:11px; }
    .food-row > span { color:var(--ink-soft); font-size:12px; white-space:nowrap; }
    .food-ai-panel input[type=file] { padding: 9px; height:auto; font-size:12px; }
    .draft-box { margin-top:14px; padding:12px; border:1px solid var(--teal-soft); border-radius:10px; background:var(--surface-soft); }
    .draft-box h3 { margin:0 0 8px; font-size:14px; }
    .draft-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
    .draft-box label { display:flex; flex-direction:column; gap:4px; color:var(--muted); font-size:11px; }
    .draft-box input { width:100%; height:35px; padding:0 8px; border:1px solid var(--line); border-radius:8px; background:#fff; }
    .draft-box .btn { width:100%; margin-top:12px; }
    .food-mode-tabs { display:grid; grid-template-columns:1fr 1fr; gap:3px; margin-bottom:18px; padding:3px; background:var(--surface-soft); border:1px solid var(--line); border-radius:8px; }
    .food-mode-tabs button, .meal-options button { min-height:36px; border:0; border-radius:6px; background:transparent; color:var(--muted); font-weight:650; }
    .food-mode-tabs button.active, .meal-options button.active { background:var(--surface); color:var(--teal-dark); box-shadow:0 1px 3px rgba(32,42,39,.1); }
    .meal-picker { margin-bottom:16px; }
    .meal-picker > span { display:block; margin-bottom:7px; color:var(--ink-soft); font-size:12px; font-weight:650; }
    .meal-picker small { display:block; margin-top:6px; color:var(--muted); font-size:11px; }
    .meal-options { display:grid; grid-template-columns:repeat(4,1fr); gap:4px; padding:3px; background:var(--surface-soft); border:1px solid var(--line); border-radius:8px; }
    .nutrition-details { margin:2px 0 14px; padding:0 12px; border:1px solid var(--line); border-radius:8px; }
    .nutrition-details summary { padding:12px 0; color:var(--ink-soft); cursor:pointer; font-weight:650; }
    .nutrition-details[open] summary { margin-bottom:10px; border-bottom:1px solid var(--line); }
    @media (max-width:760px) { .food-page { display:block; max-width:none; } .food-page > .food-add-panel { margin-top:12px; } .food-entry-grid { grid-template-columns:1fr; gap:12px; } .food-add-panel { padding:17px; } .food-metrics { grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; } .food-metrics .metric:last-child { grid-column:span 2; } .food-metrics .metric-value { font-size:20px; } .food-meal { padding:12px 16px; } .mobile-nav .nav-item { min-width:0; font-size:9px; white-space:nowrap; } .mobile-nav .nav-item svg { width:16px; height:16px; } }
    @media (max-width:420px) { .food-row { grid-template-columns:minmax(0,1fr) auto 30px; } .food-row > span { font-size:11px; } .food-row .icon-btn { width:30px; height:30px; } .food-form-actions .btn { width:100%; flex-basis:100%; } .draft-fields { grid-template-columns:1fr; } }
