:root {
  color-scheme: light;
  --bg: #f2f4f7; --panel: #fff; --panel-soft: #f7f9fb;
  --line: #e1e6ec; --line-strong: #cbd3dd;
  --text: #172033; --muted: #657084; --muted-2: #98a2b3;
  --blue: #315f8f; --blue-dark: #1d3f63; --blue-soft: #edf4fa;
  --up: #d92d20; --up-soft: #fff1f0; --up-line: #fecdc9;
  --down: #07883f; --down-soft: #ecfdf3; --down-line: #abefc6;
  --amber: #b54708; --amber-soft: #fff7ed;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% -10%, #fff 0, transparent 32%), linear-gradient(180deg, #f8fafc 0, var(--bg) 420px); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.auth-screen { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: radial-gradient(circle at 25% 10%, rgba(255,255,255,.98), transparent 38%), linear-gradient(145deg, #e8eef5, #f7f9fb 52%, #edf2f7); }
.auth-screen[hidden] { display: none; }
.auth-card { width: min(100%, 420px); padding: 34px; border: 1px solid rgba(184,199,216,.9); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 30px 80px rgba(31,47,66,.14); }
.auth-mark { position: relative; width: 46px; height: 46px; margin-bottom: 24px; border: 1px solid #c3d1df; border-radius: 14px; background: var(--blue-soft); }
.auth-mark::before { content: ""; position: absolute; left: 13px; top: 20px; width: 18px; height: 14px; border: 3px solid var(--blue-dark); border-radius: 4px; }
.auth-mark::after { content: ""; position: absolute; left: 17px; top: 10px; width: 10px; height: 13px; border: 3px solid var(--blue-dark); border-bottom: 0; border-radius: 8px 8px 0 0; }
.auth-kicker { display: block; color: var(--blue); font-size: .65rem; font-weight: 850; letter-spacing: .16em; }
.auth-card h1 { margin: 8px 0 8px; color: var(--text); font-size: 1.7rem; line-height: 1.2; letter-spacing: -.035em; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.auth-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: -6px 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.auth-paths[hidden] { display: none; }
.auth-paths button { min-height: 36px; margin: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .73rem; font-weight: 750; }
.auth-paths button:hover { background: #fff; color: var(--blue-dark); }
.auth-paths button.active { background: #fff; color: var(--blue-dark); box-shadow: 0 2px 8px rgba(31,47,66,.08); }
.auth-card form { display: grid; gap: 13px; }
.auth-card form[hidden] { display: none; }
.auth-card [hidden] { display: none; }
.auth-card label { display: grid; gap: 6px; color: #344054; font-size: .73rem; font-weight: 750; }
.auth-card input { width: 100%; min-height: 46px; padding: 11px 12px; font-size: .9rem; }
.auth-card button { min-height: 46px; margin-top: 3px; border: 1px solid var(--blue-dark); border-radius: 10px; background: var(--blue-dark); color: #fff; font-size: .84rem; font-weight: 800; }
.auth-card button:hover { background: #183b61; }
.auth-error { margin-top: 10px; color: var(--amber); font-size: .74rem; line-height: 1.5; }
.auth-error:not(:empty) { padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); }
.auth-card > small { display: block; margin-top: 14px; color: var(--muted-2); font-size: .68rem; line-height: 1.5; }
body.privacy-locked { overflow: hidden; }
body.privacy-locked .shell { filter: blur(14px); transform: scale(.995); pointer-events: none; user-select: none; }
.shell { max-width: 1440px; margin: auto; padding: 34px 30px 72px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; padding: 0 4px; }
.eyebrow { color: var(--blue); font-size: .72rem; letter-spacing: .16em; font-weight: 800; }
.top h1 { font-size: clamp(2.15rem, 4vw, 3.35rem); letter-spacing: -.05em; margin: 8px 0 7px; line-height: 1.04; font-weight: 760; }
.top p { margin: 0; color: var(--muted); font-size: .92rem; }
.header-side { display: grid; justify-items: end; gap: 12px; }
.clock { text-align: right; color: var(--muted); font-size: .78rem; }
.clock strong { display: block; color: var(--text); font-size: 1.45rem; line-height: 1; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.market-legend { display: flex; gap: 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.9); box-shadow: 0 4px 15px rgba(16,24,40,.035); color: var(--muted); font-size: .7rem; }
.market-legend span { display: inline-flex; align-items: center; gap: 5px; }
.market-legend span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.up-dot::before { background: var(--up); }
.down-dot::before { background: var(--down); }
.session-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; color: var(--muted); font-size: .7rem; }
.session-actions > span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-actions button { padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.92); color: #344054; font-size: .68rem; font-weight: 750; }
.session-actions button:hover { border-color: #9fb7cf; background: var(--blue-soft); }
#logout { color: var(--muted); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
.card { background: rgba(255,255,255,.96); border: 1px solid rgba(203,211,221,.88); border-radius: 20px; box-shadow: 0 14px 44px rgba(31,47,66,.065); }
.workspace-section { padding: 30px; border: 1px solid rgba(203,211,221,.72); border-radius: 26px; box-shadow: 0 18px 54px rgba(31,47,66,.045); }
.section-holdings { background: linear-gradient(145deg, #eef4f8, #f6f8fa 58%); }
.section-analysis { background: linear-gradient(145deg, #f7f4ee, #faf9f6 58%); }
.section-kelly { background: linear-gradient(145deg, #f0eff8, #f7f6fb 58%); }
.holdings { padding: 30px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.card-head > div, .analysis-heading > div:first-child { display: flex; align-items: center; gap: 13px; }
.card-head h2, .analysis-heading h2 { font-size: 1.45rem; margin: 0; letter-spacing: -.025em; line-height: 1.12; }
.card-head p, .analysis-heading p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.section-kicker { display: block; margin-bottom: 6px; color: var(--blue); font-size: .61rem; font-weight: 850; letter-spacing: .15em; }
.badge { font-size: .7rem; color: var(--blue); border: 1px solid #c9dcef; border-radius: 999px; padding: 5px 9px; background: var(--blue-soft); font-weight: 700; }
.kelly-badge { color: #5b5684; border-color: #d8d5eb; background: #fff; }

.portfolio-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, .82fr); gap: 28px; margin-top: 24px; padding: 24px; border: 1px solid rgba(203,211,221,.8); border-radius: 18px; background: rgba(255,255,255,.92); }
.portfolio-primary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr); gap: 13px; align-content: start; min-width: 0; }
.portfolio-primary > .subsection-title, .account-switcher, .portfolio-overview, #holding-form, #holdings-list { grid-column: 1 / -1; }
.portfolio-sidebar { min-width: 0; padding-left: 28px; border-left: 1px solid var(--line); }
.subsection-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; line-height: 1.25; }
.subsection-title span { color: var(--blue); font-size: .63rem; font-weight: 850; letter-spacing: .14em; }
.subsection-title strong { color: #344054; font-size: .92rem; font-weight: 800; }
.portfolio-overview { display: grid; grid-template-columns: minmax(92px, .52fr) minmax(155px, 1fr) minmax(310px, 1.72fr); align-items: stretch; gap: 9px; }
.portfolio-stat { position: relative; display: grid; align-content: center; min-width: 0; padding: 11px 14px; overflow: hidden; border: 1px solid #cfdae6; border-radius: 12px; background: #fff; }
.portfolio-stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #8eabc6; }
.portfolio-stat span, .total-current span { display: block; color: var(--muted); font-size: .66rem; font-weight: 700; line-height: 1.35; }
.portfolio-stat strong { display: block; margin: 4px 0 2px; color: var(--text); font-size: 1.08rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.portfolio-stat small { color: var(--muted-2); font-size: .62rem; line-height: 1.35; }
.count-stat { padding-left: 13px; }
.count-stat strong { font-size: 1.22rem; }

.account-switcher { padding: 14px; margin-bottom: 0; border: 1px solid #cfdae6; border-radius: 13px; background: linear-gradient(145deg, #f3f7fb, #edf3f8); }
.account-switcher > label { display: block; margin-bottom: 7px; color: var(--blue-dark); font-size: .74rem; font-weight: 800; line-height: 1.35; }
.account-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px; }
.account-controls select { min-width: 0; padding: 9px 40px 9px 10px; border: 1px solid #b8cee2; border-radius: 8px; appearance: none; -webkit-appearance: none; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%23657084' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; background-size: 12px 8px; color: var(--text); font-size: .88rem; font-weight: 750; line-height: 1.3; outline: none; }
.account-controls select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,91,138,.11); }
.account-controls button { padding: 0 9px; border: 1px solid #b8cee2; border-radius: 8px; background: #fff; color: var(--blue-dark); font-size: .71rem; font-weight: 750; }
.account-controls button:hover { border-color: var(--blue); }
.account-controls button.danger { color: var(--amber); }
.account-editor { margin-top: 9px; padding-top: 9px; border-top: 1px solid #c9dcef; }
.account-editor[hidden] { display: none; }
.account-editor label { display: block; margin-bottom: 6px; color: var(--blue-dark); font-size: .72rem; font-weight: 800; }
.account-editor > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.account-editor input { padding: 9px 10px; border-color: #b8cee2; }
.account-editor button { padding: 0 11px; border: 1px solid #b8cee2; border-radius: 8px; background: #fff; color: var(--blue-dark); font-size: .7rem; font-weight: 750; }
#account-save { border-color: var(--blue-dark); background: var(--blue-dark); color: #fff; }
#account-save:hover { background: #183b61; }

.total-form { min-width: 0; padding: 11px 13px; margin-bottom: 0; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 12px; }
.total-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.total-form label { display: block; }
.total-form label span { display: block; font-size: .8rem; font-weight: 800; line-height: 1.3; }
.total-form label small { display: block; margin-top: 3px; color: var(--muted); font-size: .67rem; line-height: 1.4; }
.total-current { flex: 0 0 auto; text-align: right; }
.total-current strong { display: block; margin-top: 3px; color: var(--blue-dark); font-size: .88rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.total-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#holding-form { display: grid; grid-template-columns: minmax(240px, 1.55fr) minmax(120px, .65fr) minmax(120px, .65fr) auto; gap: 9px; margin: 3px 0 1px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.stock-picker { position: relative; min-width: 0; }
.stock-picker > input:not([type="hidden"]) { width: 100%; }
.selected-stock { margin-top: 5px; padding-left: 3px; color: var(--blue); font-size: .7rem; }
input { min-width: 0; background: #fff; border: 1px solid var(--line-strong); color: var(--text); border-radius: 9px; padding: 10px 11px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder { color: var(--muted-2); }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,91,138,.11); }
.save-total, .primary, .save-edit, .cancel-edit, .run { min-height: 40px; border-radius: 9px; padding: 0 14px; font-weight: 750; transition: background .15s, border-color .15s, transform .15s; }
.primary, .save-edit { border: 1px solid var(--blue-dark); background: var(--blue-dark); color: #fff; }
.primary:hover, .save-edit:hover { background: #183b61; }
.save-total, .cancel-edit { border: 1px solid var(--line-strong); background: #fff; color: var(--text); }
.save-total:hover, .cancel-edit:hover { background: var(--panel-soft); }

.stock-suggestions { position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; right: 0; max-height: 250px; overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 16px 36px rgba(16,24,40,.14); }
.stock-suggestions button { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 8px; width: 100%; padding: 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; }
.stock-suggestions button:hover, .stock-suggestions button:focus { background: var(--blue-soft); outline: none; }
.stock-suggestions button strong { font-size: .78rem; color: var(--blue-dark); }
.stock-suggestions button span { font-size: .82rem; }
.stock-suggestions button small, .suggestion-empty { color: var(--muted); font-size: .72rem; }
.suggestion-empty { padding: 12px 10px; }
.portfolio-error { min-height: 0; color: var(--amber); font-size: .74rem; line-height: 1.5; }
.portfolio-error:not(:empty) { padding: 9px 11px; border: 1px solid #fed7aa; border-radius: 9px; background: var(--amber-soft); }
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 26px 14px; background: var(--panel-soft); color: var(--muted); text-align: center; line-height: 1.6; font-size: .82rem; }

#holdings-list:not(.empty) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.holding-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s; }
.holding-row:hover { border-color: #c5d2df; box-shadow: 0 7px 20px rgba(31,47,66,.055); transform: translateY(-1px); }
.stock { font-size: .94rem; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.stock-code { margin-left: 5px; color: var(--muted-2); font-size: .66rem; font-weight: 650; }
.meta { font-size: .74rem; color: var(--muted); margin-top: 5px; line-height: 1.55; }
.holding-performance { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 11px; }
.holding-performance > div { padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.holding-performance span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.holding-performance strong { font-size: .86rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.quote-time { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; margin-top: 7px; color: var(--muted-2); font-size: .63rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.flat-text { color: #667085; }
.row-actions { display: flex; align-items: flex-start; gap: 2px; }
.edit, .delete { border: 0; background: transparent; color: var(--muted); padding: 4px 6px; font-size: .72rem; }
.edit:hover { color: var(--blue); }
.delete:hover { color: var(--amber); }
.edit-form { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr auto auto; align-items: end; gap: 8px; padding: 12px; margin-top: 2px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; }
.edit-form[hidden] { display: none; }
.edit-form label { color: var(--muted); font-size: .7rem; }
.edit-form input { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; }

.market-pulse { margin-top: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.pulse-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pulse-head span { display: block; color: var(--muted); font-size: .66rem; line-height: 1.35; margin-bottom: 3px; }
.pulse-head strong { font-size: .9rem; line-height: 1.25; }
.pulse-head > b { font-size: .77rem; color: #475467; line-height: 1.3; }
.pulse-head em { font-style: normal; font-size: 1.08rem; margin-left: 3px; }
.market-pulse.bullish .pulse-head > b, .up-text { color: var(--up); }
.market-pulse.bearish .pulse-head > b, .down-text { color: var(--down); }
.pulse-bar { position: relative; height: 5px; margin: 11px 0; overflow: hidden; border-radius: 999px; background: linear-gradient(90deg, var(--down) 0 45%, #d0d5dd 45% 55%, var(--up) 55% 100%); opacity: .75; }
.pulse-bar i { position: absolute; top: -3px; left: var(--score); width: 3px; height: 11px; transform: translateX(-50%); border-radius: 3px; background: #101828; box-shadow: 0 0 0 2px #fff; }
.pulse-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pulse-stats > div { min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pulse-stats span { display: block; color: var(--muted); font-size: .63rem; line-height: 1.35; margin-bottom: 3px; }
.pulse-stats strong { font-size: .8rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.pulse-stats i { font-style: normal; }
.margin-factor { margin-top: 10px; padding: 10px; border: 1px solid #d7e2ed; border-radius: 9px; background: #f7faff; }
.margin-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.margin-title span { display: block; color: var(--muted); font-size: .62rem; line-height: 1.35; margin-bottom: 2px; }
.margin-title strong, .margin-title > b { font-size: .76rem; line-height: 1.3; }
.margin-title > b { color: #475467; }
.margin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.margin-stats > div { min-width: 0; padding: 7px; border-radius: 7px; background: #fff; border: 1px solid var(--line); }
.margin-stats span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .61rem; line-height: 1.35; }
.margin-stats strong { font-size: .74rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.margin-stats i { font-style: normal; }
.crowding-high { color: var(--amber); }
.crowding-medium { color: #b26a00; }
.crowding-low { color: var(--blue); }
.market-pulse .margin-warning { color: var(--amber); }
.margin-factor.unavailable { background: var(--amber-soft); border-color: #fedf89; }
.market-pulse p { margin: 9px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.55; }
.market-pulse.unavailable { border-color: #fedf89; background: var(--amber-soft); }
.market-pulse.unavailable .pulse-head > b { color: var(--amber); }

.community-panel { margin-top: 11px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-soft); }
.community-panel[open] { border-color: #cbd9e8; background: #f7faff; }
.community-panel summary { cursor: pointer; font-size: .8rem; font-weight: 750; color: #344054; }
.community-panel p { color: var(--muted); font-size: .73rem; line-height: 1.6; }
.community-panel input[type="file"] { width: 100%; padding: 8px; font-size: .72rem; }
.community-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 9px; }
.community-actions button, .community-actions a { border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; background: #fff; color: #344054; font-size: .71rem; font-weight: 700; text-decoration: none; }
.community-actions button:hover, .community-actions a:hover { border-color: #9fb7cf; background: var(--blue-soft); }
.community-status { margin-top: 9px; font-size: .72rem; color: var(--blue-dark); }
.community-panel small { display: block; margin-top: 7px; color: var(--muted); font-size: .66rem; line-height: 1.5; }
.analysis-action { margin-top: 11px; padding: 13px; border: 1px solid #d1dce7; border-radius: 13px; background: linear-gradient(145deg, #f7fafd, #eff5fa); }
.run { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 0; border: 1px solid var(--blue-dark); background: var(--blue-dark); color: #fff; box-shadow: 0 7px 18px rgba(29,63,99,.17); }
.run i { font-style: normal; font-size: 1rem; transition: transform .15s; }
.run:hover { background: #183b61; transform: translateY(-1px); }
.run:hover i { transform: translateX(3px); }
.run:disabled { opacity: .55; cursor: wait; transform: none; }
.job { font-size: .74rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.model-status { display: inline-block; font-size: .72rem; color: var(--amber); margin-top: 5px; padding: 4px 7px; border-radius: 6px; background: var(--amber-soft); }
.model-status.ready { color: var(--blue-dark); background: var(--blue-soft); }
.error { color: var(--amber); background: var(--amber-soft); border-radius: 7px; font-size: .78rem; margin-top: 8px; line-height: 1.5; }
.error:not(:empty) { padding: 8px 10px; }

.analysis-area { min-width: 0; }
.analysis-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 2px 18px; }
.analysis-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 330px); align-items: center; gap: 14px; margin: 0 0 12px; padding: 14px 16px; }
.analysis-toolbar .run { min-height: 46px; }
.analysis-toolbar .job { margin-top: 0; font-weight: 650; }
.analysis-toolbar .model-status { margin-top: 6px; }
.analysis-toolbar .error { grid-column: 1 / -1; margin-top: 0; }
.quota-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.quota-status { color: var(--blue-dark); font-size: .74rem; font-weight: 800; }
#quota-request { padding: 6px 10px; border: 1px solid #b8cee2; border-radius: 8px; background: #fff; color: var(--blue-dark); font-size: .68rem; font-weight: 800; }
#quota-request:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
#quota-request:disabled { color: var(--muted); cursor: default; opacity: .75; }
.admin-quota-panel { margin: 0 0 14px; padding: 16px; border: 1px solid #d7e2ed; border-radius: 14px; background: #f7faff; }
.admin-quota-panel[hidden] { display: none; }
.admin-quota-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-quota-head span { display: block; color: var(--muted); font-size: .59rem; font-weight: 800; letter-spacing: .13em; }
.admin-quota-head strong { display: block; margin-top: 3px; font-size: .88rem; }
.admin-quota-head button { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--blue-dark); font-size: .68rem; font-weight: 750; }
.admin-quota-list { display: grid; gap: 8px; }
.empty-admin-list { padding: 13px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: .72rem; text-align: center; }
.quota-request-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.quota-request-row strong, .quota-request-row span, .quota-request-row small { display: block; }
.quota-request-row strong { font-size: .8rem; }
.quota-request-row span { margin-top: 3px; color: #475467; font-size: .7rem; }
.quota-request-row small { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.quota-request-row > div:last-child { display: flex; gap: 6px; }
.quota-request-row button { padding: 7px 11px; border: 1px solid var(--blue-dark); border-radius: 7px; background: var(--blue-dark); color: #fff; font-size: .68rem; font-weight: 800; }
.quota-request-row button.reject { border-color: #f3b7b3; background: #fff; color: var(--up); }
.pipeline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .67rem; font-weight: 700; }
.pipeline span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.85); }
.pipeline i { width: 18px; height: 1px; background: var(--line-strong); }
.report { padding: 30px; min-height: 570px; }
.report-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.date { font-size: .72rem; color: var(--muted); }
.headline { font-size: clamp(1.42rem, 2.5vw, 2rem); line-height: 1.38; letter-spacing: -.03em; margin: 8px 0 0; max-width: 980px; }
.risk { align-self: flex-start; padding: 6px 9px; border-radius: 7px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.risk-high { background: #fff4e8; color: #b54708; border: 1px solid #fedf89; }
.risk-medium { background: #fffbea; color: #8a6100; border: 1px solid #f5df8c; }
.risk-low { background: var(--blue-soft); color: var(--blue-dark); border: 1px solid #c9dcef; }
.section-label { margin-top: 18px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .09em; }
.holdings-label { margin: 22px 0 9px; }
.overview { margin-top: 8px; padding: 18px 20px; border-left: 3px solid var(--blue); background: var(--panel-soft); border-radius: 4px 12px 12px 4px; color: #344054; font-size: .9rem; line-height: 1.82; }
.stock-cards { display: grid; gap: 11px; }
.stock-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; padding: 19px 20px; background: #fff; box-shadow: 0 3px 13px rgba(31,47,66,.025); }
.stock-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-strong); }
.stock-card.bullish::before { background: var(--up); }
.stock-card.bearish::before { background: var(--down); }
.stock-card.neutral::before { background: #98a2b3; }
.stock-top { display: flex; justify-content: space-between; gap: 14px; }
.stock-name { font-size: 1rem; font-weight: 800; }
.action { color: #344054; font-size: .82rem; margin-top: 7px; line-height: 1.65; }
.action > span { display: inline-block; margin-right: 7px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 5px; padding: 1px 5px; font-size: .65rem; font-weight: 800; vertical-align: 1px; }
.stance { align-self: flex-start; font-size: .72rem; font-weight: 800; padding: 5px 8px; border-radius: 999px; white-space: nowrap; }
.stance.bullish { background: var(--up-soft); color: var(--up); border: 1px solid var(--up-line); }
.stance.neutral { background: #f2f4f7; color: #475467; border: 1px solid #e4e7ec; }
.stance.bearish { background: var(--down-soft); color: var(--down); border: 1px solid var(--down-line); }
.stock-summary { color: #475467; line-height: 1.72; font-size: .86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .7rem; border-radius: 6px; padding: 5px 7px; line-height: 1.45; }
.chip.catalyst { color: #b42318; border: 1px solid var(--up-line); background: var(--up-soft); }
.chip.risk-chip { color: #06713a; border: 1px solid var(--down-line); background: var(--down-soft); }
.stock-card details { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 11px; }
.stock-card summary { cursor: pointer; color: var(--blue); font-size: .76rem; font-weight: 650; }
.agent-grid { display: grid; gap: 0; margin-top: 11px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.agent-grid > div { display: grid; grid-template-columns: 4.2rem 1fr; gap: 10px; padding: 10px; border-top: 1px solid var(--line); font-size: .78rem; line-height: 1.58; }
.agent-grid > div:first-child { border-top: 0; }
.agent-grid > div:nth-child(odd) { background: var(--panel-soft); }
.agent-grid b { color: #344054; }
.agent-bull b { color: var(--up); }
.agent-bear b { color: var(--down); }
.agent-grid span { color: #52606f; }
.kelly-area { min-width: 0; }
.kelly-heading { margin-bottom: 18px; }
.kelly-route { margin-top: 0; padding: 24px; border: 1px solid #d7d5e6; border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 12px 36px rgba(53,49,88,.045); }
.kelly-route.pending { border-style: dashed; background: rgba(255,255,255,.72); }
.kelly-route.pending .kelly-route-head > b { background: #667085; }
.kelly-empty { min-height: 150px; display: grid; place-content: center; gap: 7px; text-align: center; color: var(--muted); }
.kelly-empty strong { color: var(--text); font-size: .95rem; }
.kelly-empty span { font-size: .76rem; }
.kelly-route-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.kelly-route-head span { color: var(--muted); font-size: .65rem; }
.kelly-route-head h3 { margin: 4px 0 0; font-size: 1.02rem; }
.kelly-route-head > b { padding: 5px 8px; border-radius: 999px; background: var(--blue); color: #fff; font-size: .66rem; }
.kelly-method { margin: 10px 0 13px; color: #52606f; font-size: .76rem; line-height: 1.65; }
.kelly-cards { display: grid; gap: 10px; }
.kelly-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.kelly-card.unavailable { background: var(--amber-soft); border-color: #fedf89; }
.kelly-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kelly-card-head strong { display: block; font-size: .87rem; }
.kelly-card-head small { margin-left: 4px; color: var(--muted); font-size: .64rem; }
.kelly-card-head span { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; }
.kelly-card-head > b { color: var(--blue-dark); font-size: 1.12rem; }
.kelly-weight { display: grid; grid-template-columns: 1fr auto 1.35fr; align-items: center; gap: 10px; margin: 10px 0; padding: 9px 10px; border-radius: 8px; background: var(--panel-soft); }
.kelly-weight span, .kelly-metrics span { display: block; color: var(--muted); font-size: .61rem; margin-bottom: 3px; }
.kelly-weight strong { font-size: .78rem; }
.kelly-weight i { color: var(--muted-2); font-style: normal; }
.kelly-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.kelly-metrics > div { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; }
.kelly-metrics strong { font-size: .7rem; font-variant-numeric: tabular-nums; }
.kelly-card > p { margin: 9px 0 0; color: var(--muted); font-size: .64rem; line-height: 1.55; }
.kelly-route details { margin-top: 12px; border-top: 1px solid #d7e2ed; padding-top: 10px; }
.kelly-route summary { cursor: pointer; color: var(--blue); font-size: .72rem; font-weight: 700; }
.kelly-notes { margin-top: 9px; color: #52606f; font-size: .68rem; line-height: 1.55; }
.kelly-notes code { display: block; padding: 8px; border-radius: 7px; background: #fff; color: var(--blue-dark); white-space: normal; }
.kelly-notes p { margin: 6px 0 0; }
.sources { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; line-height: 1.55; }
.waiting { min-height: 420px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.waiting strong { display: block; color: var(--text); margin: 16px 0 7px; }
.orb { width: 64px; height: 64px; border: 1px solid #cdd9e6; border-radius: 50%; margin: auto; position: relative; background: var(--blue-soft); }
.orb::after { content: ""; position: absolute; inset: 13px; border: 3px solid var(--blue); border-top-color: transparent; border-radius: 50%; }
.working .orb::after { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { color: var(--muted); font-size: .7rem; line-height: 1.65; margin: 18px 4px 0; text-align: center; }

@media (max-width: 1080px) {
  .portfolio-layout { grid-template-columns: 1fr; }
  .portfolio-sidebar { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 920px) {
  .top { align-items: center; }
  .analysis-heading { align-items: flex-start; }
  .pipeline { display: none; }
  #holdings-list:not(.empty) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .auth-screen { padding: 16px; }
  .auth-card { padding: 27px 22px; border-radius: 19px; }
  .shell { padding: 20px 13px 42px; }
  .top { display: block; margin-bottom: 18px; }
  .header-side { justify-items: start; margin-top: 15px; }
  .clock { text-align: left; }
  .market-legend { flex-wrap: wrap; }
  .session-actions { justify-content: flex-start; flex-wrap: wrap; }
  .card { border-radius: 13px; }
  .workspace-section, .holdings, .report { padding: 17px; }
  .card-head { align-items: flex-start; gap: 12px; padding-bottom: 17px; }
  .badge { white-space: nowrap; }
  .portfolio-layout { margin-top: 18px; padding: 16px; }
  .portfolio-primary { grid-template-columns: 1fr; }
  .portfolio-primary > .subsection-title, .account-switcher, .portfolio-overview, #holding-form, #holdings-list { grid-column: auto; }
  .portfolio-overview { grid-template-columns: minmax(92px, .58fr) minmax(150px, 1.15fr); }
  .portfolio-overview .total-form { grid-column: 1 / -1; }
  #holding-form { grid-template-columns: 1fr 1fr; }
  .name { grid-column: 1 / -1; }
  .primary { min-height: 42px; }
  #holdings-list:not(.empty) { grid-template-columns: 1fr; }
  .edit-form { grid-template-columns: 1fr 1fr; }
  .save-edit, .cancel-edit { width: 100%; }
  .report-head, .stock-top { display: block; }
  .analysis-toolbar { grid-template-columns: 1fr; }
  .analysis-toolbar .run { grid-row: 1; }
  .analysis-status { grid-row: 2; }
  .analysis-toolbar .error { grid-column: auto; }
  .quota-request-row { align-items: flex-start; flex-direction: column; }
  .risk, .stance { display: inline-block; margin-top: 11px; }
  .agent-grid > div { grid-template-columns: 1fr; gap: 4px; }
  .kelly-route { padding: 14px; }
  .kelly-metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 410px) {
  #holding-form, .edit-form, .kelly-metrics { grid-template-columns: 1fr; }
  .name { grid-column: auto; }
  .account-controls { grid-template-columns: 1fr 1fr 1fr; }
  .account-controls select { grid-column: 1 / -1; }
  .account-editor > div { grid-template-columns: 1fr 1fr; }
  .account-editor input { grid-column: 1 / -1; }
}
