/* ════════════════════════════════════════════════════════════════
   DuDuClock · 小框日记 — Frontend Styles
   Modern, responsive SPA with an ink-white default palette.
   ════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ───────────────────────────────────────────── */
:root {
    /* Brand — 墨蓝灰 (subtle ink-blue, not too muted) */
    --accent: #434358;
    --accent-hover: #333350;
    --accent-soft: rgba(67, 67, 88, 0.06);
    --accent-gradient: linear-gradient(135deg, #434358 0%, #5e5e7a 100%);

    /* Status */
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0ea5e9;
    --info-soft: #e0f2fe;

    /* Surfaces */
    --bg: #fafaf9;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f3f3f0;
    --border: #d6d6d8;
    --border-strong: #c5c5ca;

    /* Text */
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Layout */
    --sidebar-w: 240px;
    --header-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* Shadows — layered elevation (diffuse + tight) */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.1), 0 8px 20px rgba(15, 23, 42, 0.14);

    /* Spring easing for tactile interactions */
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    /* Mood colors */
    --mood-happy: #fbbf24;
    --mood-sweet: #ec4899;
    --mood-miss: #8b5cf6;
    --mood-sad: #64748b;
    --mood-neutral: #94a3b8;

    /* Backward-compatible aliases for advanced-effects.css / animations.css */
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --primary-light: var(--accent-soft);
    --text-primary: var(--text);
    --bg-secondary: var(--bg);
    --bg-tertiary: var(--surface-hover);
}

/* ════════════════════════════════════════════════════════════════
   Theme variables are now defined in frontend/themes/*.css
   and loaded dynamically by theme-manager.js.
   See: base.css (defaults) + per-theme files.
   ════════════════════════════════════════════════════════════════ */

/* ─── Advanced Effects Containers ─────────────────────────────── */
/* All effect canvases stay at the bottom layer, behind all content */
.starfield-container,
.particles-container,
.constellation-container,
.starfield-canvas,
.particles-canvas,
.constellation-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Free-tier ambient glow backgrounds (always on) */
#free-ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    pointer-events: none;
}

.ambient-glow-1 {
    width: 60vw;
    height: 60vw;
    max-width: 800px;
    max-height: 800px;
    top: -20%;
    left: -10%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
    animation: ambientDrift1 20s ease-in-out infinite;
}

.ambient-glow-2 {
    width: 50vw;
    height: 50vw;
    max-width: 650px;
    max-height: 650px;
    bottom: -15%;
    right: -10%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, transparent 70%);
    animation: ambientDrift2 25s ease-in-out infinite;
}

.ambient-glow-3 {
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
    animation: ambientDrift3 18s ease-in-out infinite;
}

@keyframes ambientDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3vw, 2vh) scale(1.05); }
    66% { transform: translate(-2vw, -1vh) scale(0.95); }
}

@keyframes ambientDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-3vw, -2vh) scale(0.95); }
    66% { transform: translate(2vw, 3vh) scale(1.08); }
}

@keyframes ambientDrift3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.starfield-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.particles-canvas,
.constellation-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ─── Reset ───────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 50%, var(--accent-soft) 100%);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Ambient Glow — base structure; per-theme tints are in themes/*.css */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Tabular nums for all numeric/date/time elements */
.stat-value, .calendar-day, .cal-day, .cal-title,
.device-stat .val, .cycle-stat .num,
.ws-status, .badge, .priority-badge, .category-tag,
.visibility-tag, .mood-tag, .weather-tag,
.message-time, .nav-badge, code {
    font-feature-settings: 'tnum' 1;
    font-variant-numeric: tabular-nums;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
svg { fill: currentColor; }

[hidden] { display: none !important; }

/* ─── Login Screen ────────────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--accent-gradient);
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px 32px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.logo-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    overflow: hidden;
}
.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.logo-icon.small {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin-bottom: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo .subtitle {
    color: var(--text-muted);
    font-size: 13px;
}

.login-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.login-tabs .tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}
.login-tabs .tab-btn.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-form input {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.login-help {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 4px;
}
.login-help a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}
.login-help a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.register-verify-step {
    margin-top: 4px;
    animation: fadeIn 0.25s ease;
}
.register-verify-divider {
    border: none;
    border-top: 1px solid var(--border, #e5e7eb);
    margin: 14px 0 12px;
}
.register-verify-code-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.register-verify-code-row input {
    flex: 1;
    min-width: 0;
}
.register-verify-step .login-help {
    justify-content: space-between;
    margin-top: 10px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.error-msg {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s var(--ease-spring);
    white-space: nowrap;
    position: relative;
}
.btn:hover { background: var(--surface-hover); }
.btn:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
    border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; }

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
    border-color: var(--success);
}
.btn-success:hover { background: #15803d; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-hover); }

.btn-text {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
}
.btn-text:hover { background: var(--surface-hover); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ─── App Layout ──────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.4s var(--ease-spring);
}

/* Desktop-only: collapse sidebar via grid column */
@media (min-width: 769px) {
    .app-layout.sidebar-collapsed {
        grid-template-columns: 0px 1fr;
    }

    .app-layout.sidebar-collapsed .sidebar {
        width: 0;
        transform: translateX(-100%);
        opacity: 0;
        border-right: none;
    }

    /* Shift Q button when sidebar collapsed on desktop */
    .app-layout.sidebar-collapsed ~ .q-toggle-btn {
        left: 16px;
    }

    /* Prevent Q button from overlapping header title when sidebar collapsed */
    .app-layout.sidebar-collapsed .content-header {
        padding-left: 68px;
    }
}

/* ─── Q Button Toggle ────────────────────────────────────────── */
.q-toggle-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    overflow: hidden;
}

[data-theme="dark-mode"] .q-toggle-btn {
    background: rgba(22, 24, 32, 0.35);
}

.q-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
    background: var(--accent-soft);
    border-color: var(--accent);
}

.q-toggle-btn:active {
    transform: scale(0.93);
    transition-duration: 0.1s;
}

.q-toggle-btn .q-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-spring);
    display: block;
}

.q-toggle-btn.rotated .q-icon {
    transform: rotate(360deg);
}

/* Q button: subtle gear animation on rotate */
.q-toggle-btn.gear-effect {
    animation: qGearPulse 0.6s var(--ease-spring);
}

@keyframes qGearPulse {
    0% { box-shadow: var(--shadow-md); }
    50% { box-shadow: 0 0 0 8px var(--accent-soft), var(--shadow-lg); }
    100% { box-shadow: var(--shadow-md); }
}

@media (min-width: 769px) {
    .q-toggle-btn {
        display: flex;
    }
    /* Shift Q button position when sidebar is collapsed */
    .app-layout.sidebar-collapsed ~ .q-toggle-btn {
        left: 16px;
    }
}

@media (max-width: 768px) {
    .q-toggle-btn {
        display: flex;
        top: 12px;
        left: 12px;
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }
    .q-toggle-btn .q-icon {
        font-size: 18px;
    }
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: var(--sidebar-w);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.4s var(--ease-spring);
        overflow: hidden;
    }
    .sidebar.open {
        transform: translateX(0) !important;
        opacity: 1 !important;
    }

    /* Sidebar overlay backdrop (mobile only) */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .view-container {
        padding: 16px;
    }
    .content-header {
        padding: 0 16px;
        padding-left: 56px;
    }
    .content-header h1 {
        font-size: 16px;
    }
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    transition: transform 0.4s var(--ease-spring), width 0.4s var(--ease-spring), opacity 0.3s var(--ease-spring), min-width 0.4s var(--ease-spring);
    overflow: hidden;
    z-index: 50;
}

[data-theme="dark-mode"] .sidebar {
    background: rgba(22, 24, 32, 0.32);
}

/* Desktop-only: hide sidebar when collapsed */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        transform: translateX(-100%);
        border-right: none;
        opacity: 0;
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-title {
    font-weight: 700;
    font-size: 15px;
}
.sidebar-subtitle {
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s var(--ease-spring);
    cursor: pointer;
    margin-bottom: 2px;
    user-select: none;
}
.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.nav-item:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}
.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    display: inline-block;
    margin-left: auto;
    padding: 2px 7px;
    background: var(--danger);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    letter-spacing: 0;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
}

