/* ===================================================
   SunnyHome Web — Design System
   Premium dark-mode e-commerce UI
   =================================================== */

/* --- Design Tokens --- */
:root {
    --primary: #FF6B35;
    --primary-hover: #ff7f4f;
    --primary-dark: #E55A2B;
    --primary-glow: rgba(255, 107, 53, 0.3);

    --bg-body: #0f0f1a;
    --bg-surface: #16162a;
    --bg-card: #1c1c35;
    --bg-card-hover: #24243f;
    --bg-input: #1a1a30;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #eaeaf0;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --text-on-primary: #ffffff;

    --success: #4ecdc4;
    --success-bg: rgba(78, 205, 196, 0.15);
    --warning: #ffc107;
    --warning-bg: rgba(255, 193, 7, 0.15);
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.15);

    --border: #2a2a48;
    --border-hover: #3a3a58;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* System-first stack — no external font CSS (better for cross-border latency). */
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    --header-height: 60px;
    --nav-height: 64px;
    --content-max-width: 1200px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

/* --- Loading Screen --- */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-body);
}
.loading-spinner-container { text-align: center; }
.loading-logo {
    font-size: 3rem;
    animation: pulse 1.5s ease-in-out infinite;
}
.loading-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1rem;
    color: var(--text-primary);
}
.loading-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 1rem;
}
.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: bounce 1.4s ease-in-out infinite both;
}
.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

/* --- Layout --- */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.app-header-section {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 26, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
}
.app-header {
    height: var(--header-height);
    background: transparent;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid transparent;
}
.app-header-section:has(.store-banner) .app-header {
    border-bottom-color: var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    gap: 1rem;
}
.header-logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header-logo span { font-size: 1.4rem; }
.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.header-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search::before {
    content: "🔍";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    pointer-events: none;
}
/* Keeps header balance when search is hidden on non-home routes */
.header-search-spacer {
    flex: 1;
    max-width: 400px;
    min-height: 2.5rem;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* --- Store banner (under header) --- */
.store-banner {
    padding: 0.35rem 1rem 0.5rem;
    background: linear-gradient(90deg, rgba(255, 107, 53, 0.12), rgba(255, 107, 53, 0.04));
    border-top: 1px solid rgba(255, 107, 53, 0.15);
}
.store-banner-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.store-banner-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--primary);
    text-align: center;
    word-break: break-word;
}
.store-banner-text--single {
    animation: store-banner-pulse 3.2s ease-in-out infinite;
}
.store-banner-text--rotate {
    animation: store-banner-pop 0.45s ease;
}
@keyframes store-banner-pulse {
    0%, 100% { opacity: 0.78; }
    50% { opacity: 1; }
}
@keyframes store-banner-pop {
    from { opacity: 0.35; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Main Content --- */
.app-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: calc(var(--nav-height) + 1.5rem);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(22, 22, 42, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    position: relative;
    border-radius: var(--radius-md);
}
.nav-item:hover:not(.active) {
    color: var(--text-secondary);
}
.nav-item.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(255, 107, 53, 0.14);
    box-shadow: inset 0 -3px 0 0 var(--primary);
}
.nav-item.active .nav-icon {
    transform: scale(1.06);
    filter: drop-shadow(0 0 6px var(--primary-glow));
}
.nav-icon {
    font-size: 1.3rem;
    line-height: 1;
    transition: transform var(--transition-fast), filter var(--transition-fast);
}
.nav-badge {
    position: absolute;
    top: 2px;
    right: 0.25rem;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: var(--radius-full);
    padding: 0 4px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm), 0 0 16px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}
.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 107, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(255, 107, 107, 0.25);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
}
.btn-ghost:hover { color: var(--text-primary); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}
.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card-body { padding: 1rem; }

