.paper-shell { width: min(100%, 1540px); margin: 0 auto; padding: 26px 30px 48px; }
.paper-shell > .error-banner { margin-bottom: 14px; }
.account-overview { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.account-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.account-heading h1 { margin: 0; font-size: 23px; }
.account-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.secondary-button { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: #4f5a68; }
.secondary-button:hover { border-color: #9ea7b2; color: var(--text); }
.account-metrics { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr) 0.8fr; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.account-metric { min-width: 0; min-height: 98px; padding: 15px 17px; border-right: 1px solid var(--line); }
.account-metric:last-child { border-right: 0; }
.account-metric span, .account-metric small { display: block; color: var(--muted); font-size: 11px; }
.account-metric strong { display: block; overflow: hidden; margin-top: 9px; font-size: 23px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.account-metric small { margin-top: 5px; }
.account-metric.primary { border-top: 3px solid var(--accent); padding-top: 12px; }
.account-metric.compact strong { font-size: 18px; }

.paper-workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; gap: 28px; padding-top: 24px; }
.trade-ticket { position: sticky; top: 92px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.trade-ticket > .panel-heading { padding: 15px 16px; border-bottom: 1px solid var(--line); }
.trade-ticket > .panel-heading a { color: var(--accent); font-size: 11px; text-decoration: none; }
.selected-instrument { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px; }
.selected-instrument strong, .selected-instrument span { display: block; }
.selected-instrument > div:first-child strong { max-width: 150px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.selected-instrument > div:first-child span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.ticket-price { text-align: right; font-variant-numeric: tabular-nums; }
.ticket-price strong { font-size: 20px; }
.ticket-price span { margin-top: 5px; font-size: 11px; }
.trade-side { display: grid; grid-template-columns: 1fr 1fr; margin: 0 16px; border: 1px solid var(--line-strong); border-radius: 5px; }
.trade-side button { height: 36px; border: 0; background: transparent; color: var(--muted); font-weight: 600; }
.trade-side button + button { border-left: 1px solid var(--line-strong); }
.trade-side button[data-side="BUY"].active { background: #fcedee; color: var(--up); }
.trade-side button[data-side="SELL"].active { background: #e9f5f0; color: var(--down); }
.order-form { display: grid; gap: 10px; padding: 16px; }
.order-form > label { display: flex; align-items: center; justify-content: space-between; color: #3f4854; font-size: 12px; }
.order-form > label small { color: var(--muted); font-size: 10px; }
.quantity-input { display: grid; grid-template-columns: 38px 1fr 38px; height: 40px; border: 1px solid var(--line-strong); border-radius: 5px; }
.quantity-input button, .quantity-input input { min-width: 0; border: 0; background: transparent; text-align: center; }
.quantity-input button { color: #4f5a68; font-size: 18px; }
.quantity-input button:first-child { border-right: 1px solid var(--line); }
.quantity-input button:last-child { border-left: 1px solid var(--line); }
.quantity-input input { outline: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.quick-quantity { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.quick-quantity button { height: 29px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.quick-quantity button:hover { border-color: var(--accent); color: var(--accent); }
.order-form textarea { resize: vertical; min-height: 70px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 5px; outline: 0; color: var(--text); }
.order-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 87, 217, 0.10); }
.order-estimate { display: grid; grid-template-columns: 1fr 1fr; margin: 3px 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.order-estimate div { padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-estimate dt { color: var(--muted); font-size: 10px; }
.order-estimate dd { margin: 5px 0 0; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.submit-order { height: 42px; border: 0; border-radius: 5px; color: #fff; font-weight: 700; }
.submit-order.buy { background: var(--up); }
.submit-order.sell { background: var(--down); }
.submit-order:disabled { background: #aeb5be; cursor: not-allowed; }
.market-note { margin: 0; padding: 0 16px 15px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.practice-content { min-width: 0; display: grid; gap: 26px; }
.performance-section, .email-alerts-section, .positions-section, .orders-section { min-width: 0; }
.practice-content .panel-heading { margin-bottom: 12px; }
.pnl-legend { text-align: right; color: var(--muted); font-size: 10px; }
.pnl-legend strong { display: block; margin-top: 4px; color: var(--text); font-size: 12px; }
.equity-chart-shell { position: relative; height: 245px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
#equityChart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.chart-empty[hidden] { display: none; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 18px; }
.paper-table th, .paper-table td { padding: 11px 12px; }
.paper-table .instrument-cell strong, .paper-table .instrument-cell span { display: block; }
.paper-table .instrument-cell span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.paper-table .price-pair strong, .paper-table .price-pair span { display: block; }
.paper-table .price-pair span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.paper-table .position-action { height: 28px; padding: 0 9px; border: 1px solid #b8d8cc; border-radius: 4px; background: #f2f8f5; color: var(--down); font-size: 11px; }
.paper-table .reason-cell { max-width: 230px; overflow: hidden; text-align: left; text-overflow: ellipsis; }
.side-badge { display: inline-block; min-width: 38px; padding: 3px 6px; border-radius: 4px; text-align: center; font-size: 10px; font-weight: 700; }
.side-badge.buy { background: #fcedee; color: var(--up); }
.side-badge.sell { background: #e9f5f0; color: var(--down); }

.email-alert-heading { align-items: center; }
.email-alert-actions { display: flex; align-items: center; gap: 8px; }
.mail-status { min-width: 92px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--muted); font-size: 10px; text-align: center; }
.mail-status.ok { border-color: #b8d8cc; background: #eef8f3; color: var(--down); }
.mail-status.error { border-color: #e7c4c6; background: #fff4f4; color: var(--up); }
.email-alert-layout { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr); gap: 12px; }
.alert-builder, .email-preferences { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.alert-builder, .email-preferences { display: grid; align-content: start; gap: 9px; }
.subpanel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-height: 35px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.subpanel-heading strong, .subpanel-heading span { display: block; }
.subpanel-heading strong { font-size: 13px; }
.subpanel-heading span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.subpanel-heading > span { margin-top: 1px; font-variant-numeric: tabular-nums; }
.alert-builder > label, .email-preferences > label, .alert-condition-grid > label { display: grid; gap: 5px; color: #3f4854; font-size: 11px; }
.alert-builder input, .alert-builder select, .email-preferences input { width: 100%; min-width: 0; height: 36px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--text); outline: 0; }
.alert-builder input:focus, .alert-builder select:focus, .email-preferences input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 87, 217, 0.10); }
.alert-condition-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.threshold-input { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; border: 1px solid var(--line-strong); border-radius: 5px; }
.threshold-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 87, 217, 0.10); }
.threshold-input input { border: 0; box-shadow: none; }
.threshold-input input:focus { box-shadow: none; }
.threshold-input span { color: var(--muted); font-size: 11px; text-align: center; }
.primary-command { height: 38px; margin-top: 3px; border: 0; border-radius: 5px; background: var(--accent); color: #fff; font-weight: 700; }
.primary-command:disabled { background: #aeb5be; cursor: not-allowed; }
.email-content-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 0; border: 0; }
.email-content-options legend { margin-bottom: 5px; color: #3f4854; font-size: 11px; }
.email-content-options label { display: flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; color: #4f5a68; font-size: 10px; }
.email-content-options input { width: 14px; height: 14px; margin: 0; padding: 0; accent-color: var(--accent); }
.save-email-settings { width: 100%; margin-top: 3px; }
.email-alert-table-wrap { margin-top: 12px; }
.email-alert-table .alert-condition strong, .email-alert-table .alert-condition span, .email-alert-table .alert-state strong, .email-alert-table .alert-state span { display: block; }
.email-alert-table .alert-condition span, .email-alert-table .alert-state span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.email-alert-table .alert-state.error strong { color: var(--up); }
.alert-toggle, .alert-delete { height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: #4f5a68; font-size: 10px; }
.alert-toggle.active { border-color: #b8d8cc; background: #eef8f3; color: var(--down); }
.alert-delete { border-color: #e7c4c6; color: var(--up); }

@media (max-width: 1180px) {
  .account-metrics { grid-template-columns: repeat(3, 1fr); }
  .account-metric { border-bottom: 1px solid var(--line); }
  .account-metric:nth-child(3) { border-right: 0; }
  .account-metric:nth-last-child(-n+2) { border-bottom: 0; }
  .paper-workspace { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 1000px) {
  .email-alert-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .paper-shell { padding: 20px 14px 36px; }
  .account-metrics { grid-template-columns: 1fr 1fr; }
  .account-metric, .account-metric:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .account-metric:nth-child(even) { border-right: 0; }
  .account-metric:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .paper-workspace { grid-template-columns: 1fr; }
  .trade-ticket { position: static; }
  .equity-chart-shell { height: 220px; }
  .email-alert-layout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .account-heading h1 { font-size: 20px; }
  .account-metric { min-height: 86px; padding: 12px; }
  .account-metric strong { font-size: 19px; }
  .selected-instrument { padding: 14px; }
  .email-alert-heading { align-items: flex-start; }
  .email-alert-actions { align-items: flex-end; flex-direction: column; }
  .email-alert-layout, .alert-condition-grid { grid-template-columns: 1fr; }
  .email-content-options { grid-template-columns: 1fr; }
}
