*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0b; --ink2: #111114; --ink3: #18181d; --ink4: #1c1c22;
  --line: #1e1e25; --line2: #28282f; --dim: #3a3a44; --muted: #6b6b7b;
  --sub: #9b9baa; --text: #dedee7; --bright: #f1f1f5; --accent: #e8d5b0;
  --red: #c95c50; --green: #67aa7d; --blue: #6c9dcc; --purple: #9c82ce; --teal: #58a9a9;
  --mono: "DM Mono", monospace; --serif: "DM Serif Display", serif; --sans: "Syne", sans-serif;
}

html, body { min-height: 100%; background: var(--ink); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--bright); text-decoration: underline; text-decoration-color: rgba(232, 213, 176, .65); }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img, svg { max-width: 100%; }
* { -webkit-tap-highlight-color: transparent; }
.position-item, .list-row, .nav-item, .snapshot-row, .news-row, .btn, .filter-tab, .t-tab { -webkit-tap-highlight-color: rgba(232,213,176,.15); }

.shell { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--ink); }
.wordmark { font-family: var(--serif); font-size: 19px; color: var(--bright); display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; }
.wordmark-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.wordmark-logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; display: block; }
.auth-wordmark .wordmark-logo { width: 36px; height: 36px; }

.mobile-menu-btn { display: none; width: 40px; height: 40px; background: transparent; border: 1px solid var(--line2); border-radius: 4px; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; flex: 0 0 auto; }
.mobile-menu-btn span { display: block; width: 18px; height: 1.5px; background: var(--text); border-radius: 1px; transition: transform .2s, opacity .2s; }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.topbar-center { display: flex; align-self: stretch; min-width: 0; }
.t-tab { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: none; border: none; padding: 0 16px; height: 52px; cursor: pointer; border-bottom: 1px solid transparent; transition: color .18s, border-color .18s; }
.t-tab:hover, .cell-link:hover, .wordmark:hover { color: var(--sub); }
.t-tab.active { color: var(--bright); border-bottom-color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.t-clock, .t-status { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; white-space: nowrap; }
.t-status { display: flex; align-items: center; gap: 6px; }
.t-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid var(--line2); border-radius: 3px; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; cursor: pointer; }
.icon-btn:hover { border-color: var(--dim); color: var(--accent); }
.file-btn input { display: none; }

.auth-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(10, 10, 11, .92); }
.auth-overlay[hidden] { display: none; }
.auth-panel { width: min(460px, 100%); border: 1px solid var(--line2); background: var(--ink2); border-radius: 4px; padding: 28px; box-shadow: 0 24px 90px rgba(0, 0, 0, .52); }
.auth-wordmark { margin-bottom: 24px; cursor: default; }
.auth-panel h1 { font-family: var(--serif); font-size: 31px; line-height: 1.12; font-weight: 400; color: var(--bright); }
.auth-copy { color: var(--sub); line-height: 1.6; margin: 12px 0 22px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.scroll { height: 100%; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.view { display: none; min-height: calc(100vh - 52px); }
.view.active { display: block; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 34px 36px 24px; border-bottom: 1px solid var(--line); }
.hero-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.hero-date, .section-title { font-family: var(--serif); font-size: 38px; font-weight: 400; color: var(--bright); line-height: 1.08; }
.hero-greeting { margin-top: 8px; color: var(--sub); max-width: 760px; line-height: 1.55; }
.hero-actions, .toolbar-row, .modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.metric { background: var(--ink); padding: 20px 24px; }
.metric-label, .sec-label, .cell-title, .modal label, .provider-box label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.metric-value { font-family: var(--serif); font-size: 30px; color: var(--bright); margin-top: 6px; }
.metric-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 5px; }
.up, .green { color: var(--green) !important; }
.dn, .red { color: var(--red) !important; }
.accent { color: var(--accent) !important; }

.overview-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1px; background: var(--line); }
.cell, .detail-section { min-height: 330px; background: var(--ink); padding: 22px 24px; overflow: hidden; }
.span-2 { grid-row: span 2; }
.cell-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cell-title { color: var(--accent); display: flex; align-items: center; gap: 8px; }
.cell-title::before { content: ""; width: 3px; height: 13px; background: var(--accent); border-radius: 1px; }
.cell-link { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; background: none; border: none; cursor: pointer; text-transform: uppercase; }

