:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #7b7b80;
  --soft: #a7a7ab;
  --paper: #f5f5f2;
  --surface: rgba(255, 255, 253, .9);
  --surface-solid: #fffffd;
  --surface-soft: #efefeb;
  --line: rgba(29, 29, 31, .09);
  --line-strong: rgba(29, 29, 31, .16);
  --accent: #1d1d1f;
  --gold: #a78751;
  --blue: #3478f6;
  --green: #2f8f68;
  --danger: #c2473f;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar: 232px;
  --workspace-max: 1480px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .03), 0 10px 30px rgba(28, 28, 25, .045);
  --shadow-lg: 0 30px 80px rgba(28, 28, 25, .14);
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); scrollbar-gutter: stable; }
body { min-height: 100vh; margin: 0; background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(52, 120, 246, .24);
  outline-offset: 2px;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.ambient { position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; }
.ambient-top { width: 520px; height: 520px; top: -300px; right: -140px; background: radial-gradient(circle, rgba(203, 184, 148, .17), transparent 68%); }
.ambient-bottom { width: 480px; height: 480px; left: 3vw; bottom: -340px; background: radial-gradient(circle, rgba(154, 174, 184, .11), transparent 70%); }

.app-shell { min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 26px 16px 20px;
  border-right: 1px solid var(--line);
  background: rgba(250, 250, 248, .8);
  backdrop-filter: blur(28px) saturate(1.15);
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 0 26px; }
.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 11px;
  filter: drop-shadow(0 8px 14px rgba(20, 55, 92, .18));
}
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #f8f4ea;
  background: #1d1d1b;
  box-shadow: 0 9px 20px rgba(24, 24, 22, .14), inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.brand-mark span { font: 650 16px/1 Georgia, "Times New Roman", serif; }
.brand-copy { min-width: 0; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; font-weight: 680; letter-spacing: -.025em; }
.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 43px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 9px 22px rgba(29, 29, 31, .14);
  cursor: pointer;
  font-size: 12px;
  font-weight: 620;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.primary-nav:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(29, 29, 31, .18); }
.primary-nav svg { width: 17px; }

.nav-list { display: grid; gap: 5px; margin-top: 18px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: #74746f;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: background .16s, color .16s;
}
.nav-item:hover { color: var(--ink); background: rgba(29, 29, 31, .045); }
.nav-item.active { color: var(--ink); background: rgba(29, 29, 31, .07); font-weight: 620; }
.nav-item svg { width: 17px; }
.nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 99px; color: var(--muted); background: rgba(29, 29, 31, .06); font-size: 9px; text-align: center; }