/* --- Product Grid --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (min-width: 640px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
}
@media (min-width: 1200px) {
    .product-grid { grid-template-columns: repeat(5, 1fr); }
}

/* --- Product Card --- */
.product-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.product-card .card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.product-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
}
.product-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.product-price {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}
.product-price-original {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 0.25rem;
}
/* 与 MAUI HomePage 主价格行一致（Shared.Api ProductModel.PriceDisplayForUser） */
.product-price-user {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}
.product-price-user--promo {
    color: #ff4444;
}
/* 可获得积分：与产品详情一致；颜色在 __text 上避免与 emoji 混排时被继承成正文色 */
.points-earn-hint {
    font-size: 0.8rem;
    line-height: 1.35;
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.points-earn-hint__text {
    color: var(--success);
}
/* 提高优先级，避免在商品卡内被正文色覆盖成近白色 */
.product-card .card-body .points-earn-hint .points-earn-hint__text,
.detail-info .points-earn-hint .points-earn-hint__text {
    color: var(--success);
}
.product-card .points-earn-hint {
    margin-top: 0.2rem;
}
.points-earn-hint--detail {
    margin-bottom: 0.5rem;
}
/* 对齐 MAUI 月销量 DimGray / #ACACAC，略亮于 --text-muted 以保证暗色背景下可读 */
.product-sales {
    font-size: 0.6rem;
    line-height: 1.35;
    color: #a8a8c4;
    margin-top: auto;
    padding-top: 0.45rem;
}
.product-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: linear-gradient(135deg, var(--danger), #ff4757);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* --- Category Bar --- */
.category-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.category-pill {
    flex-shrink: 0;
    padding: 0.375rem 1rem;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.category-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.category-pill.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* --- Sort Bar --- */
.sort-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    align-items: center;
}
.sort-bar label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}
.sort-btn {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.sort-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}

.load-more-bar {
    display: flex;
    justify-content: center;
    padding: 1rem 0 1.5rem;
}
.load-more-bar .load-more-btn {
    min-width: 8rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-readonly {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}
.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0.75rem;
}
.form-error {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* --- Auth Pages --- */
.auth-page {
    max-width: 420px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
}
.auth-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.auth-footer a { font-weight: 600; }
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* --- Cart --- */
.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    transition: border-color var(--transition-fast);
}
.cart-item:hover { border-color: var(--border-hover); }
.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-surface);
    flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-stock {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    line-height: 1.35;
}
.cart-item-price {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.quantity-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-fast);
}
.quantity-btn:hover:not(:disabled) { background: var(--bg-card-hover); }
.quantity-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.quantity-value {
    width: 40px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bg-input);
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    height: 30px;
    line-height: 30px;
}
.cart-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1rem;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}
.cart-total-price {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: 1.3rem;
}

/* --- Product Detail --- */
.detail-page { max-width: 800px; margin: 0 auto; }
.detail-gallery {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    margin-bottom: 1rem;
    /* Main image was full width; reduce visual weight to ~half width, centered */
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}
.detail-main-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--bg-surface);
}
.detail-thumbnails {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.detail-thumbnails::-webkit-scrollbar { display: none; }
.detail-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition-fast);
    flex-shrink: 0;
    background: var(--bg-card);
}
.detail-thumb.active, .detail-thumb:hover {
    border-color: var(--primary);
}
.detail-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.detail-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.detail-price {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}
.detail-original-price {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 0.9rem;
}
.detail-stock {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.detail-stock.low { color: var(--danger); }
/* 与 MAUI ProductDetailsPage「产品详情」Frame：标题条 + 正文区 */
.detail-description-section {
    margin-top: 1.25rem;
}
.detail-description-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
.detail-description-header {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.detail-description-body {
    padding: 0.875rem 1rem 1rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #b0b0b0;
    text-align: start;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* --- My Page --- */
.my-page-header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
}
.my-avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 0.75rem;
}
.my-user-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.my-username {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}
.my-role-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    line-height: 1.2;
}
.my-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}
.my-stat {
    text-align: center;
}
.my-stat-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}
.my-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.my-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    text-decoration: none;
}
.my-menu-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.my-menu-icon { font-size: 1.2rem; }
.my-menu-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.empty-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* --- Loading Spinner --- */
.spinner-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow-md);
    max-width: 360px;
}
.toast-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: var(--success);
}
.toast-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
}
.toast-info {
    background: rgba(79, 195, 247, 0.15);
    border: 1px solid #4fc3f7;
    color: #4fc3f7;
}

