:root {
    color-scheme: light;
    --bg: #f3f5f4;
    --surface: #ffffff;
    --surface-soft: #f7f9f8;
    --surface-strong: #e9eeec;
    --text: #18201e;
    --muted: #6c7773;
    --line: #dfe5e2;
    --accent: #167d68;
    --accent-strong: #0c6654;
    --accent-soft: #e3f2ed;
    --danger: #bd3d39;
    --danger-soft: #fae9e7;
    --rail: #14211e;
    --rail-text: #e9f0ed;
    --shadow: 0 14px 45px rgba(24, 32, 30, .12);
    --radius: 8px;
    --font: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body[data-theme="coral"] { --accent: #b84f3a; --accent-strong: #943b2c; --accent-soft: #f8e9e5; --rail: #29201e; }
body[data-theme="midnight"] { --accent: #44607c; --accent-strong: #314b66; --accent-soft: #e7edf2; --rail: #111820; }
body[data-theme="emerald"] { --accent: #14755f; --accent-strong: #0b5f4d; --accent-soft: #e2f1ec; --rail: #12231f; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; text-decoration: none; }
.is-hidden { display: none !important; }
.mobile-only { display: none !important; }

.brand-mark { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font-size: 21px; font-weight: 800; flex: 0 0 auto; }
.brand-mark--large { width: 62px; height: 62px; font-size: 31px; background: #fff; color: var(--accent); }
.auth-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(460px, .8fr); }
.auth-brand { padding: clamp(40px, 7vw, 100px); display: flex; flex-direction: column; justify-content: center; gap: 28px; color: #fff; background: #18342d; }
.auth-brand h1 { margin: 0; font-size: clamp(38px, 5vw, 62px); line-height: 1; }
.auth-brand p { margin: 12px 0 0; color: #c7d7d1; font-size: 18px; }
.auth-feature-list { margin-top: 40px; display: grid; gap: 13px; color: #d7e4df; }
.auth-feature-list span::before { content: "✓"; display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 10px; border-radius: 50%; background: rgba(255,255,255,.12); }
.auth-panel { display: grid; place-items: center; padding: 36px; background: var(--surface); }
.auth-box { width: min(100%, 410px); }
.auth-mobile-brand { display: none; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--surface-strong); border-radius: 8px; margin-bottom: 38px; }
.segment { height: 42px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-weight: 650; }
.segment.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 5px rgba(24,32,30,.09); }
.auth-form header { margin-bottom: 28px; }
.auth-form h2 { font-size: 26px; margin: 0 0 8px; }
.auth-form header p { color: var(--muted); margin: 0; }
.auth-form label, .stack-form > label, .settings-form label, .field-label { display: grid; gap: 8px; margin-bottom: 18px; color: #39433f; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); outline: 0; }
input, select { height: 44px; padding: 0 13px; }
textarea { resize: vertical; padding: 11px 13px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error, .inline-error { min-height: 20px; color: var(--danger); margin: 4px 0 12px; font-size: 13px; }
.primary-button, .secondary-button, .danger-button { min-height: 40px; padding: 0 16px; border-radius: 7px; border: 1px solid transparent; font-weight: 700; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-strong); }
.secondary-button { background: var(--surface); border-color: var(--line); color: var(--text); }
.secondary-button:hover { background: var(--surface-soft); }
.danger-button { background: var(--danger); color: #fff; }
.full-button { width: 100%; }

.app-shell { width: 100%; height: 100dvh; display: grid; grid-template-columns: 76px 340px minmax(0, 1fr); overflow: hidden; }
.app-rail { background: var(--rail); color: var(--rail-text); padding: 18px 12px; display: flex; flex-direction: column; align-items: center; z-index: 3; }
.app-rail > .brand-mark { width: 44px; height: 44px; }
.rail-nav { flex: 1; width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 28px; }
.rail-button { position: relative; width: 100%; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 7px; background: transparent; color: #aebdb8; }
.rail-button span { font-size: 21px; line-height: 1; }
.rail-button small { font-size: 10px; }
.rail-button:hover, .rail-button.is-active { background: rgba(255,255,255,.1); color: #fff; }
.rail-bottom { width: 100%; display: grid; justify-items: center; gap: 12px; }
.nav-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #e45a4e; box-shadow: 0 0 0 2px var(--rail); }

.conversation-panel { min-width: 0; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.conversation-header { height: 86px; padding: 19px 18px 10px 22px; display: flex; align-items: center; justify-content: space-between; }
.conversation-header h1 { margin: 0; font-size: 23px; }
.conversation-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--surface); font-size: 22px; line-height: 1; }
.icon-button:hover { background: var(--surface-soft); }
.search-box { height: 40px; margin: 4px 16px 12px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-soft); color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); background: var(--surface); }
.search-box input { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.search-box input:focus { box-shadow: none; }
.friend-list { min-height: 0; flex: 1; overflow-y: auto; padding: 0 9px 18px; }
.friend-item { width: 100%; height: 72px; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 8px 10px; border: 0; border-radius: 7px; text-align: left; color: var(--text); background: transparent; }
.friend-item:hover { background: var(--surface-soft); }
.friend-item.is-active { background: var(--accent-soft); }
.avatar { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--avatar, var(--accent)); color: #fff; font-weight: 800; font-size: 16px; }
.avatar--small { width: 38px; height: 38px; }
.avatar--large { width: 76px; height: 76px; font-size: 28px; }
.avatar--message { width: 30px; height: 30px; font-size: 12px; }
.online-dot { position: absolute; right: -1px; bottom: 0; width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: #2ca56f; }
.online-dot.is-offline { background: #a7afac; }
.friend-copy { min-width: 0; display: grid; gap: 5px; }
.friend-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.friend-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 400; }
.friend-meta { align-self: stretch; display: flex; min-width: 35px; flex-direction: column; align-items: flex-end; justify-content: center; gap: 9px; }
.friend-meta time { color: #929a97; font-size: 10px; }
.friend-meta b { min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--accent); font-size: 10px; }
.list-empty, .modal-empty { min-height: 230px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.list-empty span, .modal-empty span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--accent); font-size: 22px; }
.text-button { padding: 5px 7px; border: 0; background: transparent; color: var(--accent); font-weight: 650; }
.danger-text { color: var(--danger); }

.chat-panel { min-width: 0; background: var(--bg); }
.empty-chat { height: 100%; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.empty-symbol { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: #c0c9c5; font-size: 28px; font-weight: 800; }
.empty-chat h2 { margin: 18px 0 5px; color: #48534f; font-size: 18px; }
.empty-chat p { margin: 0; }
.active-chat { height: 100%; display: grid; grid-template-rows: 72px minmax(0,1fr) auto; }
.chat-header { padding: 0 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.chat-peer { min-width: 0; flex: 1; }
.chat-peer h2 { margin: 0; font-size: 16px; }
.chat-peer p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.vip-badge { display: inline-flex; height: 17px; align-items: center; padding: 0 5px; border-radius: 4px; vertical-align: 1px; color: #fff; background: #167d68; font-size: 9px; font-weight: 800; }
.vip-coral { background: #ba503c !important; }
.vip-midnight { background: #384f68 !important; }
.message-list { min-height: 0; overflow-y: auto; padding: 26px clamp(18px, 5vw, 72px); scroll-behavior: smooth; }
.date-divider { width: 100%; display: flex; justify-content: center; margin: 4px 0 18px; }
.date-divider span { padding: 3px 8px; border-radius: 5px; color: #87918d; background: #e8ecea; font-size: 10px; }
.message-row { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 16px; }
.message-row.is-mine { justify-content: flex-end; }
.message-content { max-width: min(72%, 620px); display: flex; flex-direction: column; align-items: flex-start; }
.message-content p { margin: 0; padding: 10px 13px; border: 1px solid var(--line); border-radius: 3px 8px 8px 8px; background: var(--surface); line-height: 1.55; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(24,32,30,.03); }
.is-mine .message-content { align-items: flex-end; }
.is-mine .message-content p { border-color: var(--accent); border-radius: 8px 3px 8px 8px; background: var(--accent); color: #fff; }
.message-content time { padding: 4px 3px 0; color: #929a97; font-size: 9px; }
.message-image { display: block; max-width: min(360px, 100%); max-height: 360px; margin-bottom: 4px; border-radius: 7px; object-fit: contain; background: var(--surface-strong); }
.chat-start, .message-loading { padding: 30px; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.chat-start span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.composer { min-height: 74px; padding: 11px clamp(16px, 4vw, 48px) max(11px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.attach-button { border: 0; background: var(--surface-soft); }
.composer-input-wrap { min-width: 0; min-height: 42px; flex: 1; padding: 2px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.composer-input-wrap:focus-within { border-color: var(--accent); background: var(--surface); }
.composer textarea { min-height: 36px; max-height: 120px; padding: 8px 0 5px; resize: none; border: 0; box-shadow: none; background: transparent; }
.composer textarea:focus { box-shadow: none; }
.image-chip { display: block; padding: 5px 0 7px; overflow: hidden; color: var(--accent); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.send-button { width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 7px; background: var(--accent); color: #fff; font-size: 18px; }
.mobile-nav { display: none; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; padding: 24px; display: grid; place-items: center; background: rgba(12,20,18,.52); }
.modal { width: min(560px, 100%); max-height: min(760px, calc(100dvh - 48px)); display: flex; flex-direction: column; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.modal-header { min-height: 64px; padding: 12px 16px 12px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header .icon-button { border: 0; }
.modal-body { min-height: 150px; padding: 20px 22px 24px; overflow-y: auto; }
.panel-loading { padding: 60px; color: var(--muted); text-align: center; }
.field-help { margin: -8px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.inline-notice { padding: 10px 12px; color: #625431; background: #f6f1df; border-radius: 6px; }
.invite-box { margin-top: 24px; padding-top: 20px; display: grid; gap: 9px; border-top: 1px solid var(--line); }
.invite-box > span { font-weight: 700; }
.invite-box code { padding: 10px; overflow: hidden; border-radius: 6px; color: var(--muted); background: var(--surface-soft); text-overflow: ellipsis; white-space: nowrap; }
.found-user, .request-item { margin: 12px 0 18px; padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 7px; }
.found-user > span:nth-child(2), .request-item > span:nth-child(2) { min-width: 0; flex: 1; display: grid; gap: 3px; }
.found-user small, .request-item small { color: var(--muted); }
.request-list { display: grid; gap: 10px; }
.request-item { margin: 0; }
.request-item > div { display: flex; gap: 7px; }
.request-item button { padding: 0 11px; }
.notice-list { display: grid; gap: 10px; }
.notice-item { padding: 14px 15px; border: 1px solid var(--line); border-radius: 7px; }
.notice-item.is-unread { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.notice-item header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.notice-item h3 { margin: 0; font-size: 14px; }
.notice-item time { color: var(--muted); font-size: 10px; }
.notice-item p { margin: 9px 0 0; color: #4e5955; line-height: 1.65; }
.vip-hero { margin: -20px -22px 20px; padding: 24px; display: flex; align-items: center; gap: 16px; color: #fff; background: #1b3c33; }
.vip-hero > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.14); font-size: 22px; }
.vip-hero h3 { margin: 0 0 4px; font-size: 19px; }
.vip-hero p { margin: 0; color: #c8d8d2; }
.package-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.package-card { min-width: 0; min-height: 116px; padding: 13px 9px; display: flex; flex-direction: column; justify-content: center; gap: 6px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 7px; background: var(--surface); color: var(--text); }
.package-card strong { font-size: 19px; }
.package-card small { color: var(--muted); font-size: 10px; }
.package-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.style-picker { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.style-picker h3 { margin: 0 0 12px; font-size: 14px; }
.style-picker > div { display: flex; gap: 8px; }
.style-swatch { height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; color: #fff; }
.swatch-emerald { background: #167d68; } .swatch-coral { background: #b84f3a; } .swatch-midnight { background: #384f68; }
.payment-options { display: grid; gap: 10px; }
.payment-options button { height: 62px; padding: 0 16px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-weight: 700; }
.payment-options button:hover { background: var(--surface-soft); }
.payment-options b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: #1886d2; }
.payment-options button:nth-child(2) b { background: #1fa557; } .payment-options button:nth-child(3) b { background: #3489c9; }
.profile-card { display: grid; justify-items: center; text-align: center; }
.profile-card h3 { margin: 14px 0 5px; font-size: 20px; }
.profile-card > p { margin: 0; color: var(--muted); }
.profile-stats { width: 100%; margin: 23px 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 7px; }
.profile-stats span { padding: 14px 8px; display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.profile-stats span + span { border-left: 1px solid var(--line); }
.profile-stats b { color: var(--text); font-size: 14px; }
.profile-card .danger-button { margin-top: 9px; }
.profile-card .profile-secondary { margin-top: 9px; }
.admin-reply { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-soft); text-align: left; }
.admin-reply p { margin: 5px 0 0; }
.confirmation { padding: 10px 0; display: grid; justify-items: center; text-align: center; }
.confirmation-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: 28px; }
.confirmation h3 { margin: 15px 0 5px; }
.confirmation p { margin: 0 0 20px; color: var(--muted); }
.evidence-field { margin: 0 0 18px; padding: 0; border: 0; }
.evidence-field legend { margin-bottom: 8px; font-weight: 650; }
.evidence-list { max-height: 210px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.evidence-row { min-height: 50px; padding: 8px 10px; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.evidence-row:last-child { border-bottom: 0; }
.evidence-row input { width: 16px; height: 16px; }
.evidence-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.evidence-row b { margin-right: 8px; }
.evidence-row time { color: var(--muted); font-size: 10px; }
.file-field { padding: 12px; border: 1px dashed #bfc9c5; border-radius: 7px; }
.file-field input { height: auto; padding: 0; border: 0; }
.file-field small { color: var(--muted); font-weight: 400; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 220px; max-width: 360px; padding: 12px 15px; border-radius: 7px; color: #fff; background: #25322e; box-shadow: var(--shadow); }
.toast--error { background: #883632; }

/* Admin */
.admin-shell { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0,1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100dvh; padding: 22px 14px; display: flex; flex-direction: column; background: var(--rail); color: var(--rail-text); }
.admin-brand { padding: 0 8px 24px; display: flex; align-items: center; gap: 10px; font-size: 16px; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav button, .admin-nav a { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 6px; background: transparent; color: #b7c4c0; text-align: left; }
.admin-nav button:hover, .admin-nav button.is-active, .admin-nav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.admin-nav span { width: 21px; text-align: center; }
.admin-sidebar .admin-back { margin-top: auto; }
.admin-main { min-width: 0; padding: 30px clamp(20px, 4vw, 56px) 60px; }
.admin-topbar { margin-bottom: 26px; display: flex; align-items: center; justify-content: space-between; }
.admin-topbar h1 { margin: 0; font-size: 25px; }
.admin-topbar p { margin: 6px 0 0; color: var(--muted); }
.admin-section { display: none; }
.admin-section.is-active { display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat-card { min-height: 120px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stat-card span { color: var(--muted); }
.stat-card strong { display: block; margin-top: 15px; font-size: 29px; }
.admin-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.panel-header { min-height: 64px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 16px; }
.panel-tools { display: flex; gap: 8px; }
.panel-tools input, .panel-tools select { width: 210px; }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 15px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); background: var(--surface-soft); font-size: 11px; text-transform: uppercase; }
.data-table tbody tr:hover { background: #fafbfb; }
.status-pill { display: inline-flex; height: 23px; align-items: center; padding: 0 8px; border-radius: 5px; color: #236c58; background: #e4f3ee; font-size: 11px; }
.status-pill.is-banned, .status-pill.is-pending { color: #993b37; background: #f9e7e5; }
.status-pill.is-processing { color: #7b5c16; background: #f7efd9; }
.admin-form { padding: 20px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.toggle-row { min-height: 52px; display: flex !important; grid-template-columns: 1fr auto !important; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.toggle-row input { width: 40px; height: 22px; }
.settings-group { margin-bottom: 28px; }
.settings-group h3 { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.report-admin-list { padding: 14px; display: grid; gap: 12px; }
.report-card { padding: 16px; border: 1px solid var(--line); border-radius: 7px; }
.report-card header { display: flex; justify-content: space-between; gap: 10px; }
.report-card h3 { margin: 0; font-size: 15px; }
.report-card p { color: #4f5a56; line-height: 1.6; }
.report-evidence { padding: 10px; border-radius: 6px; background: var(--surface-soft); }
.report-evidence p { margin: 4px 0; font-size: 12px; }
.report-actions { margin-top: 12px; display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; }
.report-actions textarea { min-height: 42px; }
.notice-admin-item { padding: 14px 18px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; border-bottom: 1px solid var(--line); }
.notice-admin-item h3 { margin: 0 0 6px; }
.notice-admin-item p { margin: 0; color: var(--muted); white-space: pre-line; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 68px 300px minmax(0,1fr); }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
    body { background: var(--surface); }
    .mobile-only { display: inline-grid !important; }
    .auth-page { display: block; background: var(--surface); }
    .auth-brand { display: none; }
    .auth-panel { min-height: 100dvh; padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); align-items: start; }
    .auth-box { margin-top: 5vh; }
    .auth-mobile-brand { margin-bottom: 38px; display: flex; align-items: center; gap: 11px; font-size: 18px; }
    .segmented { margin-bottom: 30px; }
    .app-shell { height: 100dvh; display: block; overflow: hidden; }
    .app-rail { display: none; }
    .conversation-panel { position: absolute; inset: 0 0 calc(62px + env(safe-area-inset-bottom)); border: 0; }
    .conversation-header { height: 76px; padding-top: max(13px, env(safe-area-inset-top)); }
    .conversation-header h1 { font-size: 22px; }
    .friend-item { height: 70px; }
    .chat-panel { position: fixed; inset: 0; z-index: 10; display: none; background: var(--bg); }
    body.chat-open .chat-panel { display: block; }
    .active-chat { grid-template-rows: calc(64px + env(safe-area-inset-top)) minmax(0,1fr) auto; }
    .chat-header { padding: env(safe-area-inset-top) 10px 0; gap: 9px; }
    .chat-header .mobile-only { margin-left: -4px; border: 0; background: transparent; font-size: 34px; }
    .chat-header .avatar { width: 36px; height: 36px; }
    .chat-header .danger-text { padding-right: 3px; }
    .message-list { padding: 20px 12px; }
    .message-content { max-width: 79%; }
    .composer { min-height: 64px; padding: 9px 9px max(9px, env(safe-area-inset-bottom)); gap: 7px; }
    .attach-button { width: 38px; height: 38px; }
    .send-button { width: 39px; height: 39px; }
    .mobile-nav { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: calc(62px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
    .mobile-nav button { position: relative; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; color: var(--muted); font-size: 10px; }
    .mobile-nav button span { font-size: 19px; }
    .mobile-nav button.is-active { color: var(--accent); }
    .mobile-nav .nav-dot { top: 1px; right: calc(50% - 18px); }
    .modal-backdrop { padding: 0; place-items: end center; }
    .modal { width: 100%; max-height: 88dvh; border-radius: 8px 8px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .modal-body { padding: 18px 16px 22px; }
    .vip-hero { margin: -18px -16px 18px; }
    .package-grid { grid-template-columns: 1fr; }
    .package-card { min-height: 82px; align-items: flex-start; padding-left: 16px; }
    .request-item { align-items: flex-start; flex-wrap: wrap; }
    .request-item > span:nth-child(2) { width: calc(100% - 55px); }
    .request-item > div { width: 100%; justify-content: flex-end; }
    .toast-region { left: 14px; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom)); }
    .toast { min-width: 0; max-width: none; }
    .admin-shell { display: block; }
    .admin-sidebar { position: static; width: 100%; height: auto; padding: 12px; }
    .admin-brand { padding-bottom: 12px; }
    .admin-nav { display: flex; overflow-x: auto; }
    .admin-nav button, .admin-nav a { min-width: max-content; }
    .admin-sidebar .admin-back { margin: 6px 0 0; }
    .admin-main { padding: 22px 14px 50px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { min-height: 100px; padding: 15px; }
    .panel-header { align-items: flex-start; flex-direction: column; }
    .panel-tools { width: 100%; }
    .panel-tools input, .panel-tools select { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .report-actions { grid-template-columns: 1fr; }
}
