/* ============================================================
   Redesign layer - Premium warm consumer aesthetic
   Applied on top of style.css. All original class names preserved.
   Design direction: warm editorial premium, single accent, haptic depth.
   ============================================================ */

:root {
    /* Neutral warm palette - one consistent hue family */
    --r-bg: #F7F4EF;
    --r-bg-deep: #EFEAE2;
    --r-surface: #FFFDFA;
    --r-surface-2: #FBF8F3;
    --r-ink: #211C16;
    --r-ink-soft: #4A423A;
    --r-ink-muted: #8A7F73;
    --r-ink-faint: #B3A99C;
    --r-line: rgba(33, 28, 22, 0.08);
    --r-line-strong: rgba(33, 28, 22, 0.14);

    /* Single accent, desaturated peach-clay */
    --r-accent: #E8A87C;
    --r-accent-deep: #C97B4A;
    --r-accent-soft: #FBEDE1;
    --r-accent-ink: #8A4B21;

    /* Semantic */
    --r-success: #4E8D5B;
    --r-success-soft: #EDF4EE;
    --r-danger: #C2554B;
    --r-danger-soft: #FBEDEB;
    --r-warning: #B97E2E;
    --r-warning-soft: #FBF1E2;
    --r-info: #4A6E8F;
    --r-info-soft: #EBF1F6;

    /* Type */
    --r-font-display: 'ZCOOL KuaiLe', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --r-font-body: 'Outfit', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --r-font-mono: 'JetBrains Mono', 'Noto Sans SC', 'SF Mono', ui-monospace, monospace;

    /* Radius scale - concentric */
    --r-r-xs: 8px;
    --r-r-sm: 12px;
    --r-r-md: 18px;
    --r-r-lg: 26px;
    --r-r-xl: 34px;
    --r-r-pill: 999px;

    /* Motion */
    --r-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --r-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
    --r-t-fast: 180ms;
    --r-t: 320ms;
    --r-t-slow: 620ms;

    /* Elevation - warm tinted, single light source (top) */
    --r-shadow-1: 0 1px 2px rgba(33, 28, 22, 0.04), 0 4px 12px rgba(33, 28, 22, 0.04);
    --r-shadow-2: 0 2px 6px rgba(33, 28, 22, 0.05), 0 12px 32px rgba(33, 28, 22, 0.07);
    --r-shadow-3: 0 4px 12px rgba(33, 28, 22, 0.06), 0 24px 60px rgba(33, 28, 22, 0.10);
    --r-shadow-accent: 0 8px 28px rgba(201, 123, 74, 0.24);

    /* Override legacy tokens so untouched components inherit the new language */
    --bg-primary: var(--r-bg);
    --bg-nav: rgba(247, 244, 239, 0.82);
    --bg-input: var(--r-surface-2);
    --bg-card: var(--r-surface);
    --bg-card-hover: var(--r-accent-soft);
    --text-primary: var(--r-ink);
    --text-secondary: var(--r-ink-soft);
    --text-muted: var(--r-ink-muted);
    --text-placeholder: var(--r-ink-faint);
    --accent: var(--r-accent);
    --accent-hover: #DF9A69;
    --accent-deep: var(--r-accent-deep);
    --accent-light: var(--r-accent-soft);
    --border: var(--r-line);
    --border-light: var(--r-line);
    --border-color: var(--r-line);
    --border-color-light: var(--r-line);
    --card-bg: var(--r-surface);
    --success: var(--r-success);
    --success-bg: var(--r-success-soft);
    --danger: var(--r-danger);
    --danger-bg: var(--r-danger-soft);
    --warning: var(--r-warning);
    --warning-bg: var(--r-warning-soft);
    --info: var(--r-info);
    --info-bg: var(--r-info-soft);
    --font-heading: var(--r-font-display);
    --font-body: var(--r-font-body);
    --font-mono: var(--r-font-mono);
    --radius-xs: var(--r-r-xs);
    --radius-sm: var(--r-r-sm);
    --radius-md: var(--r-r-md);
    --radius-lg: var(--r-r-lg);
    --radius-xl: var(--r-r-xl);
    --transition: all var(--r-t) var(--r-ease);
    --nav-height: 72px;
    /* Effective navbar height including the iOS/WebView safe-area inset.
       Nav uses box-sizing:content-box, so its real height is nav-height + safe-area-top.
       Content offsets must use this total, otherwise content slides under the fixed nav. */
    --nav-total: calc(var(--nav-height) + var(--safe-area-top, 0px));
}

/* --- Global canvas: warm paper, subtle ambient light --- */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--r-bg);
    color: var(--r-ink);
    font-family: var(--r-font-body);
    font-size: 15px;
    line-height: 1.65;
    letter-spacing: 0.005em;
    background-image:
        radial-gradient(1200px 620px at 12% -8%, rgba(232, 168, 124, 0.16), transparent 62%),
        radial-gradient(900px 520px at 96% 4%, rgba(201, 123, 74, 0.09), transparent 60%);
    background-attachment: fixed;
}

