:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #64717f;
  --line: #dbe1e7;
  --accent: #176b87;
  --accent-strong: #0f5068;
  --good: #137a4b;
  --bad: #b3261e;
  --warn: #9a6200;
  --shadow: 0 12px 28px rgba(28, 43, 56, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.access-warning {
  padding: 12px 18px;
  background: #fff1d6;
  color: #6f4300;
  border-bottom: 1px solid #f2c46d;
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  background: #13202a;
  color: #f7fbff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f0b429;
  color: #17212b;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p {
  margin-top: 4px;
  color: #adbac5;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  color: #d5dde5;
  text-align: left;
  text-decoration: none;
}

.nav-item.is-active {
  background: #203241;
  color: #ffffff;
}

.side-panel {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

body[data-view="trades"] .side-panel {
  display: none;
}

.side-panel label {
  color: #c6d0da;
  font-size: 13px;
}

.side-panel input {
  width: 100%;
  padding: 10px;
  border: 1px solid #3b5061;
  border-radius: 8px;
  background: #0f1820;
  color: #ffffff;
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-file-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.primary-file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-file-button:hover {
  background: var(--accent-strong);
}

.upload-trigger {
  display: inline-grid;
  place-items: center;
}

.upload-date-control {
  display: grid;
  gap: 3px;
  min-width: 142px;
  color: #627180;
  font-size: 11px;
  font-weight: 800;
}

.upload-date-control input {
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.hidden-file-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.ghost-button {
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.content {
  padding: 30px;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.heading-actions .ghost-button {
  border: 1px solid #c9d8e0;
  background: #ffffff;
  color: var(--accent);
  font-weight: 700;
}

.heading-actions .ghost-button:hover {
  border-color: #9fc4d8;
  background: #f3f8fb;
}

#import-sample-image,
#refresh-stock-change,
#add-trade {
  display: none;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.score-pill {
  display: grid;
  place-items: center;
  min-width: 98px;
  min-height: 72px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.score-pill span {
  color: var(--muted);
  font-size: 13px;
}

.score-pill strong {
  font-size: 28px;
}

.grid {
  display: grid;
  gap: 14px;
}

.market-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.panel-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.wide-field {
  grid-column: 1 / -1;
}

.trade-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.mindset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wisdom-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.wisdom-strip div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(28, 43, 56, 0.05);
}

.wisdom-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wisdom-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 17px;
}

.practice-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.practice-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 94px;
  padding: 12px;
  border: 1px solid #dce5eb;
  border-radius: 8px;
  background: #fbfdfe;
}

.practice-item span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #e8f2f6;
  color: var(--accent-strong);
  font-weight: 800;
}

.practice-item p {
  margin: 0;
  color: #3f4a54;
  font-size: 13px;
  line-height: 1.5;
}

.mantra-panel {
  display: grid;
  gap: 16px;
  margin-top: 8px;
  padding: 20px;
  border: 1px solid #e2e9ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(28, 43, 56, 0.04);
}

.mantra-heading-actions {
  position: relative;
  align-items: flex-start;
  min-width: min(520px, 56vw);
}

.mantra-toggle-button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.mantra-composer {
  position: absolute;
  z-index: 12;
  top: 46px;
  right: 0;
  width: min(520px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid #d9e3eb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(28, 43, 56, 0.14);
}

.mantra-composer[hidden] {
  display: none;
}

.mantra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mantra-head h3,
.mantra-head p {
  margin: 0;
}

.mantra-head h3 {
  color: #22313f;
  font-size: 18px;
  font-weight: 750;
}

.mantra-head p {
  margin-top: 4px;
  color: #7a8793;
  font-size: 13px;
}

.mantra-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: start;
}

.mantra-input-row input,
.mantra-input-row textarea {
  min-width: 0;
  min-height: 44px;
  max-height: 168px;
  padding: 10px 12px;
  border-color: #d7e0e7;
  background: #fff;
  color: #26333f;
  -webkit-text-fill-color: #26333f;
  caret-color: var(--accent);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  opacity: 1;
  resize: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-wrap;
}

.mantra-input-row input:focus,
.mantra-input-row textarea:focus {
  background: #fff;
  color: #26333f;
  -webkit-text-fill-color: #26333f;
  border-color: #86b7ca;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.1);
}

.mantra-input-row input::placeholder,
.mantra-input-row textarea::placeholder {
  color: #8b98a5;
  -webkit-text-fill-color: #8b98a5;
}

.mantra-input-row .primary-button {
  min-height: 44px;
}

.mantra-list {
  display: grid;
  gap: 0;
  border-top: 1px solid #edf1f4;
}

.mantra-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 128px;
  align-items: start;
  gap: 14px;
  min-height: 64px;
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid #edf1f4;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.mantra-row span,
.mantra-row em {
  color: #8a929a;
  font-size: 12px;
  font-style: normal;
}

.mantra-row .mantra-number {
  display: block;
  width: auto;
  height: auto;
  padding-top: 2px;
  border-radius: 0;
  background: transparent;
  color: #7690a0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.7;
  text-align: right;
}

.mantra-row strong {
  display: block;
  color: #26313b;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.75;
}

.mantra-content {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.mantra-content em {
  width: fit-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #92a0aa;
  font-size: 12px;
  font-weight: 500;
}

.mantra-edit-input {
  display: none;
  min-height: 68px;
  border: 1px solid #c9d8e0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.55;
}

.mantra-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: start;
}

.mantra-actions .ghost-light-button {
  min-height: 30px;
  padding: 0 9px;
  border-color: #d9e2e8;
  border-radius: 6px;
  color: #496170;
  font-size: 12px;
  font-weight: 650;
}

.mantra-row.is-editing {
  margin: 0 -10px;
  padding: 15px 10px;
  border-color: #dbe8ee;
  border-radius: 8px;
  background: #f7fbfd;
}

.mantra-row.is-editing .mantra-content strong {
  display: none;
}

.mantra-row.is-editing .mantra-content em {
  display: none;
}

.mantra-row.is-editing .mantra-edit-input,
.mantra-row.is-editing .mantra-save-button,
.mantra-row.is-editing .mantra-cancel-button {
  display: block;
}

.mantra-row.is-editing .mantra-edit-button {
  display: none;
}

.empty-mantra {
  padding: 12px;
  border: 1px dashed #cfdbe3;
  border-radius: 6px;
  color: var(--muted);
  background: #fbfdfe;
}

.mantra-status {
  display: none;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #eef7fa;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.mantra-status.is-visible {
  display: block;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
}

.trade-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(28, 43, 56, 0.06);
}

.trade-card,
.report-output {
  background: var(--panel);
}

.holding-table-head,
.holding-group {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 58px;
  align-items: stretch;
}

.bulk-ocr-status {
  display: none;
}

.bulk-ocr-status.is-visible {
  display: block;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #d5e7ef;
  border-radius: 6px;
  background: #eef7fa;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.holding-table-head {
  min-height: 48px;
  padding: 0 16px;
  color: #8a929a;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  background: #fbfcfd;
}

.holding-table-head span:nth-child(2) {
  padding-left: 10px;
}

.holding-group {
  min-height: 104px;
  padding: 0 16px;
  border-bottom: 1px solid #eef2f5;
}

.holding-group:last-child {
  border-bottom: 0;
}

.holding-group {
  border-top: 10px solid #f2f4f6;
}

.holding-group:first-child {
  border-top: 0;
}

.holding-cell {
  display: grid;
  gap: 6px;
  padding-right: 12px;
}

.holding-group input,
.holding-group select,
.holding-group textarea {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 28px;
}

.holding-group input:focus,
.holding-group select:focus,
.holding-group textarea:focus {
  outline: 0;
}

.holding-group input[readonly],
.holding-group select:disabled {
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: currentcolor;
}

.group-summary {
  display: grid;
  align-content: center;
  gap: 10px;
  grid-column: 1;
  min-width: 0;
  padding: 18px 24px 18px 0;
}

.summary-field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}

.summary-field span {
  color: #9aa3ac;
  font-weight: 700;
}

.group-stocks {
  grid-column: 2;
  min-width: 0;
}

.stock-line {
  display: grid;
  grid-template-columns: minmax(112px, 0.58fr) 52px minmax(0, 1.8fr);
  align-items: center;
  min-height: 72px;
  gap: 7px;
  border-bottom: 1px solid #f1f3f5;
}

.stock-line:last-child {
  border-bottom: 0;
}

.group-image {
  display: grid;
  align-content: center;
  gap: 10px;
  grid-column: 3;
  padding: 16px 0 16px 6px;
  justify-items: start;
}

.holding-date {
  color: #58616a;
  font-size: 19px;
  line-height: 1.1;
}

.holding-return {
  font-size: 23px;
  font-weight: 800;
}

.holding-day-pnl {
  font-size: 21px;
  font-weight: 800;
}

.holding-asset,
.holding-net-asset,
.holding-total-market-value,
.holding-equity-asset,
.stock-change,
.stock-close,
.trade-qty,
.holding-cost-now,
.holding-position-pnl,
.holding-daily-pnl,
.trade-point-score {
  color: #8a929a;
  font-size: 13px;
}

.holding-value-cell {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 40px minmax(96px, 1fr) minmax(132px, 1.3fr);
  align-items: center;
  gap: 3px 8px;
  padding: 6px 0;
  min-width: 0;
}

.holding-value-cell input {
  min-width: 0;
}

.holding-position-pnl {
  grid-column: 3;
}

.holding-daily-pnl {
  display: none;
}

.trade-point-score {
  grid-column: 4;
  color: var(--accent-strong);
  font-weight: 800;
}

.holding-reason-field {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0 0 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #f7fafc;
  color: #8a929a;
}

.holding-reason-field span {
  padding-top: 5px;
  font-size: 13px;
  font-weight: 800;
}

.holding-reason {
  width: 100%;
  min-height: 28px;
  max-height: none;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
  resize: none;
}

.holding-reason:focus {
  background: transparent;
  box-shadow: none;
}

.holding-position-pnl,
.holding-daily-pnl {
  font-weight: 700;
}

.is-up {
  color: var(--bad);
}

.is-down {
  color: var(--good);
}

.stock-name {
  color: #2c76c7;
  font-size: 17px;
  font-weight: 700;
}

.stock-change {
  margin-top: 2px;
  font-weight: 800;
}

.stock-close {
  margin-top: 0;
  color: #8a929a;
}

.trade-side {
  font-size: 18px;
  font-weight: 800;
}

.trade-side:has(option[value="买入"]:checked) {
  color: var(--bad);
}

.trade-side:has(option[value="卖出"]:checked) {
  color: #32b24a;
}

.holding-market-value {
  color: #202833;
  font-size: 18px;
}

.holding-image-cell {
  position: relative;
  align-items: center;
}

.image-detail-button,
.image-upload-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  color: #2c76c7;
  cursor: pointer;
  font-size: 15px;
  background: #f3f8fb;
}