/* --- 404 --- */
.not-found-container {
    text-align: center;
    padding: 4rem 1rem;
}
.not-found-icon { font-size: 4rem; margin-bottom: 1rem; }
.not-found-container h1 {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* --- Blazor Error UI --- */
.blazor-error {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: var(--danger-bg);
    border-top: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    z-index: 9999;
}
.blazor-error a { color: var(--danger); font-weight: 600; margin: 0 0.5rem; }

/* --- Promotion Badge --- */
.promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
}
.promo-badge-discount {
    background: var(--danger-bg);
    color: var(--danger);
}
.promo-badge-flash {
    background: var(--warning-bg);
    color: var(--warning);
}
.promo-badge-group {
    background: var(--success-bg);
    color: var(--success);
}

/* --- Section --- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Page Transition --- */
.page-enter {
    animation: fadeInUp 0.35s var(--transition-slow);
}

/* --- Keyframes --- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* --- Responsive helpers --- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* --- Orders list: MAUI OrderDetail-style lines per product inside one frame per order --- */
.orders-page .orders-list-ui {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* One card per order (like MAUI Frame around whole order + item rows) */
.order-maui-frame {
    display: block;
    padding: 0.75rem 0.85rem 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.order-maui-frame:hover {
    border-color: rgba(255, 107, 53, 0.4);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.order-maui-header {
    padding-bottom: 0.65rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.order-maui-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.order-maui-order-id {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
}
.order-maui-header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.order-maui-pay {
    color: var(--success);
    font-size: 0.85rem;
}
.order-maui-pay strong {
    color: var(--success);
    font-weight: 700;
}
/* Inner “order items” — each product one row: thumb | name + meta | line total */
.order-maui-items {
    display: flex;
    flex-direction: column;
}
.order-maui-line {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}
.order-maui-line:last-child {
    border-bottom: none;
    padding-bottom: 0.25rem;
}
.order-maui-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-surface);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px var(--border);
}
.order-maui-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.order-maui-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    opacity: 0.45;
}
.order-maui-line-info {
    min-width: 0;
}
.order-maui-line-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.order-maui-line-meta {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.order-maui-line-total {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    align-self: center;
}
.order-maui-no-lines {
    padding: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}
.order-maui-footer-hint {
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 0.35rem;
    margin-top: 0.15rem;
    border-top: 1px solid rgba(42, 42, 72, 0.6);
}
.orders-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.orders-pager-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
@media (max-width: 480px) {
    .order-maui-line {
        grid-template-columns: 56px 1fr auto;
        gap: 0.55rem;
    }
    .order-maui-thumb {
        width: 56px;
        height: 56px;
    }
}

/* Order status badges (list + detail) */
.order-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}
.order-status.status-warn {
    background: var(--warning-bg);
    color: var(--warning);
}
.order-status.status-ok {
    background: var(--success-bg);
    color: var(--success);
}
.order-status.status-muted {
    background: rgba(128, 128, 128, 0.2);
    color: var(--text-muted);
}
.order-status.status-default {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}
.order-detail-header .link-back {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
}
.order-detail-header .link-back:hover { color: var(--primary); }
.order-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}
.order-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.order-detail-row:last-child { border-bottom: none; }
.order-amount-lg {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}
.subsection-title {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
    font-family: var(--font-heading);
}
.order-lines {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.order-line {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.order-line:last-child { border-bottom: none; }
.order-line-name { font-weight: 500; margin-bottom: 0.35rem; }
.order-line-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.order-line-sub { font-weight: 600; color: var(--text-primary); }
.checkout-page .checkout-lead {
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 1.25rem;
}
.checkout-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text-primary);
}

.checkout-tier-info {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--color-danger, #c62828);
  line-height: 1.4;
}

