:root {
  --ink: #142824;
  --muted: #667b75;
  --paper: #f5f3ec;
  --panel: #fbfaf6;
  --line: #dcded6;
  --green: #176b5b;
  --green-dark: #0f4d42;
  --green-soft: #e6f0ec;
  --amber: #b87724;
  --amber-soft: #fff0d8;
  --red: #a54b45;
  --red-soft: #f9e7e4;
  --blue: #356884;
  --blue-soft: #e6eff4;
  --shadow: 0 18px 55px rgba(25, 45, 40, .08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; height: 100dvh; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 10%, rgba(23, 107, 91, .08), transparent 30%),
    var(--paper);
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-columns: 330px 1fr; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px 22px 20px;
  background: rgba(250, 249, 244, .94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 5px 24px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px; color: white; background: var(--green); box-shadow: 0 8px 20px rgba(23, 107, 91, .2); }
.brand-mark svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: Georgia, "Microsoft YaHei", serif; font-size: 20px; letter-spacing: .03em; }
.brand span { margin-top: 2px; font-size: 11px; color: var(--muted); letter-spacing: .08em; }

.new-chat {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%; min-height: 45px; border: 1px solid var(--green); border-radius: 12px;
  color: white; background: var(--green); cursor: pointer; transition: .18s ease;
}
.new-chat:hover { background: var(--green-dark); transform: translateY(-1px); }
.new-chat span { font-size: 20px; font-weight: 300; }