.recent-section { display: flex; flex: 1 1 auto; min-height: 0; margin-top: 27px; flex-direction: column; overflow: hidden; }
.section-label { padding: 0 11px 8px; color: var(--soft); font-size: 9px; font-weight: 650; letter-spacing: .1em; }
.recent-list { display: grid; flex: 1 1 auto; min-height: 0; align-content: start; gap: 3px; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
.recent-item { width: 100%; padding: 9px 11px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.recent-item:hover { background: rgba(29, 29, 31, .04); }
.recent-item strong { display: block; overflow: hidden; color: #575752; font-size: 11px; font-weight: 520; text-overflow: ellipsis; white-space: nowrap; }
.recent-item small { display: block; margin-top: 3px; color: var(--soft); font-size: 9px; }
.empty-note { margin: 0; padding: 9px 11px; color: var(--soft); font-size: 10px; }

.sidebar-footer { display: grid; gap: 6px; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); color: var(--soft); font-size: 9px; }
.copyright-note { display: grid; gap: 4px; font-size: 11px; line-height: 1.55; }
.status-row { display: flex; align-items: center; gap: 7px; color: #676762; font-size: 10px; }
.status-dot, .live-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #d4ad67; box-shadow: 0 0 0 4px rgba(212, 173, 103, .12); }
.status-dot.connected, .live-dot { background: #55a47d; box-shadow: 0 0 0 4px rgba(85, 164, 125, .11); }
.status-dot.error { background: #cb655d; box-shadow: 0 0 0 4px rgba(203, 101, 93, .11); }

/* Main */
.main-content { min-height: 100vh; margin-left: var(--sidebar); padding: 0 24px 72px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--workspace-max);
  height: 76px;
  margin: 0 auto;
  border-bottom: 1px solid transparent;
  background: rgba(245, 245, 242, .72);
  backdrop-filter: blur(26px) saturate(1.2);
}
.topbar-title { display: grid; gap: 2px; }
.topbar-title strong { font-size: 14px; font-weight: 660; letter-spacing: -.015em; }
.topbar-title span { color: var(--muted); font-size: 9px; }
.mobile-brand { display: none; align-items: center; gap: 9px; }
.mobile-brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.notification-button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); font: inherit; font-size: 16px; cursor: pointer; }
.notification-button:hover { border-color: var(--line-strong); background: #fff; }
.tutorial-button { white-space: nowrap; }
.notification-button > svg { width: 20px; height: 20px; flex: none; }
.notification-badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 12px; color: #fff; background: #b54c43; font-size: 12px; line-height: 20px; text-align: center; }
.notification-badge[hidden] { display: none; }
.notification-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fbfbf8; box-shadow: var(--shadow-lg); }
.notification-dialog::backdrop { background: rgba(30, 30, 28, .28); backdrop-filter: blur(10px); }
.notification-panel { padding: clamp(22px, 4vw, 32px); }
.notification-section { margin-top: 26px; }
.notification-section h3 { margin: 0; font-size: 17px; font-weight: 600; }
.notification-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notification-refresh { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.notification-refresh:disabled { cursor: wait; opacity: .55; }
.notification-status { margin: 12px 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.notification-list { display: grid; gap: 12px; }
.notification-item { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow-wrap: anywhere; }
.notification-item h4 { margin: 0; font-size: 17px; font-weight: 600; }
.notification-item time { display: block; margin-top: 6px; color: var(--soft); font-size: 13px; }
.notification-item p { margin: 10px 0 0; white-space: pre-wrap; font-size: 15px; line-height: 1.8; }
body:has(#notificationDialog[open]), body:has(#devicesDialog[open]) { overflow: hidden; }
.tutorial-dialog { width: min(1040px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; overscroll-behavior: contain; contain: layout paint; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fbfbf8; box-shadow: var(--shadow-lg); }
.tutorial-dialog::backdrop { background: rgba(24, 25, 23, .42); }
body:has(#aiTutorialDialog[open]) { overflow: hidden; }
.tutorial-heading { position: sticky; top: 0; z-index: 1; padding: 24px 30px; border-bottom: 1px solid var(--line); background: #fbfbf8; }
.tutorial-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.tutorial-heading .icon-button { flex: none; }
.tutorial-body { padding: 24px 30px 30px; }
.tutorial-steps { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.tutorial-step { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.tutorial-step h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.tutorial-step-number { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; color: #87642f; background: #f4eddf; font-size: 16px; }
.tutorial-step p, .tutorial-support p { margin: 10px 0; font-size: 15px; line-height: 1.85; }
.tutorial-platform-link { display: inline-flex; gap: 8px; align-items: center; margin-top: 6px; padding: 10px 16px; border: 1px solid #d2dce5; border-radius: 10px; color: #355d80; background: #f4f7fa; text-decoration: none; font-size: 15px; }
.tutorial-platform-link:hover { background: #eaf0f6; }
.tutorial-platform-address { overflow-wrap: anywhere; user-select: text; }
.tutorial-image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tutorial-step figure { margin: 18px 0 0; min-width: 0; }
.tutorial-step img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.tutorial-step figcaption { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tutorial-cost-note { padding: 12px 15px; border-radius: 10px; color: #795e34; background: #f7f1e6; }
.tutorial-support { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-top: 24px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.tutorial-support strong { color: #355d80; overflow-wrap: anywhere; }
.device-authorization-rule { margin: 20px 0 0; padding: 16px; border-radius: 12px; color: #795e34; background: #f7f1e6; font-size: 15px; line-height: 1.8; }
.account-control { position: relative; }
.provider-chip, .account-chip, .icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 253, .72);
  backdrop-filter: blur(15px);
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.provider-chip:hover, .account-chip:hover, .icon-button:hover { border-color: var(--line-strong); background: #fff; transform: translateY(-1px); }
.provider-chip { display: flex; align-items: center; gap: 11px; min-width: 205px; height: 50px; padding: 0 14px; border-radius: 14px; }
.provider-status { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #fff; background: #20201e; font-size: 10px; font-weight: 750; }
.provider-chip > span:nth-child(2), .account-chip > span:nth-child(2) { display: grid; flex: 1; text-align: left; }
.provider-chip small, .account-chip small { color: var(--soft); font-size: 10px; }
.provider-chip strong, .account-chip strong { margin-top: 2px; max-width: 140px; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.provider-chip > svg { width: 15px; color: var(--soft); }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; }
.icon-button svg { width: 17px; }
.account-chip { display: flex; align-items: center; gap: 10px; min-width: 180px; height: 50px; padding: 0 13px; border-radius: 14px; }
.account-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #fff; background: #aa8c58; font-size: 11px; font-weight: 700; }
.account-chip > svg { width: 15px; color: var(--soft); transition: transform .18s; }
.account-chip[aria-expanded="true"] > svg { transform: rotate(180deg); }
.account-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 40;
  width: 290px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 253, .97);
  box-shadow: 0 24px 60px rgba(28, 28, 25, .16);
  backdrop-filter: blur(22px);
  transform-origin: top right;
  animation: account-menu-in .2s var(--ease) both;
}
.recharge-action, .device-action { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px; margin-bottom: 5px; padding: 10px; border: 0; border-radius: 10px; color: var(--ink); background: transparent; text-align: left; font: inherit; font-size: 16px; font-weight: 400; cursor: pointer; }
.recharge-action:hover, .device-action:hover { background: var(--surface-soft); }
.account-menu [hidden] { display: none; }
.recharge-action svg, .device-action svg { width: 18px; height: 18px; flex: none; }
.recharge-dialog { width: min(1160px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: #fbfbf8; box-shadow: var(--shadow-lg); }
.recharge-dialog::backdrop, .payment-dialog::backdrop, .purchase-requirements-dialog::backdrop { background: rgba(24, 25, 23, .38); backdrop-filter: none; }
.recharge-panel { position: relative; padding: clamp(24px, 4vw, 40px); }
.recharge-dialog .dialog-heading { justify-content: center; padding-inline: 24px; text-align: center; }
.recharge-dialog .dialog-heading h2 { font-size: clamp(22px, 3vw, 30px); }
.recharge-dialog .dialog-heading .icon-button { position: absolute; top: 16px; right: 16px; }
.recharge-content { min-height: 220px; }
body:has(#rechargeDialog[open]), body:has(#paymentDialog[open]) { overflow: hidden; }
body:has(#purchaseRequirementsDialog[open]) .recharge-dialog::backdrop { background: transparent; }
body:has(#paymentDialog[open]) .recharge-dialog::backdrop { background: transparent; }
.recharge-periods { display: flex; gap: 4px; width: fit-content; margin: 22px auto 24px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); }
.recharge-periods button { min-width: 120px; min-height: 40px; padding: 8px 24px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 15px; font-weight: 600; cursor: pointer; }
.recharge-periods button[aria-pressed="true"] { color: #fff; background: #9d7a40; box-shadow: 0 3px 9px rgba(112, 88, 46, .16); }
.recharge-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 20px; }
.recharge-plan { display: grid; grid-row: span 7; grid-template-rows: subgrid; padding: clamp(20px, 2.2vw, 28px); border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface-solid); }
.recharge-plan > .plan-heading { grid-row: 1; }
.recharge-plan > .plan-price { grid-row: 2; }
.recharge-plan > .plan-promotion-note { grid-row: 3; justify-self: start; }
.recharge-plan > .plan-alternate-price { grid-row: 4; }
.recharge-plan > .plan-buy-button { grid-row: 5; }
.recharge-plan > h4 { grid-row: 6; }
.recharge-plan > .plan-benefits { grid-row: 7; }
.recharge-plan h3 { margin: 0 0 18px; color: var(--ink); font-size: 22px; font-weight: 650; }
.plan-heading { display: flow-root; min-height: 96px; }
.plan-heading h3 { margin-bottom: 6px; }
.plan-description { margin: 0 0 18px; color: var(--muted); font-size: 14px; font-weight: 400; line-height: 1.5; }
.plan-price { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.plan-currency { color: var(--ink); font-size: 22px; font-weight: 600; }
.plan-price-number { color: var(--ink); font-size: clamp(36px, 4vw, 46px); font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.plan-price-period { margin-left: 4px; color: var(--muted); font-size: 15px; }
.plan-price-original { margin-right: 7px; color: var(--muted); font-size: 17px; font-weight: 400; }
.plan-promotion-note { display: inline-block; margin: 9px 0 0; padding: 2px 7px; border-radius: 5px; color: #8a6a34; background: #f4ecdd; font-size: 13px; line-height: 1.6; }
.plan-price-original[hidden], .plan-promotion-note[hidden] { display: none; }
.purchase-quote { color: var(--ink); font-size: 16px; line-height: 1.7; }
.plan-price-negotiable { min-height: 53px; }
.plan-price-negotiable strong { font-size: 32px; line-height: 1.3; font-weight: 700; }
.plan-alternate-price { min-height: 20px; margin: 8px 0 18px; color: var(--muted); font-size: 14px; }
.plan-buy-button { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #d9c6a5; border-radius: 999px; color: #70582e; background: #f4ecdd; font-size: 15px; font-weight: 600; }
.plan-buy-button:disabled { cursor: not-allowed; opacity: .7; }
.plan-buy-button:not(:disabled) { cursor: pointer; }
.plan-buy-button:not(:disabled):hover { background: #ecdfc8; border-color: #b3935f; }
.purchase-requirements-dialog, .database-dialog { width: min(580px, calc(100vw - 28px)); }
.purchase-requirements-text { margin: 22px 0; color: var(--ink-2); font-size: 16px; line-height: 1.9; }
.purchase-requirements-dialog .plan-buy-button { margin-top: 4px; }
.database-dialog progress { width: 100%; height: 8px; accent-color: var(--green); }
.database-size, .database-note { margin: 16px 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.database-storage { margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.database-storage-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; color: var(--ink-2); font-size: 14px; }
.database-storage-choose { min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); font: inherit; cursor: pointer; }
.database-storage-choose:disabled { cursor: wait; opacity: .6; }
.database-storage-choose:not(:disabled):hover { border-color: var(--green); }
.database-directory { margin: 10px 0 6px; color: var(--ink); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.database-disk-space { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.database-disk-space[data-insufficient="true"] { color: #a63e2b; }
.database-dialog [hidden] { display: none; }
body:has(#purchaseRequirementsDialog[open]), body:has(#databaseDialog[open]) { overflow: hidden; }
.recharge-plan h4 { margin: 20px 0 14px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 500; }
.plan-benefits { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.plan-benefits li { display: flex; align-items: baseline; gap: 7px; color: var(--ink-2); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.plan-benefits li::before { content: "✓"; flex: none; color: #9d7a40; font-weight: 700; }
.plan-full { flex: none; margin-left: auto; padding: 0 5px; border-radius: 4px; color: #8a6a34; background: #f4ecdd; font-size: 11px; }
.recharge-payment-status { margin: 22px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.recharge-payment-methods { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.payment-method-label { color: var(--muted); font-size: 14px; }
.payment-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.payment-option { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink-2); background: var(--surface-solid); font-size: 14px; font-weight: 400; cursor: pointer; }
.payment-symbol { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; color: white; font-size: 15px; font-weight: 600; }
.payment-symbol-alipay { background: #287acb; }
@media (max-width: 900px) { .recharge-plans { column-gap: 12px; } .recharge-plan { padding: 20px 16px; } }
@media (max-width: 700px) { .recharge-plans { grid-template-columns: 1fr; row-gap: 12px; } .recharge-plan { display: block; grid-row: auto; padding: 24px; } .recharge-periods button { min-width: 100px; } }
.account-menu-profile { display: flex; align-items: center; gap: 10px; padding: 7px 7px 11px; }
.account-menu-profile .account-avatar { width: 38px; height: 38px; font-size: 15px; }
.account-menu-profile div { min-width: 0; }
.account-menu-profile small, .account-menu-profile strong { display: block; }
.account-menu-profile small { color: var(--soft); font-size: 14px; }
.account-menu-profile strong { margin-top: 3px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-membership { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 8px; font-size: 15px; line-height: 1.5; }
.account-menu-membership > span { color: var(--muted); }
.account-menu-membership strong { font-weight: 500; }
.logout-action { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 10px; color: var(--danger); background: transparent; cursor: pointer; font: inherit; font-size: 16px; text-align: left; }
.logout-action:hover { background: rgba(194, 71, 63, .07); }
.logout-action:disabled { cursor: wait; opacity: .55; }
.logout-action svg { width: 18px; height: 18px; flex: none; }

/* Composer */
.workspace-grid { width: 100%; max-width: var(--workspace-max); margin: 0 auto; padding-top: clamp(30px, 5vh, 58px); animation: rise-in .6s var(--ease) both; }
.workspace-hero { margin-bottom: 20px; text-align: center; }
.workspace-hero p, .eyebrow { margin: 0 0 13px; color: var(--gold); font-size: 9px; font-weight: 720; letter-spacing: .18em; }
.workspace-hero h1 { margin: 0; font-size: clamp(32px, 4vw, 46px); font-weight: 640; letter-spacing: -.055em; line-height: 1.1; }
.workspace-hero > span { display: block; margin-top: 10px; color: var(--muted); font-size: 15px; }
.research-access-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 0 0 20px; padding: 16px 20px; border: 1px solid #decda9; border-radius: 14px; background: #faf6ed; }
.research-access-notice[hidden] { display: none; }
.research-access-notice strong { color: #75592d; font-size: 15px; }
.research-access-notice p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.research-access-notice .secondary-button { flex: none; font-size: 14px; }
.search-duration-notice { margin: 12px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.7; text-align: right; }
.panel { border: 1px solid rgba(29, 29, 31, .075); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); backdrop-filter: blur(20px); }
.research-composer { padding: 24px; }
.composer-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.composer-topline h2 { margin: 0; font-size: 15px; font-weight: 650; }
.text-button { padding: 5px 7px; border: 0; color: #6c604c; background: transparent; cursor: pointer; font-size: 10px; }
.text-button:hover { color: var(--ink); }
.text-button.danger { color: var(--danger); }

.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-soft); }
.segmented button { min-width: 72px; padding: 8px 13px; border: 0; border-radius: 8px; color: #74746f; background: transparent; cursor: pointer; font-size: 12px; transition: background .16s, color .16s, box-shadow .16s; }
.segmented button.selected { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .08); font-weight: 620; }

.facts-field { position: relative; margin-top: 15px; }
.case-lock-notice { margin: 15px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.case-lock-notice + .facts-field { margin-top: 8px; }
.case-input-locked :is(.domain-selector, .mode-cards, .preference-chips) button:disabled { cursor: default; opacity: .72; }
.case-input-locked :is(textarea, input)[readonly] { background: var(--surface-soft); }
.facts-field textarea {
  width: 100%;
  min-height: 150px;
  padding: 15px 18px 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  resize: vertical;
  font-size: 15px;
  line-height: 1.8;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.facts-field textarea::placeholder { color: #aaa9a4; }
.facts-field textarea:focus { border-color: rgba(29, 29, 31, .27); background: #fff; box-shadow: 0 0 0 4px rgba(29, 29, 31, .04); }
.facts-field > span { position: absolute; right: 15px; bottom: 12px; color: var(--soft); font-size: 10px; font-variant-numeric: tabular-nums; }

.advanced-options { margin-top: 12px; }
.advanced-options summary { display: flex; align-items: center; gap: 8px; width: fit-content; padding: 9px 2px; color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 650; list-style: none; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::before { content: "+"; display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; color: #686864; background: var(--surface-soft); font-size: 16px; font-weight: 400; }
.advanced-options[open] summary::before { content: "−"; }
.advanced-options summary small { color: var(--soft); font-size: 11px; font-weight: 500; }
.details-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 10px 0 2px; }
.field-group { display: grid; gap: 7px; margin-top: 16px; }
.details-grid .field-group { margin-top: 0; }
.advanced-options .field-group label { font-size: 13px; }
.advanced-options .field-group small { font-size: 11px; }
.advanced-options :is(input, select) { font-size: 13px; }
.field-group label { color: var(--ink-2); font-size: 10px; font-weight: 650; }
.field-group small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.preference-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.preference-chips button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
}
.preference-chips button:hover { border-color: var(--line-strong); }
.preference-chips button.selected {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
  box-shadow: 0 6px 14px rgba(29, 29, 31, .12);
}
.region-selectors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
input, select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fff; font-size: 12px; }
select:disabled { color: var(--soft); background: var(--surface-soft); cursor: not-allowed; }
input:focus, select:focus { border-color: rgba(29, 29, 31, .27); box-shadow: 0 0 0 4px rgba(29, 29, 31, .04); }
.composer-divider { height: 1px; margin: 18px 0; background: var(--line); }
.delivery-row { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.delivery-row > div:first-child { display: grid; gap: 3px; }
.delivery-row strong { font-size: 11px; font-weight: 650; }
.delivery-row small { color: var(--muted); font-size: 9px; }
.mode-cards { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-soft); }
.mode-cards > button { position: relative; min-height: 42px; padding: 0 17px; border: 0; border-radius: 8px; color: #74746f; background: transparent; cursor: pointer; font-size: 14px; }
.mode-cards > button.selected { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .08); font-weight: 620; }
.mode-cards em { position: absolute; top: -10px; right: 4px; color: var(--gold); font-size: 9px; font-style: normal; font-weight: 700; }
.composer-footer { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-top: 22px; }
.privacy-note { display: flex; align-items: center; gap: 7px; color: var(--soft); font-size: 9px; }
.privacy-note svg { width: 14px; }
.run-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 155px;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 24px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 26px rgba(29, 29, 31, .17);
  cursor: pointer;
  font-size: 14px;
  font-weight: 620;
  transition: transform .22s var(--ease), box-shadow .22s;
}
.run-button:hover { transform: translateY(-2px); box-shadow: 0 17px 34px rgba(29, 29, 31, .22); }
.run-button:disabled { transform: none; cursor: wait; color: #f4f4f2; background: #9b9b98; box-shadow: none; opacity: 1; }
.run-button svg { width: 17px; }
/* Progress and result */
.progress-panel, .result-panel, .history-panel { width: 100%; max-width: var(--workspace-max); margin: 24px auto 0; }
.progress-panel, .history-panel { padding: 25px 28px; }
.result-panel { padding: 30px 28px 42px; }
.progress-heading { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.progress-heading div { display: flex; align-items: center; gap: 9px; }
.progress-heading > span { color: var(--muted); font-variant-numeric: tabular-nums; }
.task-queue-notice { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border: 1px solid #d8c59b; border-radius: 12px; background: #fbf7ed; color: #735b2e; }
.task-queue-notice[hidden] { display: none; }
.task-queue-notice strong { display: block; font-size: 15px; font-weight: 600; }
.task-queue-notice p { margin: 4px 0 0; font-size: 13px; line-height: 1.6; }
.task-queue-indicator { flex: none; width: 20px; height: 20px; border: 2px solid #d8c59b; border-top-color: #9c793e; border-radius: 50%; animation: fulltext-spin 1s linear infinite; }
.progress-track { height: 4px; margin: 17px 0 18px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.stage-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.stage-item { display: flex; align-items: flex-start; gap: 8px; min-height: 64px; padding: 10px 11px; border: 1px solid transparent; border-radius: 12px; color: var(--soft); background: rgba(29, 29, 31, .025); font-size: 9px; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.stage-item strong { display: block; margin-bottom: 3px; color: #6a6a66; font-size: 10px; font-weight: 620; line-height: 1.35; }
.stage-number { position: relative; display: grid; flex: 0 0 auto; width: 21px; height: 21px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--soft); background: #fff; font-size: 8px; font-variant-numeric: tabular-nums; }
.stage-item.active { border-color: rgba(152, 137, 98, .2); color: #5d664e; background: #f4f1e9; transform: translateY(-1px); }
.stage-item.active .stage-number { border-color: #a49a80; color: #fff; background: #a49a80; }
.stage-item.done { border-color: rgba(47, 143, 104, .13); color: #597264; background: #edf4ef; }
.stage-item.done strong { color: #446153; }
.stage-item.done .stage-number { border-color: #6f927e; color: transparent; background: #6f927e; }
.stage-item.done .stage-number::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-family: Arial, sans-serif; font-size: 12px; font-weight: 700; line-height: 1; }

/* Long reports use solid surfaces to reduce painting during scrolling. */
.result-panel { background: var(--surface-solid); backdrop-filter: none; }
body:has(#resultPanel:not(.hidden)) .topbar { background: var(--paper); backdrop-filter: none; }
body:has(#resultPanel:not(.hidden)) .sidebar { background: #fafaf8; backdrop-filter: none; }
.result-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.result-toolbar h2, .history-heading h2, .dialog-heading h2 { margin: 0; font-size: 22px; font-weight: 640; letter-spacing: -.035em; }
.result-toolbar > div:last-child { display: flex; gap: 6px; }
.secondary-button, .save-button { min-height: 36px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; font-size: 10px; font-weight: 580; }
.secondary-button:hover { background: var(--surface-soft); }
.save-button { border-color: var(--accent); color: #fff; background: var(--accent); }
.save-button:hover { background: #333330; }
.save-button:disabled,
.save-button[aria-busy="true"] {
  color: #f4f4f2;
  border-color: #9b9b98;
  background: #9b9b98;
  box-shadow: none;
  cursor: wait;
  pointer-events: none;
}
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 13px 0; }
.meta-pill { padding: 4px 7px; border-radius: 99px; color: var(--soft); background: rgba(29, 29, 31, .035); font-size: 8px; }
.result-actions { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 18px; margin: 3px 0 28px; padding: 16px 17px; border: 1px solid rgba(47, 143, 104, .16); border-radius: 15px; background: #f3f8f4; }
.action-copy strong { display: block; color: #315f49; font-size: 12px; }
.action-copy p { margin: 4px 0 0; color: #748278; font-size: 9px; }
.action-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 7px; }
.case-fulltext-button {
  display: flex;
  align-items: center;
  width: max-content;
  margin-top: 14px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: #4d6f91;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease;
}
.case-fulltext-button:hover { color: #294f75; }
.case-fulltext-button:focus-visible { outline: 3px solid rgba(77, 111, 145, .2); outline-offset: 3px; }
.case-fulltext-button:disabled { opacity: .55; cursor: wait; }
.fulltext-dialog {
  position: fixed;
  width: min(1180px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #fbfbf8;
  box-shadow: var(--shadow-lg);
}
.fulltext-dialog::backdrop { background: rgba(24, 25, 23, .42); }
body:has(#fulltextDialog[open]) { overflow: hidden; }
.fulltext-window {
  max-height: calc(100vh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  contain: layout paint;
  padding: 28px 32px 38px;
}
.fulltext-close-button { position: absolute; top: 16px; right: 16px; z-index: 2; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 11px; background: #f0f0ec; }
.fulltext-close-button:hover { background: #e6e6e0; }
.fulltext-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-right: 46px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.fulltext-heading h2 { margin: 0; font-size: 21px; }
.fulltext-loading { display: grid; justify-items: center; align-content: center; min-height: 320px; padding: 36px; text-align: center; color: var(--text); }
.fulltext-loading strong { margin-top: 16px; font-size: 17px; }
.fulltext-loading p { max-width: 500px; margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.fulltext-loading.error { color: var(--danger); }
.fulltext-loading.error p { color: var(--muted); }
.fulltext-spinner { width: 30px; height: 30px; border: 3px solid rgba(152, 120, 68, .18); border-top-color: #987844; border-radius: 50%; animation: fulltext-spin .8s linear infinite; }
@keyframes fulltext-spin { to { transform: rotate(360deg); } }

.report-content { width: 100%; max-width: none; margin: 12px auto 10px; color: #2f2f30; font-family: "Songti SC", "STSong", Georgia, serif; font-size: 14px; line-height: 1.95; }
.fulltext-content { width: min(900px, 100%); max-width: 900px; margin: 12px auto 10px; padding: 4px 26px 24px; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 15px; }
.fulltext-content h2:first-child { margin-top: 24px; }
.fulltext-content p { margin: 13px 0; line-height: 2; text-align: justify; }
.fulltext-content p.document-line { text-indent: 0; }
.report-content > h1:first-child { margin-top: 22px; }
.report-content h1 { margin: 46px 0 20px; color: #202020; font-size: 27px; font-weight: 650; letter-spacing: -.035em; }
.report-content h2 { margin: 34px 0 13px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 19px; font-weight: 650; }
.report-content h3 { margin: 27px 0 9px; font-size: 16px; }
.report-content p { margin: 9px 0; text-indent: 2em; }
.report-content .conclusion-number { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
.report-content .conclusion-point > strong { font-weight: 700; }
.report-content .conclusion-hint, .report-content .conclusion-hint strong { font-weight: 400; }
.report-content ul, .report-content ol { display: grid; gap: 7px; margin: 11px 0 19px; padding-left: 23px; }
.table-scroll { width: 100%; margin: 15px 0 24px; overflow: visible; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.report-content table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 14.4px; line-height: 1.6; }
.report-content table.wide-table { min-width: 0; font-size: 13.2px; }
.report-content table.wide-table th:nth-child(1) { width: 3.5%; }
.report-content table.wide-table th:nth-child(2) { width: 8%; }
.report-content table.wide-table th:nth-child(3) { width: 3.5%; }
.report-content table.wide-table th:nth-child(4) { width: 4%; }
.report-content table.wide-table th:nth-child(5) { width: 5.5%; }
.report-content table.wide-table th:nth-child(6) { width: 4.5%; }
.report-content table.wide-table th:nth-child(7) { width: 4.5%; }
.report-content table.wide-table th:nth-child(8) { width: 3.75%; }
.report-content table.wide-table th:nth-child(9) { width: 23.75%; }
.report-content table.wide-table th:nth-child(10) { width: 15.25%; }
.report-content table.wide-table th:nth-child(11) { width: 23.75%; }
.report-content table.wide-table :is(th, td):nth-child(n+2):nth-child(-n+8) { font-size: 11px; }
.report-content th, .report-content td { padding: 11px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.report-content table.wide-table th, .report-content table.wide-table td { padding: 10px 8px; word-break: break-word; }
.report-content th:last-child, .report-content td:last-child { border-right: 0; }
.report-content tbody tr:last-child td { border-bottom: 0; }
.report-content th { position: sticky; top: 0; z-index: 1; color: #454542; background: #f4f4f1; text-align: left; font-weight: 650; }
.report-content tbody tr:nth-child(even) td { background: #fbfbf9; }
.report-content tbody tr:hover td { background: #f7f7f3; }
.report-content blockquote { margin: 16px 0; padding: 12px 15px; border-left: 2px solid var(--gold); color: #5c5549; background: #f8f4eb; }
.official-link { color: #4d6f91; }

/* History */
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.history-heading span { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.history-list { display: grid; gap: 7px; margin-top: 18px; }
.history-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: rgba(29, 29, 31, .027); }
.history-card strong { font-size: 11px; font-weight: 620; }
.history-card p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.history-card button { border: 0; color: #6a5d47; background: transparent; cursor: pointer; font-size: 10px; }

/* Settings */
.settings-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 24px; color: var(--ink); background: #fbfbf8; box-shadow: var(--shadow-lg); }
.settings-dialog::backdrop { background: rgba(30, 30, 28, .28); backdrop-filter: blur(18px) saturate(.8); }
.settings-dialog[open] { animation: dialog-in .35s var(--ease) both; }
.settings-dialog form { padding: 32px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settings-dialog .dialog-heading h2 { font-size: 26px; }
.dialog-heading > div > span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.dialog-heading .icon-button { width: 34px; height: 34px; background: var(--surface-soft); }
.settings-page { padding: 9px 0 7px; }
.connection-cards { display: grid; grid-template-columns: 1fr; gap: 8px; }
.connection-cards button { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.connection-cards button.selected { border-color: #b6b6b0; background: #f0f0ec; box-shadow: inset 0 0 0 1px rgba(29, 29, 31, .08); }
.connection-cards strong, .connection-cards small { display: block; }
.settings-dialog .field-group label { font-size: 13px; }
.settings-dialog .field-group small { font-size: 11px; line-height: 1.55; }
.settings-dialog :is(input, select) { height: 46px; font-size: 13px; }
.connection-cards strong { font-size: 13px; }
.connection-cards small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.provider-fixed { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding: 11px 13px; border-radius: 12px; background: var(--surface-soft); }
.provider-fixed > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #fff; background: var(--ink); font-size: 9px; font-weight: 750; }
.provider-fixed small, .provider-fixed strong { display: block; }
.provider-fixed small { color: var(--muted); font-size: 10px; }
.provider-fixed strong { margin-top: 2px; font-size: 13px; }
.warning-text { color: #99734e !important; }
.dialog-footer { display: flex; align-items: center; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.connection-result { flex: 1; color: var(--muted); font-size: 11px; }
.settings-dialog :is(.secondary-button, .save-button) { min-height: 40px; padding-inline: 16px; font-size: 12px; }
.connection-result.success { color: var(--green); }
.connection-result.error { color: var(--danger); }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 7px; }
.toast { max-width: 360px; padding: 11px 14px; border-radius: 11px; color: #fff; background: #252523; box-shadow: 0 13px 34px rgba(0, 0, 0, .18); font-size: 10px; animation: toast-in .25s var(--ease); }
.hidden { display: none !important; }

@keyframes rise-in { from { transform: translateY(12px); opacity: 0; } }
@keyframes dialog-in { from { transform: translateY(10px) scale(.985); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes account-menu-in { from { transform: translateY(-5px) scale(.98); opacity: 0; } }

@media (max-width: 1050px) {
  :root { --sidebar: 78px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-copy, .primary-nav span, .nav-item > span:not(.nav-count), .recent-section, .copyright-note { display: none; }
  .primary-nav { padding: 0; }
  .nav-item { position: relative; justify-content: center; padding: 0; }
  .nav-count { position: absolute; top: 3px; right: 3px; }
  .sidebar-footer { align-items: center; }
  .status-row { justify-content: center; }
}

@media (max-width: 760px) {
  .tutorial-heading { padding: 20px; }
  .tutorial-body { padding: 18px; }
  .tutorial-step { padding: 18px; }
  .tutorial-image-grid { grid-template-columns: 1fr; }
  .tutorial-button { gap: 5px; padding-inline: 9px; font-size: 13px; }
  .tutorial-button > svg { width: 17px; height: 17px; }
  .topbar-actions { max-width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .topbar:has(.tutorial-button) { height: auto; min-height: 66px; flex-wrap: wrap; gap: 10px; padding-block: 10px; }
  :root { --sidebar: 0px; }
  .ambient { display: none; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: 64px; padding: 8px 14px; flex-direction: row; align-items: center; border-top: 1px solid var(--line); border-right: 0; }
  .sidebar .brand, .sidebar .primary-nav, .sidebar .recent-section, .sidebar .sidebar-footer { display: none; }
  .nav-list { grid-template-columns: 1fr 1fr; width: 100%; margin: 0; }
  .nav-item { display: flex; flex-direction: column; gap: 2px; min-height: 48px; font-size: 9px; }
  .nav-item > span:not(.nav-count) { display: block; }
  .nav-count { top: 1px; right: calc(50% - 24px); }
  .main-content { margin-left: 0; padding: 0 14px 92px; }
  .topbar { height: 66px; }
  .topbar-title { display: none; }
  .mobile-brand { display: flex; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; }
  .mobile-brand strong { font-size: 14px; }
  .provider-chip { min-width: 40px; width: 40px; padding: 0 6px; }
  .provider-chip > span:nth-child(2), .provider-chip > svg { display: none; }
  .provider-status { width: 27px; }
  .account-chip { min-width: 40px; width: 40px; padding: 0 6px; }
  .account-chip > span:nth-child(2) { display: none; }
  .account-chip > svg { display: none; }
  .account-menu { position: fixed; top: 70px; right: 14px; width: min(290px, calc(100vw - 28px)); }
  .workspace-grid { padding-top: 28px; }
  .workspace-hero h1 { font-size: 34px; }
  .research-composer { padding: 17px; border-radius: 22px; }
  .domain-selector { display: grid; grid-template-columns: 1fr 1fr; }
  .segmented button { min-width: 0; }
  .facts-field textarea { min-height: 145px; padding-inline: 15px; }
  .details-grid { grid-template-columns: 1fr; }
  .region-selectors { grid-template-columns: 1fr; }
  .delivery-row { align-items: flex-start; flex-direction: column; }
  .mode-cards { display: grid; grid-template-columns: 1fr; width: 100%; }
  .mode-cards > button { padding: 0 7px; }
  .composer-footer { align-items: stretch; flex-direction: column; }
  .privacy-note { justify-content: center; order: 2; }
  .run-button { width: 100%; }
  .progress-panel, .result-panel, .history-panel { padding: 20px 17px; border-radius: 20px; }
  .stage-list { grid-template-columns: 1fr 1fr; }
  .result-toolbar { display: grid; }
  .result-actions { grid-template-columns: 1fr; }
  .action-controls { justify-content: flex-start; }
  .report-content { font-size: 13px; }
  .report-content h1 { font-size: 23px; }
  .fulltext-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); border-radius: 18px; }
  .fulltext-window { max-height: calc(100vh - 20px); padding: 20px 15px 26px; }
  .fulltext-close-button { top: 10px; right: 10px; }
  .fulltext-content { padding-inline: 0; }
  .table-scroll { overflow-x: auto; }
  .report-content table { min-width: 720px; table-layout: auto; }
  .report-content table.wide-table { min-width: 1500px; }
  .settings-dialog form { padding: 22px 18px; }
  .connection-cards { grid-template-columns: 1fr; }
  .dialog-footer { flex-wrap: wrap; }
  .connection-result { width: 100%; flex-basis: 100%; }
}

.payment-dialog { width: min(440px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: var(--surface-solid); box-shadow: var(--shadow-lg); }
.payment-order-panel { margin: 0; padding: 28px; text-align: center; }
.payment-heading { display: flex; align-items: center; gap: 10px; text-align: left; }
.payment-heading h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 650; }
.payment-heading .icon-button { width: 32px; height: 32px; background: var(--surface-soft); }
.payment-order-panel canvas { display: block; width: 232px; height: 232px; margin: 18px auto; max-width: 100%; image-rendering: pixelated; }
.payment-order-panel [hidden] { display: none; }
.payment-order-panel p { overflow-wrap: anywhere; line-height: 1.65; font-size: 14px; }
.payment-order-panel .payment-order-plan { margin: 26px 0 4px; color: var(--muted); }
.payment-order-panel .payment-order-amount { margin: 0; font-size: 40px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.payment-order-panel .payment-countdown { min-height: 24px; margin: 10px 0 0; color: #8a6a34; font-variant-numeric: tabular-nums; }
.payment-official-panel { margin: 22px auto 14px; max-width: 100%; }
.payment-official-frame { display: block; width: 256px; max-width: 100%; height: 256px; margin: 0 auto; border: 0; background: #fff; }
.payment-order-panel .payment-official-hint { margin: 14px auto 8px; color: var(--muted); font-size: 12px; }
.payment-official-link { display: inline-block; padding: 7px 12px; border: 1px solid var(--line, #dedbd4); border-radius: 9px; color: inherit; font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.payment-official-link:hover { background: var(--surface, #f5f3ee); }
.payment-official-link:focus-visible { outline: 2px solid var(--gold, #b58a49); outline-offset: 3px; }
.payment-order-panel .payment-order-description { margin: 18px 0 8px; color: var(--muted); font-size: 12px; }
.payment-order-panel .payment-order-state { margin: 8px 0 16px; }
.payment-actions { display: grid; gap: 8px; }
.payment-confirm-button { min-height: 42px; padding: 10px 16px; border: 0; border-radius: 11px; color: #fff; background: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.payment-confirm-button:disabled { opacity: .6; cursor: wait; }
.payment-order-panel .payment-security-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.payment-feedback-dialog { width: min(360px, calc(100vw - 32px)); padding: 26px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--surface-solid); box-shadow: var(--shadow-lg); }
.payment-feedback-dialog::backdrop { background: transparent; }
.payment-feedback-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.payment-feedback-dialog p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.payment-feedback-dialog .payment-confirm-button { width: 100%; }
.facts-minimum { margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (max-width: 480px) { .payment-order-panel { padding: 24px 18px; } }
.authorized-device-list { padding-left: 22px; font-size: 17px; line-height: 1.9; }
#deviceEnrollment label { display: block; margin-block: 14px; font-size: 16px; line-height: 1.6; }
#deviceLabel { width: 100%; box-sizing: border-box; margin-top: 8px; padding: 10px 12px; font: inherit; border: 1px solid #d8d5cd; border-radius: 10px; }
#deviceEnrollment .device-confirm { display: flex; align-items: flex-start; gap: 10px; }
.device-confirm input { display: inline-block; flex: 0 0 18px; width: 18px; height: 18px; margin: 4px 0 0; padding: 0; accent-color: var(--gold); }
.report-title-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.report-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.report-tab{appearance:none;border:1px solid var(--line);border-radius:12px;padding:11px 18px;background:transparent;color:var(--muted);font:inherit;font-size:20px;font-weight:700;cursor:pointer;transition:background .15s,color .15s}
.report-tab.active{background:var(--ink);border-color:var(--ink);color:var(--paper)}
.report-tab:focus-visible{outline:3px solid var(--gold);outline-offset:3px}
.report-wait{display:inline-flex;align-items:center;gap:9px;color:var(--muted);font-size:14px;line-height:1.65;font-weight:400}
.report-spinner{display:inline-block;flex:0 0 15px;width:15px;height:15px;box-sizing:border-box;border:2px solid var(--line);border-top-color:var(--gold);border-radius:50%;animation:report-spin .85s linear infinite}
.report-pending-tiers{display:grid;gap:10px;margin-top:22px}
.report-pending-section{padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft)}
.report-cases-loading{padding:12px 4px 18px}
@keyframes report-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.report-spinner{animation:none;border-top-color:var(--gold);border-right-color:var(--gold)}}
@media(max-width:600px){.report-tab{font-size:16px;padding:10px 12px}.result-toolbar{gap:14px;flex-wrap:wrap}}