.image-detail-button:disabled {
  color: #a3adb5;
  cursor: default;
  background: #f2f4f6;
}

.image-upload-button input {
  display: none;
}

.ocr-status {
  padding: 5px 7px;
  border-radius: 8px;
  background: #edf5f8;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.trade-image-preview {
  display: none;
  max-width: 100%;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.trade-image-preview.is-visible {
  display: block;
}

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 23, 31, 0.62);
}

.image-modal-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(9, 18, 28, 0.35);
}

.image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.image-modal-close {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

#image-modal-preview {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 57px);
  margin: auto;
  object-fit: contain;
  background: #f7f9fb;
}

.ghost-light-button {
  display: none;
  width: fit-content;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

.ghost-light-button.is-visible {
  display: inline-block;
}

.icon-button {
  width: 30px;
  min-height: 30px;
  background: #edf1f4;
  color: #4d5b68;
  font-size: 18px;
}

.report-output {
  min-height: 520px;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.7;
  color: #26323d;
  overflow: auto;
}

.report-status {
  display: none;
  margin: -8px 0 12px;
  padding: 9px 12px;
  border: 1px solid #d5e7ef;
  border-radius: 6px;
  background: #eef7fa;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.report-status.is-visible {
  display: block;
}

.report-reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 92px minmax(0, 220px) 92px;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px 0;
  background: var(--bg);
}