.split-layout { display: grid; min-height: calc(100vh - 52px); grid-template-columns: 340px 1fr; }
.three-col { grid-template-columns: 230px 1fr 330px; }
.portfolio-layout { grid-template-columns: 410px 1fr; }
.intel-layout { grid-template-columns: 260px 1fr; }
.history-layout { grid-template-columns: 330px 1fr; }
.profile-layout { grid-template-columns: 1fr 360px; }

.panel { border-right: 1px solid var(--line); background: var(--ink); min-width: 0; }
.compact-panel { min-height: calc(100vh - 52px); }
.panel-head { padding: 15px 20px 14px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.sec-badge { font-family: var(--mono); font-size: 10px; color: var(--dim); background: var(--ink3); border: 1px solid var(--line2); padding: 3px 8px; border-radius: 2px; }
.summary-card, .panel-stats { padding: 22px 20px; border-bottom: 1px solid var(--line); }
.summary-value { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--bright); }
.summary-row { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.summary-stat { min-width: 86px; }
.summary-stat strong { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.summary-stat span { display: block; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }

.position-list, .list-scroll, .news-feed, .workspace-body { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.position-item, .list-row, .news-row, .activity-row, .lot-row, .snapshot-row, .nav-item { border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s, border-color .15s; }
.position-item { padding: 14px 20px; }
.position-item:hover, .position-item.active, .list-row:hover, .list-row.selected, .nav-item:hover, .nav-item.active, .snapshot-row:hover, .snapshot-row.active { background: var(--ink3); }
.position-item.active, .list-row.selected, .nav-item.active, .snapshot-row.active { border-left: 2px solid var(--accent); }
.row-top, .row-meta, .asset-title-row, .db-row, .lot-row, .activity-row, .snapshot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.asset-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ticker { font-family: var(--mono); font-size: 14px; color: var(--bright); font-weight: 500; }
.muted, .asset-name, .small { color: var(--muted); font-size: 12px; }
.pnl-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .03); }
.mono { font-family: var(--mono); font-size: 12px; }
.alloc-track { height: 3px; background: var(--line2); overflow: hidden; border-radius: 2px; margin-top: 8px; }
.alloc-fill { height: 100%; border-radius: 2px; }

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: calc(100vh - 52px); }
.workspace-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 32px 22px; border-bottom: 1px solid var(--line); }
.asset-title { font-family: var(--serif); font-size: 34px; color: var(--bright); line-height: 1; }
.price-block { text-align: right; }
.price-block .summary-value { font-size: 31px; }

.kmetrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 18px; }
.km { background: var(--ink2); padding: 13px 14px; }
.km-val { font-family: var(--mono); font-size: 13px; color: var(--text); }
.km-lbl { font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: 5px; }

