:root {
  color-scheme: light;
  --ink: #162b3b;
  --ink-deep: #102333;
  --muted: #5e6e78;
  --paper: #f3f6f7;
  --card: #ffffff;
  --line: #dce5e8;
  --teal: #176b61;
  --teal-deep: #10564e;
  --teal-soft: #e9f4f0;
  --gain: #b33740;
  --loss: #16704d;
  --warning: #865715;
  --warning-soft: #fff6e7;
  --danger-soft: #fff0f0;
  --shadow: 0 8px 28px rgb(25 50 65 / 4%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
body.dialog-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--teal); text-underline-offset: 0.2em; }
p, h1, h2, h3, dl, dd, ul { margin: 0; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset:disabled { opacity: 0.68; }
:focus-visible { outline: 3px solid #368f87; outline-offset: 3px; }
h1, h2, h3 { line-height: 1.4; letter-spacing: -0.025em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.0625rem; font-weight: 650; overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-radius: 0.5rem;
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1160px; margin: auto; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-size: 1.25rem; color: var(--ink); font-weight: 750; text-decoration: none; letter-spacing: -0.04em; }
.brand span { color: var(--teal); margin-left: 0.15em; }
.page-shell { max-width: 1160px; margin: auto; padding: 2rem 1.5rem 1rem; }
.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.eyebrow { color: var(--muted); font-size: 0.875rem; font-weight: 550; margin-bottom: 0.25rem; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  transition: background-color 120ms, border-color 120ms;
}
.button:disabled { cursor: wait; opacity: 0.58; }
.button-primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button-primary:hover:not(:disabled) { background: var(--teal-deep); border-color: var(--teal-deep); }
.button-secondary { background: var(--card); border-color: var(--line); }
.button-secondary:hover:not(:disabled) { border-color: #a7bdc4; background: #f8fbfb; }
.button-quiet { color: var(--muted); padding-right: 0.75rem; padding-left: 0.75rem; }
.button-quiet:hover:not(:disabled) { color: var(--ink); background: #edf2f4; }
.button-danger { color: var(--gain); border-color: #eecbd0; background: #fff; }
.button-danger:hover:not(:disabled) { background: var(--danger-soft); }
.button-full { width: 100%; }

.portfolio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  padding: 1.75rem 2rem 0;
  border-radius: 1.25rem;
  background: var(--ink-deep);
  color: #fff;
  box-shadow: 0 10px 30px rgb(16 35 51 / 8%);
}
.hero-primary, .hero-profit { min-width: 0; }
.portfolio-hero .metric-label { color: #c3d1d7; }
.hero-value { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 650; line-height: 1.4; letter-spacing: -0.045em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hero-note { color: #afc3cb; margin-top: 0.35rem; font-size: 0.875rem; }
.hero-profit { padding-left: 2rem; border-left: 1px solid #344957; }
.profit-value { margin-top: 0.1rem; font-size: clamp(1.75rem, 3.6vw, 2.35rem); font-weight: 600; letter-spacing: -0.035em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.profit-rate { font-weight: 550; font-variant-numeric: tabular-nums; }
.hero-footer { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap; padding: 1rem 0; border-top: 1px solid #344957; color: #b4c7cf; font-size: 0.875rem; }
.hero-footer strong { color: #e2ebef; font-weight: 550; margin-left: 0.35rem; font-variant-numeric: tabular-nums; }
.hero-footer > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.hero-value, .profit-value, .profit-rate, .metric-value, .metric-subvalue { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.is-gain { color: var(--gain); }
.is-loss { color: var(--loss); }
.portfolio-hero .is-gain { color: #ffb1ad; }
.portfolio-hero .is-loss { color: #8cdbb9; }
.report-strip { display: flex; align-items: flex-start; gap: 0.5rem 1.5rem; justify-content: space-between; margin-top: 1rem; padding: 0.9rem 1.1rem; background: var(--teal-soft); border-radius: 0.85rem; font-size: 0.875rem; }
.report-strip > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem; flex-shrink: 0; }
.report-strip strong { color: var(--teal-deep); font-weight: 600; }
.report-strip p { color: #43665f; overflow-wrap: anywhere; }
.report-strip span { color: #466c65; }

.section-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 0.4rem; width: fit-content; max-width: 100%; margin: 1.75rem 0 1.5rem; padding: 0.3rem; border: 1px solid var(--line); background: rgb(255 255 255 / 96%); border-radius: 0.85rem; box-shadow: var(--shadow); }
.section-nav a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.5rem 1rem; border-radius: 0.6rem; color: var(--muted); text-decoration: none; font-size: 0.9375rem; font-weight: 550; }
.section-nav a:hover, .section-nav a:focus-visible { background: var(--teal-soft); color: var(--teal-deep); }
.content-section { margin-top: 2.25rem; scroll-margin-top: 5rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.section-heading > div { flex: 1; min-width: 160px; }
.section-heading > .button { flex-shrink: 0; }
.section-description { color: var(--muted); font-size: 0.875rem; margin-top: 0.35rem; }
.position-grid, .opportunity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.position-card, .opportunity-card { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.asset-heading { min-width: 0; flex: 1; }
.asset-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin-top: 0.35rem; font-size: 0.875rem; color: var(--muted); }
.asset-code { font-variant-numeric: tabular-nums; }
.asset-type { border-radius: 0.35rem; background: #f1f4f6; color: #4d636f; font-size: 0.875rem; padding: 0.05rem 0.4rem; }
.risk-group { margin-top: 0.45rem; color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.card-top > .button { margin: -0.4rem -0.4rem 0 0; flex-shrink: 0; }
.position-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; padding: 1.1rem 0 0.95rem; }
.metric-label { font-size: 0.875rem; color: var(--muted); }
.metric-value { font-size: 1.35rem; font-weight: 650; line-height: 1.5; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-subvalue { font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.quote-line { font-size: 0.875rem; color: var(--muted); padding-top: 0.8rem; border-top: 1px solid #edf1f3; overflow-wrap: anywhere; }
.stale-note { color: var(--warning); margin-top: 0.25rem; font-size: 0.875rem; }
.advice-box { margin-top: 0.8rem; padding: 0.75rem 0.85rem; border-radius: 0.65rem; background: #f3f7f6; }
.advice-box p { font-size: 0.875rem; color: #42625b; margin-top: 0.2rem; }
.advice-box strong { font-size: 0.9375rem; color: #255b4e; font-weight: 600; }
.advice-box.is-warning { background: var(--warning-soft); }
.advice-box.is-warning strong, .advice-box.is-warning p { color: var(--warning); }
.advice-box.is-danger { background: var(--danger-soft); }
.advice-box.is-danger strong, .advice-box.is-danger p { color: #8e3a43; }
.analysis-details { margin-top: 1rem; border-top: 1px solid #edf1f3; }
summary { position: relative; list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 0.45rem; height: 0.45rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); flex-shrink: 0; margin-left: auto; margin-top: -0.2rem; }
details[open] > summary::after { transform: rotate(225deg); margin-top: 0.2rem; }
.analysis-details > summary { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0.65rem 0.1rem 0.2rem; color: var(--muted); font-size: 0.875rem; }
.analysis-details[open] > summary { padding-bottom: 0.65rem; }
.analysis-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 0.4rem 0 0.9rem; }
.analysis-metrics > div { min-width: 0; }
.analysis-metrics dt { font-size: 0.875rem; color: var(--muted); }
.analysis-metrics dd { font-size: 0.9375rem; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.analysis-meta { color: var(--muted); font-size: 0.875rem; margin-top: 0.45rem; overflow-wrap: anywhere; }
.reason-list { margin: 0.5rem 0 0; padding-left: 1.15rem; font-size: 0.875rem; color: var(--muted); }
.reason-list li + li { margin-top: 0.4rem; }
.opportunity-state { display: inline-block; max-width: 100%; margin-top: 0.85rem; padding: 0.2rem 0.55rem; border-radius: 0.4rem; background: var(--teal-soft); color: var(--teal-deep); font-size: 0.875rem; overflow-wrap: anywhere; }
.opportunity-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 0.85rem 0 0.2rem; }
.opportunity-stats .metric-value { font-size: 1.2rem; }
.opportunity-card .analysis-details { margin-top: 0.65rem; }
.opportunity-actions { display: flex; justify-content: flex-end; padding-top: 0.4rem; }
.opportunity-actions .button { color: var(--teal); font-size: 0.875rem; }
.empty-state { grid-column: 1 / -1; padding: 2.5rem 1.5rem; border: 1px dashed #bfced4; border-radius: 1rem; text-align: center; background: #f9fbfb; }
.empty-state h3 { font-size: 1.0625rem; color: #405662; }
.empty-state p { max-width: 34rem; margin: 0.6rem auto 0; font-size: 0.9375rem; color: var(--muted); }
.data-note { margin: -0.35rem 0 0.85rem; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.data-note:empty { display: none; }

.notice { padding: 0.85rem 1rem; border-radius: 0.75rem; color: #3b615c; background: var(--teal-soft); font-size: 0.9375rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.notice.is-error, .form-message.is-error { color: #963e40; }
.notice.is-error { background: #fceeee; border: 1px solid #f1d4d4; }
.notice.is-warning { color: var(--warning); background: var(--warning-soft); }
.form-message { color: var(--teal-deep); font-size: 0.9375rem; margin-top: 0.75rem; overflow-wrap: anywhere; }
.form-message:empty { display: none; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.settings-panel { min-width: 0; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); box-shadow: var(--shadow); }
.settings-panel > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.75rem; min-height: 76px; padding: 1rem 1.2rem; font-weight: 600; }
.settings-panel > summary::after { position: absolute; right: 1.3rem; top: 2.1rem; }
.settings-panel > summary > span:first-child { width: calc(100% - 1.5rem); }
.summary-detail { font-size: 0.875rem; font-weight: 400; color: var(--muted); padding-right: 1.25rem; overflow-wrap: anywhere; }
.settings-panel[open] > summary { border-bottom: 1px solid var(--line); }
.panel-body { padding: 1.25rem; }
.form-intro { color: var(--muted); font-size: 0.9375rem; margin: 0 0 1.15rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.full-width { grid-column: 1 / -1; }
label { display: flex; min-width: 0; flex-direction: column; gap: 0.4rem; color: #40535f; font-size: 0.875rem; font-weight: 550; }
input, select { display: block; width: 100%; min-width: 0; min-height: 46px; padding: 0.65rem 0.8rem; border: 1px solid #cbd8de; border-radius: 0.65rem; background: #fff; color: var(--ink); font-size: 1rem; line-height: 1.4; }
input::placeholder { color: #788790; opacity: 1; }
input:focus, select:focus { border-color: var(--teal); }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, #5e6e78 50%), linear-gradient(135deg, #5e6e78 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[type="checkbox"] { width: 20px; min-width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--teal); }
.checkbox-label { flex-direction: row; gap: 0.65rem; align-items: center; min-height: 44px; margin-top: 0.9rem; font-size: 0.9375rem; font-weight: 400; }
.field-hint { color: var(--muted); font-size: 0.875rem; font-weight: 400; margin-top: 0.6rem; overflow-wrap: anywhere; }
.form-grid > .field-hint { margin-top: -0.5rem; }
.form-actions { margin-top: 1.25rem; display: flex; justify-content: flex-end; }
.mail-test-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.mail-test-row .field-hint { margin: 0; flex: 1; min-width: 130px; }
.otp-input { font-variant-numeric: tabular-nums; letter-spacing: 0.18em; }
.otp-input::placeholder { letter-spacing: normal; }
.breakable { overflow-wrap: anywhere; }
.page-footer { padding: 2rem 0 1rem; color: var(--muted); text-align: center; font-size: 0.875rem; }

.position-dialog { --dialog-max-height: min(90vh, 860px); width: min(100% - 2rem, 570px); max-height: var(--dialog-max-height); overflow: hidden; margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 1.15rem; color: var(--ink); background: var(--card); box-shadow: 0 24px 80px rgb(10 25 35 / 22%); }
.position-dialog::backdrop { background: rgb(9 23 32 / 50%); backdrop-filter: blur(3px); }
.position-dialog form { display: flex; flex-direction: column; min-width: 0; min-height: 0; max-height: calc(var(--dialog-max-height) - 2px); overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.dialog-header h2 { font-size: 1.2rem; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem; }
.dialog-body fieldset { overflow: visible; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); flex-shrink: 0; }
.dialog-footer .button-danger { margin-right: auto; }
.asset-search-controls { display: grid; grid-template-columns: minmax(100px, 0.75fr) minmax(0, 1.6fr); gap: 0.75rem; }
.asset-results { display: grid; gap: 0.4rem; margin-top: 0.65rem; }
.asset-results:empty { display: none; }
.asset-result { width: 100%; text-align: left; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 0.65rem; background: #f9fbfb; color: var(--ink); }
.asset-result:hover, .asset-result:focus-visible { border-color: var(--teal); background: var(--teal-soft); }
.asset-result strong { display: block; font-size: 0.9375rem; font-weight: 550; overflow-wrap: anywhere; }
.asset-result span { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 0.1rem; }
.selected-asset { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.8rem 0.9rem; margin-top: 1rem; border: 1px solid #cfe4dd; border-radius: 0.75rem; background: var(--teal-soft); }
.selected-asset > span { font-size: 0.875rem; color: #4b6d64; }
.selected-asset strong { font-size: 0.9375rem; font-weight: 600; color: var(--teal-deep); overflow-wrap: anywhere; }
.position-inputs { margin-top: 1.1rem; }

.auth-page { min-height: 100vh; min-height: 100svh; background: linear-gradient(180deg, #142c3c 0, #142c3c 300px, #f3f6f7 300px); }
.auth-shell { width: min(100% - 2rem, 440px); margin: 0 auto; padding: clamp(2rem, 7vh, 4.5rem) 0 2rem; }
.auth-shell-wide { width: min(100% - 2rem, 500px); }
.auth-heading { color: #fff; margin-bottom: 1.8rem; }
.auth-heading .eyebrow { color: #b3cbd1; margin-bottom: 0.4rem; }
.auth-heading h1 { font-size: 2.25rem; letter-spacing: -0.055em; }
.auth-heading h1 span { color: #b1d7cc; margin-left: 0.1em; }
.auth-heading > p:last-child { color: #c4d4da; font-size: 0.9375rem; margin-top: 0.65rem; }
.auth-card { padding: 1.75rem; background: var(--card); border: 1px solid #dce5e8; border-radius: 1.25rem; box-shadow: 0 15px 55px rgb(17 42 57 / 10%); }
.auth-card h2 { font-size: 1.25rem; margin-bottom: 0.55rem; }
.auth-card .form-intro { margin-bottom: 1.35rem; }
.auth-card label + label { margin-top: 1.1rem; }
.auth-card .field-hint + label { margin-top: 1.1rem; }
.auth-card .button-full { min-height: 48px; margin-top: 1.5rem; }
.auth-footer { color: var(--muted); font-size: 0.875rem; padding: 1.2rem 0.25rem 0; text-align: center; }
.qr-frame { display: flex; justify-content: center; min-width: 0; padding: 0.7rem; margin: 0 0 1.1rem; border: 1px solid var(--line); border-radius: 0.85rem; background: #fff; }
.qr-frame img { width: 220px; max-width: 100%; aspect-ratio: 1; object-fit: contain; }
.manual-secret { border: 1px solid var(--line); border-radius: 0.65rem; padding: 0.65rem 0.8rem; margin-bottom: 1.3rem; }
.manual-secret summary { display: flex; align-items: center; gap: 0.5rem; min-height: 32px; font-size: 0.875rem; color: var(--teal); }
.manual-secret code { display: block; padding: 0.7rem; margin-top: 0.6rem; background: #f1f5f6; font-size: 1rem; line-height: 1.8; letter-spacing: 0.08em; overflow-wrap: anywhere; user-select: all; }
.text-link { display: inline-block; min-height: 44px; padding: 0.5rem 0; font-size: 0.9375rem; }
.noscript-notice { margin: 1rem; padding: 1rem; border-radius: 0.75rem; background: var(--warning-soft); color: var(--warning); }

@media (max-width: 760px) {
  .header-inner { padding: 0.7rem 1.1rem; }
  .page-shell { padding: 1.4rem 1.1rem 0.75rem; }
  .portfolio-hero { padding: 1.4rem 1.4rem 0; gap: 1.2rem; }
  .hero-profit { padding-left: 1.2rem; }
  .hero-value { font-size: 2.2rem; }
  .profit-value { font-size: 1.8rem; }
  .report-strip { display: block; padding: 0.85rem 1rem; }
  .report-strip p { margin-top: 0.35rem; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .position-grid { grid-template-columns: minmax(0, 1fr); }
  .section-heading > div { min-width: 145px; }
}

@media (max-width: 560px) {
  .header-inner { padding-right: 0.85rem; padding-left: 1rem; }
  .page-shell { padding-right: 1rem; padding-left: 1rem; }
  .page-intro { align-items: flex-end; }
  .page-intro .button { padding-right: 0.8rem; padding-left: 0.8rem; }
  .portfolio-hero { grid-template-columns: minmax(0, 1fr); padding: 1.3rem 1.25rem 0; gap: 1rem; }
  .hero-value { font-size: clamp(2rem, 8.5vw, 2.8rem); }
  .hero-profit { padding: 0.85rem 0 0; border-left: 0; border-top: 1px solid #344957; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.65rem; }
  .hero-profit .metric-label { width: 100%; margin-bottom: 0.1rem; }
  .profit-value { font-size: 1.65rem; }
  .profit-rate { font-size: 0.9375rem; }
  .hero-footer { padding: 0.85rem 0; }
  .hero-footer > span:last-child { width: 100%; }
  .section-nav { width: 100%; gap: 0.1rem; margin-top: 1.4rem; }
  .section-nav a { flex: 1; padding: 0.5rem 0.25rem; font-size: 0.875rem; }
  .content-section { margin-top: 1.8rem; }
  .section-heading { gap: 0.65rem; }
  .section-heading > div { min-width: 130px; }
  .section-heading > .button { padding-right: 0.75rem; padding-left: 0.75rem; font-size: 0.875rem; }
  .position-card, .opportunity-card { padding: 1.1rem; }
  .opportunity-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-body { padding: 1.1rem; }
  .settings-panel > summary { padding-right: 1.1rem; padding-left: 1.1rem; }
  .position-dialog { --dialog-max-height: 94vh; width: calc(100% - 1rem); }
  .dialog-header, .dialog-footer { padding: 0.85rem 1rem; }
  .dialog-body { padding: 1rem; }
  .form-grid { gap: 0.9rem; }
  .auth-card { padding: 1.4rem; }
}

@media (max-width: 360px) {
  .page-shell { padding-right: 0.8rem; padding-left: 0.8rem; }
  .header-inner { gap: 0.4rem; }
  .brand { font-size: 1.12rem; }
  .header-inner .button { font-size: 0.875rem; padding-right: 0.4rem; padding-left: 0.4rem; }
  .position-card, .opportunity-card { padding: 1rem; }
  .metric-value { font-size: 1.22rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .asset-search-controls { grid-template-columns: minmax(0, 1fr); }
  .auth-shell, .auth-shell-wide { width: calc(100% - 1.5rem); }
  .auth-card { padding: 1.15rem; }
  .auth-heading h1 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@supports (height: 100svh) {
  .position-dialog { --dialog-max-height: min(90svh, 860px); }
  @media (max-width: 560px) {
    .position-dialog { --dialog-max-height: 94svh; }
  }
}