.report-step-button,
.report-date-picker input {
  height: 42px;
  border: 1px solid #cbd8df;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.report-step-button {
  cursor: pointer;
}

.report-step-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.report-date-picker {
  display: grid;
  gap: 5px;
}

.report-date-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-date-picker input {
  width: 100%;
  padding: 0 12px;
  font-size: 15px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.report-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}

.report-item,
.empty-report {
  flex: 0 0 168px;
  width: 168px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.report-item {
  cursor: pointer;
}

.report-item.is-active {
  border-color: var(--accent);
  background: #eef7fa;
}

.report-item strong,
.report-item span,
.report-item small {
  display: block;
}

.report-item strong {
  font-size: 15px;
  line-height: 1.25;
}

.report-item span {
  display: -webkit-box;
  min-height: 36px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.report-item small {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--accent-strong);
  font-weight: 800;
}

.report-item small b {
  font: inherit;
}

.report-item small em {
  border-radius: 999px;
  background: #f3f7f9;
  color: #60717d;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
}

.empty-report {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  color: var(--muted);
  font-weight: 700;
}

.risk-control-panel {
  display: grid;
  gap: 14px;
}

.risk-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(28, 43, 56, 0.06);
}

.risk-hero span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.risk-hero strong {
  color: #1f2b36;
  font-size: 36px;
  line-height: 1.1;
}