.case-card { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .56); box-shadow: 0 10px 34px rgba(30, 50, 45, .04); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.eyebrow { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.section-heading h2 { margin: 2px 0 0; font: 600 17px/1.2 Georgia, "Microsoft YaHei", serif; }
.secure-chip { padding: 4px 7px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 700; }
.case-hint { margin: 10px 0 15px; color: var(--muted); font-size: 11px; line-height: 1.6; }

label { display: block; margin-top: 12px; color: #536862; font-size: 11px; font-weight: 700; }
select, input { width: 100%; height: 38px; margin-top: 6px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fff; transition: .15s; }
select { padding: 0 10px; }
input { padding: 0 9px; border: 0; margin: 0; height: 36px; min-width: 0; }
select:focus, .money-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 91, .1); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.money-field { display: flex; align-items: center; height: 38px; margin-top: 6px; padding: 0 7px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.money-field span { color: #84928e; font-size: 11px; font-weight: 500; }

.capacity { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; padding: 10px 11px; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); }
.capacity span { font-size: 11px; }
.capacity strong { font-size: 13px; }
.capacity.negative { color: var(--red); background: var(--red-soft); }

.sidebar-footer { margin-top: auto; padding: 18px 5px 0; color: var(--muted); }
.status-row { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; }
.status-dot, .online-dot { width: 7px; height: 7px; border-radius: 50%; background: #d19c51; box-shadow: 0 0 0 4px rgba(209, 156, 81, .12); }
.status-dot.ready, .online-dot { background: #32a179; box-shadow: 0 0 0 4px rgba(50, 161, 121, .12); }
.status-dot.error { background: #c65b51; box-shadow: 0 0 0 4px rgba(198, 91, 81, .12); }
.sidebar-footer p { margin: 10px 0 0; font-size: 10px; line-height: 1.55; }

.workspace { min-width: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: 68px auto 1fr auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(245, 243, 236, .74); backdrop-filter: blur(16px); }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title strong, .topbar-title span { display: block; }
.topbar-title strong { font-size: 14px; }
.topbar-title span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.ghost-button, .icon-button { border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.55); cursor: pointer; }
.ghost-button { padding: 8px 12px; color: var(--muted); font-size: 11px; }
.ghost-button:hover { color: var(--ink); border-color: #b9c5c0; }
.icon-button { width: 36px; height: 36px; }
.mobile-only { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.knowledge-button { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--green); border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 700; cursor: pointer; transition: .16s; }
.knowledge-button:hover { color: white; background: var(--green); }
.knowledge-icon { font-size: 15px; font-weight: 400; line-height: 1; }
.knowledge-label { font-size: 11px; font-weight: 700; line-height: 1; }
.quota-button { padding: 8px 11px; border: 1px solid #d5bd8d; border-radius: 9px; color: #745725; background: #fff7e7; font-size: 10px; font-weight: 700; cursor: pointer; }
.quota-button.exhausted { border-color: #e2aaa2; color: var(--red); background: var(--red-soft); }

.config-notice { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 28px; color: #6d461c; border-bottom: 1px solid #efd5ad; background: var(--amber-soft); }
.config-notice strong, .config-notice span { display: block; }
.config-notice strong { font-size: 12px; }
.config-notice span { margin-top: 3px; font-size: 10px; }
.config-notice code { padding: 2px 4px; border-radius: 4px; background: rgba(255,255,255,.65); }
.config-notice button { border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.hidden { display: none !important; }

.chat-area { min-height: 0; overflow-y: auto; scroll-behavior: smooth; padding: 24px clamp(22px, 6vw, 90px); }
.welcome { max-width: 850px; margin: 5vh auto 0; text-align: center; animation: rise .5s ease both; }
.welcome-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 19px; border: 1px solid rgba(23,107,91,.22); border-radius: 22px; color: var(--green); background: rgba(255,255,255,.62); box-shadow: var(--shadow); }
.welcome-icon svg { width: 40px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.welcome h1 { margin: 9px 0 16px; font: 500 clamp(31px, 4vw, 48px)/1.18 Georgia, "Songti SC", serif; letter-spacing: -.025em; }
.welcome h1 em { color: var(--green); font-style: italic; }
.welcome > p { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.8; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px; text-align: left; }
.quick-card { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.68); box-shadow: 0 9px 28px rgba(24,50,43,.035); cursor: pointer; transition: .18s ease; }
.quick-card:hover { border-color: rgba(23,107,91,.45); background: white; transform: translateY(-2px); box-shadow: 0 14px 36px rgba(24,50,43,.08); }
.quick-card b { color: #9aa7a3; font-size: 18px; font-weight: 400; }
.quick-card strong, .quick-card small { display: block; }
.quick-card strong { font-size: 12px; }
.quick-card small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.quick-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; font-family: Georgia, serif; font-size: 15px; }
.quick-icon.teal { color: var(--green); background: var(--green-soft); }
.quick-icon.amber { color: var(--amber); background: var(--amber-soft); }
.quick-icon.blue { color: var(--blue); background: var(--blue-soft); }
.quick-icon.red { color: var(--red); background: var(--red-soft); }
.mobile-direct-tip { display: none; }

.messages { max-width: 880px; margin: 0 auto; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin: 20px 0; animation: rise .25s ease both; }
.message.user { grid-template-columns: minmax(0, 1fr) 34px; }
.message.user .avatar { grid-column: 2; }
.message.user .message-body { grid-column: 1; grid-row: 1; justify-self: end; max-width: 78%; color: white; background: var(--green); border-color: var(--green); border-radius: 16px 4px 16px 16px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; background: var(--green); font: 600 13px Georgia, serif; }
.message.user .avatar { color: var(--green); background: var(--green-soft); }
.message-body { min-width: 0; padding: 15px 17px; border: 1px solid var(--line); border-radius: 4px 16px 16px; background: rgba(255,255,255,.76); box-shadow: 0 9px 30px rgba(25,45,40,.04); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.message-body h2, .message-body h3 { margin: 13px 0 5px; font-family: Georgia, "Microsoft YaHei", serif; line-height: 1.4; }
.message-body h2 { font-size: 17px; }
.message-body h3 { font-size: 14px; color: var(--green-dark); }
.message-body a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.message-body .list-line { display: block; margin: 5px 0; padding-left: 15px; position: relative; }
.message-body .list-line::before { content: "·"; position: absolute; left: 2px; color: var(--green); font-weight: 800; }
.message-body.error { color: #7f342f; border-color: #ebc4be; background: var(--red-soft); }
.typing-cursor { display: inline-block; width: 6px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--green); animation: blink .8s infinite; }

.composer-wrap { padding: 8px clamp(22px, 6vw, 90px) 18px; background: linear-gradient(transparent, var(--paper) 25%); }
.privacy-tip { max-width: 880px; margin: 0 auto 7px; color: var(--muted); font-size: 10px; }
.privacy-tip span { color: var(--green); }
.composer { display: flex; align-items: flex-end; gap: 10px; max-width: 880px; margin: 0 auto; padding: 10px 10px 10px 17px; border: 1px solid #cbd1cb; border-radius: 17px; background: white; box-shadow: 0 14px 45px rgba(25,45,40,.1); transition: .15s; }
.composer:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,91,.08), 0 16px 45px rgba(25,45,40,.11); }
.composer textarea { flex: 1; max-height: 160px; padding: 8px 0; border: 0; outline: 0; resize: none; color: var(--ink); background: transparent; font-size: 13px; line-height: 1.55; }
.composer textarea::placeholder { color: #9aa8a3; }
.send-button { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border: 0; border-radius: 13px; color: white; background: var(--green); cursor: pointer; transition: .18s; }
.send-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.send-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.send-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.composer-meta { display: flex; justify-content: space-between; max-width: 880px; margin: 7px auto 0; color: #8a9893; font-size: 9px; }

.sidebar-mask { display: none; }

.ingest-dialog { width: min(720px, calc(100vw - 30px)); max-height: min(860px, calc(100vh - 30px)); padding: 0; border: 1px solid rgba(23,107,91,.18); border-radius: 22px; color: var(--ink); background: var(--panel); box-shadow: 0 32px 100px rgba(18,45,38,.24); overflow: auto; }
.ingest-dialog::backdrop { background: rgba(15,38,32,.43); backdrop-filter: blur(5px); }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; padding: 25px 28px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, rgba(230,240,236,.8), rgba(251,250,246,.95)); }
.dialog-header h2 { margin: 3px 0 5px; font: 600 23px/1.2 Georgia, "Microsoft YaHei", serif; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 11px; }
.dialog-close { align-self: flex-start; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.66); font-size: 21px; cursor: pointer; }

.pipeline-steps { display: flex; align-items: center; padding: 20px 28px 14px; }
.pipeline-step { display: grid; grid-template-columns: 28px 1fr; column-gap: 7px; align-items: center; min-width: 90px; color: #8a9994; }
.pipeline-step span { grid-row: 1 / 3; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #cbd2cf; border-radius: 50%; background: white; font-size: 10px; font-weight: 800; }
.pipeline-step b { font-size: 11px; }
.pipeline-step small { font-size: 9px; }
.pipeline-step.active, .pipeline-step.done { color: var(--green); }
.pipeline-step.active span { color: white; border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px rgba(23,107,91,.1); }
.pipeline-step.done span { color: white; border-color: #36a17d; background: #36a17d; }
.pipeline-steps > i { flex: 1; height: 1px; margin: 0 8px; background: var(--line); }

.dependency-panel { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 28px 8px; }
.dependency-check { padding: 5px 8px; border-radius: 999px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 700; }
.dependency-check::before { content: "✓"; margin-right: 4px; }
.dependency-check.error { color: var(--red); background: var(--red-soft); }
.dependency-check.error::before { content: "×"; }
.dependency-check.loading { color: var(--amber); background: var(--amber-soft); }
.dependency-check.loading::before { content: "…"; }
.dependency-note { flex-basis: 100%; margin: 0; color: var(--red); font-size: 9px; }

.ingest-form { padding: 8px 28px 26px; }
.ingest-form label { margin-top: 10px; }
.ingest-form textarea { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; resize: vertical; color: var(--ink); background: white; font-size: 12px; line-height: 1.6; }
.ingest-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,91,.09); }
.ingest-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ingest-note { display: flex; gap: 10px; margin-top: 16px; padding: 11px 12px; border: 1px solid #ebddc8; border-radius: 11px; color: #705532; background: #fff7e9; font-size: 10px; line-height: 1.5; }
.ingest-note strong { flex: 0 0 auto; }
.start-ingest { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 45px; margin-top: 15px; border: 0; border-radius: 12px; color: white; background: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; transition: .16s; }
.start-ingest:hover { background: var(--green-dark); transform: translateY(-1px); }
.start-ingest:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.job-panel { margin: 0 28px 28px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.job-heading, .job-heading > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.job-heading span { font-size: 11px; font-weight: 800; }
.job-heading strong { color: var(--green); font-size: 12px; }
.cancel-button { padding: 6px 9px; border: 1px solid #ebc5c0; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 9px; cursor: pointer; }
.progress-track { height: 7px; margin: 12px 0; border-radius: 99px; background: #e9ece7; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #4aa98a); transition: width .35s ease; }
.job-result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0; }
.job-result div { padding: 9px; border-radius: 9px; text-align: center; background: var(--green-soft); }
.job-result strong, .job-result span { display: block; }
.job-result strong { color: var(--green); font-size: 15px; }
.job-result span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.job-result.error { display: block; padding: 9px 11px; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 10px; }
.job-logs { max-height: 230px; margin: 8px 0 0; padding: 12px; border-radius: 10px; color: #d8e8e2; background: #18352e; overflow: auto; white-space: pre-wrap; word-break: break-all; font: 10px/1.55 Consolas, monospace; }

.access-dialog { width: min(540px, calc(100vw - 28px)); padding: 28px; border: 1px solid rgba(23,107,91,.18); border-radius: 22px; color: var(--ink); background: var(--panel); box-shadow: 0 30px 90px rgba(18,45,38,.25); }
.access-dialog::backdrop { background: rgba(15,38,32,.48); backdrop-filter: blur(5px); }
.access-close { position: absolute; top: 15px; right: 15px; }
.access-heading { text-align: center; }
.access-heading h2 { margin: 5px 0 7px; font: 600 25px Georgia, "Microsoft YaHei", serif; }
.access-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.wechat-card { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; margin-top: 22px; padding: 17px; border: 1px solid #dce6e1; border-radius: 15px; background: var(--green-soft); }
.qr-frame { width: 180px; height: 238px; display: grid; place-items: center; padding: 4px; border-radius: 12px; color: var(--muted); background: white; text-align: center; font-size: 9px; line-height: 1.6; overflow: hidden; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.wechat-card strong, .wechat-card span { display: block; }
.wechat-card strong { font-size: 13px; }
.wechat-card span { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.wechat-card ol { margin: 10px 0 0; padding-left: 17px; color: var(--green-dark); font-size: 9px; line-height: 1.8; }
.activation-form { margin-top: 18px; }
.activation-form label { font-size: 10px; font-weight: 700; }
.activation-form > div { display: flex; gap: 8px; margin-top: 7px; }
.activation-form input { min-width: 0; flex: 1; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; text-transform: uppercase; }
.activation-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,91,.09); }
.activation-form button { padding: 0 17px; border: 0; border-radius: 10px; color: white; background: var(--green); font-size: 10px; font-weight: 700; cursor: pointer; }
.activation-form button:disabled { opacity: .5; }
.activation-form p { min-height: 17px; margin: 6px 0 0; color: var(--green); font-size: 9px; }
.access-privacy { margin: 7px 0 0; color: #8a9691; text-align: center; font-size: 8px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 50% { opacity: .15; } }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(330px, 88vw); height: 100vh; height: 100dvh; padding-top: max(26px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); overflow-y: auto; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 22px 0 55px rgba(20,40,36,.16); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; z-index: 15; background: rgba(20,40,36,.24); backdrop-filter: blur(2px); }
  .sidebar-mask.open { display: block; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 0 17px; }
  .chat-area, .composer-wrap { padding-left: 17px; padding-right: 17px; }
}

@media (max-width: 620px) {
  .workspace { grid-template-rows: 60px auto 1fr auto; }
  .topbar { gap: 6px; padding: env(safe-area-inset-top) 10px 0; }
  .topbar-title { min-width: 0; gap: 8px; }
  .topbar-title > div { min-width: 0; }
  .topbar-title > div > span { display: none; }
  .topbar-title strong { display: block; max-width: 126px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .topbar-actions { gap: 4px; }
  .quick-grid { grid-template-columns: 1fr; }
  .welcome { margin-top: 0; }
  .welcome-icon { width: 54px; height: 54px; margin-bottom: 13px; border-radius: 17px; }
  .welcome-icon svg { width: 33px; }
  .welcome h1 { margin-bottom: 11px; font-size: 29px; }
  .welcome > p { font-size: 12px; }
  .quick-grid { gap: 8px; margin-top: 20px; }
  .quick-card { min-height: 62px; padding: 10px 12px; }
  .chat-area { padding: 15px 12px 8px; }
  .message { grid-template-columns: 29px minmax(0,1fr); gap: 8px; margin: 14px 0; }
  .message.user { grid-template-columns: minmax(0,1fr) 29px; }
  .avatar { width: 29px; height: 29px; border-radius: 9px; font-size: 11px; }
  .message-body { padding: 12px 13px; font-size: 14px; line-height: 1.7; }
  .message.user .message-body { max-width: 90%; }
  .composer-wrap { padding: 6px 12px max(10px, env(safe-area-inset-bottom)); }
  .privacy-tip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
  .composer { gap: 7px; padding: 7px 7px 7px 13px; border-radius: 14px; }
  .composer textarea { font-size: 16px; }
  .send-button { flex-basis: 40px; width: 40px; height: 40px; border-radius: 11px; }
  .composer-meta { display: none; }
  .config-notice { padding: 11px 17px; }
  .knowledge-button { display: none; }
  .ghost-button { display: none; }
  .quota-button { padding: 7px 8px; font-size: 9px; }
  .access-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); padding: 25px 17px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; border-radius: 17px; }
  .wechat-card { grid-template-columns: 150px 1fr; gap: 13px; padding: 12px; }
  .qr-frame { width: 150px; height: 198px; }
  .activation-form input { font-size: 16px; }
  .ingest-dialog { width: calc(100vw - 10px); max-height: calc(100dvh - 10px); border-radius: 15px; }
  .dialog-header, .pipeline-steps, .dependency-panel, .ingest-form { padding-left: 18px; padding-right: 18px; }
  .pipeline-step { min-width: 53px; grid-template-columns: 25px 1fr; }
  .pipeline-step span { width: 25px; height: 25px; }
  .pipeline-step small { display: none; }
  .pipeline-steps > i { margin: 0 3px; }
  .job-panel { margin-left: 18px; margin-right: 18px; }
  .ingest-options { grid-template-columns: 1fr; gap: 0; }
  .ingest-form textarea, .ingest-form select { font-size: 16px; }
  .job-logs { max-height: 170px; }
  .quick-card:nth-child(n+3) { display: none; }
  .mobile-direct-tip { display: block; margin-top: 12px; color: var(--muted); font-size: 10px; }
}

@media (max-width: 390px) {
  .topbar-title strong { max-width: 98px; }
  .quota-button { max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .welcome h1 { font-size: 26px; }
  .wechat-card { grid-template-columns: 1fr; text-align: center; }
  .qr-frame { margin: auto; }
  .wechat-card ol { display: inline-block; text-align: left; }
  .activation-form > div { flex-direction: column; }
  .activation-form button { min-height: 43px; }
}