/* ─── Main Content ────────────────────────────────────────────── */
.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-header {
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

[data-theme="dark-mode"] .content-header {
    background: rgba(22, 24, 32, 0.32);
}
.content-header h1 {
    font-size: 18px;
    font-weight: 600;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ws-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 500;
}
.ws-status.online {
    background: var(--success-soft);
    color: var(--success);
}
.ws-status.offline {
    background: var(--surface-hover);
    color: var(--text-muted);
}

/* ── 积分挂件（右上角星星 + 余额）与规则弹窗 ────────────── */
/* 全部走主题变量：随主题（含深色）自动跟随，无硬编码颜色/圆角/字体 */
.points-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s var(--ease-smooth), border-color 0.15s var(--ease-smooth);
}
.points-chip:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}
.points-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.points-chip[hidden] { display: none; }

.points-star {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    fill: var(--warning);
}

.points-modal-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.points-modal-total .points-star {
    width: 22px;
    height: 22px;
    align-self: center;
}
.points-modal-num {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}
.points-modal-unit {
    font-size: 13px;
    color: var(--text-secondary);
}
.points-modal-today {
    margin-top: 4px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.points-modal-rules {
    margin: 0;
    padding-left: 20px;
    color: var(--text);
    font-size: 13px;
}
.points-modal-rules li + li { margin-top: 8px; }

.view-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ─── Forms ───────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
[data-theme="dark-mode"] .form-group input,
[data-theme="dark-mode"] .form-group textarea,
[data-theme="dark-mode"] .form-group select {
    background: rgba(22, 24, 32, 0.32);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ─── Cards ───────────────────────────────────────────────────── */
/* All card elements use semi-transparent backgrounds for glass effect,
   allowing the ambient glow and particle effects to shine through */
.card {
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring), background 0.3s var(--ease-smooth);
}
[data-theme="dark-mode"] .card {
    background: rgba(22, 24, 32, 0.32);
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.5), transparent);
    pointer-events: none;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-weight: 600;
    font-size: 15px;
}
.card-body { padding: 20px; }

/* ─── Dashboard ───────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring), background 0.3s var(--ease-smooth);
    box-shadow: var(--shadow-sm);
}
[data-theme="dark-mode"] .stat-card {
    background: rgba(22, 24, 32, 0.28);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.6), transparent);
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}
.stat-card .stat-sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.stat-card.accent { border-left: 3px solid var(--accent); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.danger { border-left: 3px solid var(--danger); }

.dashboard-section {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}
[data-theme="dark-mode"] .dashboard-section {
    background: rgba(22, 24, 32, 0.25);
}
.dashboard-section-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dashboard-section-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}
.dashboard-section-body { padding: 16px 20px; }

/* ─── Kanban Board ────────────────────────────────────────────── */
.kanban-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.kanban-toolbar input,
.kanban-toolbar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text);
    outline: none;
    font-size: 13px;
}
[data-theme="dark-mode"] .kanban-toolbar input,
[data-theme="dark-mode"] .kanban-toolbar select {
    background: rgba(22, 24, 32, 0.32);
}
.kanban-toolbar input:focus,
.kanban-toolbar select:focus {
    border-color: var(--accent);
}
.kanban-toolbar .spacer { flex: 1; }

/* Partner toggle row in toolbar（T-20261004-066：日记筛选区 / 相册头部复用同一套布局，
   仅追加容器选择器，声明块与日程看板完全一致 —— 不新增任何视觉取值） */
.kanban-toolbar .toggle-row,
.diary-toolbar .toggle-row,
.album-page-header .toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .kanban-board { grid-template-columns: 1fr; }
}

.kanban-col {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 240px;
}
[data-theme="dark-mode"] .kanban-col {
    background: rgba(22, 24, 32, 0.20);
}
.kanban-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kanban-col-header .count {
    margin-left: auto;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.kanban-col[data-status="todo"] .kanban-col-header { color: var(--text-secondary); }
.kanban-col[data-status="in_progress"] .kanban-col-header { color: var(--info); border-bottom-color: var(--info-soft); }
.kanban-col[data-status="done"] .kanban-col-header { color: var(--success); border-bottom-color: var(--success-soft); }

.schedule-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px) saturate(160%);
    -webkit-backdrop-filter: blur(4px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-spring), border-color 0.2s var(--ease-spring);
    position: relative;
    box-shadow: var(--shadow-sm);
}
[data-theme="dark-mode"] .schedule-card {
    background: rgba(22, 24, 32, 0.32);
}
.schedule-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    pointer-events: none;
}
.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.schedule-card:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}
.schedule-card .card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
}
.schedule-card .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    align-items: center;
}
.schedule-card .card-desc {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Schedule card inline action buttons */
.schedule-card .card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.card-actions .mini-btn {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
    white-space: nowrap;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.card-actions .mini-btn:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.card-actions .mini-btn.start-btn:hover {
    background: var(--info);
    border-color: var(--info);
}
.card-actions .mini-btn.done-btn:hover {
    background: var(--success);
    border-color: var(--success);
}
.card-actions .mini-btn.back-btn:hover {
    background: var(--warning);
    border-color: var(--warning);
    color: #ffffff;
}
.card-actions .mini-btn.edit-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}
.card-actions .mini-btn.del-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* Dark mode */
[data-theme="dark-mode"] .card-actions .mini-btn {
    background: rgba(22, 24, 32, 0.5);
}
[data-theme="dark-mode"] .card-actions .mini-btn:hover {
    color: #ffffff;
}

.priority-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.priority-1 {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.15);
}
.priority-2 {
    background: rgba(217, 119, 6, 0.08);
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.15);
}
.priority-3 {
    background: rgba(14, 165, 233, 0.08);
    color: var(--info);
    border-color: rgba(14, 165, 233, 0.15);
}

.visibility-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-hover);
    color: var(--text-muted);
}
.visibility-tag.couple { background: var(--accent-soft); color: var(--accent); }

.category-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.owner-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.user-search-item:hover {
    background: var(--surface-hover) !important;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── Diary Timeline ──────────────────────────────────────────── */
.diary-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.diary-toolbar .filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.diary-toolbar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text);
    outline: none;
    font-size: 13px;
}
[data-theme="dark-mode"] .diary-toolbar select {
    background: rgba(22, 24, 32, 0.32);
}

.diary-timeline {
    position: relative;
    padding-left: 28px;
}
.diary-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}
.diary-entry {
    position: relative;
    margin-bottom: 20px;
}
.diary-entry::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--accent);
}
.diary-entry.private::before { border-color: var(--text-muted); }

.diary-card {
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring);
    box-shadow: var(--shadow-sm);
    position: relative;
}
[data-theme="dark-mode"] .diary-card {
    background: rgba(22, 24, 32, 0.32);
}
.diary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.5), transparent);
    pointer-events: none;
    z-index: 1;
}
.diary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.diary-card:active {
    transform: scale(0.99);
    transition-duration: 0.1s;
}
.diary-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.diary-card-title {
    font-weight: 600;
    font-size: 15px;
}
.diary-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.diary-card-body {
    padding: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.mood-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}
.mood-happy { background: rgba(251, 191, 36, 0.15); color: #b45309; }
.mood-sweet { background: rgba(236, 72, 153, 0.15); color: #be185d; }
.mood-miss  { background: rgba(139, 92, 246, 0.15); color: #6d28d9; }
.mood-sad   { background: rgba(100, 116, 139, 0.15); color: #475569; }
.mood-neutral { background: var(--surface-hover); color: var(--text-muted); }

.weather-tag {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--info-soft);
    color: var(--info);
}

/* ─── Period Calendar ─────────────────────────────────────────── */
.health-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .health-grid { grid-template-columns: 1fr; }
}

.period-calendar {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
[data-theme="dark-mode"] .period-calendar {
    background: rgba(22, 24, 32, 0.25);
}
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.calendar-title {
    font-weight: 600;
    font-size: 15px;
    min-width: 140px;
    text-align: center;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 6px 0;
}
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    position: relative;
}
.calendar-day:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}
.calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.4;
}
.calendar-day.today {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}
.calendar-day.period {
    background: rgba(220, 38, 38, 0.15);
    color: var(--danger);
    font-weight: 600;
}
.calendar-day.predicted-period {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border: 1px dashed var(--danger);
}
.calendar-day.ovulation {
    background: rgba(14, 165, 233, 0.15);
    color: var(--info);
    font-weight: 600;
}
.calendar-day.fertile {
    background: rgba(14, 165, 233, 0.08);
    color: var(--info);
}
.calendar-day .flow-dot {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--danger);
}