/* Film grain - fixed, pointer-transparent, never on scroll containers */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Mobile perf: background-attachment:fixed forces full-page repaints on every
   scroll in mobile browsers. Switch to scroll and drop the fixed grain layer,
   which costs a compositing pass per frame on low-end devices. */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    body { background-attachment: scroll; }
    body::after { display: none; }
}

/* Medium viewports carry the full desktop nav (9 items + dropdowns) next to the
   PC sidebar. Tighten spacing below 1120px so the bar never wraps or overflows. */
@media (min-width: 769px) and (max-width: 1120px) {
    .glass-nav .nav-links { gap: 2px; }
    .glass-nav .nav-link { padding: 8px 9px; font-size: 0.84rem; }
    .glass-nav { padding: 0 16px; }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--r-font-display);
    color: var(--r-ink);
    letter-spacing: 0.01em;
    line-height: 1.22;
    text-wrap: balance;
}

h1 { font-size: 2.35rem; }
h2 { font-size: 1.78rem; }
h3 { font-size: 1.36rem; }
h4 { font-size: 1.12rem; }

p { color: var(--r-ink-soft); }

a {
    color: var(--r-accent-ink);
    text-decoration: none;
    transition: color var(--r-t-fast) var(--r-ease), opacity var(--r-t-fast) var(--r-ease);
}
a:hover { color: var(--r-accent-deep); }

::selection {
    background: var(--r-accent);
    color: #fff;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(33, 28, 22, 0.14);
    border-radius: var(--r-r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(33, 28, 22, 0.26); background-clip: content-box; }

/* ============================================================
   Navigation - floating glass pill, keeps hamburger on mobile
   ============================================================ */
.glass-nav {
    height: var(--nav-height);
    padding: 0 22px;
    padding-top: var(--safe-area-top);
    box-sizing: content-box;
    background: var(--bg-nav);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--r-line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 24px rgba(33, 28, 22, 0.04);
}

.glass-nav .brand-text {
    font-family: var(--r-font-display);
    font-size: 1.32rem;
    letter-spacing: 0.04em;
    color: var(--r-ink);
}

.glass-nav .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r-r-sm);
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    color: #fff;
    box-shadow: var(--r-shadow-accent);
}

.glass-nav .nav-link {
    position: relative;
    padding: 8px 16px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--r-ink-muted);
    border-radius: var(--r-r-pill);
    transition: color var(--r-t-fast) var(--r-ease), background-color var(--r-t-fast) var(--r-ease);
}
.glass-nav .nav-link:hover {
    color: var(--r-ink);
    background: rgba(33, 28, 22, 0.045);
}
.glass-nav .nav-link.active {
    color: var(--r-accent-ink);
    background: var(--r-accent-soft);
    box-shadow: 0 0 0 1px rgba(201, 123, 74, 0.14) inset;
}

.glass-nav .nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--r-r-sm);
    color: var(--r-ink);
    transition: background-color var(--r-t-fast) var(--r-ease), transform var(--r-t-fast) var(--r-ease);
}
.glass-nav .nav-toggle:hover { background: rgba(33, 28, 22, 0.055); }
.glass-nav .nav-toggle:active { transform: scale(0.94); }

.glass-nav .nav-user {
    padding: 5px 14px 5px 5px;
    border-radius: var(--r-r-pill);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--r-line);
    transition: border-color var(--r-t-fast) var(--r-ease), box-shadow var(--r-t-fast) var(--r-ease);
}
.glass-nav .nav-user:hover {
    border-color: rgba(201, 123, 74, 0.35);
    box-shadow: var(--r-shadow-1);
}
.glass-nav .nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    box-shadow: 0 3px 10px rgba(201, 123, 74, 0.3);
}

/* ============================================================
   Sidebar - nested shell, warm surface
   ============================================================ */
.sidebar {
    top: calc(var(--nav-height) + 18px);
    left: 18px;
    bottom: 18px;
    width: var(--sidebar-width);
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    box-shadow: var(--r-shadow-2);
    padding: 22px 0 92px;
}
.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--r-line);
    margin-bottom: 14px;
}
.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r-r-sm);
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    color: #fff;
    font-family: var(--r-font-display);
    box-shadow: var(--r-shadow-accent);
}
.sidebar-brand-text {
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--r-ink);
}
.sidebar-section-title {
    padding: 14px 24px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--r-ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.sidebar-link {
    padding: 11px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--r-ink-soft);
    border-radius: var(--r-r-sm);
    transition: background-color var(--r-t-fast) var(--r-ease), color var(--r-t-fast) var(--r-ease), transform var(--r-t-fast) var(--r-ease);
}
.sidebar-link:hover {
    background: rgba(33, 28, 22, 0.045);
    color: var(--r-ink);
    transform: translateX(2px);
}
.sidebar-link.active {
    background: var(--r-accent-soft);
    color: var(--r-accent-ink);
    font-weight: 600;
    box-shadow: 0 0 0 1px rgba(201, 123, 74, 0.14) inset;
}
.sidebar-link.active svg { color: var(--r-accent-deep); }
.sidebar-link svg { transition: color var(--r-t-fast) var(--r-ease); }
.sidebar-link:hover svg { color: var(--r-accent-deep); }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--r-line);
    background: var(--r-surface);
    border-radius: 0 0 var(--r-r-lg) var(--r-r-lg);
}
.sidebar-footer .user-mini-name { font-size: 0.86rem; font-weight: 600; color: var(--r-ink); }
.sidebar-footer .user-mini-role { font-size: 0.72rem; color: var(--r-ink-muted); }