.chart-panel { border-bottom: 1px solid var(--line); min-height: 330px; }
.chart-toolbar, .list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 32px 0; }
.chart-control-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.range-tabs { display: flex; gap: 2px; }
.range-tab, .filter-tab { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); background: none; border: 0; padding: 6px 11px; cursor: pointer; border-radius: 2px; }
.range-tab.active, .filter-tab.active { color: var(--accent); background: rgba(232, 213, 176, .07); }
.chart-style-tabs { margin-left: auto; }
.chart-legend { display: flex; gap: 16px; font-family: var(--mono); font-size: 10px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; margin-right: 5px; }
.dot.green { background: var(--green); }
.dot.accent { background: var(--accent); }
.chart-stat { font-family: var(--mono); font-size: 10px; color: var(--text); letter-spacing: .06em; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line2); }
.chart-stat.up { color: var(--green); }
.chart-stat.dn { color: var(--red); }
.chart-empty { font-family: var(--mono); font-size: 11px; fill: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.line-chart { width: calc(100% - 64px); min-height: 250px; margin: 12px 32px 18px; }
.chart-canvas { position: relative; width: calc(100% - 64px); height: 320px; margin: 14px 32px 18px; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(180deg, rgba(232,213,176,.02) 0%, rgba(10,10,11,0) 60%); overflow: hidden; }
.chart-canvas canvas { display: block; }
.chart-canvas .tv-lightweight-charts { border-radius: 4px; }
.chart-empty-msg { margin: 0 32px 18px; padding: 40px 16px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; border: 1px dashed var(--line2); border-radius: 4px; }

.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.detail-section { min-height: 270px; }
.lot-row, .activity-row { padding: 10px 0; font-family: var(--mono); font-size: 11px; }
.portfolio-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.health-card { background: var(--ink3); border: 1px solid var(--line2); border-radius: 3px; padding: 10px; }
.health-card strong { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--bright); }
.health-card span { display: block; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.alloc-stack { display: flex; gap: 1px; height: 5px; border-radius: 3px; overflow: hidden; background: var(--line2); margin: 16px 0 10px; }
.alloc-piece { height: 100%; }
.connection-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 10px; }
.connection-row:last-child { border-bottom: none; }
.connection-row span:first-child { color: var(--sub); }
.connection-row span:last-child { color: var(--muted); text-align: right; }

.profile-form { padding: 28px 32px; max-width: 820px; }
.profile-form > label { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.profile-side { border-right: 0; border-left: 1px solid var(--line); }
.profile-account { padding: 8px 20px 22px; }
.profile-stat { padding: 14px 0; border-bottom: 1px solid var(--line); }
.profile-stat span { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.profile-stat strong { display: block; margin-top: 6px; color: var(--text); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }

.activity-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; text-align: right; }
.danger-link { color: var(--red); }
.nav-list { padding: 8px 0; }
.nav-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; }
.nav-name { color: var(--sub); font-size: 13px; }
.nav-count { font-family: var(--mono); font-size: 10px; color: var(--dim); }

.list-toolbar { justify-content: flex-start; padding: 0; border-bottom: 1px solid var(--line); }
.list-toolbar .filter-tab { height: 44px; padding: 0 18px; border-radius: 0; border-bottom: 2px solid transparent; }
.list-toolbar .filter-tab.active { border-bottom-color: var(--accent); background: transparent; color: var(--bright); }
.list-toolbar .btn { margin-left: auto; margin-right: 18px; }

.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; }
.check { width: 17px; height: 17px; border: 1px solid var(--line2); border-radius: 3px; flex: 0 0 auto; margin-top: 1px; }
.check.done { background: var(--green); border-color: var(--green); }
.check.done::after { content: ""; display: block; width: 8px; height: 4px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translate(-1px, 4px); margin: auto; }

.tag { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border-radius: 2px; padding: 2px 7px; border: 1px solid var(--line2); color: var(--sub); }
.tag.finance, .tag.etf, .tag.stock { color: var(--blue); background: rgba(108, 157, 204, .08); border-color: rgba(108, 157, 204, .22); }
.tag.crypto, .tag.health { color: var(--green); background: rgba(103, 170, 125, .08); border-color: rgba(103, 170, 125, .22); }
.tag.committed { color: var(--green); }
.tag.research { color: var(--accent); }
.tag.raw { color: var(--muted); }
.tag.business, .tag.tech { color: var(--purple); background: rgba(156, 130, 206, .08); border-color: rgba(156, 130, 206, .22); }