.risk-hero em {
  justify-self: end;
  border-radius: 999px;
  background: #eef7fa;
  color: var(--accent-strong);
  font-style: normal;
  font-size: 18px;
  font-weight: 900;
  padding: 8px 12px;
}

.risk-hero p {
  grid-column: 1 / -1;
  margin: 0;
  color: #5f6f7a;
  font-weight: 700;
  line-height: 1.55;
}

.risk-danger .risk-hero {
  border-color: #f0b8b8;
  background: #fff7f6;
}

.risk-danger .risk-hero strong {
  color: #b62828;
}

.risk-warning .risk-hero {
  border-color: #efd08d;
  background: #fffaf0;
}

.risk-warning .risk-hero strong {
  color: #9b6715;
}

.risk-safe .risk-hero strong {
  color: #16805a;
}

.risk-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.risk-metric {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.risk-metric span,
.risk-reference h3,
.risk-columns h3 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.risk-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.risk-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.risk-columns section,
.risk-reference {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.risk-columns h3,
.risk-reference h3 {
  margin: 0 0 10px;
}

.risk-signal-list {
  display: grid;
  gap: 8px;
}

.risk-signal {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 8px;
  background: #f6f8fa;
  border-left: 4px solid #9aa8b2;
}

.risk-signal strong {
  color: var(--ink);
  font-size: 15px;
}

.risk-signal span {
  color: #667783;
  font-size: 13px;
  line-height: 1.5;
}

.risk-signal.is-danger {
  background: #fff4f3;
  border-left-color: #d23b3b;
}

.risk-signal.is-warning {
  background: #fff8e8;
  border-left-color: #d29522;
}

.risk-signal.is-safe {
  background: #eefaf5;
  border-left-color: #20a978;
}

.risk-indicator-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.risk-record-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.risk-tech-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.risk-indicator-list article,
.risk-record-list article,
.risk-tech-list article {
  padding: 11px;
  border-radius: 8px;
  background: #f7fafc;
}

.risk-indicator-list strong,
.risk-record-list strong,
.risk-tech-list strong {
  display: block;
  color: #1f2b36;
  font-size: 14px;
}

.risk-record-list em,
.risk-tech-list em {
  display: block;
  margin-top: 6px;
  color: var(--accent-strong);
  font-style: normal;
  font-size: 18px;
  font-weight: 900;
}

.risk-indicator-list span,
.risk-record-list span,
.risk-tech-list span {
  display: block;
  margin-top: 5px;
  color: #657681;
  font-size: 13px;
  line-height: 1.5;
}

.risk-tech-list article.is-danger em {
  color: #b62828;
}

.risk-tech-list article.is-safe em {
  color: #16805a;
}

.news-control-panel {
  display: none;
  grid-template-columns: 1.2fr 180px 1fr;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.icon-refresh-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid #c9d8e0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.icon-refresh-button:hover {
  border-color: #9fc4d8;
  background: #f3f8fb;
}

.news-radar-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.news-control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 160px;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.news-control-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.news-control-panel input,
.news-control-panel select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d9e4ea;
  border-radius: 7px;
  background: #fbfdfe;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.news-radar-summary {
  display: grid;
  gap: 10px;
}

.news-radar-summary .stat-card {
  padding: 14px;
}

.news-radar-summary .stat-card strong {
  font-size: 24px;
}

.news-radar-list {
  display: grid;
  gap: 10px;
}

.news-radar-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.news-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #9aa3ac;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(28, 43, 56, 0.05);
}

.news-item.is-fresh {
  border-color: #f0b429;
  background: #fffaf0;
}

.news-tone-positive {
  border-left-color: var(--bad);
}

.news-tone-risk {
  border-left-color: var(--good);
}

.news-meta {
  display: grid;
  align-content: start;
  gap: 5px;
}

.news-meta strong {
  display: grid;
  place-items: center;
  width: 44px;
  height: 30px;
  border-radius: 7px;
  background: #eef7fa;
  color: var(--accent-strong);
  font-size: 16px;
}