/* Mobile drawer - premium frosted overlay */
.mobile-nav-sidebar {
    width: 300px;
    max-width: 84vw;
    background: rgba(255, 253, 250, 0.96);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-right: 1px solid var(--r-line);
    padding: calc(var(--nav-height) + 16px) 0 24px;
    transition: transform var(--r-t) var(--r-ease);
}
.mobile-nav-sidebar.mobile-open { box-shadow: 12px 0 48px rgba(33, 28, 22, 0.14); }
.mobile-nav-overlay { background: rgba(33, 28, 22, 0.4); backdrop-filter: blur(2px); }

.mobile-nav-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--r-ink-faint);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.mobile-nav-item {
    padding: 12px 14px;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--r-ink-soft);
    border-radius: var(--r-r-sm);
    transition: background-color var(--r-t-fast) var(--r-ease), color var(--r-t-fast) var(--r-ease);
}
.mobile-nav-item:hover { background: rgba(33, 28, 22, 0.05); color: var(--r-ink); }
.mobile-nav-item.active {
    background: var(--r-accent-soft);
    color: var(--r-accent-ink);
    font-weight: 600;
}
.mobile-nav-logout {
    border-radius: var(--r-r-sm);
    background: var(--r-danger-soft);
    border: 1px solid rgba(194, 85, 75, 0.28);
    color: var(--r-danger);
    transition: background-color var(--r-t-fast) var(--r-ease), color var(--r-t-fast) var(--r-ease);
}

/* ============================================================
   Buttons - pill CTAs with tactile press physics
   ============================================================ */
.glass-btn {
    padding: 12px 26px;
    font-family: var(--r-font-body);
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--r-ink);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--r-line-strong);
    border-radius: var(--r-r-pill);
    box-shadow: var(--r-shadow-1);
    transition: transform var(--r-t-fast) var(--r-ease), box-shadow var(--r-t) var(--r-ease),
                background-color var(--r-t-fast) var(--r-ease), border-color var(--r-t-fast) var(--r-ease), color var(--r-t-fast) var(--r-ease);
}
.glass-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--r-shadow-2);
    border-color: rgba(201, 123, 74, 0.4);
}
.glass-btn:active { transform: scale(0.975) translateY(0); box-shadow: var(--r-shadow-1); }

.glass-btn-primary {
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    border-color: transparent;
    color: #fff;
    box-shadow: var(--r-shadow-accent);
}
.glass-btn-primary:hover {
    background: linear-gradient(150deg, #EBAF86, #C9764A);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 34px rgba(201, 123, 74, 0.32);
}

.glass-btn-secondary {
    background: transparent;
    border-color: var(--r-line-strong);
    color: var(--r-ink-soft);
    box-shadow: none;
}
.glass-btn-secondary:hover {
    background: rgba(33, 28, 22, 0.045);
    border-color: var(--r-line-strong);
    color: var(--r-ink);
    box-shadow: none;
}

.glass-btn-danger {
    background: linear-gradient(150deg, #D0665C, var(--r-danger));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 26px rgba(194, 85, 75, 0.26);
}

.glass-btn-text {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--r-accent-ink);
    padding: 8px 14px;
}
.glass-btn-text:hover {
    background: var(--r-accent-soft);
    color: var(--r-accent-ink);
    box-shadow: none;
    transform: none;
}

.glass-btn:disabled, .glass-btn.disabled {
    opacity: 0.42;
    box-shadow: none;
    transform: none;
}

/* ============================================================
   Cards - double-bezel nested architecture
   ============================================================ */
.glass-card {
    position: relative;
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    padding: 26px;
    box-shadow: var(--r-shadow-1);
    transition: transform var(--r-t) var(--r-ease), box-shadow var(--r-t) var(--r-ease), border-color var(--r-t) var(--r-ease);
}
.glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.glass-card:hover {
    transform: translateY(-2px);
    border-color: rgba(201, 123, 74, 0.22);
    box-shadow: var(--r-shadow-2);
}
.glass-card-lg { border-radius: var(--r-r-xl); padding: 34px; }
.glass-card-sm { border-radius: var(--r-r-md); padding: 18px; }

.glass-card-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--r-line);
}
.glass-card-title { font-size: 1.12rem; letter-spacing: 0.01em; }
.glass-card-footer { border-top: 1px solid var(--r-line); padding-top: 16px; margin-top: 20px; }

/* ============================================================
   Inputs - soft inset, clear focus ring
   ============================================================ */