.detail-card { padding: 20px; }
.detail-card h2 { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--bright); line-height: 1.25; margin-bottom: 12px; }
.detail-card p { color: var(--sub); line-height: 1.7; margin: 12px 0; }
.db-row { border-bottom: 1px solid var(--line); padding: 7px 0; font-family: var(--mono); font-size: 11px; }

.news-feed { padding: 0 0 24px; }
.news-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; padding: 18px 32px; }
.news-num { font-family: var(--mono); color: var(--dim); font-size: 11px; }
.news-title { color: var(--text); font-size: 16px; line-height: 1.45; }
.news-title a { color: var(--text); display: inline; }
.news-title a::after { content: " OPEN"; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--accent); margin-left: 8px; white-space: nowrap; }
.news-title a:hover { color: var(--bright); }
.news-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.news-source { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 2px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line2); color: var(--sub); }
.news-source.theblock { color: #ff6b35; border-color: rgba(255,107,53,.3); background: rgba(255,107,53,.06); }
.news-source.coindesk { color: #f7931a; border-color: rgba(247,147,26,.3); background: rgba(247,147,26,.06); }
.news-source.cointelegraph { color: #fab915; border-color: rgba(250,185,21,.3); background: rgba(250,185,21,.06); }
.news-source.yahoo { color: #b280ce; border-color: rgba(178,128,206,.3); background: rgba(178,128,206,.06); }
.news-source.alphavantage { color: var(--blue); border-color: rgba(108,157,204,.3); background: rgba(108,157,204,.06); }

.news-toolbar.list-toolbar { padding-left: 16px; }
.news-toolbar.list-toolbar .filter-tab { height: 40px; padding: 0 14px; }

.sentiment-pill { display: inline-block; padding: 2px 7px; border-radius: 999px; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--line2); }
.sentiment-pill.bullish, .sentiment-pill.somewhat-bullish { color: var(--green); border-color: rgba(103,170,125,.35); background: rgba(103,170,125,.08); }
.sentiment-pill.bearish, .sentiment-pill.somewhat-bearish { color: var(--red); border-color: rgba(201,92,80,.35); background: rgba(201,92,80,.08); }
.sentiment-pill.neutral { color: var(--muted); }

.provider-box { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; min-width: min(420px, 45vw); }
.provider-box label { grid-column: 1 / -1; }

.btn { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; padding: 8px 14px; border-radius: 2px; cursor: pointer; transition: all .15s; border: 1px solid; text-transform: uppercase; }
.btn-primary { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #f1dfbd; }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line2); }
.btn-ghost:hover { color: var(--sub); border-color: var(--dim); }
.btn-danger { color: var(--red); border-color: rgba(201, 92, 80, .28); background: transparent; }
.full { width: 100%; justify-content: center; }

input, textarea, select { width: 100%; background: var(--ink3); border: 1px solid var(--line2); border-radius: 2px; color: var(--text); padding: 9px 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 78px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(10, 10, 11, .86); z-index: 50; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--ink2); border: 1px solid var(--line2); border-radius: 4px; padding: 24px; box-shadow: 0 22px 80px rgba(0, 0, 0, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-title { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--bright); }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.field-with-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.field-with-action .btn { height: 100%; min-width: 92px; }
.modal-note { font-size: 12px; color: var(--muted); line-height: 1.5; border: 1px solid var(--line2); padding: 10px; margin: 4px 0 14px; }

.empty { padding: 22px 0; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.snapshot-row { padding: 14px 18px; align-items: flex-start; }
.report { padding: 30px 34px; }
.report h1 { font-family: var(--serif); font-size: 34px; font-weight: 400; color: var(--bright); margin-bottom: 20px; }
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); margin-bottom: 28px; }
.report-section { border-top: 1px solid var(--line); padding: 20px 0; }
.report-section h2 { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: 12px; }

/* TABLET (≤1120px) */
@media (max-width: 1120px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100vh; }
  .topbar { position: sticky; top: 0; z-index: 40; height: auto; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar-center { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .topbar-center::-webkit-scrollbar { display: none; }
  .t-tab { height: 38px; flex: 0 0 auto; padding: 0 12px; }
  .scroll { height: auto; overflow: visible; }
  .hero, .workspace-head { flex-direction: column; align-items: stretch; padding: 28px 20px 22px; }
  .hero-summary, .overview-grid, .detail-grid, .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout, .three-col, .portfolio-layout, .intel-layout, .history-layout, .profile-layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-side { border-left: 0; }
  .workspace, .compact-panel { min-height: auto; }
  .workspace-body, .position-list, .list-scroll, .news-feed { overflow: visible; }
  .position-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-layout .position-list { border-top: 1px solid var(--line); }
  .chart-toolbar { align-items: flex-start; padding: 12px 20px 0; flex-wrap: wrap; }
  .chart-control-group { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .chart-style-tabs { margin-left: 0; }
  .range-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .range-tabs::-webkit-scrollbar { display: none; }
  .kmetrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .asset-actions { align-items: flex-start; }
  .price-block { text-align: left; }
  .news-row { grid-template-columns: 34px 1fr; }
  .news-row .tag { grid-column: 2; width: max-content; }
  .provider-box { min-width: 0; width: 100%; }
  .profile-form { padding: 24px 20px; max-width: none; }
  .chart-canvas { width: calc(100% - 40px); margin: 14px 20px 18px; height: 280px; }
  .chart-empty-msg { margin: 0 20px 18px; }
}

/* MOBILE (≤780px) — slide-out nav */
@media (max-width: 780px) {
  html, body { font-size: 14px; }
  body { -webkit-text-size-adjust: 100%; }
  .t-clock { display: none; }
  .topbar { gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); flex-wrap: nowrap; }
  .wordmark { font-size: 18px; flex: 1 1 auto; min-width: 0; }
  .wordmark-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wordmark-logo { width: 28px; height: 28px; }
  .mobile-menu-btn { display: flex; }

  .topbar-center {
    position: fixed; top: 0; left: 0; right: 0; width: 100%;
    flex-direction: column; background: var(--ink2); border-bottom: 1px solid var(--line2);
    box-shadow: 0 12px 24px rgba(0,0,0,.5);
    padding: max(60px, calc(env(safe-area-inset-top) + 56px)) 16px 16px;
    transform: translateY(-100%); transition: transform .25s ease;
    z-index: 35; overflow-y: auto; max-height: 100vh; align-items: stretch;
  }
  .topbar-center.open { transform: translateY(0); }
  .topbar-center::-webkit-scrollbar { display: none; }
  .topbar-center .t-tab { height: 48px; padding: 0 16px; text-align: left; justify-content: flex-start; border-bottom: 1px solid var(--line); border-radius: 0; width: 100%; font-size: 13px; }
  .topbar-center .t-tab.active { border-bottom-color: var(--accent); color: var(--accent); background: rgba(232,213,176,.04); }

  .topbar-right { gap: 6px; flex-shrink: 0; flex-wrap: nowrap; }
  .topbar-right .icon-btn { width: 36px; height: 36px; min-width: 36px; }
  .topbar-right .t-status { display: none; }

  .hero { padding: 22px 16px 18px; }
  .hero-date, .section-title { font-size: 28px; }
  .hero-greeting { font-size: 13px; }
  .hero-summary, .overview-grid, .detail-grid, .report-grid, .form-grid, .kmetrics { grid-template-columns: 1fr; }
  .cell, .detail-section { min-height: auto; padding: 18px 16px; }
  .metric { padding: 16px 18px; }
  .metric-value { font-size: 26px; }
  .summary-card, .panel-stats { padding: 18px 16px; }
  .panel-head { padding: 13px 16px; }
  .position-list { display: block; }
  .position-item, .list-row, .snapshot-row { padding: 14px 16px; min-height: 56px; }
  .position-item:hover, .list-row:hover { background: var(--ink2); }
  .row-top, .row-meta, .db-row, .lot-row, .activity-row, .snapshot-row { align-items: flex-start; }
  .row-meta { flex-wrap: wrap; gap: 6px; }
  .asset-title { font-size: 28px; }
  .asset-title-row { align-items: flex-start; }
  .asset-actions .toolbar-row, .hero-actions, .modal-actions, .toolbar-row { align-items: stretch; }
  .asset-actions .btn, .hero-actions .btn, .toolbar-row .btn, .modal-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .chart-toolbar { flex-direction: column; padding: 12px 16px 0; gap: 10px; }
  .chart-control-group { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .chart-style-tabs { margin-left: 0; }
  .chart-legend { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .chart-stat { margin-left: 0; padding-left: 0; border-left: 0; }
  .chart-canvas { width: calc(100% - 24px); height: 240px; margin: 12px 12px 16px; }
  .chart-empty-msg { margin: 0 12px 16px; padding: 28px 12px; }
  .line-chart { width: calc(100% - 24px); margin: 12px 12px 16px; }
  .btn { min-height: 40px; padding: 10px 14px; }
  .btn-primary, .btn-ghost, .btn-danger { min-height: 44px; }
  input, textarea, select { font-size: 16px; padding: 11px 12px; min-height: 44px; }
  textarea { min-height: 88px; }
  .provider-box { min-width: 0; grid-template-columns: 1fr; padding-top: 8px; }
  .news-toolbar.list-toolbar { padding-left: 4px; padding-right: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .news-toolbar.list-toolbar::-webkit-scrollbar { display: none; }
  .news-toolbar.list-toolbar .filter-tab { flex: 0 0 auto; padding: 0 14px; height: 42px; }
  .news-row { grid-template-columns: 1fr; gap: 8px; padding: 16px 14px; }
  .news-row .tag { grid-column: 1; }
  .news-num { order: -1; font-size: 10px; }
  .news-title { font-size: 15px; line-height: 1.4; }
  .news-title a::after { display: none; }
  .profile-form { padding: 20px 16px; max-width: none; }
  .profile-account { padding: 4px 16px 20px; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 20px 16px; padding-bottom: max(20px, env(safe-area-inset-bottom)); animation: modal-slide-up .22s ease-out; }
  @keyframes modal-slide-up { from { transform: translateY(20px); opacity: .85; } to { transform: translateY(0); opacity: 1; } }
  .modal-head { margin-bottom: 14px; }
  .modal-title { font-size: 22px; }
  .modal-close { width: 36px; height: 36px; }
  .field-with-action { grid-template-columns: 1fr; }
  .field-with-action .btn { min-height: 44px; }

  .auth-overlay { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-panel { padding: 24px 18px; }
  .auth-panel h1 { font-size: 26px; }
}

/* SMALL PHONES (≤380px) */
@media (max-width: 380px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .wordmark { font-size: 16px; }
  .wordmark-logo { width: 24px; height: 24px; }
  .topbar-right .icon-btn { width: 34px; height: 34px; min-width: 34px; font-size: 9px; }
  .hero-date, .section-title { font-size: 24px; }
  .modal-title { font-size: 19px; }
  .chart-canvas { height: 220px; }
}

/* LANDSCAPE phone fixes */
@media (max-width: 920px) and (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 16px 16px 12px; }
  .hero-date { font-size: 24px; }
  .chart-canvas { height: 200px; }
  .modal { max-height: 96vh; }
}

/* Touch device hover overrides */
@media (hover: none) {
  .position-item:hover, .list-row:hover, .nav-item:hover, .snapshot-row:hover { background: transparent; }
  .position-item.active, .list-row.selected, .nav-item.active, .snapshot-row.active { background: var(--ink3); }
  .btn:hover { transform: none; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .modal-overlay { padding-bottom: env(safe-area-inset-bottom); }
}