.checkout-add-address-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.checkout-points-available {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkout-pay-amount {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.checkout-points-reward-hint {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: #e65100;
  line-height: 1.4;
}

.checkout-field-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.checkout-summary-block {
    margin-top: 0.75rem;
}
.checkout-est-total {
    font-weight: 600;
    border-top: 1px dashed var(--border);
    margin-top: 0.35rem;
    padding-top: 0.65rem;
}
.checkout-est-total span:first-child {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 70%;
}
.checkout-free-ship {
    color: var(--success);
    font-weight: 600;
}
.checkout-quote-err {
    color: var(--danger);
}
.checkout-quote-hint {
    font-size: 0.82rem;
    color: var(--danger);
    margin: 0.35rem 0 0;
}
.checkout-discount-modes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.checkout-radio {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-primary);
}
.checkout-radio input {
    accent-color: var(--primary);
}
.checkout-discount-row span:last-child {
    color: var(--success);
    font-weight: 600;
}
.checkout-coupon-hint {
    word-break: break-word;
}
.checkout-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}

/* Orders list: MAUI-style top row + action column */
.order-maui-card-wrap { list-style: none; }
.order-maui-top {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 0.65rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.order-maui-top-main { flex: 1; min-width: 0; }
.order-maui-order-link {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
}
.order-maui-order-link:hover { color: var(--primary); }
.order-maui-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
}
.order-maui-mini-btn {
    min-width: 4.5rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    color: #fff;
}
.order-maui-mini-view { background: #3b6cff; }
.order-maui-mini-pay { background: #2e9d5c; }
.order-maui-mini-del { background: var(--danger); }
.order-maui-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(42, 42, 72, 0.6);
}
.order-maui-wide-btn {
    flex: 1 1 auto;
    min-width: 6.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-primary);
    background: var(--bg-surface);
}
.order-maui-wide-cancel { border-color: var(--warning); color: var(--warning); }
.order-maui-wide-confirm { border-color: var(--success); color: var(--success); }
.order-maui-wide-return { border-color: var(--danger); color: var(--danger); }

/* 仅「取消订单」一项时：约 1/3 宽、右对齐，减少误触 */
.order-maui-secondary-actions--single-cancel {
    justify-content: flex-end;
}
.order-maui-wide-btn--single-cancel {
    flex: 0 0 auto;
    width: 33%;
    min-width: 5.75rem;
    max-width: 11rem;
    box-sizing: border-box;
}
.order-maui-line-name-link {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--text-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.order-maui-line-name-link:hover { color: var(--primary); }

/* Order detail — extended */
.order-detail-card-wide .order-detail-card-title,
.order-pay-breakdown-title {
    font-size: 1rem;
    font-family: var(--font-heading);
    margin: 0 0 0.5rem;
}
.order-detail-card-title { margin-top: 0; }
.order-detail-mono {
    font-size: 0.78rem;
    word-break: break-all;
    text-align: right;
    max-width: 65%;
}
.order-detail-em { font-weight: 600; }
.order-lines-with-thumb .order-line-grid {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 0.75rem;
    align-items: center;
}
.order-detail-line-thumb { width: 64px; height: 64px; }
.order-line-body { min-width: 0; }
.order-line-line-total {
    align-self: center;
    white-space: nowrap;
    font-weight: 700;
}
.order-pay-breakdown {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid rgba(78, 205, 196, 0.35);
    border-radius: var(--radius-md);
}
.order-pay-breakdown-title { color: var(--success); }
.order-discount-row span:last-child { color: var(--danger); }
.order-subtotal-divider {
    border-top: 1px dashed var(--border);
    margin-top: 0.35rem;
    padding-top: 0.65rem;
}
.order-final-pay-row {
    border-top: 2px solid rgba(78, 205, 196, 0.45);
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    font-weight: 600;
}
.order-detail-addr-line { font-size: 0.9rem; line-height: 1.5; }
.order-detail-addr-single .order-detail-addr-flow {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
}
.order-detail-row-block {
    flex-wrap: wrap;
    align-items: flex-start;
}
.order-detail-row-block .order-detail-addr-flow {
    flex: 1 1 100%;
    text-align: right;
    margin-top: 0.35rem;
    max-width: 100%;
    word-break: break-word;
}
.order-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 1rem 0;
}
.order-detail-action-btn { width: 100%; justify-content: center; }
.order-return-panel { margin-top: 0.5rem; }
.order-pay-field {
    margin-bottom: 0.85rem;
}
.order-pay-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.order-pay-qr-wrap {
    text-align: center;
    margin: 1rem 0;
}
.order-pay-qr {
    max-width: min(280px, 100%);
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Orders list filters (aligned with MAUI OrdersViewModel) */
.orders-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.order-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: min(100%, 200px);
}
.order-filter-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.order-filter-select { min-height: 44px; }
.orders-custom-range {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}
.order-date-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Subpages: back link + title */
.page-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}
.page-toolbar .link-back {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    align-self: flex-start;
}
.page-toolbar .link-back:hover { color: var(--primary); }