.glass-input {
    padding: 12px 18px;
    font-size: 0.92rem;
    color: var(--r-ink);
    background: var(--r-surface-2);
    border: 1px solid var(--r-line-strong);
    border-radius: var(--r-r-pill);
    transition: border-color var(--r-t-fast) var(--r-ease), background-color var(--r-t-fast) var(--r-ease), box-shadow var(--r-t-fast) var(--r-ease);
}
.glass-input::placeholder { color: var(--r-ink-faint); }
.glass-input:hover { border-color: rgba(33, 28, 22, 0.22); }
.glass-input:focus {
    border-color: var(--r-accent-deep);
    background: var(--r-surface);
    box-shadow: 0 0 0 4px rgba(201, 123, 74, 0.14);
    outline: none;
}
textarea.glass-input { border-radius: var(--r-r-md); min-height: 120px; }
select.glass-input { border-radius: var(--r-r-md); }

.input-group {
    border-radius: var(--r-r-pill);
    border: 1px solid var(--r-line-strong);
    background: var(--r-surface-2);
}
.input-group:focus-within {
    border-color: var(--r-accent-deep);
    background: var(--r-surface);
    box-shadow: 0 0 0 4px rgba(201, 123, 74, 0.14);
}

/* ============================================================
   Auth screens - centered card with ambient warmth
   ============================================================ */
.auth-container {
    min-height: 100dvh;
    padding: 24px;
}
.auth-card {
    max-width: 428px;
    padding: 40px 34px;
    border-radius: var(--r-r-xl);
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    box-shadow: var(--r-shadow-3);
}
.auth-title {
    font-size: 1.85rem;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}
.auth-subtitle {
    font-size: 0.9rem;
    color: var(--r-ink-muted);
    margin-bottom: 26px;
}
.auth-switch { color: var(--r-ink-muted); }
.auth-switch a { color: var(--r-accent-ink); font-weight: 500; }

/* ============================================================
   Page headers, sections, stats
   ============================================================ */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}
/* Title + description stack vertically and never get squeezed by flex siblings */
.page-header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
    width: 100%;
}
.page-header-text > * {
    flex: 0 0 auto;
    max-width: 100%;
}
.page-header-text > .page-title { margin: 0; }
/* Fallback: if title and description are direct flex siblings, stack them full-width
   instead of letting flexbox squeeze them into overlap. */
.page-header > .page-title { flex: 1 1 100%; margin-bottom: 0; }
.page-header > .page-desc { flex: 1 1 100%; }
.page-title {
    font-size: 1.68rem;
    letter-spacing: 0.01em;
    line-height: 1.35;
    margin: 0 0 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.page-subtitle { color: var(--r-ink-muted); }
.page-desc {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--r-ink-muted);
    text-wrap: pretty;
}
.section-title { font-size: 1.18rem; letter-spacing: 0.01em; }

.stat-card {
    padding: 24px 20px;
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-md);
    box-shadow: var(--r-shadow-1);
    transition: transform var(--r-t) var(--r-ease), box-shadow var(--r-t) var(--r-ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--r-shadow-2); border-color: rgba(201, 123, 74, 0.22); }
.stat-icon {
    border-radius: var(--r-r-sm);
    background: var(--r-accent-soft);
    color: var(--r-accent-deep);
}
.stat-value {
    font-family: var(--r-font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--r-accent-deep);
    letter-spacing: -0.02em;
}
.stat-label { color: var(--r-ink-muted); }

/* ============================================================
   Persona cards
   ============================================================ */
.persona-card {
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    box-shadow: var(--r-shadow-1);
    transition: transform var(--r-t) var(--r-ease), box-shadow var(--r-t) var(--r-ease), border-color var(--r-t) var(--r-ease);
}
.persona-card:hover {
    transform: translateY(-4px);
    border-color: rgba(201, 123, 74, 0.28);
    box-shadow: var(--r-shadow-2);
    background: var(--r-surface);
}
.persona-card.active {
    border-color: var(--r-accent-deep);
    background: var(--r-accent-soft);
    box-shadow: 0 0 0 1px var(--r-accent-deep) inset, var(--r-shadow-2);
}
.persona-avatar {
    border-radius: var(--r-r-md);
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    color: #fff;
    font-family: var(--r-font-display);
    box-shadow: var(--r-shadow-accent);
}
.persona-meta { border-top: 1px solid var(--r-line); }

/* ============================================================
   Tables - hairline rows, no heavy borders
   ============================================================ */
.table-wrapper {
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-md);
    background: var(--r-surface);
    box-shadow: var(--r-shadow-1);
}
.log-table th {
    padding: 14px 18px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--r-ink-faint);
    background: var(--r-surface-2);
    border-bottom: 1px solid var(--r-line);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.log-table td { border-bottom: 1px solid var(--r-line); color: var(--r-ink-soft); }
