/* Shared presentation review: prose flows left; compact comparisons center. */
:root {
  --bg: #f3f6f2;
  --muted: #596b62;
  --line: #dce5dc;
  --shadow: 0 4px 24px #19382d07;
}

/* Page and section hierarchy */
.top-title { color: var(--ink); font-weight: 600; }
.top-date, .nav-label, footer { color: var(--muted); }
.nav-label { font-weight: 600; letter-spacing: .6px; }
.nav-item.active { box-shadow: inset 3px 0 #36745c; }
.page-head {
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.page-head > div, .card-head > div, .chart-heading > div { min-width: 0; }
.page-head > .flow-actions { flex-shrink: 0; padding-top: 4px; }
.page-head h1 { font-weight: 750; letter-spacing: -.9px; line-height: 1.3; }
.page-head .sub { max-width: 68ch; font-size: 15px; line-height: 1.8; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; }
.card-head { align-items: flex-start; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.record-performance .card-head { padding-bottom: 17px; }
.card-head h2, .card-body > h2 { font-size: 20px; line-height: 1.5; font-weight: 700; }
.card-head p { font-size: 13px; line-height: 1.8; margin-top: 6px; }
.card-body > h2 { margin-bottom: 18px; }
.account-card-header h2, .rpa-account h3 { overflow-wrap: anywhere; line-height: 1.5; }
.account-card-header > div { min-width: 0; }
.account-card-header > .badge { flex-shrink: 0; }
.form-note, .note, .result-detail p { line-height: 1.8; }
.result-detail p { font-size: 13px; }
.card-body > p, .rpa-account p, .rpa-device p, .health-item p { overflow-wrap: anywhere; }

/* Compact summaries form a common visual anchor on account/result screens. */
.stats > .stat, .kpis > .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}
.stat > span { font-size: 13px; font-weight: 600; }
.stat > strong { margin: 5px 0; line-height: 1.35; }
.stat > small { font-size: 12px; line-height: 1.7; }
.stat .money-dual { align-items: center; text-align: center; }
.stat > small .money-dual { justify-content: center; }
.stat.asset-summary { min-width: 0; }
.stat > .asset-profit { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 6px; }
.asset-profit .money-dual { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 5px; }
.asset-profit .money-krw { font-size: 11px; font-weight: 400; }
.backtest-metrics, .record-metrics { grid-auto-rows: 1fr; }
.backtest-metrics > .stat, .record-metrics > .stat { min-height: 164px; justify-content: center; }
.record-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
.record-performance-heading { margin-bottom: 16px; text-align: center; }
.record-performance-heading h2 { margin-bottom: 4px; font-size: 18px; }
.record-performance-heading p { margin-bottom: 0; font-size: 12px; color: var(--muted); }
.record-performance > .record-metric-guide { margin: 16px 0 0; padding: 0 20px; }
@media (max-width: 760px) { .record-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 380px) { .record-metrics { grid-template-columns: minmax(0,1fr); } }
.record-performance-metrics > div {
  padding: 12px 8px;
  border-radius: 10px;
  background: #f5f8f3;
  text-align: center;
}
.record-performance-metrics dt {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3em;
  font-size: 12px;
  line-height: 1.5;
}
.record-performance-metrics dd { margin-top: 8px; }
.account-facts { gap: 12px; margin: 22px 0; }
.account-facts > div {
  min-width: 0;
  padding: 15px 10px;
  background: #f5f8f3;
  border: 1px solid #e5ece1;
  border-radius: 12px;
  text-align: center;
}
.account-facts dt { font-size: 12px; font-weight: 500; }
.account-facts dd { margin: 7px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.account-facts .money-dual { align-items: center; text-align: center; }
.account-footer { padding-top: 20px; }

/* Tables: clear column labels; descriptive message columns still read left. */
.record-trades > .table-wrap { position: relative; }
.record-trades-table thead th, .calendar-returns-table thead th,
.backtest-results .result-detail thead th,
[data-screen="data"] thead th, [data-screen="admin"] thead th {
  font-weight: 650;
  color: #435d4f;
  background: #eff4eb;
  border-bottom: 1px solid #d5e0d2;
  line-height: 1.6;
}
.record-trades-table tbody tr:hover { background: #f7faf5; }
.record-trades-table th, .record-trades-table td { padding-block: 16px; }
.record-trades-table .record-source-badge { padding: 4px 10px; font-size: 12px; }
.record-source-guide { line-height: 1.8; }
.record-trades .form-note { font-size: 12px; }
.calendar-returns-table thead th { font-size: 11px; }
.calendar-returns-table tbody th small { font-size: 10px; line-height: 1.6; }
.calendar-returns-table .return-missing { color: #697b70; }
.calendar-returns-note { font-size: 12px; line-height: 1.8; }
[data-screen="data"] > section .table-wrap th,
[data-screen="data"] > section .table-wrap td,
[data-screen="data"] > details .table-wrap th:nth-child(-n+3),
[data-screen="data"] > details .table-wrap td:nth-child(-n+3),
[data-screen="admin"] .table-wrap th:nth-child(-n+2),
[data-screen="admin"] .table-wrap td:nth-child(-n+2) {
  text-align: center;
  vertical-align: middle;
}
[data-screen="data"] > details .table-wrap th:last-child,
[data-screen="data"] > details .table-wrap td:last-child,
[data-screen="admin"] .table-wrap th:last-child,
[data-screen="admin"] .table-wrap td:last-child { text-align: left; }
[data-screen="data"] .table-wrap, [data-screen="admin"] .table-wrap { border: 1px solid var(--line); border-radius: 10px; }
[data-screen="data"] .table-wrap th, [data-screen="data"] .table-wrap td,
[data-screen="admin"] .table-wrap th, [data-screen="admin"] .table-wrap td { line-height: 1.7; }

/* Charts retain left-aligned explanations and their original axes/scales. */
.chart-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chart-heading h3 { font-size: 17px; font-weight: 700; line-height: 1.5; }
.chart-heading p { font-size: 13px; line-height: 1.7; }
.chart-toggle, .chart-legend, .chart-range, .chart-caption { font-size: 12px; }
.chart-svg text { fill: #5e7265; }
.chart-readout { padding-top: 13px; line-height: 1.7; }
.result-heading { align-items: flex-start; }
.result-heading h2 { line-height: 1.5; font-weight: 700; }
.result-heading p { font-size: 13px; line-height: 1.75; }
.period-choice { text-align: center; }
.period-choice .period-dates { align-items: center; font-size: 11px; line-height: 1.7; }
.mode-choice > span { text-align: center; }
.backtest-controls .section-label { color: #355b48; }
.backtest-controls .section-label b { background: #e5efe0; color: #355b48; }

/* Forms and operational details remain left aligned and usable with long text. */
.trade-editor { align-items: start; }
.trade-editor .button { align-self: start; margin-top: 28px; }
.field { line-height: 1.6; text-align: left; }
.field input::placeholder, .field textarea::placeholder { color: #69796f; opacity: 1; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #59886a;
  box-shadow: 0 0 0 3px #487c5620;
}
.field input[readonly] { background: #f3f6f0; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.button, .text-link { text-align: center; }
.segmented button { min-height: 44px; }
.dialog-head h2 { line-height: 1.5; }
.dialog-head > h2 { min-width: 0; overflow-wrap: anywhere; }
.dialog-body { line-height: 1.8; }
.dialog-body .form-note, .dialog-body .note { font-size: 13px; }
.capital-guide {
  margin: 6px 0 16px;
  padding: 8px 10px;
  border-left: 2px solid #c8d9c1;
  border-radius: 0 7px 7px 0;
  background: #f5f8f2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
  overflow-wrap: anywhere;
}
.capital-guide p { margin: 0; }
.capital-guide-rows { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.capital-guide-rows > div { display: grid; grid-template-columns: 2em minmax(0, 1fr); align-items: baseline; gap: 8px; }
.capital-guide-rows dt { font-weight: 600; }
.capital-guide-rows dd { margin: 0; min-width: 0; color: #425d4e; font-variant-numeric: tabular-nums; word-break: keep-all; overflow-wrap: normal; }
.capital-guide-basis { margin-top: 7px !important; font-size: 11px; line-height: 1.65; }
.capital-guide-details { margin: 5px 0 0; }
.capital-guide-details > summary { min-height: 0; padding: 2px 0; font-size: 11px; font-weight: 400; }
.capital-guide-details[open] > summary { margin-bottom: 4px; }
.capital-guide-details p { font-size: 11px; line-height: 1.65; }
.capital-guide-details p + p { margin-top: 6px; }
.login-form h2 { line-height: 1.4; font-weight: 750; }
.login-form form > .eyebrow { margin-bottom: 10px; }
.login-form form > p { font-size: 14px; line-height: 1.8; }
.login-form .login-foot { text-align: center; }
.login-form .field { font-size: 14px; }
.login-form .full-width { margin-top: 8px; min-height: 48px; }
.health-head, .rpa-line, .exchange-card-heading { flex-wrap: wrap; align-items: flex-start; }
.health-head > strong, .rpa-line > div { min-width: 0; overflow-wrap: anywhere; }
.health-head > .badge, .rpa-line > .badge { flex-shrink: 0; }
.rpa-line > strong { min-width: 0; overflow-wrap: anywhere; }
.rpa-account dl { grid-template-columns: 100px minmax(0,1fr); font-size: 13px; }
.rpa-account dd { min-width: 0; overflow-wrap: anywhere; }
.rpa-account, .rpa-device { padding-block: 22px; }
.rpa-columns { align-items: start; }
.rpa-account p, .rpa-device p, .health-item p { font-size: 13px; line-height: 1.8; }
.health-item { background: #fafcf8; }
.admin-user-card { background: #fafcf8; }
.admin-user-card h3 { font-size: 17px; line-height: 1.5; }
.admin-user-card p { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.data-row { align-items: center; }
.data-row > strong { text-align: right; overflow-wrap: anywhere; min-width: 0; }

/* Center short order columns only while the sheet has room for a table. */
@container (min-width: 641px) {
  .order-presentation .order-table thead th:nth-child(-n+3),
  .order-presentation .order-table tbody th,
  .order-presentation .order-table tbody td:nth-child(2),
  .order-presentation .order-table tbody td:nth-child(3) { text-align: center; vertical-align: middle; }
}

@media (max-width: 760px) {
  main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-item { justify-content: flex-start; }
  .mobile-nav .nav-item span {
    min-height: 2.6em;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
  }
  .page-head { padding-bottom: 18px; margin-bottom: 22px; }
  .page-head h1 { font-size: 29px; }
  .page-head .sub { font-size: 14px; line-height: 1.8; }
  .eyebrow { font-size: 10px; letter-spacing: 1.2px; }
  .card-head h2, .card-body > h2 { font-size: 18px; }
  .card-head p { font-size: 12px; }
  .account-facts > div { padding: 13px 8px; }
  .account-facts dt { font-size: 12px; }
  .account-facts dd { font-size: 16px; }
  .stats > .stat { padding: 18px 12px; }
  .stat > span { font-size: 12px; }
  .stat > small { font-size: 11px; }
  .record-performance-metrics { gap: 12px; }
  .record-performance-metrics > div { padding: 10px 8px; }
  .record-trades-table th, .record-trades-table td { padding-block: 14px; }
  .record-source-guide { font-size: 12px; }
  .calendar-returns-description, .calendar-returns-note { font-size: 12px; line-height: 1.8; }
  .chart-heading h3 { font-size: 16px; }
  .chart-heading p, .chart-toggle, .chart-caption, .chart-legend { font-size: 12px; }
  .chart-heading { flex-wrap: wrap; gap: 10px; }
  .chart-toggle { min-height: 32px; }
  .chart-readout { font-size: 12px; }
  .login-form { padding: 32px 24px; }
  footer { font-size: 11px; line-height: 1.8; }
}

@media (max-width: 600px) {
  .page-head { flex-wrap: wrap; gap: 14px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head > .flow-actions { padding-top: 0; }
  .page-head .button { min-height: 42px; font-size: 13px; }
  .card-head, .account-card-header { flex-wrap: wrap; gap: 12px; }
  .account-card-header > div { flex: 1 1 160px; }
  .account-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .account-facts > div:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .telegram-overview, .telegram-auto-setting { align-items: flex-start; }
  .telegram-auto-setting { flex-wrap: wrap; gap: 12px; }
  .telegram-auto-control { margin-left: auto; }
  .rpa-account dl { grid-template-columns: 82px minmax(0,1fr); }
  [data-screen="data"] .table-wrap table { min-width: 520px; }
  [data-screen="admin"] .table-wrap table { min-width: 440px; }
}

@media (max-width: 380px) {
  .stat > strong { font-size: 23px; }
  .account-footer > .flow-actions { flex-wrap: wrap; }
  .chart-readout span { white-space: normal; }
}