/* Coupons / points / messages / settings */
.stack-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.coupon-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.coupon-card-active { border-color: rgba(255, 107, 53, 0.45); }
.coupon-card-muted { opacity: 0.72; }
.coupon-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.coupon-code { font-weight: 700; font-family: ui-monospace, monospace; }
.coupon-status-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}
.coupon-desc { margin: 0.35rem 0; font-size: 0.9rem; line-height: 1.45; }
.coupon-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.coupon-foot { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }

.points-balance-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(78, 205, 196, 0.12));
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}
.points-balance-label { font-size: 0.85rem; color: var(--text-secondary); }
.points-balance-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); }

.points-ledger .ledger-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.ledger-main { min-width: 0; flex: 1; }
.ledger-title { font-weight: 600; }
.ledger-time { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.ledger-desc { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.35rem; }
.ledger-delta { font-weight: 700; white-space: nowrap; }
.ledger-plus { color: var(--success); }
.ledger-minus { color: var(--danger); }

.messages-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.messages-filter .btn.active {
    border-color: var(--primary);
    color: var(--primary);
}
.message-list .message-item {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
}
.message-item.message-unread { border-left: 3px solid var(--primary); }
.message-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.message-title { font-weight: 600; }
.message-time { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
.message-body {
    margin-top: 0.65rem;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.settings-page .form-stack { margin-top: 0.5rem; }
.form-error-banner {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: var(--danger);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* --- App download (/app-download) --- */
.app-download-page {
    max-width: 42rem;
    margin: 0 auto;
    padding-bottom: 1.5rem;
}
.app-download-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}
.app-download-title {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}
.app-download-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.app-download-section {
    padding: 1.25rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}
.app-download-section--highlight {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.app-download-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.app-download-platform-icon { font-size: 1.15rem; }
.app-download-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 1rem;
}
.app-download-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}
.app-download-btn {
    font-weight: 600;
}
.app-download-btn--narrow {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}
.app-download-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
}
.app-download-checksum {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    font-size: 0.82rem;
    color: var(--text-secondary);
    word-break: break-all;
}
.app-download-checksum--tight { margin-top: 0.5rem; padding: 0.45rem 0.65rem; }
.app-download-checksum strong { color: var(--text-primary); }
.app-download-page .link-inline {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.app-download-page .link-inline:hover {
    text-decoration: underline;
}
.app-download-secondary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}
.app-download-instructions {
    margin-top: 1.25rem;
    padding: 1.25rem 1.1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
.app-download-instructions-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.app-download-instructions-sub {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}
.app-download-instructions-sub:first-of-type { margin-top: 0; }
.app-download-warn-title { color: var(--danger); }
.app-download-list {
    margin-left: 1.15rem;
    padding-left: 0.35rem;
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: 0.9rem;
}
.app-download-list li { margin-bottom: 0.35rem; }
.app-download-list--warn {
    margin-left: 1rem;
    list-style: disc;
    color: var(--danger);
}
.app-download-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
}
.app-download-footer-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.45;
}
.app-download-footer-hint code {
    font-size: 0.72rem;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

@media (max-width: 600px) {
    .header-search { max-width: none; }
    .app-content { padding: 0.75rem; padding-bottom: calc(var(--nav-height) + 1rem); }
}