.log-table tr:hover td { background: rgba(232, 168, 124, 0.06); }
.log-table .cell-mono { font-family: var(--r-font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   Badges - squared, restrained
   ============================================================ */
.badge {
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--r-r-xs);
    letter-spacing: 0.02em;
}
.badge-success { background: var(--r-success-soft); border-color: rgba(78, 141, 91, 0.28); color: var(--r-success); }
.badge-danger { background: var(--r-danger-soft); border-color: rgba(194, 85, 75, 0.28); color: var(--r-danger); }
.badge-warning { background: var(--r-warning-soft); border-color: rgba(185, 126, 46, 0.28); color: var(--r-warning); }
.badge-info { background: var(--r-info-soft); border-color: rgba(74, 110, 143, 0.28); color: var(--r-info); }
.badge-accent { background: var(--r-accent-soft); border-color: rgba(201, 123, 74, 0.28); color: var(--r-accent-ink); }
.badge-default { background: var(--r-surface-2); border-color: var(--r-line-strong); color: var(--r-ink-muted); }

/* ============================================================
   Modals - soft spring entrance
   ============================================================ */
.modal-overlay {
    background: rgba(33, 28, 22, 0.42);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: opacity var(--r-t) var(--r-ease), visibility var(--r-t) var(--r-ease);
}
.modal {
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-xl);
    box-shadow: var(--r-shadow-3);
    transform: translateY(16px) scale(0.985);
    transition: transform var(--r-t) var(--r-ease);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-header { border-bottom: 1px solid var(--r-line); padding: 22px 26px 16px; }
.modal-title { font-size: 1.2rem; }
.modal-footer { border-top: 1px solid var(--r-line); }

/* ============================================================
   Toasts
   ============================================================ */
.toast-container { top: calc(var(--nav-height) + 18px); right: 22px; }
.toast {
    padding: 13px 20px;
    border-radius: var(--r-r-md);
    background: rgba(255, 253, 250, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--r-line);
    box-shadow: var(--r-shadow-2);
    animation: r-toast-in 0.42s var(--r-ease-soft);
}
@keyframes r-toast-in {
    0% { opacity: 0; transform: translateX(28px) scale(0.96); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============================================================
   WeChat QR & misc surfaces
   ============================================================ */
.wechat-bind {
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-xl);
    box-shadow: var(--r-shadow-2);
}
.wechat-qr {
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-md);
    background: #fff;
    box-shadow: var(--r-shadow-1);
}
.qr-box { border-radius: var(--r-r-md); box-shadow: var(--r-shadow-1); border: 1px solid var(--r-line); }
.qr-step {
    background: var(--r-surface-2);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-pill);
    color: var(--r-ink-muted);
}
.qr-step span {
    background: var(--r-accent);
    color: #fff;
    border-radius: 50%;
}
.form-card {
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-xl);
    box-shadow: var(--r-shadow-1);
}

/* ============================================================
   Entry animation - scroll-driven via IO, opt-in class
   ============================================================ */
/* Entry animation.
   Uses a self-completing CSS animation with a fail-safe: even if the JS
   observer never fires (embedded WebViews, prerender, reduced visibility),
   the animation still runs and the element ends fully visible. */
.r-reveal {
    animation: r-enter var(--r-t-slow) var(--r-ease-soft) both;
    animation-delay: var(--r-delay, 0ms);
}
@keyframes r-enter {
    0% { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0); }
}
/* Keep observer-driven reveal working when available, without hiding content */
.r-reveal.r-in {
    animation: none;
    opacity: 1;
    transform: none;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .r-reveal { opacity: 1; transform: none; }
    body::after { display: none; }
}

/* ============================================================
   Content offset fix - reserve full navbar height incl. safe area
   ============================================================ */
.main-container {
    padding-top: calc(var(--nav-total) + 24px);
}
.main-content {
    margin-top: var(--nav-total);
    min-height: calc(100dvh - var(--nav-total));
}
.sidebar {
    top: calc(var(--nav-total) + 18px);
}
.mobile-nav-sidebar {
    padding-top: calc(var(--nav-total) + 16px);
}
.sidebar-overlay {
    top: var(--nav-total);
}
.toast-container {
    top: calc(var(--nav-total) + 18px);
}

/* ===== Chat: shared ===== */
.chat-list-page { padding-bottom: 40px; max-width: 1360px; }

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 56px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--r-line-strong, rgba(33,28,22,0.14));
    border-radius: var(--r-r-lg);
}
.chat-empty-icon {
    width: 62px; height: 62px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px;
    margin-bottom: 16px;
    color: var(--r-accent);
    background: var(--r-accent-soft);
}
.chat-empty-icon svg { width: 30px; height: 30px; }
.chat-empty-title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--r-ink); }
.chat-empty-desc { margin: 6px 0 0; font-size: 0.82rem; color: var(--r-ink-faint); }