.cycle-info {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
[data-theme="dark-mode"] .cycle-info {
    background: rgba(22, 24, 32, 0.25);
}
.cycle-info h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cycle-phase {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.cycle-phase .phase-icon {
    font-size: 36px;
    margin-bottom: 8px;
}
.cycle-phase .phase-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
}
.cycle-phase .phase-day {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.cycle-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.cycle-stat {
    text-align: center;
    padding: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.cycle-stat .num {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.cycle-stat .lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.partner-reminder {
    background: linear-gradient(135deg, #fdf2f8 0%, #eef2ff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}
.partner-reminder h3 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 8px;
}
.partner-reminder p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

/* ─── Devices ─────────────────────────────────────────────────── */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.device-card {
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring);
    box-shadow: var(--shadow-sm);
    position: relative;
}
[data-theme="dark-mode"] .device-card {
    background: rgba(22, 24, 32, 0.32);
}
.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.5), transparent);
    pointer-events: none;
}
.device-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.device-card:active {
    transform: scale(0.99);
    transition-duration: 0.1s;
}
.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.device-name {
    font-weight: 600;
    font-size: 15px;
}
.device-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-top: 2px;
}
.device-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}
.device-status.online { background: var(--success-soft); color: var(--success); }
.device-status.offline { background: var(--surface-hover); color: var(--text-muted); }
.device-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.device-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.device-stat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.device-stat .lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.device-stat .val {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}
.device-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ─── Messages ─────────────────────────────────────────────────── */
.messages-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.messages-filter {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark-mode"] .messages-filter {
    background: rgba(22, 24, 32, 0.28);
}

.filter-btn {
    padding: 7px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s var(--ease-spring);
    cursor: pointer;
    letter-spacing: 0.02em;
    position: relative;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent-soft);
}

.messages-actions {
    display: flex;
    gap: 8px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-card {
    background: rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
    box-shadow: var(--shadow-sm);
    position: relative;
}
[data-theme="dark-mode"] .message-card {
    background: rgba(22, 24, 32, 0.32);
}

.message-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.5), transparent);
    pointer-events: none;
}

.message-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.message-card.unread {
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
}

.message-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.message-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.message-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.message-delete:hover {
    opacity: 1;
    color: var(--danger);
}

.message-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.message-time {
    font-feature-settings: 'tnum' 1;
    font-variant-numeric: tabular-nums;
}

.message-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: var(--text-inverse);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ─── Settings ────────────────────────────────────────────────── */
.settings-section {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
[data-theme="dark-mode"] .settings-section {
    background: rgba(22, 24, 32, 0.25);
}
.settings-section-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-section-body { padding: 20px; }

/* Collapsible section (profile edit / password change) */
.settings-collapsible {
    border-bottom: 1px solid var(--border);
}

.api-key-card {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
[data-theme="dark-mode"] .api-key-card {
    background: rgba(22, 24, 32, 0.25);
}
.api-key-info { flex: 1; min-width: 200px; }
.api-key-name { font-weight: 600; font-size: 14px; }
.api-key-prefix {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.api-key-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 飞书绑定码展示（T-20261015-173）：仅补码字突出，颜色/间距全走主题变量 */
.feishu-code-display {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--accent);
    margin-top: 8px;
}

/* 渠道绑定扫码展开区（T-20261017-198）：微信/飞书两栏的「点击扫码添加」展开内容 ——
   真图限宽 + 404 占位块，颜色/圆角/间距全走主题变量，不加新样式体系 */
.channel-qr-img {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.channel-qr-placeholder {
    margin-top: 12px;
    padding: 40px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

/* 隐私设置 —— 智能体日记权限三选一（T-20261001-046） */
.privacy-item-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}
.privacy-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.privacy-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.privacy-option:hover {
    border-color: var(--accent);
}
.privacy-option.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.privacy-option input[type="radio"] {
    flex: 0 0 auto;
    margin: 3px 0 0;
    accent-color: var(--accent);
}
.privacy-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.privacy-option-label {
    font-size: 14px;
    font-weight: 600;
}
.privacy-option-desc {
    font-size: 12px;
    color: var(--text-secondary);
}
.privacy-note {
    margin-top: 12px;
}

.couple-status-card {
    background: linear-gradient(135deg, #fdf2f8 0%, #eef2ff 100%);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}
.couple-status-card .heart {
    font-size: 32px;
    margin-bottom: 8px;
}
.couple-status-card .couple-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}
.couple-status-card .anniversary {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
}
[data-theme="dark-mode"] .modal {
    background: rgba(22, 24, 32, 0.38);
}
.modal.modal-lg { max-width: 640px; }
.modal.modal-sm { max-width: 360px; }
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: var(--bg);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--text);
    color: var(--text-inverse);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    min-width: 200px;
    max-width: 360px;
    pointer-events: auto;
    animation: slideInRight 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Loading Spinner ─────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-muted);
    gap: 10px;
    font-size: 13px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Badge ───────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.badge-success {
    background: rgba(22, 163, 74, 0.08);
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.15);
}
.badge-warning {
    background: rgba(217, 119, 6, 0.08);
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.15);
}
.badge-danger {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.15);
}
.badge-info {
    background: rgba(14, 165, 233, 0.08);
    color: var(--info);
    border-color: rgba(14, 165, 233, 0.15);
}

/* ─── Tables ──────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.table tr:hover td { background: var(--surface-hover); }

/* ─── Responsive (final overrides — keep in sync with main MQ above) ── */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: var(--sidebar-w);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.4s var(--ease-spring);
        overflow: hidden;
    }
    .sidebar.open {
        transform: translateX(0) !important;
        opacity: 1 !important;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    .view-container { padding: 16px; }
    .content-header { padding: 0 16px; padding-left: 56px; }
    .content-header h1 { font-size: 16px; }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .kanban-board {
        grid-template-columns: 1fr;
    }
    .health-grid {
        grid-template-columns: 1fr;
    }
    .device-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Modal Form ──────────────────────────────────────────────── */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.modal-form .form-group { margin-bottom: 12px; }
.modal-form .form-group:last-child { margin-bottom: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ─── Diary Images ───────────────────────────────────────────── */
.diary-card-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    padding: 0 16px 16px;
}
.diary-card-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ─── Calendar Legend ────────────────────────────────────────── */
.calendar-legend {
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--accent);
}

/* ─── Misc Utilities ──────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ─── Schedule Calendar ───────────────────────────────────────── */
.schedule-calendar {
    max-width: 480px;
    margin: 0 auto 1.5rem auto;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
[data-theme="dark-mode"] .schedule-calendar {
    background: rgba(22, 24, 32, 0.25);
}
[data-theme="dark-mode"] .cal-view-toggle {
    background: rgba(30, 32, 40, 0.5);
}
[data-theme="dark-mode"] .cal-view-btn.active {
    background: rgba(40, 42, 54, 0.8);
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    min-width: 120px;
    text-align: center;
}

.cal-nav {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.15s;
}

.cal-nav:hover {
    background: var(--border);
}

.cal-today-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.cal-today-btn:hover {
    background: var(--accent-hover);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.3rem 0.15rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text);
    position: relative;
    transition: background 0.15s;
    min-height: 2.8rem;
}

.cal-day:hover {
    background: var(--surface-hover);
}

.cal-day.other-month {
    color: var(--text-muted);
    opacity: 0.35;
    cursor: default;
}

.cal-day.today {
    box-shadow: inset 0 0 0 2px var(--accent);
    font-weight: 700;
}

.cal-day.has-event {
    font-weight: 600;
}

.cal-day-num {
    line-height: 1.2;
}

