:root {
  --ink: #142831;
  --ink-2: #213c47;
  --muted: #6f7e84;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --border: #dce4e7;
  --green: #167a5b;
  --green-soft: #e7f3ee;
  --cyan: #287f9b;
  --amber: #b87722;
  --red: #b84f5e;
  --shadow: 0 7px 22px rgba(21, 43, 52, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.app-header {
  min-height: 68px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff; border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-block, .header-actions, .toolbar, .input-row, .rail-heading, .address-row { display: flex; align-items: center; }
.brand-block { gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #81d8c6; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; }
.brand-mark svg { width: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: 17px; letter-spacing: 0; }
.brand-block p { margin-top: 3px; color: #9fb0b7; font-size: 11px; }
.header-actions { gap: 6px; }
.icon-button, .tool-button {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 6px; background: transparent; color: inherit; text-decoration: none;
}
.icon-button svg, .tool-button svg { width: 17px; height: 17px; }
.tab-bar { height: 46px; padding: 0 24px; display: flex; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-bar a { min-width: 142px; padding: 0 16px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-bar a svg { width: 16px; }
.tab-bar a.active { color: var(--ink); border-bottom-color: var(--cyan); font-weight: 700; }
main { max-width: 1600px; margin: 0 auto; padding: 20px 24px 42px; }
.status-band { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; }
.status-band article { min-height: 88px; padding: 15px 18px; border-right: 1px solid var(--border); }
.status-band article:last-child { border-right: 0; }
.status-band span, .status-band b, .status-band small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-band span { color: var(--muted); font-size: 11px; }
.status-band b { margin-top: 7px; font-size: 18px; }
.status-band small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.status-band b.good { color: var(--green); }
.status-band b.warn { color: var(--amber); }
.workspace { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.browser-region, .control-rail { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.browser-region { padding: 16px; min-width: 0; }
.section-heading { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { color: var(--cyan); font-size: 10px; font-weight: 700; }
h2 { margin-top: 4px; font-size: 15px; }
.toolbar { gap: 6px; }
.toolbar .tool-button { border-color: var(--border); color: var(--ink); }
.toolbar .tool-button.primary { width: auto; padding: 0 12px; color: #fff; background: var(--ink-2); border-color: var(--ink-2); }
.address-row { height: 36px; margin-top: 10px; padding: 0 11px; gap: 8px; color: var(--muted); background: #f7f9fa; border: 1px solid var(--border); border-radius: 5px; font-size: 11px; overflow: hidden; }
.address-row svg { width: 14px; flex: 0 0 auto; color: var(--green); }
.address-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-shell { position: relative; margin-top: 10px; min-height: 480px; aspect-ratio: 1365 / 768; overflow: hidden; background: #15242b; border: 1px solid #223841; border-radius: 5px; }
#cloud-screen { width: 100%; height: 100%; display: block; object-fit: contain; cursor: crosshair; user-select: none; }
.screen-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #b7c7cd; font-size: 12px; }
.screen-loading svg { width: 18px; animation: spin 1s linear infinite; }
.screen-loading.hidden { display: none; }
.control-rail { overflow: hidden; }
.rail-section { padding: 17px; border-bottom: 1px solid var(--border); }
.rail-section:last-child { border-bottom: 0; }
.rail-heading { gap: 8px; }
.rail-heading svg { width: 17px; color: var(--cyan); }
.rail-heading h2 { margin: 0; }
.login-steps { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.login-steps span { min-height: 42px; padding: 8px; display: flex; align-items: center; gap: 7px; color: var(--ink-2); background: #f5f8f9; border: 1px solid var(--border); border-radius: 5px; font-size: 10px; line-height: 1.35; }
.login-steps b { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; color: #fff; background: var(--cyan); border-radius: 50%; font-size: 10px; }
.focus-feedback { min-height: 34px; margin-top: 8px; padding: 0 9px; display: flex; align-items: center; gap: 7px; color: var(--amber); background: #fff9ef; border: 1px solid #ecd8b6; border-radius: 5px; font-size: 10px; }
.focus-feedback.ready { color: var(--green); background: var(--green-soft); border-color: #bddbce; }
.focus-feedback svg { width: 14px; flex: 0 0 auto; }
.input-label { display: block; margin: 15px 0 6px; color: var(--muted); font-size: 11px; }
.input-row { gap: 6px; }
.input-row input { min-width: 0; height: 38px; flex: 1; padding: 0 10px; border: 1px solid var(--border); border-radius: 5px; outline: none; }
.input-row input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(40,127,155,.11); }
.input-row .tool-button { flex: 0 0 38px; border-color: var(--border); color: var(--ink); }
.primary-button, .secondary-button { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 5px; }
.primary-button { border: 1px solid var(--ink-2); background: var(--ink-2); color: #fff; }
.secondary-button { border: 1px solid var(--border); background: #fff; color: var(--ink); }
.primary-button svg, .secondary-button svg { width: 16px; }
.key-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.key-grid button { height: 34px; border: 1px solid var(--border); background: #f8fafb; color: var(--muted); border-radius: 4px; font-size: 11px; }
.key-grid svg { width: 15px; }
.security-note { margin-top: 12px; display: flex; gap: 7px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.security-note svg { width: 15px; flex: 0 0 auto; color: var(--green); }
.action-stack { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.capture-facts { margin: 14px 0 0; }
.capture-facts div { min-height: 32px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #edf1f3; }
.capture-facts dt { color: var(--muted); font-size: 11px; }
.capture-facts dd { margin: 0; font-size: 11px; font-weight: 700; }
.capture-result p { margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.result-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-grid div { padding: 10px; background: #f7f9fa; border: 1px solid var(--border); border-radius: 4px; }
.result-grid span, .result-grid b { display: block; }
.result-grid span { color: var(--muted); font-size: 10px; }
.result-grid b { margin-top: 5px; font-size: 13px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 28px)); padding: 11px 14px; color: #fff; background: var(--ink); border-radius: 5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
button:disabled { opacity: .5; cursor: wait; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1040px) {
  .workspace { grid-template-columns: 1fr; }
  .control-rail { display: grid; grid-template-columns: 1fr 1fr; }
  .rail-section { border-right: 1px solid var(--border); border-bottom: 0; }
  .rail-section:nth-child(2) { border-right: 0; }
  .capture-result { grid-column: 1 / -1; border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .app-header { min-height: 58px; padding: 8px 12px; }
  .brand-mark { display: none; }
  h1 { font-size: 15px; }
  .tab-bar { padding: 0 8px; }
  .tab-bar a { min-width: 52px; padding: 0 12px; }
  .tab-bar a span { display: none; }
  main { padding: 12px 10px 30px; }
  .status-band { grid-template-columns: 1fr 1fr; }
  .status-band article { min-height: 78px; padding: 12px; border-bottom: 1px solid var(--border); }
  .status-band article:nth-child(2n) { border-right: 0; }
  .status-band article:nth-last-child(-n+2) { border-bottom: 0; }
  .status-band b { font-size: 15px; }
  .browser-region { padding: 12px; }
  .section-heading { align-items: flex-start; }
  .toolbar .tool-button.primary { width: 38px; padding: 0; }
  .toolbar .tool-button.primary span { display: none; }
  .screen-shell {
    height: min(58vh, 500px);
    min-height: 360px;
    aspect-ratio: auto;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    scrollbar-width: thin;
  }
  #cloud-screen {
    width: 960px;
    max-width: none;
    height: auto;
    object-fit: initial;
    cursor: pointer;
  }
  .control-rail { display: block; }
  .rail-section { border-right: 0; border-bottom: 1px solid var(--border); }
  .capture-result { border-top: 0; }
  .input-row { flex-wrap: wrap; }
  .input-row input { flex-basis: calc(100% - 44px); }
  .input-row .primary-button { width: 100%; }
  .login-steps { grid-template-columns: 1fr; }
}