/* skeleton */
.sk {
    background: linear-gradient(90deg, rgba(33,28,22,0.06) 25%, rgba(33,28,22,0.11) 37%, rgba(33,28,22,0.06) 63%);
    background-size: 400% 100%;
    animation: skShimmer 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes skShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
.session-card.is-skeleton { pointer-events: none; }
.sk-line { height: 11px; margin-bottom: 8px; }
.sk-w40 { width: 40%; }
.sk-w80 { width: 80%; }
.sk-w30 { width: 30%; }

/* ===== Chat: list page ===== */
.chat-stat-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.chat-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-md);
    box-shadow: 0 1px 2px rgba(33,28,22,0.03);
}
.chat-stat-val {
    font-family: var(--r-font-display);
    font-size: 1.32rem;
    line-height: 1.1;
    color: var(--r-accent-deep);
}
.chat-stat-lbl { font-size: 0.72rem; color: var(--r-ink-faint); }

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

.session-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    background: var(--bg-card);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    box-shadow: 0 1px 2px rgba(33,28,22,0.03), 0 8px 24px rgba(33,28,22,0.035);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform var(--r-t-fast) var(--r-ease), box-shadow var(--r-t-fast) var(--r-ease), border-color var(--r-t-fast) var(--r-ease);
}
.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(33,28,22,0.05), 0 14px 34px rgba(33,28,22,0.08);
    border-color: rgba(201,123,74,0.28);
}
.session-card:active { transform: translateY(0) scale(0.995); }

.session-avatar {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--r-font-display);
    font-size: 1.28rem;
    color: #fff;
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    box-shadow: var(--r-shadow-accent);
}
.session-avatar.web {
    background: linear-gradient(150deg, #8FA9C4, #5E7C9B);
    box-shadow: 0 8px 20px rgba(94,124,155,0.26);
}
.session-avatar.sk { background: rgba(33,28,22,0.07); box-shadow: none; }

.session-body { flex: 1 1 auto; min-width: 0; }

.session-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.session-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--r-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9em;
}
.session-source {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.5;
}
.session-source.wechat { color: #2F855A; background: rgba(56,161,105,0.12); }
.session-source.web { color: var(--r-accent-ink); background: var(--r-accent-soft); }
.session-time {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--r-ink-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.session-preview {
    font-size: 0.82rem;
    color: var(--r-ink-muted);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.session-count { font-size: 0.72rem; color: var(--r-ink-faint); }

.session-arrow {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    color: var(--r-ink-faint);
    transition: transform var(--r-t-fast) var(--r-ease), color var(--r-t-fast) var(--r-ease);
}
.session-arrow svg { width: 100%; height: 100%; display: block; }
.session-card:hover .session-arrow { color: var(--r-accent); transform: translateX(3px); }

/* ===== Chat: conversation view ===== */
.chat-view-page {
    max-width: 1360px;
    margin: 0 auto;
    padding: calc(var(--nav-total) + 14px) 16px calc(28px + var(--safe-area-bottom));
    display: flex;
    flex-direction: column;
}

.chat-view-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 14px;
    background: var(--bg-card);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    box-shadow: 0 1px 2px rgba(33,28,22,0.03), 0 8px 24px rgba(33,28,22,0.035);
}

.chat-back-btn {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    color: var(--r-ink);
    background: var(--r-accent-soft);
    transition: background-color var(--r-t-fast) var(--r-ease), transform var(--r-t-fast) var(--r-ease);
}
.chat-back-btn svg { width: 20px; height: 20px; }
.chat-back-btn:hover { background: rgba(201,123,74,0.2); }
.chat-back-btn:active { transform: scale(0.94); }

.chat-peer {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}
.chat-peer-avatar {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--r-font-display);
    font-size: 1.12rem;
    color: #fff;
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    box-shadow: var(--r-shadow-accent);
}
.chat-peer-avatar.web {
    background: linear-gradient(150deg, #8FA9C4, #5E7C9B);
    box-shadow: 0 8px 20px rgba(94,124,155,0.26);
}
.chat-peer-info { min-width: 0; }
.chat-peer-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--r-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-peer-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    color: var(--r-ink-faint);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.16);
    flex: 0 0 auto;
}
.chat-source-tag {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 999px;
}
.chat-source-tag.wechat { color: #2F855A; background: rgba(56,161,105,0.12); }
.chat-source-tag.web { color: var(--r-accent-ink); background: var(--r-accent-soft); }

.chat-view-scroll {
    background: var(--bg-card);
    border: 1px solid var(--r-line);
    border-radius: var(--r-r-lg);
    padding: 20px 18px 24px;
    min-height: 52vh;
    max-height: calc(100vh - var(--nav-total) - 156px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 1px 2px rgba(33,28,22,0.03), 0 8px 24px rgba(33,28,22,0.035);
}

.chat-loading { display: flex; justify-content: flex-start; padding: 8px 0; }

.chat-day-sep, .chat-time-sep {
    display: flex;
    justify-content: center;
}
.chat-day-sep { margin: 20px 0 16px; }
.chat-time-sep { margin: 16px 0 12px; }
.chat-day-sep span {
    font-size: 0.7rem;
    color: var(--r-ink-muted);
    background: rgba(33,28,22,0.06);
    padding: 4px 14px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    font-weight: 500;
}
.chat-time-sep span {
    font-size: 0.68rem;
    color: var(--r-ink-faint);
    padding: 2px 6px;
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin-bottom: 14px;
    animation: chatMsgIn 0.32s var(--r-ease) both;
}
@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-message.user { flex-direction: row-reverse; }
.chat-message.follow { margin-bottom: 6px; }

.chat-avatar {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--r-font-display);
    font-size: 0.98rem;
    color: #fff;
    user-select: none;
}
.chat-avatar.bot {
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    box-shadow: var(--r-shadow-accent);
}
.chat-avatar.user {
    background: linear-gradient(150deg, #8FA9C4, #5E7C9B);
    box-shadow: 0 6px 16px rgba(94,124,155,0.24);
}
.chat-avatar.is-hidden { visibility: hidden; }

.message-col {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    min-width: 0;
}
.chat-message.user .message-col { align-items: flex-end; }

.message-bubble {
    padding: 11px 15px;
    font-size: 0.88rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    background: rgba(33,28,22,0.045);
    color: var(--r-ink);
    border-radius: 18px;
    border-bottom-left-radius: 5px;
}
.chat-message.user .message-bubble {
    background: linear-gradient(150deg, var(--r-accent), var(--r-accent-deep));
    color: #fff;
    border-radius: 18px;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 14px rgba(201,123,74,0.22);
}

@media (max-width: 480px) {
    .chat-stat-val { font-size: 1.16rem; }
    .chat-view-page { padding-left: 12px; padding-right: 12px; }
    .chat-view-scroll { padding: 16px 13px 20px; }
    .message-col { max-width: 82%; }
    .chat-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 0.88rem; }
    .message-bubble { font-size: 0.86rem; padding: 10px 13px; }
    .session-card { padding: 14px 13px; gap: 12px; }
    .session-avatar { width: 42px; height: 42px; border-radius: 13px; font-size: 1.16rem; }
    .session-name { max-width: 7em; }
}

/* Mobile refinements */
@media (max-width: 768px) {
    h1 { font-size: 1.95rem; }
    .auth-card { padding: 32px 24px; }
    .glass-card { padding: 20px; }
    .glass-card-lg { padding: 24px; }
    .page-title { font-size: 1.42rem; }
}

/* ============================================================
   第三方登录（聚合登录）样式
   ============================================================ */
#oauthLoginBlock,
#oauthRegisterBlock {
    margin-top: 18px;
}