.cal-dots {
    display: flex;
    gap: 3px;
    margin-top: 0.15rem;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

/* ─── Calendar View Toggle ─────────────────────────────────────── */
.cal-view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: 6px;
    padding: 2px;
    margin-left: 4px;
}
.cal-view-btn {
    padding: 3px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}
.cal-view-btn.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ─── Week View ───────────────────────────────────────────────── */

/* Scroll container — rows grow with their content, so the week scrolls
   instead of clipping; matches month view height */
.cal-week-scroll {
    width: 100%;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Grid: 1 time gutter + 7 day columns, row-major.
   grid-auto-rows: minmax(24px, auto) → a row grows to its tallest cell and
   every cell of that row grows with it, so cells stay aligned while a cell
   with several events shows all of them (no fixed height, no clipping). */
.cal-week-table {
    display: grid;
    grid-template-columns: 48px repeat(7, minmax(50px, 1fr));
    grid-template-rows: 32px;
    grid-auto-rows: minmax(24px, auto);
    align-items: stretch;
}

/* Last day column (8 children per grid row) must not draw a doubled border
   against the scroll container's own right border. */
.cal-week-table > :nth-child(8n) {
    border-right: none;
}

/* ── Time gutter (grid column 1) ── */
.cal-week-time-head,
.cal-week-time-slot {
    background: var(--bg);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cal-week-time-head {
    min-height: 32px;
}
.cal-week-time-slot {
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Day headers (grid row 1) ── */
.cal-week-day-header {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.cal-week-day-header.today {
    color: var(--accent);
}

/* ── Hour cell — grows with its events, never clips them ── */
.cal-week-cell {
    min-width: 0;
    min-height: 24px;
    padding: 1px 2px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.cal-week-cell.today {
    background: var(--accent-soft);
}

/* ── Event badges — wrap onto a second line, then truncate ── */
.cal-week-event {
    font-size: 0.6rem;
    line-height: 1.35;
    margin: 1px 0;
    padding: 1px 3px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    cursor: pointer;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.cal-week-event.priority-1 { background: var(--danger-soft); color: var(--danger); }
.cal-week-event.priority-2 { background: var(--warning-soft); color: var(--warning); }
.cal-week-event.priority-3 { background: var(--info-soft); color: var(--info); }

/* ── Dark mode ──
   No overrides needed: every rule above already uses theme tokens, and
   [data-theme="dark-mode"] redefines --bg/--surface/--border/--*-soft. */

/* ── Mobile ── */
@media (max-width: 768px) {
    .cal-week-scroll { max-height: 350px; }
    .cal-week-table { grid-template-columns: 32px repeat(7, minmax(40px, 1fr)); }
    .cal-week-time-slot { font-size: 0.5rem; }
    .cal-week-event { font-size: 0.5rem; }
    .cal-week-day-header { font-size: 0.6rem; }
}

/* ─── Calendar Popup ──────────────────────────────────────────── */
.cal-popup {
    position: fixed;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-width: 320px;
    overflow: hidden;
}
[data-theme="dark-mode"] .cal-popup {
    background: rgba(22, 24, 32, 0.38);
}

.cal-popup-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.cal-popup-body {
    padding: 0.3rem 0;
    max-height: 240px;
    overflow-y: auto;
}

.cal-popup-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.12s;
}

.cal-popup-item:hover {
    background: var(--surface-hover);
}

.cal-popup-prio {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.cal-popup-title {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-popup-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* ─── Mobile: Calendar collapse ── */
@media (max-width: 640px) {
    .schedule-calendar {
        max-width: 100%;
    }
    .cal-day {
        font-size: 0.72rem;
        min-height: 2.2rem;
        padding: 0.15rem 0.1rem;
    }
    .cal-dot {
        width: 4px;
        height: 4px;
    }
}

/* ─── Avatar Upload ───────────────────────────────────────────── */
.avatar-upload-container {
    display: flex;
    gap: 16px;
    align-items: center;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 32px;
    color: var(--text-muted);
}

.avatar-upload-actions {
    flex: 1;
}

/* ─── Theme Grid ──────────────────────────────────────────────── */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.theme-card {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
    position: relative;
}
[data-theme="dark-mode"] .theme-card {
    background: rgba(22, 24, 32, 0.25);
}

.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-preview {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.theme-info {
    text-align: center;
}

.theme-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.theme-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.theme-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.theme-premium-hint {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

/* ─── Effects Grid ────────────────────────────────────────────── */
.effects-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.effect-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s var(--ease-spring);
}
[data-theme="dark-mode"] .effect-card {
    background: rgba(22, 24, 32, 0.25);
}

.effect-card.enabled {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.effect-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.effect-info {
    flex: 1;
}

.effect-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.effect-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 「纪念日设置」栏内：日期输入 + 保存按钮（T-20261007-097），复用主题变量 */
.ms-anniv-edit-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.effect-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.effect-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.effect-toggle input:checked + .toggle-slider {
    background-color: var(--accent);
}

.effect-toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.premium-notice {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

/* ─── Membership Status ───────────────────────────────────────── */
.membership-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.membership-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.membership-badge.free {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.membership-badge.premium {
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    color: white;
}

.membership-badge.lifetime {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

/* ─── Theme Preview Colors ────────────────────────────────────── */
:root {
    --theme-couple-pink-bg: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    --theme-tech-blue-bg: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    --theme-minimal-white-bg: linear-gradient(135deg, #fafaf9 0%, #e8e8e4 100%);
    --theme-warm-orange-bg: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    --theme-dark-mode-bg: linear-gradient(135deg, #161820 0%, #0d0f13 100%);
    --theme-nature-green-bg: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

/* ═══════════════════════════════════════════════════════════════
   ── 注册页性别下拉 ──
   ═══════════════════════════════════════════════════════════════ */
/* ── 性别滑动切换按钮 ── */
.gender-toggle {
    margin-bottom: 12px;
}

.gender-toggle-track {
    position: relative;
    display: flex;
    background: var(--surface-hover);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.gender-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.gender-toggle-slider.female {
    transform: translateX(100%);
}

.gender-toggle-option {
    flex: 1;
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}

.gender-toggle-option.active {
    color: var(--text);
    font-weight: 600;
}

.gender-icon {
    font-size: 18px;
    transition: transform 0.2s;
}

.gender-toggle-option.active .gender-icon {
    transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════════════════
   ── 经期日历：例假期(浅色) + 统一图例 ──
   ═══════════════════════════════════════════════════════════════ */
.calendar-day.period-light {
    background: rgba(220, 38, 38, 0.07);
    color: rgba(185, 28, 28, 0.65);
}
[data-theme="dark-mode"] .calendar-day.period-light {
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
}
.calendar-legend {
    align-items: center;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.06);
}
.legend-swatch.period { background: rgba(220, 38, 38, 0.15); border-color: var(--danger); }
.legend-swatch.period-light { background: rgba(220, 38, 38, 0.07); }
.legend-swatch.predicted-period { background: rgba(220, 38, 38, 0.08); border: 1px dashed var(--danger); }
.legend-swatch.ovulation { background: rgba(14, 165, 233, 0.15); border-color: var(--info); }
.legend-swatch.fertile { background: rgba(14, 165, 233, 0.08); }

/* 我的记录 / 伴侣记录 切换 */
.health-target-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    background: var(--bg);
    border-radius: 6px;
    padding: 2px;
    width: fit-content;
}
.health-target-btn {
    border: none;
    background: transparent;
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.health-target-btn.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Toggle wrapper for health target switcher (full width in health-grid) */
.health-target-toggle-wrapper {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   ── 日程页：日历 + 例行打卡 布局 ──
   ═══════════════════════════════════════════════════════════════ */
.schedule-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.schedule-top .schedule-calendar {
    flex: 1;
    min-width: 0;
}
@media (max-width: 1024px) {
    .schedule-top { flex-direction: column; }
    .schedule-top .schedule-calendar { width: 100%; }
    .routine-panel { width: 100% !important; }
}

/* ── 例行打卡面板 ── */
.routine-panel {
    flex: 0 0 280px;
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    position: sticky;
    top: 74px;
    max-height: 480px;
    overflow-y: auto;
}
[data-theme="dark-mode"] .routine-panel {
    background: rgba(22, 24, 32, 0.25);
}
.routine-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.routine-panel-title {
    font-weight: 700;
    font-size: 14px;
}
.routine-panel-actions {
    display: flex;
    gap: 6px;
}
.routine-panel-actions .btn {
    padding: 3px 10px;
    font-size: 12px;
}
.routine-week-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.routine-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.7;
    padding: 20px 4px;
}
.routine-row {
    margin-bottom: 10px;
}
.routine-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}
.routine-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.routine-chips {
    display: flex;
    gap: 5px;
}
.routine-chip {
    flex: 1;
    text-align: center;
    font-size: 11px;
    padding: 3px 0;
    border-radius: 5px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    border: 1px solid var(--border);
}
.routine-chip:hover {
    border-color: var(--accent);
}
.routine-chip.done {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
}
.routine-days-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.routine-day-opt {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}
.routine-manage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 2px;
    border-bottom: 1px solid var(--border);
}

/* ── 打卡记录弹窗遮罩 ── */
.routine-record-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: routineFadeIn 0.2s ease;
}

@keyframes routineFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.routine-record-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: min(680px, 95vw);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.routine-record-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    border-radius: 14px 14px 0 0;
    z-index: 1;
}

.routine-record-modal-title {
    font-weight: 700;
    font-size: 15px;
}

.routine-record-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
}

.routine-record-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.routine-record-modal-body {
    padding: 16px 20px 20px;
}

/* Remove old inline panel styles */
.routine-record-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.routine-record-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.routine-record-nav {
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1;
}

.routine-record-title {
    font-weight: 600;
    font-size: 13px;
    min-width: 90px;
    text-align: center;
}

.routine-record-summary {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

/* Record panel: left (calendar) + right (30-day stats) two-column layout */
.routine-record-body {
    display: flex;
    gap: 14px;
}

.routine-record-cal-col {
    flex: 1;
    min-width: 0;
}

.routine-record-stats-col {
    flex: 0 0 120px;
    border-left: 1px solid var(--border);
    padding-left: 10px;
}

.routine-record-stats-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.routine-record-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 0;
    color: var(--text-secondary);
}

.routine-record-stat-item .stat-icon {
    flex-shrink: 0;
    font-size: 12px;
}

.routine-record-stat-item .stat-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.routine-record-stat-item .stat-count {
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    font-size: 10px;
}

/* Calendar grid inside record panel */
.routine-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
}

.routine-cal-weekday {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
}

.routine-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s;
    color: var(--text-secondary);
}

.routine-cal-day:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

.routine-cal-day.other-month {
    opacity: 0;
    pointer-events: none;
}

.routine-cal-day.today {
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.routine-cal-day.checked {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.routine-cal-day.selected {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.routine-cal-day.today.checked {
    background: var(--accent);
    color: #fff;
}

/* Date detail section */
.routine-record-detail {
    margin-top: 8px;
    font-size: 12px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.routine-record-detail-title {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.routine-record-detail-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    margin: 2px 4px 2px 0;
    background: var(--bg);
    border-radius: 4px;
    font-size: 11px;
}

/* ── Simplified routine row (replaces 7-day chip layout) ── */
.routine-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.15);
    user-select: none;
}

.routine-row:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

.routine-row.checked {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.routine-row .routine-check-mark {
    margin-left: auto;
    font-size: 14px;
    flex-shrink: 0;
}

.routine-row .routine-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

/* Check-in records button active state */
#routine-records-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   ── 情侣空间页面 ──
   ═══════════════════════════════════════════════════════════════ */
.couple-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) {
    .couple-grid { grid-template-columns: 1fr; }
}
.couple-card {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(6px) saturate(160%);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
[data-theme="dark-mode"] .couple-card,
[data-theme="dark-mode"] .couple-anniv-card {
    background: rgba(22, 24, 32, 0.25);
}
.couple-card-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 14px;
}
.couple-partner-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.couple-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.couple-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.couple-avatar-letter {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}
.couple-partner-name {
    font-size: 18px;
    font-weight: 700;
}
.couple-partner-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
}
.couple-anniv-card {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(255, 255, 255, 0.3));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.couple-anniv-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.couple-anniv-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    margin: 6px 0;
}
.couple-anniv-sub {
    font-size: 12px;
    color: var(--text-secondary);
}
.couple-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ═══════ 意见反馈 ═══════ */
.feedback-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .feedback-page { grid-template-columns: 1fr; }
}

.feedback-form-card,
.feedback-list-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.feedback-form-card h3,
.feedback-list-card h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--text);
}

.feedback-form-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

#feedback-form input,
#feedback-form textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
#feedback-form textarea { resize: vertical; }
#feedback-form input:focus,
#feedback-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.feedback-msg {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}
.feedback-msg.success { background: var(--success-soft); color: var(--success); }
.feedback-msg.error { background: var(--danger-soft); color: var(--danger); }

.feedback-item {
    padding: 14px;
    margin-bottom: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.feedback-item.replied { border-left: 3px solid var(--success); }

.feedback-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.feedback-item-subject { font-weight: 600; font-size: 14px; color: var(--text); }
.feedback-item-status { font-size: 12px; }

.feedback-item-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.feedback-item-reply {
    background: var(--success-soft);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.5;
}
.feedback-item-reply-time { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ═══════ 主题编辑器 ═══════ */
.theme-editor-page { max-width: 1000px; margin: 0 auto; }
.theme-editor-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
}
.theme-editor-header h2 { flex: 1; font-size: 18px; margin: 0; }

.theme-editor-body {
    display: grid; grid-template-columns: 280px 1fr; gap: 20px;
}
@media (max-width: 768px) {
    .theme-editor-body { grid-template-columns: 1fr; }
}

.theme-editor-preview {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border); min-height: 200px;
    display: flex; align-items: center; justify-content: center;
}

.theme-editor-slots {
    display: flex; flex-direction: column; gap: 8px;
}

.te-slot-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface);
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.te-slot-row.custom { border-color: var(--accent); background: var(--accent-soft); }
.te-slot-info { flex: 1; min-width: 0; }
.te-slot-label { font-size: 14px; font-weight: 600; color: var(--text); display: block; }
.te-slot-filename { font-size: 11px; color: var(--text-muted); }
.te-slot-thumb { width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--bg); flex-shrink: 0; }
.te-slot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.te-slot-custom-badge {
    font-size: 10px; background: var(--accent); color: #fff;
    padding: 1px 6px; border-radius: 3px; margin-left: 4px;
}
.te-slot-fill-row {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.te-slot-fill-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.te-slot-fill-select {
    font-size: 11px; padding: 2px 6px; border: 1px solid var(--border);
    border-radius: 4px; background: var(--surface); color: var(--text);
    cursor: pointer;
}
.te-slot-fill-select:focus { outline: none; border-color: var(--accent); }

.theme-editor-actions {
    margin-top: 20px; display: flex; align-items: center;
    padding: 16px 0; border-top: 1px solid var(--border);
}

/* Picker overlay */
.te-picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.te-picker {
    background: var(--surface); border-radius: var(--radius);
    width: 700px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.te-picker-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.te-picker-header h3 { flex: 1; font-size: 16px; margin: 0; }
.te-picker-tabs { display: flex; gap: 4px; }
.te-picker-tab {
    padding: 4px 12px; border-radius: 16px; border: 1px solid var(--border);
    background: var(--bg); cursor: pointer; font-size: 12px; color: var(--text-secondary);
}
.te-picker-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.te-picker-close {
    width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.te-picker-grid {
    flex: 1; overflow-y: auto; padding: 16px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.te-picker-item {
    position: relative; cursor: pointer; border-radius: 8px;
    border: 2px solid transparent; padding: 6px; text-align: center;
    transition: all 0.15s; background: var(--bg);
}
.te-picker-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.te-picker-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.te-picker-item img { width: 80px; height: 80px; object-fit: contain; border-radius: 4px; display: block; margin: 0 auto 4px; }
.te-picker-item-name { font-size: 11px; color: var(--text-secondary); display: block; }
.te-picker-item-size { font-size: 10px; color: var(--text-muted); }
.te-picker-item-check {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.te-picker-footer {
    padding: 12px 20px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* ──「AI 助手图片」分区（槽位 assistant-bg，T-20261013-152）─────────────
   助手页聊天底板的素材缩略图**点选即存**：复用 .te-picker-grid / .te-picker-item 那套
   （不新造选择器体系），这里只补三处排版 —— 去掉弹窗里为滚动预留的 padding、
   让「状态文字 + 填充下拉」并成一行。 */
.te-assistant-note { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }
.te-assistant-grid {
    padding: 0; overflow: visible;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.te-assistant-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; margin-top: 12px;
}

/* Locked theme card */
.theme-card.locked { opacity: 0.7; cursor: not-allowed; }
.theme-card.locked:hover { border-color: var(--border); }
.theme-lock { position: absolute; top: 8px; right: 8px; font-size: 16px; }

/* ═══════ 14 槽位在 UI 中的应用（fill mode via CSS vars） ═══════ */
/* 每个槽位使用 --theme-img-XXX (url), --theme-img-XXX-size, --theme-img-XXX-repeat */

/* Login screen — full background */
.login-screen {
    background-image: var(--theme-img-login-bg), linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
    background-blend-mode: overlay;
    background-size: var(--theme-img-login-bg-size, cover), auto;
    background-repeat: var(--theme-img-login-bg-repeat, no-repeat), no-repeat;
    background-position: center;
}

/* Dashboard hero banner — default contain (original ratio, no stretch) */
.content-header {
    background-image: var(--theme-img-dashboard-hero);
    background-size: var(--theme-img-dashboard-hero-size, contain);
    background-repeat: var(--theme-img-dashboard-hero-repeat, no-repeat);
    background-position: center;
}

/* Empty state placeholder */
.empty-state {
    background-image: var(--theme-img-empty-state);
    background-size: var(--theme-img-empty-state-size, contain);
    background-repeat: var(--theme-img-empty-state-repeat, no-repeat);
    background-position: center;
}

/* Health grid / calendar background */
.health-grid {
    background-image: var(--theme-img-calendar-bg);
    background-size: var(--theme-img-calendar-bg-size, cover);
    background-repeat: var(--theme-img-calendar-bg-repeat, no-repeat);
    background-position: center;
}

/* Login card decoration */
.login-card {
    background-image: var(--theme-img-login-card-deco);
    background-size: var(--theme-img-login-card-deco-size, contain);
    background-repeat: var(--theme-img-login-card-deco-repeat, no-repeat);
    background-position: top right;
}

/* Loading overlay */
.loading-overlay {
    background-image: var(--theme-img-loading);
    background-size: var(--theme-img-loading-size, 120px);
    background-repeat: var(--theme-img-loading-repeat, no-repeat);
    background-position: center;
}

/* Sidebar bottom decoration */
.sidebar-deco {
    background-image: var(--theme-img-sidebar-deco);
    background-size: var(--theme-img-sidebar-deco-size, contain);
    background-repeat: var(--theme-img-sidebar-deco-repeat, no-repeat);
    background-position: bottom center;
    width: 100%;
    height: 120px;
    margin-top: auto;
    flex-shrink: 0;
    pointer-events: none;
}

/* Couple hero / couple space header decoration */
.couple-hero {
    background-image: var(--theme-img-couple-hero);
    background-size: var(--theme-img-couple-hero-size, cover);
    background-repeat: var(--theme-img-couple-hero-repeat, no-repeat);
    background-position: center;
}

/* ── New slots ── */

/* Floating mascot — always visible at bottom-right of main content area */
.floating-mascot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 100px;
    height: 100px;
    background-image: var(--theme-img-floating-mascot);
    background-size: var(--theme-img-floating-mascot-size, contain);
    background-repeat: var(--theme-img-floating-mascot-repeat, no-repeat);
    background-position: center;
    pointer-events: none;
    z-index: 10;
    opacity: 0.85;
    transition: opacity 0.3s, transform 0.3s;
    animation: mascot-float 3s ease-in-out infinite;
}
@keyframes mascot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@media (max-width: 768px) {
    .floating-mascot {
        right: 12px;
        bottom: 12px;
        width: 72px;
        height: 72px;
    }
}

/* Schedule calendar box */
.schedule-calendar {
    background-image: var(--theme-img-schedule-calendar);
    background-size: var(--theme-img-schedule-calendar-size, cover);
    background-repeat: var(--theme-img-schedule-calendar-repeat, no-repeat);
    background-position: center;
}

/* Routine check-in panel */
.routine-panel {
    background-image: var(--theme-img-routine-box);
    background-size: var(--theme-img-routine-box-size, cover);
    background-repeat: var(--theme-img-routine-box-repeat, no-repeat);
    background-position: center;
}

/* Couple space content box */
.couple-status-card {
    background-image: var(--theme-img-couple-box);
    background-size: var(--theme-img-couple-box-size, cover);
    background-repeat: var(--theme-img-couple-box-repeat, no-repeat);
    background-position: center;
}

/* Messages view content box */
.message-card {
    background-image: var(--theme-img-messages-box);
    background-size: var(--theme-img-messages-box-size, cover);
    background-repeat: var(--theme-img-messages-box-repeat, no-repeat);
    background-position: center;
}

/* Settings view content box */
.api-key-card {
    background-image: var(--theme-img-settings-box);
    background-size: var(--theme-img-settings-box-size, cover);
    background-repeat: var(--theme-img-settings-box-repeat, no-repeat);
    background-position: center;
}

.feedback-item-time { font-size: 11px; color: var(--text-muted); }

.feedback-footer {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.feedback-footer a { color: var(--accent); }

/* ════════════════════════════════════════════════════════════════
   Couple Space — Warm Premium Dashboard
   ════════════════════════════════════════════════════════════════ */

.cs-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-bottom: 40px;
}
@media (max-width: 768px) {
    .cs-dashboard {
        grid-template-columns: 1fr;
    }
}

.cs-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s;
}

.cs-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.cs-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cs-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.cs-section-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 纪念日卡片右上角齿轮（T-20261007-097）：尺寸/颜色全走主题变量，无内联 style */
.cs-anniv-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.cs-anniv-settings-btn:hover {
    color: var(--accent);
    background: var(--surface-hover);
}

.cs-anniv-settings-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.cs-view-all {
    color: var(--accent) !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.cs-view-all:hover {
    text-decoration: underline;
}

/* Divider between hero countdown and other memorial days */
.cs-anniv-divider {
    margin: 12px 0;
    border-top: 1px solid var(--border);
    opacity: 0.5;
}

.cs-footer {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.cs-section-footer {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.cs-empty-hint {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Partner Card ───────────────────────────────── */

.cs-partner-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, var(--surface) 0%, #fff0f5 100%);
    border: 1px solid #f8d7e6;
}

.cs-partner-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(245,66,140,0.2);
}

.cs-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-avatar-letter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5428c, #ff8eb8);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}

.cs-partner-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.cs-partner-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Anniversary Countdown ───────────────────────── */

.cs-anniv-card {
    background: linear-gradient(135deg, #fef5f9 0%, #fff9fb 50%, #fdf2f7 100%);
    border: 1px solid #f5d5e6;
}

.cs-anniv-hero-wrap {
    text-align: center;
}

.cs-anniv-hero {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    padding: 24px 0 8px;
}

.cs-anniv-hero-caption {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2px;
}

.cs-anniv-hero-days {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #f5428c, #ff8eb8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.cs-anniv-hero-label {
    font-size: 24px;
    font-weight: 600;
    color: #d6336c;
}

.cs-anniv-hero-sub {
    text-align: center;
    font-size: 13px;
    color: #b0758a;
    line-height: 1.7;
    padding-bottom: 8px;
}

/* ── Memorial day items in countdown ─────────────── */

.cs-anniv-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cs-anniv-extra-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #f0c4d8;
}

.cs-anniv-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    border: 1px solid #f5d5e6;
    transition: transform 0.2s;
}

.cs-anniv-item:hover {
    transform: translateX(4px);
}

.cs-anniv-today {
    background: linear-gradient(135deg, #fff0f5, #ffe0ec);
    border-color: #f5428c;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,66,140,0.15); }
    50% { box-shadow: 0 0 0 6px rgba(245,66,140,0); }
}

.cs-anniv-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.cs-anniv-info {
    flex: 1;
}

.cs-anniv-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.cs-anniv-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.cs-anniv-countdown {
    text-align: center;
    flex-shrink: 0;
}

.cs-anniv-days {
    font-size: 28px;
    font-weight: 800;
    color: #f5428c;
    line-height: 1;
}

.cs-anniv-unit {
    font-size: 11px;
    color: #d6336c;
    margin-top: 2px;
}

/* ── Diary Section ───────────────────────────────── */

.cs-diary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cs-diary-entry {
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border-left: 3px solid transparent;
}

.cs-diary-entry:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-left-color: var(--accent);
}

.cs-diary-entry-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.cs-diary-entry-preview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cs-diary-entry-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

/* ── Album Section ───────────────────────────────── */

.cs-album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.cs-album-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cs-album-thumb:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.cs-album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Memorial Days Section ───────────────────────── */

.cs-md-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-md-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: 10px;
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}

.cs-md-row:hover {
    background: #fef5f9;
}

.cs-md-del-btn {
    display: none;
    width: 24px;
    height: 24px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    margin-left: 6px;
    transition: background 0.2s;
}

.cs-md-row:hover .cs-md-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cs-md-del-btn:hover {
    background: #fca5a5;
    color: #991b1b;
}

.cs-md-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-md-type {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.cs-md-type-anniversary { background: #fce4ec; color: #c62828; }
.cs-md-type-birthday { background: #fff3e0; color: #e65100; }
.cs-md-type-first_meeting { background: #fce4ec; color: #d6336c; }
.cs-md-type-proposal { background: #fce4ec; color: #ad1457; }
.cs-md-type-wedding { background: #f3e5f5; color: #6a1b9a; }
.cs-md-type-custom { background: #f3e5f5; color: #7b1fa2; }

.cs-md-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.cs-md-primary-tag {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f5428c, #ff8eb8);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
    letter-spacing: 1px;
}

.cs-md-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cs-md-date {
    font-size: 12px;
    color: var(--text-muted);
}

.cs-md-countdown {
    font-size: 18px;
    font-weight: 700;
    color: #f5428c;
    min-width: 42px;
    text-align: right;
}

.cs-md-today {
    font-size: 13px;
    font-weight: 600;
    color: #f5428c;
    background: #fff0f5;
    padding: 2px 10px;
    border-radius: 12px;
    animation: pulseGlow 2s infinite;
}

/* ════════════════════════════════════════════════════════════════
   Memorial Day Cards
   ════════════════════════════════════════════════════════════════ */

.md-list {
    display: grid;
    gap: 12px;
}

.md-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.md-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.md-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.md-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.md-type-anniversary { background: #fce4ec; color: #c62828; }
.md-type-birthday { background: #fff3e0; color: #e65100; }
.md-type-first_meeting { background: #e8f5e9; color: #2e7d32; }
.md-type-proposal { background: #fce4ec; color: #ad1457; }
.md-type-wedding { background: #f3e5f5; color: #6a1b9a; }
.md-type-custom { background: #e3f2fd; color: #1565c0; }

.md-title {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}

.md-actions {
    display: flex;
    gap: 4px;
}

.md-card-body {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.md-next {
    color: var(--accent);
    font-weight: 500;
}

.md-desc {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.md-card-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.md-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-muted);
}

.md-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.md-reminder-days {
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 8px;
    border-radius: 10px;
}

/* Memorial day mini cards (overview tab) */
.memorial-mini-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memorial-day-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.md-mini-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}

.md-mini-title {
    flex: 1;
    font-weight: 500;
}

.md-mini-days {
    color: var(--accent);
    font-weight: 500;
    font-size: 12px;
}

/* ════════════════════════════════════════════════════════════════
   Photo Album
   ════════════════════════════════════════════════════════════════ */

.album-page {
    padding-bottom: 40px;
}

.album-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.album-page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.album-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.album-photo:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.album-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox */
.album-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.album-lightbox-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
}

.album-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

.album-lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
}

.album-lightbox-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

/* ════════════════════════════════════════════════════════════════
   Storage Quota Bar
   ════════════════════════════════════════════════════════════════ */

.quota-bar {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.quota-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.quota-bar-track {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #22c55e;
    transition: width 0.4s ease;
}

.quota-bar-fill.quota-warning {
    background: #f59e0b;
}

.quota-bar-fill.quota-danger {
    background: #ef4444;
}

/* ════════════════════════════════════════════════════════════════
   Markdown Rendered Content
   ════════════════════════════════════════════════════════════════ */

.md-rendered {
    line-height: 1.7;
    word-break: break-word;
}

.md-rendered h1 { font-size: 1.5rem; font-weight: 700; margin: 1em 0 0.5em; }
.md-rendered h2 { font-size: 1.25rem; font-weight: 600; margin: 1em 0 0.5em; padding-bottom: 0.25em; border-bottom: 1px solid var(--border); }
.md-rendered h3 { font-size: 1.1rem; font-weight: 600; margin: 0.8em 0 0.4em; }
.md-rendered h4, .md-rendered h5, .md-rendered h6 { font-size: 1rem; font-weight: 600; margin: 0.6em 0 0.3em; }

.md-rendered p { margin: 0.5em 0; }

.md-rendered strong { font-weight: 700; }
.md-rendered em { font-style: italic; }

.md-rendered blockquote {
    margin: 0.8em 0;
    padding: 8px 16px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
}

.md-rendered ul, .md-rendered ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.md-rendered li { margin: 0.25em 0; }

.md-rendered code {
    background: var(--code-bg, #f1f5f9);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.md-rendered pre {
    background: var(--code-bg, #1e293b);
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.8em 0;
    font-size: 13px;
    line-height: 1.5;
}

.md-rendered pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.md-rendered img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

.md-rendered a {
    color: var(--accent);
    text-decoration: underline;
}

.md-rendered table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8em 0;
    font-size: 13px;
}

.md-rendered th {
    background: var(--accent-soft);
    font-weight: 600;
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border);
}

.md-rendered td {
    padding: 6px 12px;
    border: 1px solid var(--border);
}

.md-rendered hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1em 0;
}

/* ════════════════════════════════════════════════════════════════
   Single-Pane Markdown Editor (Typora-like)
   One contenteditable area — sigil chars dimmed until cursor nears.
   ════════════════════════════════════════════════════════════════ */

.mde-pane {
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    overflow: hidden;
    background: var(--surface, #fff);
}

/* ── Toolbar ─────────────────────────────────────── */
.mde-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 6px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.mde-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary, #666);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.mde-btn:hover {
    background: var(--accent-soft, rgba(245,66,140,0.1));
    color: var(--accent, #f5428c);
}

/* ── Heading dropdown ─────────────────────────────── */
.mde-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.1));
    min-width: 160px;
    z-index: 100;
    padding: 4px 0;
    display: none;
}

.mde-drop-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.mde-drop-item:hover {
    background: var(--accent-soft, rgba(245,66,140,0.1));
}

.mde-drop-item:first-child { font-size: 20px; font-weight: 700; }
.mde-drop-item:nth-child(2) { font-size: 17px; font-weight: 600; }
.mde-drop-item:nth-child(3) { font-size: 15px; font-weight: 600; }

/* ── ContentEditable area (the ONE unified editing surface) ─ */
.mde-ce {
    min-height: 220px;
    max-height: 500px;
    overflow-y: auto;
    padding: 14px 16px;
    outline: none;
    font-family: var(--font-body, 'Noto Sans SC', 'Inter', sans-serif);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
    caret-color: var(--accent, #f5428c);
    background: var(--surface, #fff);
}

/* Placeholder hint — shown when the editor holds no text (even though one
   empty block <div class="md-blank"><br></div> is always present, so the
   `.mde-empty` class is the reliable signal instead of `:empty`). */
.mde-ce.mde-empty[data-placeholder]::before {
    content: attr(data-placeholder);
    color: var(--text-muted, #999);
    pointer-events: none;
}

/* ── Blocks inside the editor ─────────────────────── */
/* Each block is a <div>, <h1>, <h2>, <h3> as direct child of .mde-ce */

.mde-ce h1 {
    font-size: 1.7em;
    font-weight: 700;
    margin: 0.4em 0 0.15em;
    line-height: 1.3;
}
.mde-ce h2 {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0.35em 0 0.1em;
    line-height: 1.3;
}
.mde-ce h3 {
    font-size: 1.15em;
    font-weight: 700;
    margin: 0.3em 0 0.05em;
    line-height: 1.3;
}

/* Paragraph blocks */
.mde-ce > div {
    min-height: 1.5em;
}

/* Empty line block — one source line with nothing but a <br>. Plain blocks
   already get min-height from `.mde-ce > div`; this just gives the caret a
   stable target. */
.md-blank {
    min-height: 1.5em;
}

/* ── Markdown sigils (dimmed by default) ──────────── */
.md-sigil {
    opacity: 0.18;
    transition: opacity 0.15s;
    user-select: none;
    pointer-events: none;
    font-weight: 400;
    font-style: normal;
}

/* Reveal sigils when cursor is on this block */
.md-sigil-visible {
    opacity: 0.65;
}

/* List item sigils are slightly different */
.md-li-sigil {
    margin-right: 2px;
}

/* ── List items ──────────────────────────────────── */
.md-li {
    margin-left: 0;
    padding-left: 1.2em;
}
.md-ol-li {
    padding-left: 1.6em;
}
.md-li::before {
    /* The sigil span handles the marker display */
    content: none;
}

/* ── Inline formatting ───────────────────────────── */
/* Lossless inline wrapper: the span holds data-raw so edits rebuild the
   source from the visible text; it stays inline & editable-looking. */
.md-inline {
    cursor: text;
}
/* Faded inline markers (** / * / `) — REAL contenteditable=false spans, like
   the # sigils. Real DOM nodes give the browser an actual caret slot after a
   closing marker, so the caret can move past `**粗体**` and plain text can be
   typed there (a CSS ::after pseudo-element offers no such slot). They fade
   like the # sigils: dim normally, brighter on the block that holds the caret. */
.md-inline .md-marker {
    opacity: 0.22;
    color: inherit;
    font-weight: 400;
    font-style: normal;
    user-select: none;
    transition: opacity 0.15s;
}
/* Brighter when the caret is on the block, matching the sigil reveal. */
.mde-ce .md-block-active .md-inline .md-marker {
    opacity: 0.55;
}
.md-inline strong,
.md-inline em,
.md-inline code {
    color: inherit;
}
.mde-ce strong { font-weight: 700; color: inherit; }
.mde-ce em { font-style: italic; color: inherit; }
.mde-ce code {
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
}
.mde-ce a { color: var(--accent); text-decoration: underline; }
.mde-ce img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    margin: 4px 0;
    display: block;
}

/* ════════════════════════════════════════════════════════════════
   Form row & checkbox helpers (used by memorial day modal)
   ════════════════════════════════════════════════════════════════ */

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════
   Button sizes: xs
   ════════════════════════════════════════════════════════════════ */

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════════
   Responsive: album grid on mobile
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .album-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .couple-space-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    .couple-space-tab .tab-label {
        display: inline;
    }
    .md-card-toggles {
        flex-direction: column;
        gap: 6px;
    }
}

/* ════════════════════════════════════════════════════════════════
   Terms & Privacy — 注册勾选 / 独立页正文排版 / 弹窗预览
   ════════════════════════════════════════════════════════════════ */

.terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.terms-checkbox input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
}
.terms-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.terms-link:hover {
    color: var(--accent-hover);
}

/* 协议正文排版：独立页与弹窗预览共用（弹窗抽取 .terms-content 注入，仅 style.css 生效） */
.terms-content {
    line-height: 1.8;
    color: var(--text);
}
.terms-content h1 {
    font-size: 26px;
    margin: 0 0 8px;
}
.terms-content .terms-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.terms-content h2 {
    font-size: 18px;
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.terms-content p,
.terms-content li {
    font-size: 14px;
    color: var(--text-secondary);
}
.terms-content ul,
.terms-content ol {
    padding-left: 22px;
    margin: 6px 0;
}
.terms-content li {
    margin: 4px 0;
}
.terms-content strong {
    color: var(--text);
}
.terms-content a {
    color: var(--accent);
}

/* 弹窗预览滚动容器 */
.terms-preview-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 2px 4px;
}

/* 补签确认弹窗 */
.terms-consent-body p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}
.terms-consent-links {
    margin-top: 12px;
    display: flex;
    gap: 16px;
}

/* ════════════════════════════════════════════════════════════════
   Onboarding — 新用户分步引导（spotlight tour）
   ════════════════════════════════════════════════════════════════ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(15, 23, 42, 0.55);
}
.onboarding-highlight {
    position: fixed;
    z-index: 1501;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg);
    animation: onboarding-pop 0.2s var(--ease-spring);
    pointer-events: none;
}
@keyframes onboarding-pop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.onboarding-tooltip {
    position: fixed;
    z-index: 1502;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 18px;
    animation: onboarding-pop 0.2s var(--ease-spring);
}
.onboarding-tooltip .onboarding-steps {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.onboarding-tooltip .onboarding-title {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--text);
}
.onboarding-tooltip .onboarding-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}
.onboarding-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}
.onboarding-actions .onboarding-skip {
    margin-right: auto;
}

/* ════════════════════════════════════════════════════════════════
   Site footer — ICP 备案号（页面底部淡色小字）
   ════════════════════════════════════════════════════════════════ */

.site-icp {
    display: block;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
    opacity: 0.75;
    padding: 14px 16px 22px;
}
.site-icp a {
    color: inherit;
    text-decoration: none;
}
.site-icp a:hover {
    text-decoration: underline;
    opacity: 1;
}
/* 登录页：备案号固定在屏幕底部（terms/privacy 独立页保持文档流） */
.login-screen .site-icp {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    padding: 6px 16px 10px;
    z-index: 1;
}
/* 仪表盘：备案号固定在主内容区最下方（不随内容滚动、不压缩） */
.main-content .app-icp {
    flex-shrink: 0;
    padding: 10px 16px 16px;
}

/* ═══════ 纪念日节点：开屏动效 / 常驻氛围 / 装扮徽章 / 3 秒小框（T-20261007-095） ═══════ */
/* 颜色 / 圆角 / 阴影 / 字号一律取主题变量（AGENTS.md §0.6）；z-index 沿用本文件既有分层习惯
   （内容 0~100 · 侧栏 50~100 · 庆祝层 1400 · 小框 1500 · 弹窗/Toast 2000）。 */

/* 一次性庆祝层（canvas 或 fireworks 容器）：单页只允许一个，播完由 milestone.js 销毁 */
.ms-celebrate-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1400;
    pointer-events: none;
}

/* 常驻氛围容器（B2 飘落樱花 / B3 呼吸光晕） */
#ms-ambient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}
.ms-glow {
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.1;
    filter: blur(48px);
}
.ms-glow-1 { top: 12%; left: 8%; }
.ms-glow-2 { right: 10%; bottom: 10%; width: 300px; height: 300px; }

/* 装扮徽章：数字 / 文案由服务端下发（nodes[].badge），前端只渲染 */
.ms-badge {
    position: fixed;
    top: 76px;
    right: 24px;
    z-index: 5;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: var(--text-inverse);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    pointer-events: none;
}

/* 3 秒小框：从上向下弹出 → 3 秒后自动收回 → 点击立即收起（不阻塞交互） */
.ms-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 1500;
    padding: 10px 18px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transform: translate(-50%, -140%);
    transition: transform 0.35s var(--ease-spring), opacity 0.35s var(--ease-smooth);
}
.ms-toast.ms-toast-in {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 轻量纯 CSS 庆祝（低端机降级 / animate.css 4.1.1 由 JS 按需注入）：无 canvas、无 rAF */
.ms-fx-light {
    animation-duration: 1.6s;
    animation-iteration-count: 2;
}

/* 系统级「减少动态效果」：不放动效，只保留静态装扮 + 小框（硬降级，无 override） */
@media (prefers-reduced-motion: reduce) {
    .ms-celebrate-canvas,
    #ms-ambient {
        display: none !important;
    }
    .ms-fx-light,
    .ms-toast {
        animation: none !important;
        transition: none !important;
    }
}