.news-meta em {
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.news-meta small {
  color: #8a929a;
  font-size: 12px;
  font-weight: 800;
}

.news-meta span,
.news-detail,
.news-title-row time,
.news-body p {
  color: var(--muted);
  font-size: 12px;
}

.news-ai-box {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #dbe7ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.news-brief {
  margin: 5px 0 0;
  color: #3f4a54;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.news-ai-head {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.news-ai-head strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.news-ai-head span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.45;
}

.news-ai-box ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: #3f4a54;
  font-size: 13px;
  line-height: 1.5;
}

.news-ai-box p {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid #e4edf2;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.news-tone-positive .news-ai-head strong {
  color: var(--bad);
}

.news-tone-risk .news-ai-head strong {
  color: var(--good);
}

.news-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.news-title-row a {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.news-title-row a:hover {
  color: var(--accent-strong);
}

.news-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 7px;
  margin-top: 7px;
}

.news-detail span {
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0f4f7;
  color: #52616e;
  font-size: 12px;
  font-weight: 750;
}

.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.news-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f6;
  color: #42505b;
  font-size: 12px;
  font-weight: 800;
}

.news-source-reason {
  margin: 6px 0 0;
  color: #7a8793;
  font-size: 12px;
  line-height: 1.4;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

@media (max-width: 980px) {
  html,
  body {
    min-height: 100%;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .content {
    padding: max(18px, env(safe-area-inset-top)) 10px calc(68px + env(safe-area-inset-bottom));
    transform: translateZ(0);
  }

  .section-heading {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .section-heading h2 {
    font-size: 20px;
    line-height: 1.18;
  }

  .section-heading p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }

  .risk-hero {
    padding: 14px;
  }

  .risk-hero strong {
    font-size: 28px;
  }

  .risk-hero em {
    font-size: 14px;
    padding: 7px 10px;
  }

  .risk-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .risk-metric {
    padding: 10px;
  }

  .risk-metric strong {
    font-size: 13px;
  }

  .risk-columns,
  .risk-indicator-list,
  .risk-record-list,
  .risk-tech-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .risk-columns section,
  .risk-reference {
    padding: 12px;
  }

  #view-mindset .section-heading {
    align-items: flex-start;
  }

  .mantra-heading-actions {
    min-width: 0;
  }

  .mantra-toggle-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .mantra-composer {
    top: 40px;
    right: 0;
    width: calc(100vw - 20px);
    padding: 10px;
  }

  #view-trades .section-heading p {
    display: none;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -5px 14px rgba(15, 31, 41, 0.14);
  }

  .brand {
    display: none;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: 100%;
    min-height: 36px;
    padding: 4px 3px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
  }

  .side-panel {
    margin-top: 8px;
    padding-top: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 6px;
  }

  .side-panel label {
    gap: 4px;
    font-size: 11px;
  }

  .side-panel input,
  .side-panel button {
    min-height: 32px;
    font-size: 12px;
  }

  #view-trades .section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  #view-trades .heading-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 6px;
  }

  #import-sample-image,
  #refresh-stock-change,
  #add-trade {
    display: none;
  }

  #view-trades .heading-actions .primary-button,
  #view-trades .heading-actions .ghost-button,
  #view-trades .primary-file-button {
    min-height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11px;
  }

  #bulk-ocr-status {
    margin-bottom: 6px;
    padding: 6px 8px;
    font-size: 12px;
  }

  #bulk-ocr-status:not(.is-visible) {
    display: none;
  }

  .market-grid,
  .stats-grid,
  .mindset-grid,
  .wisdom-strip,
  .practice-panel,
  .two-column,
  .news-control-panel,
  .news-radar-layout {
    grid-template-columns: 1fr;
  }

  .news-control-panel {
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px;
  }

  .news-radar-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .news-radar-summary .stat-card {
    padding: 10px;
    box-shadow: none;
  }

  .news-radar-summary .stat-card strong {
    font-size: 18px;
  }

  .news-item {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    box-shadow: none;
  }

  .news-meta strong {
    width: 40px;
    height: 32px;
    font-size: 16px;
  }

  .news-ai-box {
    padding: 9px;
    gap: 6px;
  }

  .news-ai-head {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .news-ai-head span {
    font-size: 14px;
  }

  .news-ai-box ul,
  .news-ai-box p {
    font-size: 12px;
  }

  .news-title-row {
    display: grid;
    gap: 4px;
  }

  .news-title-row a {
    font-size: 15px;
  }

  .mantra-panel {
    padding: 12px;
    box-shadow: none;
  }

  .mantra-input-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mantra-input-row input,
  .mantra-input-row textarea {
    height: 168px;
    min-height: 124px;
    max-height: 168px;
    font-size: 16px;
  }

  .mantra-input-row .primary-button {
    justify-self: end;
    width: 84px;
    min-height: 38px;
    font-size: 13px;
  }

  .mantra-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px 10px;
    min-height: 0;
    padding: 12px 0;
  }

  .mantra-row .mantra-number {
    width: auto;
    height: auto;
    padding-top: 1px;
    font-size: 14px;
  }

  .mantra-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .mantra-row strong {
    font-size: 14px;
    line-height: 1.7;
  }

  .holding-table-head {
    display: none;
  }

  .trade-list {
    border-radius: 4px;
    box-shadow: none;
  }

  .holding-group {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 0;
    padding: 0 10px 8px;
    border-top-width: 6px;
    contain: layout paint;
  }

  .group-summary,
  .group-stocks,
  .group-image {
    grid-column: auto;
  }

  .holding-cell,
  .stock-line {
    padding-right: 0;
  }

  .holding-cell:last-child {
    border-bottom: 0;
  }

  .group-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 8px;
    padding: 8px 0 6px;
    border-bottom: 1px solid #edf0f3;
  }

  .summary-field {
    grid-template-columns: 1fr;
    gap: 1px;
    min-width: 0;
  }

  .summary-field span {
    font-size: 11px;
  }

  .holding-date,
  .holding-return,
  .holding-day-pnl,
  .holding-asset,
  .holding-net-asset,
  .holding-total-market-value,
  .holding-equity-asset {
    min-height: 20px;
    font-size: 13px;
    line-height: 1.15;
  }

  .holding-return,
  .holding-day-pnl {
    font-size: 16px;
  }

  .stock-line {
    grid-template-columns: minmax(78px, 0.9fr) 42px minmax(0, 1.55fr);
    align-items: start;
    gap: 5px;
    min-height: 0;
    padding: 7px 0;
    border-bottom: 1px solid #edf0f3;
  }

  .holding-stock-cell {
    min-width: 0;
  }

  .stock-name {
    min-height: 22px;
    font-size: 16px;
    line-height: 1.15;
  }

  .stock-change,
  .stock-close {
    min-height: 18px;
    font-size: 11px;
    line-height: 1.1;
  }

  .trade-side {
    min-height: 24px;
    font-size: 13px;
    font-weight: 800;
  }

  .holding-value-cell {
    grid-template-columns: minmax(70px, 1fr) 30px minmax(82px, 1fr) minmax(76px, 1fr);
    gap: 1px 5px;
    padding: 0;
  }

  .holding-market-value,
  .trade-qty,
  .holding-cost-now,
  .holding-position-pnl,
  .holding-daily-pnl,
  .trade-point-score {
    min-height: 18px;
    font-size: 11px;
    line-height: 1.1;
  }

  .holding-reason-field {
    grid-template-columns: 1fr;
    gap: 3px;
    margin: 2px 0 6px;
    padding: 6px 8px;
    background: #f7fafc;
  }

  .holding-reason-field span {
    padding-top: 0;
    font-size: 10px;
    line-height: 1.2;
  }

  .holding-reason {
    min-height: 24px;
    max-height: none;
    padding: 0;
    font-size: 12px;
    line-height: 1.45;
    overflow: hidden;
    resize: none;
  }

  .group-image {
    padding: 4px 0 0;
    justify-items: end;
  }

  .image-detail-button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  .report-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .report-list {
    display: flex;
    gap: 7px;
  }

  .report-item {
    flex-basis: 138px;
    width: 138px;
    min-height: 82px;
    padding: 9px;
  }

  .report-item strong {
    font-size: 13px;
  }

  .report-item span {
    font-size: 11px;
  }

  .report-item small {
    gap: 5px;
    font-size: 11px;
  }

  .report-item small em {
    padding: 4px 6px;
    font-size: 10px;
  }

  .report-reader-toolbar {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 8px;
  }

  .report-step-button,
  .report-date-picker input {
    height: 38px;
    font-size: 13px;
  }

  .report-output {
    min-height: 420px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.65;
    box-shadow: none;
  }

  .stat-card {
    box-shadow: none;
  }
}