.oauth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 16px;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.oauth-divider::before,
.oauth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color, rgba(0, 0, 0, 0.08));
}

.oauth-primary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 16px;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    background: var(--bg-card, #fff);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.oauth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--accent, #e0a458);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.oauth-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.oauth-btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
}

.oauth-more {
    margin-top: 12px;
}

.oauth-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px;
}

.oauth-others {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.oauth-btn-sm {
    height: 40px;
    font-size: 0.82rem;
}

.oauth-btn-sm img {
    width: 18px;
    height: 18px;
}

.oauth-loading {
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* 绑定列表 */
.bindings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bindings-loading,
.bindings-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg-input);
    border-radius: var(--radius-md, 12px);
}

.binding-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md, 12px);
}

.binding-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.binding-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.binding-name {
    font-size: 0.92rem;
    font-weight: 500;
}

.binding-status {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.binding-status.bound {
    color: var(--accent-deep, #b57a2a);
}

.binding-item .glass-btn {
    flex-shrink: 0;
}

/* TA 记得的你：AI 用户档案 */
.dossier-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dossier-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
        "cat key expiry actions"
        "cat value value value";
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-md, 12px);
}

.dossier-cat {
    grid-area: cat;
    align-self: start;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    color: #fff;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.dossier-key {
    grid-area: key;
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dossier-value {
    grid-area: value;
    font-size: 0.92rem;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.5;
}

.dossier-expiry {
    grid-area: expiry;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.dossier-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dossier-item .glass-btn {
    flex-shrink: 0;
}

.dossier-add {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.dossier-add .glass-input {
    flex: 1;
    min-width: 0;
}

.dossier-add #dossierNewCategory {
    flex: 0 0 auto;
    width: 84px;
}

.dossier-add .glass-btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .dossier-item {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "cat key expiry"
            "value value value"
            "actions actions actions";
        row-gap: 8px;
    }
    .dossier-actions {
        justify-content: flex-end;
    }
    .dossier-add {
        flex-wrap: wrap;
    }
    .dossier-add #dossierNewKey,
    .dossier-add #dossierNewValue {
        flex: 1 1 100%;
    }
    .dossier-add #dossierNewCategory {
        flex: 1;
    }
}

/* 注册后推荐绑定 QQ 弹窗 */
.bind-prompt {
    max-width: 360px;
    padding: 30px 26px 24px;
    text-align: center;
}

.bind-prompt-icon img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.bind-prompt-title {
    margin: 14px 0 8px;
    font-size: 1.15rem;
}

.bind-prompt-desc {
    margin: 0 0 20px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.bind-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bind-prompt-actions .bind-prompt-skip {
    background: var(--bg-input);
    color: var(--text-muted);
}

/* ---- 第三方登录 / 个人中心 手机端适配 ---- */
@media (max-width: 768px) {
    .oauth-primary {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .oauth-btn {
        height: 44px;
        padding: 0 12px;
        font-size: 0.86rem;
    }
    .oauth-others {
        grid-template-columns: 1fr 1fr;
    }
    .oauth-btn-sm img { width: 17px; height: 17px; }

    /* 个人中心：卡片与绑定项在窄屏收紧 */
    .bindings-list { gap: 8px; }
    .binding-item {
        padding: 12px 13px;
        gap: 11px;
    }
    .binding-icon { width: 26px; height: 26px; }
    .binding-name { font-size: 0.88rem; }
    .binding-status { font-size: 0.74rem; }
    .binding-item .glass-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .bind-prompt {
        max-width: 92vw;
        padding: 26px 20px 20px;
    }
    .bind-prompt-icon img { width: 46px; height: 46px; }
    .bind-prompt-title { font-size: 1.08rem; }
    .bind-prompt-desc { font-size: 0.82rem; }
}

@media (max-width: 480px) {
    .oauth-primary { grid-template-columns: 1fr; }
    .oauth-others { grid-template-columns: 1fr 1fr; }
    .oauth-btn { height: 46px; }
    .oauth-divider { font-size: 0.74rem; }

    /* 个人中心信息行：窄屏允许换行避免挤压 */
    .binding-item { flex-wrap: wrap; }
    .binding-item .glass-btn {
        width: 100%;
        order: 3;
    }
}

/* ---- 个人中心页面结构 ---- */
.profile-wrap {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card { padding: 28px; }

.profile-card-title {
    margin: 0;
    font-size: 1.1rem;
}

.profile-card-head {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.profile-card-hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.profile-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.6;
}

.profile-info {
    background: var(--bg-input);
    border-radius: var(--radius-md, 12px);
    padding: 18px;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 6px 0;
}

.profile-info-row + .profile-info-row {
    border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.05));
    margin-top: 6px;
}

.profile-info-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.profile-info-value {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
    min-width: 0;
}

@media (max-width: 768px) {
    .profile-wrap { gap: 16px; }
    .profile-card { padding: 20px; }
    .profile-card-title { font-size: 1.02rem; }
    .profile-info { padding: 14px; }
    .profile-info-label,
    .profile-info-value { font-size: 0.86rem; }
}

@media (max-width: 480px) {
    .profile-card { padding: 18px 16px; }
    .profile-card-head { flex-wrap: wrap; }
    .profile-card-hint { margin-left: 0; width: 100%; }
    .profile-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .profile-info-value { text-align: left; }
}

/* 对话详情：独立返回按钮（移除顶部状态栏后保留返回能力） */
/* .chat-view-back 已移除：对话详情页不再显示返回按钮 */

/* 个人中心：快捷入口与退出 */
.profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}
.profile-actions .glass-btn { flex: 1 1 auto; min-width: 108px; text-align: center; }
.profile-logout {
    width: 100%;
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
}

@media (max-width: 768px) {
    .profile-actions .glass-btn { flex: 1 1 45%; }
}

@media (max-width: 480px) {
    .profile-actions .glass-btn { min-width: 0; flex: 1 1 45%; }
}

/* 开通会员：导航与侧边栏强调 */
.nav-link-vip {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: var(--text-primary) !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
}
.nav-link-vip:hover { filter: brightness(1.06); }
.sidebar-link-vip .sidebar-label { color: var(--accent-deep); font-weight: 600; }
.sidebar-link-vip.active,
.sidebar-link-vip:hover { background: var(--accent-bg, var(--bg-input)); }
.mobile-nav-vip { color: var(--accent-deep); font-weight: 600; }
.mobile-nav-vip::after {
    content: 'VIP';
    font-size: 0.62rem;
    background: var(--accent);
    color: var(--text-primary);
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 8px;
}

/* 教程页：固定导航遮挡顶部标题修复 + 内容宽度限制 */
.tutorial-page {
    max-width: 820px;
    box-sizing: border-box;
}
.tutorial-page.main-content {
    margin-left: 0;
    margin-right: auto;
    padding: calc(var(--nav-height) + var(--safe-area-top) + 24px) 40px calc(80px + var(--safe-area-bottom));
}
.tutorial-page.tutorial-guest {
    max-width: 820px;
    margin: 0 auto !important;
    padding: calc(40px + var(--safe-area-top)) 20px calc(80px + var(--safe-area-bottom));
}
@media (min-width: 769px) {
    .tutorial-page.main-content {
        margin-left: calc(var(--sidebar-width) + 32px);
        padding: calc(var(--nav-height) + var(--safe-area-top) + 8px) 40px calc(80px + var(--safe-area-bottom));
    }
}
@media (max-width: 768px) {
    .tutorial-page.main-content,
    .tutorial-page.tutorial-guest {
        padding: calc(var(--nav-height) + var(--safe-area-top) + 16px) 16px calc(80px + var(--safe-area-bottom)) !important;
    }
}
