:root{
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",sans-serif;
  color:#162033;background:#f3f5f9;line-height:1.45
}
*{box-sizing:border-box}
body{margin:0;background:linear-gradient(180deg,#f8f9fc 0,#f3f5f9 34%,#eef1f6 100%);min-height:100vh}
button,input{font:inherit}
button{-webkit-tap-highlight-color:transparent}
.app-shell{max-width:760px;margin:0 auto;padding:28px 18px max(48px,env(safe-area-inset-bottom))}
.topbar,.section-head,.equity-card,.dialog-head,.dialog-actions,.risk-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.topbar{margin-bottom:20px}
.eyebrow{margin:0 0 5px;font-size:10px;font-weight:800;letter-spacing:.15em;color:#8a94a7}
.topbar h1,.section-head h2,.dialog-head h2{margin:0;color:#141d2f}
.topbar h1{font-size:28px;letter-spacing:-.03em}
.subtitle{margin:5px 0 0;color:#8892a4;font-size:13px}
.icon-btn{border:1px solid rgba(31,41,55,.06);background:#fff;border-radius:14px;padding:10px 12px;box-shadow:0 6px 20px rgba(29,42,68,.07);cursor:pointer;color:#334155}

.summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin-bottom:10px}
.summary-card{background:rgba(255,255,255,.92);border:1px solid rgba(32,49,77,.06);border-radius:17px;padding:13px 12px;box-shadow:0 4px 16px rgba(31,41,55,.035)}
.summary-card.highlight{background:#edf4ff;border-color:#dce9ff}
.summary-card span,.equity-card span,.risk-card span,.settings-formula span{display:block;font-size:11px;color:#7d8799}
.summary-card strong{display:block;margin-top:5px;font-size:19px;color:#172033;letter-spacing:-.02em}
.summary-card small{display:block;margin-top:2px;color:#9aa3b2;font-size:10px}

.risk-card{background:#fff;border:1px solid rgba(32,49,77,.06);border-radius:22px;padding:20px;margin-bottom:10px;box-shadow:0 10px 34px rgba(28,42,66,.06)}
.risk-card-head>div>strong{display:block;font-size:44px;line-height:1;margin:7px 0 8px;color:#111a2b;letter-spacing:-.05em}
.risk-card-head>div>strong.risk-remaining>span{display:inline!important;font-size:inherit!important;color:inherit!important}
.risk-card-head>div>strong.risk-remaining.safe{color:#157347}
.risk-card-head>div>strong.risk-remaining.warn{color:#946200}
.risk-card-head>div>strong.risk-remaining.danger{color:#b42318}
.risk-card small,label small,.calc-preview small{color:#8892a4}
.status-pill{display:inline-flex!important;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;font-size:11px!important;font-weight:800}
.status-pill.safe{background:#e8f7ef;color:#157347}
.status-pill.warn{background:#fff4d8;color:#946200}
.status-pill.danger{background:#fee7e7;color:#b42318}
.risk-card .status-pill{font-size:14px!important;line-height:1.15;padding:7px 12px}
.risk-progress{display:flex;height:8px;background:#edf0f5;border-radius:999px;overflow:hidden;margin-top:16px}
.risk-progress i{display:block;flex:0 0 auto;height:100%;width:0;background:#3478f6;border-radius:999px;transition:width .25s ease}
.risk-progress i.with-excess{border-radius:999px 0 0 999px}
.risk-progress i.excess{background:#d92d20;border-radius:0 999px 999px 0}
.risk-scale{display:flex;justify-content:space-between;margin-top:6px;color:#a0a8b6;font-size:10px}

.equity-card{gap:10px;margin-bottom:25px}
.equity-card>div{flex:1;background:rgba(255,255,255,.78);border:1px solid rgba(32,49,77,.05);border-radius:16px;padding:13px 14px}
.equity-card strong{display:block;margin-top:4px;font-size:17px;color:#1c2638}
.section-head{margin:18px 0 12px}
.section-head h2{font-size:21px}
.primary-btn,.secondary-btn,.danger-btn{border:0;border-radius:14px;padding:12px 16px;font-weight:800;cursor:pointer;transition:transform .12s ease,opacity .12s ease}
.primary-btn:active,.secondary-btn:active,.danger-btn:active,.choice-chip:active,.segmented button:active{transform:scale(.98)}
.primary-btn{background:#286fef;color:#fff;box-shadow:0 6px 16px rgba(40,111,239,.2)}
.secondary-btn{background:#eef1f5;color:#354052}
.danger-btn{background:#fee9e8;color:#b42318}

.position-list{display:grid;gap:10px}
.empty-state{padding:34px 20px;text-align:center;background:rgba(255,255,255,.82);border:1px dashed #d9dee8;border-radius:18px;color:#8a94a6}
.empty-state strong{display:block;color:#2b3547;margin-bottom:5px}
.position-card{background:#fff;border:1px solid rgba(32,49,77,.06);border-radius:18px;padding:15px 16px;display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;box-shadow:0 5px 18px rgba(31,41,55,.035)}
.position-card.over-risk{border-color:#f3aaa4;background:#fff8f7;box-shadow:0 5px 18px rgba(180,35,24,.08)}
.position-card.over-risk-start{border-left:5px solid #b42318;padding-left:12px}
.position-card .title-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.position-card .title-row>strong{font-size:17px}
.position-card .meta{font-size:12px;color:#7e8798;margin-top:6px}
.position-card .risk-money{font-size:12px;color:#4f5b6c;margin-top:4px}
.position-warning{margin-top:7px;padding:7px 9px;border-radius:9px;background:#fff3f1;color:#b42318;font-size:11px;font-weight:700;line-height:1.45}
.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:11px;font-weight:800}
.badge.aplus,.badge.a{background:#fee9e8;color:#b42318}
.badge.b{background:#fff3d6;color:#8a5b00}
.badge.c{background:#f0f2f5;color:#475467}
.side.long{color:#c4322b;font-weight:700}
.side.short{color:#087a5a;font-weight:700}
.edit-btn{border:0;background:#f3f5f8;border-radius:11px;padding:9px 11px;cursor:pointer;color:#506075}
.position-actions{display:flex;flex-direction:column;gap:7px;align-items:stretch}
.close-btn{border:0;background:#eef4ff;color:#1f64d8;border-radius:11px;padding:9px 11px;font-weight:800;cursor:pointer}
.risk-history{margin-left:7px;color:#98a1b1;font-size:11px}
.closed-head{margin-top:30px}
.closed-card{background:#fff;border:1px solid rgba(32,49,77,.06);border-radius:18px;padding:15px 16px;box-shadow:0 5px 18px rgba(31,41,55,.035)}
.closed-card .title-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.closed-card .meta{font-size:12px;color:#7e8798;margin-top:6px}
.closed-result{margin-top:8px;font-size:17px;font-weight:900}
.closed-sub{margin-top:3px;font-size:11px;color:#8d96a6}
.profit{color:#c4322b!important}
.loss{color:#087a5a!important}
.flat{color:#596579!important}
.close-trade-name{margin:-2px 0 14px;padding:11px 12px;border-radius:12px;background:#f6f8fb;color:#344054;font-weight:800}
.empty-state.compact{padding:22px 18px}

dialog{border:0;border-radius:24px;padding:0;width:min(94vw,560px);max-height:90vh;overflow:auto;box-shadow:0 24px 70px rgba(17,24,39,.22)}
dialog::backdrop{background:rgba(15,23,42,.42);backdrop-filter:blur(2px)}
form{padding:18px}
.dialog-head{margin-bottom:15px}
.sticky-head{position:sticky;top:0;z-index:3;background:#fff;padding:2px 0 12px}
.form-section{padding:14px 0;border-top:1px solid #eef1f5}
.form-section:first-of-type{border-top:0}
.form-section-title{display:flex;gap:10px;align-items:center;margin-bottom:11px}
.form-section-title>span{display:grid;place-items:center;width:26px;height:26px;border-radius:9px;background:#edf4ff;color:#286fef;font-size:12px;font-weight:900}
.form-section-title>div{display:grid}
.form-section-title strong{font-size:14px}
.form-section-title small{font-size:11px;color:#929bad;margin-top:1px}
.instrument-risk-hint{display:block;margin:8px 2px 0;color:#66788c;font-size:12px;line-height:1.5}
html[data-ap-theme="night"] body>dialog#positionDialog .instrument-risk-hint{color:#b8c7da}

.chip-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.choice-chip{border:1px solid #dde3ec;background:#fff;color:#344054;border-radius:12px;padding:11px 8px;font-weight:700;font-size:13px;cursor:pointer;min-height:43px}
.choice-chip.active{border-color:#7eafff;background:#edf4ff;color:#1f64d8;box-shadow:inset 0 0 0 1px #b7d1ff}
.instrument-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.empty-picker{display:block;padding:20px;border:1px dashed #d9dee8;border-radius:14px;text-align:center;color:#98a1b1;background:#fafbfc}

.field-label{font-size:13px;color:#5f6b7c;margin:5px 0 7px}
.segmented{display:grid;gap:7px;margin-bottom:12px}
.segmented.rating-picker{grid-template-columns:repeat(4,1fr)}
.segmented.side-picker{grid-template-columns:repeat(2,1fr)}
.segmented button{border:1px solid #dde3ec;background:#fff;border-radius:12px;padding:11px 8px;font-weight:800;color:#475467;cursor:pointer}
.segmented button.active{background:#edf4ff;border-color:#9ec1ff;color:#1f64d8}
.segmented .long-choice.active{background:#fff0ef;border-color:#f4b4af;color:#b42318}
.segmented .short-choice.active{background:#eaf8f3;border-color:#a6ddca;color:#087a5a}

label{display:block;font-size:13px;color:#596579;margin-bottom:12px}
input{width:100%;margin-top:6px;padding:12px 13px;border:1px solid #dce2eb;border-radius:12px;background:#fff;font-size:16px;color:#1d2939;outline:none}
input:focus{border-color:#8cb6ff;box-shadow:0 0 0 3px rgba(40,111,239,.09)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.calc-preview{display:flex;justify-content:space-between;gap:12px;align-items:center;background:#f3f7ff;border:1px solid #e1ebff;border-radius:16px;padding:14px;margin:8px 0 10px}
.calc-preview.warning{background:#fff3f1;border-color:#ffd5d0}
.calc-preview.notice{background:#fffaf0;border-color:#f2dfb4}
.calc-preview.notice #riskPreviewNote{color:#876321}
.calc-preview span{display:block;font-size:11px;color:#748096}
.calc-preview strong{display:block;margin:4px 0;font-size:19px}
.calc-r{text-align:right}
.form-error{margin:4px 0 12px;padding:10px 12px;border-radius:11px;background:#fff0ef;color:#b42318;font-size:12px;font-weight:700}
.sticky-actions{position:sticky;bottom:-18px;background:#fff;padding:12px 0 max(2px,env(safe-area-inset-bottom));margin-top:5px}
.full{width:100%}
.hidden{display:none!important}
.confirm-copy{color:#596579;line-height:1.55}
.settings-formula{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:8px 0 16px}
.settings-formula>div{background:#f6f8fb;border-radius:14px;padding:13px}
.settings-formula strong{display:block;margin-top:4px;font-size:18px}

@media(max-width:600px){
  .app-shell{padding:20px 14px max(38px,env(safe-area-inset-bottom))}
  .summary-grid{grid-template-columns:repeat(2,1fr)}
  .risk-card-head>div>strong{font-size:40px}
  .chip-grid,.instrument-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:390px){
  .grid-2{grid-template-columns:1fr}
  .chip-grid,.instrument-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dialog-actions{align-items:stretch}
  .dialog-actions>*{flex:1}
}
/* Private account/login, member and backup surfaces */
[hidden]{display:none!important}
.auth-shell{min-height:100dvh;display:grid;place-items:center;padding:24px 16px}
.auth-card{width:min(100%,430px);background:#fff;border:1px solid #e7ebf2;border-radius:25px;padding:30px 24px;box-shadow:0 20px 60px rgba(22,34,53,.09)}
.auth-card h1{margin:0;font-size:27px;letter-spacing:-.03em}
.auth-card .subtitle{margin-bottom:26px}
.auth-form{padding:0}
.auth-form label{font-size:13px;font-weight:700;color:#596579}
.auth-links{display:flex;justify-content:center;flex-wrap:wrap;align-items:center;gap:12px;margin:13px 0}
.text-btn{border:0;background:transparent;color:#2268dd;font-size:13px;font-weight:700;padding:8px;cursor:pointer}
.auth-note{display:block;color:#8c96a6;text-align:center;line-height:1.6}
.auth-message{background:#f1f6ff;color:#285caa;padding:12px 13px;border-radius:12px;font-size:12px;line-height:1.5}
.auth-message.auth-error{background:#fff0ee;color:#b42318}
.topbar-actions{display:flex;gap:8px;align-items:center}
.topbar-actions .admin-nav{font-size:12px;padding:10px}
.account-strip{display:flex;align-items:start;justify-content:space-between;gap:12px;background:#fff;border:1px solid #e8edf5;border-radius:16px;padding:12px 14px;margin:-4px 0 16px;box-shadow:0 4px 16px rgba(31,41,55,.025)}
.account-identity{min-width:0;display:grid;gap:3px}
.account-identity strong{font-size:12px;overflow-wrap:anywhere;color:#39465a}
.account-identity small{font-size:11px;color:#188455}
.account-identity small.sync-error{color:#b42318;font-weight:800}
.account-menu{flex:none;max-width:100%;position:relative}
.account-menu summary{cursor:pointer;color:#2368d4;font-size:12px;font-weight:800;white-space:nowrap}
.account-menu-content{position:absolute;right:0;top:29px;z-index:15;display:grid;gap:7px;min-width:min(260px,83vw);padding:13px;border:1px solid #dde5ef;background:#fff;border-radius:14px;box-shadow:0 14px 34px rgba(23,42,74,.14)}
.account-menu-content button{font-size:12px;padding:10px 12px;text-align:left}
.admin-content{padding:20px}
.admin-explain{color:#667085;font-size:13px;line-height:1.6}
.member-form{padding:0;border-bottom:1px solid #e8ebf0;padding-bottom:18px}
.member-list{display:grid;gap:12px;margin-top:16px}
.member-row{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid #f0f2f5;padding:8px 0 13px}
.member-row>div:first-child{min-width:0;overflow-wrap:anywhere}
.member-row strong{display:block;font-size:13px}
.member-row small{display:block;font-size:11px;color:#7b8798;margin-top:3px}
.member-actions{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.member-actions button{font-size:11px;padding:7px}
@media(max-width:460px){
 .account-strip{gap:8px;align-items:center}
 .member-row{align-items:stretch;flex-direction:column}
 .member-actions{justify-content:flex-start}
}


/* Mobile readability — a subtle +1–2px adjustment for compact text. */
@media (max-width:600px) {
  .eyebrow { font-size:11px; }
  .subtitle { font-size:14px; line-height:1.55; }
  .section-head h2 { font-size:21px; }
  .summary-card { padding:14px 12px; }
  .summary-card span, .equity-card span, .risk-card span,
  .settings-formula span { font-size:12px; }
  .summary-card strong { font-size:20px; }
  .summary-card small { font-size:11px; line-height:1.4; }
  .risk-card small, label small, .calc-preview small { font-size:12px; line-height:1.55; }
  .field-label, label { font-size:14px; }
  .choice-chip { font-size:14px; line-height:1.35; }
  .segmented button { font-size:15px; }
  input { font-size:17px; }
  .form-section-title strong { font-size:15px; }
  .form-section-title small { font-size:12px; }
  .calc-preview span { font-size:12px; }
  .calc-preview strong { font-size:20px; }
  .account-identity strong { font-size:13px; }
  .account-identity small { font-size:12px; }
  .account-menu summary, .account-menu-content button { font-size:13px; }
  .topbar-actions .admin-nav, .member-actions button { font-size:13px; }
  .member-row strong, .member-row small { font-size:13px; }
  .admin-explain { font-size:14px; }
}

/* Keep monetary values and R units together. General card span rules
   otherwise turn numeric spans into separate lines. */
.summary-card strong > span,
.risk-card strong > span,
.equity-card strong > span,
.calc-preview strong > span,
.settings-formula strong > span {
  display:inline !important;
  font-size:inherit !important;
  font-weight:inherit;
  letter-spacing:inherit;
  color:inherit !important;
}
.summary-card strong, .equity-card strong, .calc-preview strong { white-space:nowrap; }

/* iOS virtual keyboard: resize the active dialog to the visual viewport.
   JavaScript measures viewport height and scrolls the focused field into view. */
@media(max-width:760px) {
  dialog.ap-keyboard-active[open] {
    position:fixed;
    inset:auto;
    top:var(--ap-dialog-top,8px);
    left:50%;
    bottom:auto;
    right:auto;
    margin:0;
    transform:translateX(-50%);
    width:min(calc(100vw - 20px),560px);
    max-height:var(--ap-dialog-height,calc(100dvh - 16px));
    overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  dialog.ap-keyboard-active .sticky-actions {
    position:sticky;
    bottom:0;
    z-index:5;
    background:#fff;
    padding-bottom:8px;
    box-shadow:0 -6px 14px rgba(20,32,55,.05);
  }
  dialog.ap-keyboard-active :is(input,textarea,select):focus {
    scroll-margin-top:75px;
    scroll-margin-bottom:90px;
  }
}


/* Clear, readable risk details: use two compact units rather than a single
   small element whose nested spans inherit display:block. */
.risk-limits{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  column-gap:18px;
  row-gap:5px;
  margin-top:12px;
  margin-bottom:2px;
}
.risk-card .risk-limit-item{
  display:inline-flex;
  align-items:baseline;
  gap:5px;
  white-space:nowrap;
  color:#566477;
  font-size:14px;
  line-height:1.45;
}
.risk-card .risk-limit-item strong{
  white-space:nowrap;
  font-size:15px;
  color:#26364e;
  font-weight:800;
}
.risk-card .risk-limit-item strong span{
  display:inline!important;
  font-size:inherit!important;
  color:inherit!important;
  font-weight:inherit;
}
@media(max-width:600px){
  /* Minimum 13px for secondary labels, 14px for meaningful instructions. */
  .summary-card span,.equity-card span,.risk-card-head span:not(.status-pill),
  .settings-formula span{font-size:14px;line-height:1.4}
  .summary-card small,.risk-card small,label small,.calc-preview small,
  .form-section-title small,.position-card .meta,.position-card .risk-money,
  .closed-sub,.position-warning,.auth-note,.auth-message,.member-row small,
  .account-identity small,.risk-scale{font-size:13px;line-height:1.5}
  .status-pill{font-size:13px!important}
  .risk-card .status-pill{font-size:15px!important}
  .risk-limits{column-gap:16px;margin-top:11px}
  .risk-card .risk-limit-item{font-size:14px}
  .risk-card .risk-limit-item strong{font-size:15px}
  .risk-card{padding:18px}
  .risk-progress{margin-top:14px}
  .risk-scale{margin-top:7px}
  .summary-card{min-width:0}
  .summary-card strong{font-size:21px;white-space:nowrap}
  .position-card .title-row>strong{font-size:18px}
  .badge{font-size:13px}
}


/* Journal edit controls: concise hint outside the grid, aligned price fields. */
.multiplier-hint{
  display:block;margin:0 0 15px!important;padding:2px 0;
  font-size:13px;line-height:1.5;color:#68778d;
}
.grid-2:has(.price-field){align-items:start;grid-template-columns:repeat(2,minmax(0,1fr));}
.price-field{min-width:0;display:block;}
.price-field .price-label{display:block;min-height:24px;line-height:24px;white-space:nowrap;font-size:14px;margin:0;}
.price-stepper{
  display:grid!important;grid-template-columns:34px minmax(0,1fr) 34px;
  gap:4px;align-items:center;margin-top:5px;min-width:0;
}
.price-stepper input{
  min-width:0;width:100%;margin:0;min-height:49px;padding:9px 3px;
  border-radius:10px;text-align:center;font-size:16px;
  font-variant-numeric:tabular-nums;
  -moz-appearance:textfield;appearance:textfield;
}
.price-stepper input::-webkit-inner-spin-button,
.price-stepper input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0;}
.price-stepper button{
  display:grid;place-items:center;
  min-width:0;width:34px;min-height:46px;padding:0;
  font-size:23px;font-weight:700;border:1px solid #dce3ec;
  border-radius:10px;background:#edf3fc;color:#2862bd;
  cursor:pointer;touch-action:manipulation;user-select:none;
}
.price-stepper button:active{background:#dceaff;transform:scale(.98)}
.tick-guidance{display:grid;gap:4px;margin:5px 0 12px;}
.tick-guidance small,.tick-subnote{font-size:13px;line-height:1.5;color:#65738a;}
.tick-warning{display:block;color:#99600a!important;font-size:13px;line-height:1.5;}
.tick-warning:empty{display:none}
.capital-rule-note{display:block;color:#935f07!important;margin-top:5px;line-height:1.5}
.correlation-alerts{
  background:#fff8ec;border:1px solid #f4d7a2;border-radius:15px;
  padding:13px 15px;margin:0 0 12px;color:#745119;
}
.correlation-alerts strong{display:block;font-size:15px;margin-bottom:7px}
.correlation-alerts p{font-size:14px;line-height:1.55;margin:5px 0}
.correlation-alerts small{font-size:12px;color:#846c49}
.correlation-preview{margin:9px 0 4px;padding:10px 12px;border-radius:12px;border:1px solid #f4d7a2;background:#fff8ec;color:#745119}
.correlation-preview p{margin:5px 0;line-height:1.45;font-size:13px}
.correlation-preview:empty{display:none}
@media(max-width:390px){
 .price-stepper{grid-template-columns:30px minmax(0,1fr) 30px;gap:3px}
 .price-stepper button{width:30px;font-size:20px}
 .price-stepper input{font-size:16px;padding:8px 2px}
 .grid-2:has(.price-field){grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* Closed-trade performance: legible on iPhone; no misleading P&L on open trades. */
.analytics-head{margin-top:28px;align-items:end}
.analytics-count{color:#69778b;font-size:13px;font-weight:700}
.analytics-panel{padding:16px;border:1px solid #e1e7ef;background:#fff;border-radius:18px;
  box-shadow:0 6px 20px rgba(31,41,55,.04);margin-bottom:24px}
.analytics-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:1fr;gap:10px}
.analytics-metric{min-width:0;border-radius:13px;background:#f7f9fc;padding:13px 14px}
.analytics-metric.analytics-featured{background:#edf4ff}
.analytics-metric>span{display:block;font-size:13px;line-height:1.4;color:#637289}
.analytics-metric>strong{display:block;font-size:23px;line-height:1.25;margin:5px 0 3px;
  color:#1a2739;white-space:nowrap;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.analytics-metric>small{display:block;font-size:12px;line-height:1.4;color:#7b8796}
.analytics-metric .stat-profit{color:#c4322b}
.analytics-metric .stat-loss{color:#087a5a}
.analytics-note{color:#617086;font-size:13px;line-height:1.6;margin:13px 2px 0}
@media(max-width:460px){
 .analytics-panel{padding:12px}
 .analytics-grid{gap:8px}
 .analytics-metric{padding:12px 10px}
 .analytics-metric>span{font-size:14px}
 .analytics-metric>strong{font-size:21px}
 .analytics-metric>small{font-size:13px}
}
@media(max-width:345px){
 .analytics-metric>strong{font-size:19px}
}

/* Manual actual-price corrections, average payoff ratio and price-breakeven tracking. */
/* Payoff shares the same neutral text color as PF and win rate. */
.analytics-payoff{grid-column:1/-1}
.breakeven-btn{border:1px solid #d4d9e2;border-radius:11px;background:#eef0f4;color:#687486;padding:9px 11px;min-height:37px;font-size:13px;font-weight:800;cursor:pointer}
.breakeven-btn:active:not(:disabled){background:#dfe3e9}
.breakeven-btn.is-protected{background:#e0f5e8;border-color:#9bd8b6;color:#116b42;opacity:1;cursor:pointer}
.breakeven-btn.is-protected:active{background:#c8efd9}
.pending-execution{display:inline-flex;align-items:center;border-radius:999px;background:#fff2dc;color:#8e6110;padding:4px 8px;font-size:11px;font-weight:800}
.closed-correction-btn{border:0;border-radius:10px;background:#eff3f8;color:#384e6e;padding:9px 12px;min-height:38px;cursor:pointer;font-size:13px;font-weight:800;margin-top:10px}
.closed-correction-btn:active{background:#e3ebf4}
.closed-corrected-note{color:#1a7954;font-size:12px;font-weight:700;margin-top:7px}
.close-price-note,.record-note{display:block;color:#7a6373;font-size:12px;line-height:1.5}
.record-note{margin:2px 0 16px}

/* New-position 1R initial-stop estimate; manual stops are never overwritten. */
.auto-stop-row{display:flex;align-items:center;flex-wrap:wrap;gap:9px;padding:9px 12px;background:#eef6fd;border:1px solid #d1e1f3;border-radius:11px;margin:3px 0 13px}
.auto-stop-row[hidden]{display:none!important}
.auto-stop-row small{flex:1 1 200px;font-size:12px;line-height:1.55;color:#4b6784}
.auto-stop-reset{font-size:13px;white-space:nowrap;padding:9px 12px;background:#dceafa;color:#26527c}

/* An unmistakable banner for the read/write-in-memory isolated demo. */
.demo-banner{border:1px solid #e2c58f;background:#fff5e0;color:#70490e;border-radius:14px;padding:13px 15px;margin-bottom:13px;display:flex;flex-direction:column;gap:5px;line-height:1.55}
.demo-banner strong{font-size:14px;font-weight:800}
.demo-banner small{font-size:12px;color:#775b2e}
.demo-banner[hidden],.account-menu[hidden]{display:none!important}

/* One separate reason line below initial-risk and fee metadata. */
.entry-rule-history{margin-top:5px;color:#b42318;font-size:12px;font-weight:700;line-height:1.5}
.entry-rule-notice{margin-top:5px;color:#8d6a2c;font-size:12px;font-weight:500;line-height:1.55;overflow-wrap:anywhere}

/* Closed trades: profit/R belongs to the title row; all trade details share one row. */
.closed-card .title-row .closed-result{margin:0 0 0 auto;font-size:15px;white-space:nowrap;line-height:1.4}
.closed-card .meta{line-height:1.55;overflow-wrap:anywhere}
.closed-card .pending-execution{font-size:11px}
@media(max-width:420px){.closed-card .title-row{gap:5px}.closed-card .title-row .closed-result{font-size:13px}.closed-card .meta{font-size:11px}}

/* Chinese futures convention: positive P&L red, negative P&L green. */
.closed-card .closed-result.profit{color:#c4322b!important}
.closed-card .closed-result.loss{color:#087a5a!important}

.closed-card .closed-identity{font-size:12px;color:#7e8798;white-space:nowrap}
@media(max-width:420px){.closed-card .closed-identity{font-size:11px}.closed-card .title-row{column-gap:5px;row-gap:4px}}

.capital-chart-section{margin:18px 0 14px}.capital-equity-chart{padding:12px 14px;border-radius:16px;background:#fff;border:1px solid #edf0f5}.capital-equity-chart svg{display:block;width:100%;height:auto}.capital-chart-note{font-size:12px;color:#64748b;text-align:right}.capital-chart-section>small{display:block;margin-top:7px;color:#7e8798;font-size:11px}

.capital-details{margin-top:12px;border:1px solid #e5eaf2;border-radius:14px;background:#fff;overflow:hidden}.capital-details>summary{cursor:pointer;list-style:none;padding:13px 15px;font-size:14px;font-weight:700;color:#334155;display:flex;justify-content:space-between;gap:12px}.capital-details>summary::-webkit-details-marker{display:none}.capital-details>summary span{font-size:11px;color:#7e8798;font-weight:400}.capital-details-body{padding:4px 14px 14px;border-top:1px solid #edf0f5}.capital-details-body .auth-form{margin-top:10px}.capital-card>.equity-card{margin-bottom:8px}

/* Keep all six performance indicators in two columns on phones. */
.analytics-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}.analytics-grid>.analytics-metric{grid-column:auto!important;grid-row:auto!important;min-width:0}.analytics-grid>.analytics-metric.analytics-payoff{grid-column:auto!important}
#capitalDialog{max-width:min(94vw,540px);max-height:88dvh;overflow-y:auto}#capitalSettingsMount .capital-card{margin:0;padding:4px 0}#capitalSettingsMount .section-head{margin-top:8px}#capitalSettingsMount .capital-details{margin-bottom:10px}

/* Single settings page: risk and capital management, no nested modal/disclosure. */
#settingsDialog{max-height:90dvh;overflow-y:auto}#capitalSettingsMount{margin-top:22px;padding-top:16px;border-top:1px solid #e5eaf2}#capitalSettingsMount .capital-card{margin:0;padding:0}#capitalSettingsMount .capital-details-body{padding:8px 0;border:0}#capitalSettingsMount .equity-card{margin:12px 0}#capitalSettingsMount .section-head{margin:0 0 8px}

/* Primary journal pages: mobile-first tab navigation. */
.journal-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:5px;margin:15px 0 20px;border-radius:14px;background:#e9eef6}.journal-tab{appearance:none;border:0;border-radius:10px;padding:12px 5px;background:transparent;color:#64748b;font:inherit;font-size:14px;font-weight:700;cursor:pointer}.journal-tab.active{background:#fff;color:#1e40af;box-shadow:0 2px 8px rgba(24,43,70,.08)}.journal-page[hidden]{display:none!important}@media(max-width:390px){.journal-tab{font-size:13px;padding:11px 3px}}

.journal-nav{grid-template-columns:repeat(4,minmax(0,1fr))}.journal-tab{font-size:12px}.analysis-note{font-size:12px;color:#7a8799;line-height:1.7}.analysis-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0}.analysis-filters label{font-size:12px;color:#64748b}.analysis-filters select{width:100%;display:block;margin-top:5px;border:1px solid #dce4ed;border-radius:12px;background:#fff;padding:11px 8px;font:inherit;color:#263449}.analysis-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.analysis-metric{padding:14px 12px;background:#fff;border:1px solid #e5eaf1;border-radius:16px;min-width:0}.analysis-metric span,.analysis-metric small{display:block;font-size:11px;color:#8490a2}.analysis-metric strong{display:block;font-size:20px;margin:7px 0;overflow-wrap:anywhere}.analysis-group{background:#fff;border:1px solid #e5eaf1;border-radius:16px;padding:14px 12px;margin-top:15px}.analysis-group h3{font-size:16px;margin:0 0 10px}.analysis-table{border-collapse:collapse;width:100%;font-size:12px}.analysis-table th,.analysis-table td{padding:9px 3px;border-bottom:1px solid #edf0f5;text-align:right}.analysis-table th:first-child,.analysis-table td:first-child{text-align:left}.analysis-table th{color:#8793a4;font-weight:500}.analysis-table tr:last-child td{border:0}
/* Reuse the existing position-card grade palette; only the analytics label
   becomes a compact circle. The underlying grade stays ordinary text. */
#analysisRatings .analysis-table .analysis-grade-badge{
  box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;min-width:28px;padding:0;border-radius:50%;
  font-size:11px;line-height:1;vertical-align:middle
}
@media(max-width:390px){.journal-tab{font-size:11px;padding:11px 2px}.analysis-table{font-size:11px}}

#closedArchive{margin-top:20px}#closedArchive>summary{font-size:16px;font-weight:750;cursor:pointer}#closedArchive .analysis-filters input[type=date]{width:100%;min-width:0;display:block;margin-top:5px;padding:10px 7px;border:1px solid #dce4ed;border-radius:12px;background:#fff;color:#263449}#closedArchive .position-list{margin-top:12px}.analysis-rating-field{border:1px solid #dce4ed;border-radius:12px;padding:8px 10px;grid-column:span 2;background:#fff;display:flex;flex-wrap:wrap;gap:10px}.analysis-rating-field legend{font-size:12px;color:#64748b}.analysis-rating-field label{font-size:13px;color:#263449;display:inline-flex;align-items:center;gap:4px}

/* Symmetric per-instrument realized profit/loss bars, China market colors. */
.instrument-bars-legend{display:flex;justify-content:space-between;gap:10px;color:#748195;font-size:11px;margin-bottom:12px}.instrument-bars-row{display:grid;grid-template-columns:minmax(0,1fr) 84px minmax(0,1fr);align-items:center;gap:6px;margin:9px 0;min-height:44px}.instrument-bar-half{height:35px;position:relative;display:flex;align-items:center;min-width:0;overflow:hidden;border-radius:7px;background:#f5f7fa}.instrument-bar-half.loss{justify-content:flex-end}.instrument-bar-half.gain{justify-content:flex-start}.instrument-bar-fill{position:absolute;top:0;bottom:0;min-width:0}.instrument-bar-half.loss .instrument-bar-fill{right:0;background:#c5ead4;border-right:3px solid #1b9560}.instrument-bar-half.gain .instrument-bar-fill{left:0;background:#f8c8c6;border-left:3px solid #d33c38}.instrument-bar-amount{position:relative;z-index:1;font-size:11px;font-weight:700;white-space:nowrap;padding:0 4px;color:#334155}.instrument-bar-name{text-align:center;font-size:12px;font-weight:750;overflow-wrap:anywhere;line-height:1.3}.instrument-bar-name small{display:block;font-size:10px;color:#94a0af;font-weight:400;margin-top:3px}@media(max-width:390px){.instrument-bars-row{grid-template-columns:minmax(0,1fr) 70px minmax(0,1fr);gap:4px}.instrument-bar-amount{font-size:10px;padding:0 2px}}

/* History: date shortcuts between endpoints and paginated results. */
#closedArchive>.analysis-filters{grid-template-columns:minmax(0,1fr);gap:10px}.history-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.history-presets button{border:1px solid #dce4ed;border-radius:10px;background:#f3f6fa;padding:10px 2px;color:#3b4b63;font-size:12px;font-weight:700;cursor:pointer}.history-presets button:active{background:#dce8fc}.history-pagination{display:flex;align-items:center;justify-content:center;gap:12px;margin:16px 0 4px}.history-pagination span{font-size:12px;color:#66758a}.history-pagination button{padding:9px 12px;font-size:12px}.history-pagination button:disabled{opacity:.35;cursor:not-allowed}@media(max-width:390px){.history-presets button{font-size:11px}}

/* Analytics grade selection: neutral grey checks, matching closed-trade rating badges. */
.analysis-rating-field{align-items:center;justify-content:flex-start;column-gap:17px;row-gap:12px;padding:13px 12px}.analysis-rating-field .analysis-grade-choice{display:inline-flex!important;align-items:center!important;justify-content:flex-start!important;gap:7px!important;flex:0 0 auto!important;min-width:0!important;width:auto!important;margin:0!important;padding:0!important;position:relative!important;white-space:nowrap}.analysis-rating-field .analysis-grade-choice input[type="checkbox"]{appearance:none!important;-webkit-appearance:none!important;position:static!important;display:inline-grid!important;place-content:center!important;flex:0 0 20px!important;width:20px!important;height:20px!important;min-width:20px!important;min-height:20px!important;margin:0!important;padding:0!important;border:1.5px solid #a4adb9!important;border-radius:5px!important;background:#f1f3f5!important;box-shadow:none!important;transform:none!important;opacity:1!important;accent-color:#7b8491!important;vertical-align:middle!important}.analysis-rating-field .analysis-grade-choice input[type="checkbox"]:checked{background:#858d99!important;border-color:#858d99!important}.analysis-rating-field .analysis-grade-choice input[type="checkbox"]:checked:after{content:"";display:block;width:9px;height:5px;border-left:2px solid white;border-bottom:2px solid white;transform:translateY(-1px) rotate(-45deg)}.analysis-rating-field .analysis-grade-choice .badge{position:static!important;display:inline-flex!important;align-items:center;justify-content:center;flex:0 0 auto!important;margin:0!important;transform:none!important;min-width:27px!important}.analysis-rating-field .analysis-grade-choice:focus-within{outline:2px solid #b3bdc9;outline-offset:4px;border-radius:5px}

/* Optional trade-discipline assessment and freeform review. */
.discipline-editor{display:grid;gap:8px;margin:16px 0;padding:14px;border:1px solid #e2e8f0;border-radius:14px;background:#f8fafc}.discipline-editor label{font-size:13px;font-weight:700;color:#344256}.discipline-editor select,.discipline-editor textarea{width:100%;box-sizing:border-box;padding:11px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#1e293b;font:inherit}.discipline-editor textarea{resize:vertical;min-height:96px;line-height:1.6}.discipline-status{font-size:12px;margin:10px 0 3px;font-weight:700}.discipline-followed{color:#15803d}.discipline-violated{color:#b42318}.discipline-review{margin:8px 0 10px;font-size:12px;color:#475569;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}.discipline-review strong{display:block;color:#64748b}

.ap-brand-heading{display:flex;align-items:center;gap:13px;min-width:0}.ap-brand-heading>div{min-width:0}.ap-brand-logo{display:block;flex:none;width:56px;height:56px;object-fit:cover;border-radius:50%;border:1px solid #c9c2bb;background:#111;box-shadow:0 3px 10px rgba(0,0,0,.15)}.ap-brand-logo-auth{width:72px;height:72px}.ap-brand-heading h1{overflow-wrap:anywhere}@media(max-width:420px){.ap-brand-logo{width:46px;height:46px}.ap-brand-logo-auth{width:62px;height:62px}.ap-brand-heading{gap:10px}.topbar .ap-brand-heading h1{font-size:24px}}

/* Align the login subtitle with the heading text, not the logo edge. */
.auth-card .ap-auth-subtitle{margin-left:85px}
@media(max-width:420px){.auth-card .ap-auth-subtitle{margin-left:72px}}

/* Original uploaded AP artwork now embeds in heading images, no missing external logo. */
/* Compact sync indicator in header; account and backup actions live in Settings. */
.header-sync{min-width:0;max-width:220px;display:flex;align-items:center;justify-content:flex-end;text-align:right}
.header-sync small{font-size:11px;line-height:1.35;color:#188455;overflow-wrap:anywhere}
.header-sync small.sync-error{color:#b42318;font-weight:800}
.topbar-actions{display:flex;align-items:center;gap:10px}
.settings-account-section{padding:18px 20px 22px;border-top:1px solid #e8edf5}
.settings-account-section h3{margin:0 0 12px;font-size:16px}
.settings-account-email{font-size:12px;color:#667085;overflow-wrap:anywhere;margin:0 0 12px}
.settings-account-email strong{color:#344054}
.settings-account-section .account-menu{max-width:none;position:static}
.settings-account-section .account-menu summary{padding:12px 14px;background:#f2f5fa;border-radius:10px}
.settings-account-section .account-menu-content{position:static;box-shadow:none;border:0;padding:10px 0;min-width:0}
@media(max-width:600px){.header-sync{max-width:120px}.header-sync small{font-size:10px}.topbar-actions{gap:7px}.settings-account-section{padding:16px}}

/* Account actions: backup directly beneath admin; email remains inside settings. */
.header-account-actions{display:flex;flex-direction:column;align-items:flex-end;gap:5px;flex:none}
.header-account-actions .account-menu{position:relative;max-width:100%}
.header-account-actions .account-menu summary{font-size:11px;line-height:1.25;list-style:none;cursor:pointer;padding:0 2px;color:#2368d4}
.header-account-actions .account-menu summary::-webkit-details-marker{display:none}
.header-account-actions .account-menu summary::before{content:"▸ ";font-size:10px}
.header-account-actions .account-menu[open] summary::before{content:"▾ "}
.header-account-actions .account-menu-content{position:absolute;right:0;top:25px;z-index:30;min-width:min(260px,83vw);padding:12px;border:1px solid #dde5ef;background:#fff;border-radius:14px;box-shadow:0 14px 34px rgba(23,42,74,.14)}
.settings-account-section{padding:12px 20px 18px}
.settings-account-section .settings-account-email{margin:0}
@media(max-width:600px){.header-account-actions .account-menu summary{font-size:10px}.header-account-actions{gap:3px}}

/* China-market P&L convention: positive red, negative green, zero neutral. */
.analysis-metric .stat-profit,.analysis-table .stat-profit,.instrument-bar-half.gain .instrument-bar-amount{color:#c4322b}
.analysis-metric .stat-loss,.analysis-table .stat-loss,.instrument-bar-half.loss .instrument-bar-amount{color:#087a5a}

/* Date-filtered realized P&L curve (shown inside the collapsed archive). */
.history-equity-section{margin:11px 0 15px;padding:14px 12px 10px;border:1px solid #e0e6ef;border-radius:15px;background:linear-gradient(180deg,#f8fafe,#fff)}
.history-equity-head{display:flex;align-items:baseline;justify-content:space-between;gap:9px;flex-wrap:wrap}
.history-equity-head strong{font-size:14px;color:#27374c}.history-equity-head span{font-size:11px;color:#758297}
.history-equity-chart{min-height:45px;margin-top:9px;font-size:12px;color:#7d8798}
.history-equity-chart svg{display:block;width:100%;height:auto;max-height:183px}
.history-zero-line{stroke:#b7c2d1;stroke-width:1;stroke-dasharray:4 5}
.history-zero-label,.history-date-label{fill:#8b97a9;font-size:10px}
.history-equity-meta{display:flex;align-items:baseline;justify-content:space-between;gap:10px;flex-wrap:wrap;font-size:12px;color:#627188}
.history-equity-meta strong{font-size:17px;font-variant-numeric:tabular-nums;color:#27374c}
.history-equity-meta strong.stat-profit{color:#c4322b}.history-equity-meta strong.stat-loss{color:#087a5a}
.history-equity-caption{font-size:11px;line-height:1.6;color:#8a95a6;margin:6px 0 0}
@media(max-width:390px){.history-equity-section{padding:12px 9px}.history-equity-meta strong{font-size:15px}}

.discipline-rule-preview{font-size:13px;font-weight:700;color:#344256;line-height:1.6}
.discipline-warning-list{max-height:165px;overflow:auto;border:1px solid #dbe3ed;border-radius:10px;padding:7px 10px;background:#fff}
.discipline-warning-list p{font-size:12px;line-height:1.6;margin:6px 0;overflow-wrap:anywhere}
.discipline-warning-list small{color:#637289}
.discipline-editor>small{font-size:11px;color:#64748b;line-height:1.6}
.discipline-waived{margin-top:6px;color:#087a5a;font-size:12px;line-height:1.6;overflow-wrap:anywhere}

/* Waiver editor appears only for actionable discipline violations. */
.discipline-waiver-controls,.discipline-waiver-reason{display:grid;gap:8px}
.discipline-waiver-controls>small{font-size:11px;color:#64748b;line-height:1.6}

/* A compliant correction record keeps only the review field, not the discipline panel. */
.correction-discipline-section{display:grid;gap:8px}
#correctionDisciplineSection[hidden],#correctionWaiverControls[hidden],#correctionWaiverReasonWrap[hidden]{display:none!important}

/* The settings 1R summary is itself the only editable control. */
.one-r-edit-card .one-r-edit-label{display:block;margin:0 0 4px;color:#7d8799;font-size:11px;line-height:1.4}
.one-r-edit-control{display:flex;align-items:center;gap:2px;min-height:36px}
.one-r-edit-control>span{display:inline!important;color:#1c2638!important;font-size:18px!important;font-weight:800;flex:none}
.one-r-edit-control input{min-width:0;width:100%;margin:0;padding:5px 8px;border:1px solid #cbd8ea;border-radius:8px;background:#fff;color:#172033;font-size:18px;font-weight:800;line-height:1.3;box-shadow:none}
.one-r-edit-control input:focus{outline:none;border-color:#286fef;box-shadow:0 0 0 2px rgba(40,111,239,.12)}
.one-r-edit-control input:disabled{color:#8290a3;background:#e9edf3;border-color:transparent}
@media(max-width:600px){.one-r-edit-card .one-r-edit-label{font-size:12px}.one-r-edit-control input{font-size:17px}}

/* Keep short green sync states together; retain multiline error details. */
.header-account-actions .header-sync{width:100%;max-width:150px;min-width:0;justify-content:flex-end;text-align:right}
.header-account-actions .header-sync small{line-height:1.3;font-size:10px}
.header-account-actions .header-sync small:not(.sync-long):not(.sync-error){white-space:nowrap;overflow-wrap:normal;word-break:keep-all}
.header-account-actions .header-sync small.sync-long,
.header-account-actions .header-sync small.sync-error{white-space:normal;overflow-wrap:anywhere}

/* Numeric axes on both transaction equity curves, mobile-first. */
.history-equity-chart svg{height:auto;max-height:190px}
.capital-equity-chart svg{height:auto;max-height:190px}
.history-y-grid,.capital-y-grid{stroke:#e5eaf2;stroke-width:1}
.capital-zero-line{stroke:#b7c2d1;stroke-width:1;stroke-dasharray:4 5}
.history-y-label,.capital-y-label{fill:#43556d;font-size:15px;font-weight:650;font-variant-numeric:tabular-nums}
.capital-x-label,.history-date-label{fill:#43556d;font-size:14px;font-weight:600;font-variant-numeric:tabular-nums}

@media(max-width:390px){.history-equity-chart svg,.capital-equity-chart svg{width:100%;max-height:none}}

/* Three-line home header: the first glyphs of 成员 / 账户 / 云端 align. */
.header-account-actions{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  align-content:center;
  align-items:center;
  justify-items:stretch;
  gap:2px;
  width:106px;
  flex:0 0 106px;
}
.header-account-actions .admin-nav{
  width:100%;
  min-width:0;
  margin:0;
  padding:6px 4px 6px 12px;
  text-align:left;
  font-size:11px;
  line-height:1.4;
  white-space:nowrap;
}
.header-account-actions .account-menu{
  width:100%;
  max-width:none;
  min-width:0;
  margin:0;
}
.header-account-actions .account-menu summary{
  position:relative;
  display:block;
  padding:4px 0 4px 12px;
  margin:0;
  font-size:11px;
  line-height:1.4;
  text-align:left;
  white-space:nowrap;
}
.header-account-actions .account-menu summary::before{
  content:"▸";
  position:absolute;
  top:4px;
  left:0;
  width:10px;
  line-height:1.4;
  text-align:left;
}
.header-account-actions .account-menu[open] summary::before{content:"▾"}
.header-account-actions .header-sync{
  display:block;
  width:100%;
  min-width:0;
  max-width:none;
  padding:3px 0 3px 12px;
  margin:0;
  text-align:left;
}
.header-account-actions .header-sync small{
  display:block;
  font-size:11px;
  line-height:1.4;
  text-align:left;
}
@media(max-width:420px){
  .header-account-actions{width:100px;flex-basis:100px;gap:1px}
  .header-account-actions .admin-nav,
  .header-account-actions .account-menu summary,
  .header-account-actions .header-sync small{font-size:10px}
}
/* Close date sits to the right of discipline, never beside the crowded price details.
   The row wraps naturally on narrower iPhone screens without clipping warnings. */
.closed-card .closed-discipline-row{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  flex-wrap:wrap;
  column-gap:12px;
  row-gap:4px;
  margin:10px 0 3px;
}
.closed-card .closed-discipline-row .discipline-status{
  flex:1 1 160px;
  min-width:0;
  margin:0;
  line-height:1.5;
  overflow-wrap:anywhere;
}
.closed-card .closed-discipline-row .closed-day{
  flex:0 0 auto;
  display:block;
  margin-left:auto;
  color:#8792a3;
  font-size:11px;
  line-height:1.5;
  text-align:right;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
@media(max-width:420px){
  .closed-card .closed-discipline-row{column-gap:8px;row-gap:3px}
  .closed-card .closed-discipline-row .closed-day{font-size:11px}
}

/* Member-management capsule should fit its four characters, not fill the right-side column. */
.header-account-actions .admin-nav{
  box-sizing:border-box;
  width:max-content;
  max-width:100%;
  justify-self:start;
  padding:4px 8px 4px 12px;
  border-radius:12px;
}
/* Subtle tappable correction shortcut directly before the closing calendar date. */
.closed-card .closed-date-actions{
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:flex-end;
  gap:5px;
  min-width:0;
  margin-left:auto;
}
.closed-card .closed-date-actions .closed-day{
  margin:0;
  flex:0 0 auto;
}
.closed-card .closed-date-actions .closed-correction-btn{
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin:0;
  padding:0;
  width:28px;
  height:28px;
  min-width:28px;
  min-height:28px;
  flex:0 0 28px;
  border:1px solid #c8d0db;
  border-radius:50%;
  background:#f4f6f9;
  color:#778398;
  font-size:14px;
  font-weight:700;
  line-height:1;
  box-shadow:none;
  cursor:pointer;
}
.closed-card .closed-date-actions .closed-correction-btn:focus-visible{
  outline:2px solid #2563eb;
  outline-offset:2px;
}
.closed-card .closed-date-actions .closed-correction-btn:active{
  background:#e4e9f0;
}
@media(max-width:420px){
  .header-account-actions .admin-nav{padding:4px 7px 4px 12px}
  .closed-card .closed-date-actions{gap:4px}
}


/* October 2026 journal refinement: common five-character header width,
   smaller visible edit mark with a comfortable finger-sized hit target. */
.header-account-actions .admin-nav{
  width:calc(5em + 17px);
  max-width:100%;
  box-sizing:border-box;
  padding:4px 5px 4px 12px;
  justify-self:start;
}
.closed-card .closed-date-actions .closed-correction-btn{
  width:36px;
  height:36px;
  min-width:36px;
  min-height:36px;
  flex:0 0 36px;
  border:0;
  border-radius:50%;
  background:transparent;
  padding:0;
  margin:0;
}
.closed-card .closed-date-actions .closed-correction-btn>span{
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border:1px solid #c8d0db;
  border-radius:50%;
  background:#f4f6f9;
  color:#778398;
  font-size:11px;
  line-height:1;
  font-weight:700;
}
.closed-card .closed-date-actions .closed-correction-btn:active{background:transparent}
.closed-card .closed-date-actions .closed-correction-btn:active>span{background:#e4e9f0}
.recent-closed-trades{margin-top:18px}
.recent-closed-trades>summary{
  cursor:pointer;
  font-weight:750;
  font-size:15px;
  color:#1f2b40;
  padding:2px 0;
}
.recent-closed-trades[open]>summary{margin-bottom:12px}
.recent-closed-trades .position-list{margin-top:0}
.history-archive{margin-top:0}
.history-archive>.section-head{margin-bottom:14px}


/* Charts fill the narrow iPhone viewport without enlarging their source data. */
.capital-chart-note .capital-note-value{
  font-size:15px;
  font-weight:800;
  font-variant-numeric:tabular-nums;
  color:#64748b;
}
.capital-chart-note .capital-note-value.stat-profit{color:#c4322b}
.capital-chart-note .capital-note-value.stat-loss{color:#087a5a}
@media(max-width:600px){
  .capital-equity-chart{
    box-sizing:border-box;
    padding:9px 7px 10px;
  }
  .history-archive{
    box-sizing:border-box;
    padding:12px 8px;
  }
  .history-archive .history-equity-section{
    padding:12px 6px 10px;
  }
  .capital-equity-chart svg,
  .history-equity-chart svg{
    display:block;
    width:100%;
    height:auto;
    max-height:none;
  }
  .capital-equity-chart .capital-chart-note{
    padding:2px 6px 0;
  }
}

/* Cloud-persisted auto released-capital setting, compact on mobile. */
.auto-risk-capital-toggle{display:inline-flex;max-width:100%;width:max-content;align-items:center;gap:9px;margin:4px 0 5px;padding:9px 0;color:#425168;font-size:13px;font-weight:600;cursor:pointer}
.auto-risk-capital-toggle input[type="checkbox"]{flex:0 0 19px;width:19px;height:19px;min-width:19px;margin:0;padding:0;accent-color:#3468ca;border-radius:5px}
.auto-risk-capital-toggle span{flex:0 1 auto;min-width:0;line-height:1.5}
.close-action-row{display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin:4px 0 5px;padding:9px 0;color:#425168;font-size:13px;font-weight:600}
.close-action-row input[type="checkbox"]{flex:0 0 19px;width:19px;height:19px;min-width:19px;margin:0;padding:0;accent-color:#3468ca;border-radius:5px}
.close-action-row label{display:inline;flex:none;margin:0;font:inherit;color:inherit;cursor:pointer}
.close-action-description{min-width:0;flex:0 1 auto;line-height:1.5;font-weight:400;color:#65738a}
.close-price-field{min-width:0;display:block}
.close-price-label{margin:0;line-height:1.5}
.close-fee-confirm-row{margin:10px 0 12px;padding:10px 12px;background:#fff8eb;border:1px solid #e9cfa3;border-radius:12px;color:#72531d;font-size:13px;line-height:1.5}
.close-fee-confirm-row p{margin:0 0 8px;line-height:1.55}
.close-fee-confirm-row .close-fee-confirm-label{display:inline-flex;width:max-content;max-width:100%;align-items:center;gap:9px;margin:0;padding:2px 0;color:inherit;font-size:13px;font-weight:700;cursor:pointer}
.close-fee-confirm-label input[type="checkbox"]{flex:0 0 19px;min-width:19px;width:19px;height:19px;margin:0;padding:0;accent-color:#3468ca}
.close-fee-confirm-label span{min-width:0;line-height:1.5}
.close-preview-fee-note{display:block;max-width:230px;color:#866527;font-size:11px;line-height:1.5;white-space:normal}

/* Journal date filtering: shared compact toolbar for history and analytics.
 * Keep two native iOS date pickers side-by-side only when custom is selected.
 */
.compact-date-filter{display:grid;gap:8px;margin:14px 0 12px;min-width:0}
.date-filter-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.date-filter-presets>button{appearance:none;border:1px solid #dce4ed;border-radius:11px;background:#f3f6fa;color:#3b4b63;font:inherit;font-size:12px;font-weight:700;min-height:43px;padding:8px 2px;white-space:nowrap;cursor:pointer}
.date-filter-presets>button[aria-pressed="true"]{background:#e8f0ff;border-color:#9bbcf8;color:#1e56b1}
.date-filter-presets>button:focus-visible,.date-filter-custom-toggle:focus-visible{outline:2px solid #3574e7;outline-offset:2px}
.date-filter-presets>button:active{background:#dbe7f8}
.date-filter-custom-toggle{display:inline-flex;justify-self:start;align-items:center;gap:7px;min-height:40px;padding:6px 8px 6px 0;border:0;border-radius:9px;background:transparent;color:#516582;font:inherit;font-size:12px;font-weight:700;cursor:pointer}
.date-filter-custom-toggle[aria-pressed="true"]{color:#225bc5}
.date-filter-chevron{font-size:17px;line-height:1;transition:transform .15s ease}
.date-filter-custom-toggle[aria-expanded="true"] .date-filter-chevron{transform:rotate(180deg)}
.date-filter-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
.date-filter-fields[hidden]{display:none!important}
.date-filter-fields label{min-width:0;margin:0;font-size:12px;color:#64748b}
.date-filter-fields input[type="date"]{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0;height:44px;min-height:44px;margin-top:5px;padding:7px 6px;border:1px solid #dce4ed;border-radius:11px;background:#fff;color:#263449;font:inherit;font-size:14px;line-height:1.3}
.date-filter-fields input[type="date"]::-webkit-date-and-time-value{text-align:left;min-height:1.25em}
.analysis-detail-filters{margin-top:8px}
@media(max-width:390px){
  .date-filter-presets{gap:5px}
  .date-filter-presets>button{font-size:11px;padding:8px 1px}
  .date-filter-fields{gap:6px}
  .date-filter-fields input[type="date"]{font-size:13px;padding:7px 4px}
}

/* Bounded native Safari date fields: never cross the next grid column. */
.date-filter-fields>label{box-sizing:border-box;min-width:0;width:100%;max-width:100%}
.date-filter-fields .date-input-shell{
  display:block;box-sizing:border-box;min-width:0;width:100%;max-width:100%;
  height:44px;margin-top:5px;border:1px solid #dce4ed;border-radius:11px;
  background:#fff;overflow:hidden;isolation:isolate
}
.date-filter-fields .date-input-shell>input[type="date"]{
  display:block;box-sizing:border-box;width:100%!important;max-width:100%;
  min-width:0!important;height:42px;min-height:42px;margin:0;
  padding:6px 4px;border:0;border-radius:0;background:transparent;
  font-size:13px;line-height:1.25;overflow:hidden
}
.date-filter-fields .date-input-shell:focus-within{outline:2px solid #3476db;outline-offset:1px}
@media(max-width:390px){
  .date-filter-fields .date-input-shell>input[type="date"]{padding-inline:2px;font-size:12px}
}
/* History and Analytics custom dates: center native Safari date values.
 * Both panels use the same bounded fields, retaining the system date picker. */
:is(#historyCustomDates,#analysisCustomDates) .date-input-shell{
  display:flex;align-items:center;justify-content:center
}
:is(#historyCustomDates,#analysisCustomDates) .date-input-shell>input[type="date"]{
  display:flex;align-items:center;justify-content:center;
  padding:0 4px;text-align:center;line-height:normal
}
:is(#historyCustomDates,#analysisCustomDates) .date-input-shell>input[type="date"]::-webkit-date-and-time-value{
  display:inline-flex;align-items:center;justify-content:center;
  width:100%;min-height:1.25em;margin:0;text-align:center
}
:is(#historyCustomDates,#analysisCustomDates) .date-input-shell>input[type="date"]::-webkit-datetime-edit{
  padding:0;text-align:center
}
/* Homepage performance: cash drawdown and its *matching* reference rate
   remain in one compact mobile card, opposite the profit factor. */
.analytics-overview-drawdown>strong{margin-bottom:2px}
.analytics-overview-drawdown>.overview-drawdown-rate{
  font-size:12px;font-weight:650;color:#53647d;line-height:1.4;
  white-space:normal;overflow-wrap:anywhere;margin-bottom:3px
}
.analytics-overview-drawdown>.overview-drawdown-rate b{
  font-size:13px;color:#2d445f;white-space:nowrap;font-variant-numeric:tabular-nums
}
.analytics-overview-drawdown>small:last-child{font-size:11px;line-height:1.45}
@media(max-width:390px){
  .analytics-overview-drawdown>.overview-drawdown-rate{font-size:11px}
  .analytics-overview-drawdown>.overview-drawdown-rate b{font-size:12px}
}
/* Overview: amount and reference percentage share one card; 3 paired rows stay intact. */
.analytics-grid>.analytics-overview-drawdown .overview-drawdown-rate{
  margin:5px 0 4px;font-size:12px;line-height:1.4;color:#52647a;
  overflow-wrap:anywhere
}
.analytics-overview-drawdown .overview-drawdown-rate b{
  font-size:13px;font-weight:750;color:#2b435e;font-variant-numeric:tabular-nums
}
@media(max-width:390px){
  .analytics-grid>.analytics-overview-drawdown .overview-drawdown-rate{font-size:11px}
  .analytics-overview-drawdown .overview-drawdown-rate b{font-size:12px}
}
/* Reference-equity adjustments: compact and collapsed by default on iPhone. */
.stat-equity-toggle{display:flex!important;align-items:center;gap:9px;padding:8px 0 3px;cursor:pointer;font-size:13px;line-height:1.35}
.stat-equity-toggle input{flex:0 0 auto;min-width:16px;width:16px;height:16px;margin:0;accent-color:#2563eb}
.stat-equity-toggle span{display:block;min-width:0}
.stat-equity-toggle input:disabled+span{opacity:.65}
.stat-equity-note{display:block;color:#6d7c8d;font-size:11px;line-height:1.45;margin:0 0 8px}
.risk-recalibrate-btn{display:inline-flex;align-items:center;justify-content:center;max-width:100%;min-height:40px;margin:0 0 10px;padding:8px 12px;font-size:12px;line-height:1.35;white-space:normal;text-align:center}
.stat-equity-details{margin:1px 0 12px;border:1px solid #e4e9f3;border-radius:12px;padding:0 11px;background:#f8fafd}
.stat-equity-details summary{cursor:pointer;display:flex;justify-content:space-between;align-items:center;gap:5px;padding:9px 0;font-size:12px;font-weight:600;color:#34445b}
.stat-equity-details summary span{color:#64748b;font-weight:500}
.stat-equity-history{max-height:150px;overflow:auto;border-top:1px solid #e8ecf5;padding:4px 0 7px}
.stat-equity-history-item{display:flex;justify-content:space-between;align-items:center;gap:6px;padding:7px 0;font-size:11px;color:#607086}
.stat-equity-history-item strong{font-size:12px;color:#25364a;font-variant-numeric:tabular-nums}
.stat-equity-history-empty{margin:6px 0;font-size:11px;color:#718098}
.analysis-metric.analysis-drawdown-pair strong{margin-bottom:2px}
.analysis-metric.analysis-drawdown-pair .analysis-drawdown-reference{display:block;font-size:13px;font-weight:700;color:#46566e;line-height:1.4}
@media(max-width:390px){.stat-equity-details{padding:0 8px}.stat-equity-details summary{font-size:11px}.stat-equity-toggle{font-size:12px}}
/* Align average win/loss figures immediately after 盈利/亏损 labels. */
.analysis-metric.analysis-average-pair{
  padding:12px 11px;display:flex;flex-direction:column;gap:5px;min-width:0
}
.analysis-average-pair .analysis-average-row{
  display:flex;justify-content:flex-start;align-items:baseline;flex-wrap:wrap;
  gap:3px 7px;box-sizing:border-box;width:100%;min-width:0;
  padding:5px 0 6px;border-bottom:1px solid #eef1f5
}
.analysis-average-pair .analysis-average-row small{
  flex:0 0 auto;font-size:11px;white-space:nowrap
}
.analysis-average-pair .analysis-average-row strong{
  display:inline-block;flex:0 1 auto;width:auto;max-width:100%;min-width:0;
  margin:0;text-align:left;font-size:clamp(14px,3.7vw,16px);
  line-height:1.25;overflow-wrap:anywhere;word-break:break-word;
  font-variant-numeric:tabular-nums
}
/* Keep the separator below profit; put the final separator below the 0.1R note. */
.analysis-average-pair .analysis-average-row:last-of-type{
  border-bottom:0;
  padding-bottom:4px
}
.analysis-average-pair>small:last-child{
  display:block;box-sizing:border-box;width:100%;font-size:10px;line-height:1.35;
  margin:0;padding:5px 0 8px;border-bottom:1px solid #eef1f5
}
@media(max-width:390px){
  .analysis-average-pair .analysis-average-row{column-gap:5px}
  .analysis-average-pair .analysis-average-row strong{font-size:14px}
}

/* Tucked-away analytics criteria; shortcuts and KPI cards remain prominent.
 * Explicit [hidden] wins over author display rules, including Safari.
 */
.analysis-custom-filters{
  display:grid;gap:10px;margin:0 0 4px;padding:12px 11px 11px;
  border:1px solid #e3e9f2;border-radius:13px;background:#f8fafd;
  min-width:0;
}
.analysis-custom-filters[hidden],.analysis-filter-active[hidden]{display:none!important}
.analysis-custom-filters .date-filter-fields{margin:0}
.analysis-custom-filters .analysis-detail-filters{margin:0;row-gap:10px}
.analysis-custom-filters .analysis-rating-field{margin-top:1px;background:#fff}
.analysis-custom-filters .report-actions{margin:1px 0 0}
.analysis-custom-filters .report-explain{margin:0;line-height:1.55}
.analysis-filter-active{
  display:inline-block;padding:2px 6px;border-radius:999px;
  background:#edf2fa;color:#59708e;font-size:10px;line-height:1.5;
}
@media(max-width:390px){
  .analysis-custom-filters{padding:11px 8px}
  .analysis-custom-filters .analysis-rating-field{padding:10px 8px;column-gap:12px}
}

/* Keep all three analytics filters on one line, including iPhone SE width.
 * A full-width rating field stays beneath the three native dropdowns.
 * Do not change the history/closed-trade filters.
 */
.analysis-filters.analysis-detail-filters{
  grid-template-columns:repeat(3,minmax(0,1fr));
  column-gap:8px;row-gap:9px;margin:6px 0 10px;
}
.analysis-detail-filters>label{min-width:0;max-width:100%;margin:0}
.analysis-detail-filters>label>select{
  box-sizing:border-box;display:block;min-width:0;max-width:100%;
  height:43px;margin-top:4px;padding:9px 5px;border-radius:10px;
  font-size:16px;text-overflow:ellipsis;
}
.analysis-detail-filters>.analysis-rating-field{
  grid-column:1/-1;min-width:0;max-width:100%;box-sizing:border-box;
  margin-top:2px;
}
@media(max-width:390px){
  .analysis-filters.analysis-detail-filters{column-gap:6px;row-gap:8px}
  .analysis-detail-filters>label>select{padding:8px 4px}
}
@media(max-width:340px){
  .analysis-filters.analysis-detail-filters{column-gap:4px}
  .analysis-detail-filters>label>select{padding:8px 2px}
}

/* On-screen read-only profit concentration; the downloadable reports stay unchanged. */
.analysis-concentration{margin-top:15px}
.analysis-concentration-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.analysis-concentration-card{min-width:0;display:flex;flex-direction:column;gap:5px;padding:12px 11px;background:#f7f9fd;border:1px solid #e4eaf4;border-radius:12px}
.analysis-concentration-card>span{font-size:11px;color:#66758a;line-height:1.45}
.analysis-concentration-card>strong{font-size:clamp(15px,3.8vw,22px);line-height:1.35;color:#21324b;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.analysis-concentration-card>strong.stat-profit{color:#c4322b}
.analysis-concentration-card>strong.stat-loss{color:#087a5a}
.analysis-concentration-card>small{font-size:10px;color:#8793a4;line-height:1.5}
.analysis-concentration-bar{margin-top:13px}
.analysis-concentration-track{height:11px;border-radius:999px;background:#d8e4f3;overflow:hidden}
.analysis-concentration-fill{display:block;height:100%;background:#4775c7;border-radius:999px 0 0 999px}
.analysis-concentration-legend{display:flex;justify-content:space-between;gap:8px;margin-top:7px;color:#73849a;font-size:11px}
.analysis-concentration-empty{color:#8190a4;font-size:12px;margin:10px 0}
.analysis-concentration-note{font-size:11px;line-height:1.7;color:#7d899a;margin:10px 0 0}
@media(max-width:360px){.analysis-concentration-grid{grid-template-columns:1fr}.analysis-concentration-card>strong{font-size:20px}}

/* Journal report export and guarded reset */
.report-actions{display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin:13px 0 5px}
.report-actions>button{min-width:0;flex:1 1 140px;padding:10px 12px}
.report-explain{margin:3px 0 12px}
.full-reset-dialog{width:min(92vw,470px);max-width:470px;max-height:89dvh;overflow-y:auto;border:0;border-radius:16px;padding:0;box-shadow:0 20px 70px #14203345}
.full-reset-content{padding:21px;display:flex;flex-direction:column;gap:13px}
.full-reset-content h2{margin:0;font-size:20px}
.full-reset-content p{margin:0;font-size:13px;line-height:1.6}
.full-reset-content .reset-danger-note{color:#9a1f1f;background:#fff1f0;padding:12px;border:1px solid #f2b5b0;border-radius:12px}
.full-reset-content #exportBtn{align-self:flex-start;max-width:100%}
.reset-ack-label{display:inline-flex;max-width:100%;width:max-content;gap:8px;align-items:flex-start;font-size:13px;line-height:1.5}
.reset-ack-label input[type="checkbox"]{flex:0 0 19px;width:19px;height:19px;min-width:19px;margin:3px 0 0;padding:0}
.reset-phrase-label{display:flex;flex-direction:column;gap:7px;font-size:13px;font-weight:600}
.reset-phrase-label input{max-width:100%;box-sizing:border-box;font-size:16px}
.full-reset-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.full-reset-actions>button{flex:1 1 130px}
.full-reset-actions #resetFinalBtn:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:390px){.report-actions>button{flex-basis:120px;font-size:12px}.full-reset-content{padding:17px}.full-reset-actions>button{font-size:12px}}

/* Paired average R: signed values stay legible on iPhone and desktop. */
.analysis-r-pair .analysis-average-row{padding:4px 0 5px}
.analysis-r-pair .analysis-average-row strong{font-variant-numeric:tabular-nums}
.analysis-r-pair .analysis-average-row strong.stat-profit{color:#c4322b}
.analysis-r-pair .analysis-average-row strong.stat-loss{color:#087a5a}

/* Profit-to-drawdown ratio is a neutral performance multiple, not signed money. */
.analysis-metric strong.stat-neutral-metric{color:#1b2b3e}

/* History keyword search: top-right on desktop, full width beneath title on phones. */
.history-archive>.history-search-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;min-width:0}
.history-archive>.history-search-heading>div{min-width:0}
.history-search{box-sizing:border-box;display:flex;align-items:center;gap:8px;flex:0 1 240px;width:240px;max-width:44%;min-width:172px;min-height:42px;margin:0;padding:0 12px;border:1px solid #dce4ed;border-radius:12px;background:#fff;color:#7a8799;transition:border-color .15s,box-shadow .15s}
.history-search svg{flex:0 0 18px}
.history-search input[type="search"]{box-sizing:border-box;display:block;flex:1 1 auto;width:100%;min-width:0;min-height:40px;margin:0;padding:0;border:0;border-radius:0;outline:0;box-shadow:none;background:transparent;color:#263449;font:inherit;font-size:13px}
/* Suppress generic input:focus ring and native inset rounded style; the label
   alone owns the visible iOS/desktop focus ring. Keep native search clear UX. */
.history-search input[type="search"]:focus{border:0;outline:0;box-shadow:none;background:transparent}
.history-search input[type="search"]::placeholder{color:#8392a6;opacity:1}
.history-search:focus-within{border-color:#8bafea;box-shadow:0 0 0 3px #dce9fb}
@media(max-width:600px){
  .history-archive>.history-search-heading{flex-direction:column;align-items:stretch;gap:10px}
  .history-search{flex:0 0 auto;width:100%;max-width:none;min-width:0;min-height:44px}
  .history-search input[type="search"]{min-height:42px;font-size:16px}
}

/* Read-only original-entry rolling metrics. */
.analysis-rolling{min-width:0}
.rolling-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
.rolling-head h3{margin:0 0 4px}
.rolling-head .analysis-note{margin:0}
.rolling-switch{display:flex;gap:5px;padding:3px;border-radius:12px;background:#edf2f8;flex-shrink:0}
.rolling-switch button{border:1px solid transparent;background:transparent;color:#52647a;border-radius:9px;padding:9px 12px;min-height:40px;font-size:13px;font-weight:600;cursor:pointer}
.rolling-switch button[aria-pressed="true"]{background:#fff;border-color:#d3deee;color:#1c56aa}
.rolling-switch button:focus-visible{outline:2px solid #286fef;outline-offset:2px}
.rolling-note{font-size:12px;color:#65748a;margin:12px 0}
.rolling-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.rolling-metrics>div{display:grid;gap:5px;background:#f5f8fc;padding:12px;border-radius:12px;min-width:0}
.rolling-metrics span{font-size:12px;color:#68778a}
.rolling-metrics strong{font-size:17px;color:#1c2b42;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.rolling-metrics strong.stat-profit{color:#c4322b}
.rolling-metrics strong.stat-loss{color:#087a5a}
.rolling-chart{width:100%;max-width:560px;height:auto;display:block;margin:8px auto 4px;overflow:visible}
@media(max-width:600px){
  .rolling-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rolling-metrics>div{padding:10px}
  .rolling-metrics strong{font-size:16px}
  .rolling-switch{width:100%}
  .rolling-switch button{flex:1}
}

/* Approved analytics hierarchy: four featured, collapsed rolling, eight secondary. */
.analysis-core-head,.analysis-subsection-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.analysis-core-head{margin:22px 0 12px}.analysis-core-head h3{font-size:17px;margin:0}.analysis-core-caption{text-align:right;color:#7b8796;font-size:12px}.analysis-core-caption .analysis-note{margin:3px 0 0}
.analysis-metrics{display:block}
.analysis-subsection-heading{margin:16px 0 11px;font-size:15px;color:#263449}
.analysis-subsection-heading>span{font-size:12px;font-weight:400;color:#8290a1}
.analysis-metric-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.analysis-metric-grid>.analysis-metric{min-width:0}
.analysis-other-heading{margin-top:22px}
.analysis-rolling-disclosure{margin:17px 0 0;border:1px solid #dce4ed;border-radius:15px;background:#fff;overflow:hidden}
.analysis-rolling-disclosure>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 13px;cursor:pointer;list-style:none}
.analysis-rolling-disclosure>summary::-webkit-details-marker{display:none}
.rolling-disclosure-title{display:grid;gap:5px;min-width:0}
.rolling-disclosure-title>b{font-size:15px;color:#263449}
.rolling-disclosure-title>small{font-size:12px;color:#788699}
.rolling-disclosure-action{display:flex;align-items:center;gap:9px;color:#68778a;font-size:12px;white-space:nowrap}
.analysis-rolling-disclosure[open] .rolling-disclosure-action>span:first-child{font-size:0}
.analysis-rolling-disclosure[open] .rolling-disclosure-action>span:first-child:after{content:"收起";font-size:12px}
.analysis-rolling-disclosure[open] .rolling-disclosure-action>span:last-child{transform:rotate(180deg)}
.rolling-disclosure-body{border-top:1px solid #e7edf4;padding:13px}
.rolling-disclosure-body .rolling-switch{max-width:340px}
@media(max-width:600px){.analysis-core-head{align-items:flex-start}.analysis-metric-grid{gap:9px}.analysis-core-caption{max-width:55%}.rolling-disclosure-body .rolling-switch{max-width:none}}


/* AP login: approved first-version navy layout. Journal screens are untouched. */
#authGate.auth-shell{
  min-height:100dvh;min-height:100svh;display:grid;place-items:center;
  padding:max(30px,env(safe-area-inset-top)) 20px max(30px,env(safe-area-inset-bottom));
  background:radial-gradient(ellipse at 50% 20%,#152b53 0%,#0a1222 46%,#070b13 90%);
  color:#f5f8ff;color-scheme:dark;
}
#authGate .auth-v1-shell{width:min(100%,410px);animation:ap-login-rise .85s ease-out both}
#authGate .auth-v1-brand{text-align:center;margin-bottom:32px}
#authGate .auth-v1-mark{height:195px;display:grid;place-items:center;position:relative;background:none;border:0;border-radius:0;box-shadow:none}
#authGate .auth-v1-mark svg{width:240px;height:195px;max-width:100%;overflow:visible}
#authGate .auth-v1-trace{
  stroke-dasharray:100;stroke-dashoffset:100;
  animation:ap-login-draw 1.5s .2s ease forwards
}
#authGate .auth-v1-ap{
  opacity:0;animation:ap-login-appear .7s .15s ease forwards
}
#authGate .auth-v1-arrow{filter:drop-shadow(0 0 7px #248bff70)}
#authGate .auth-v1-brand h1{font-size:25px;letter-spacing:2px;line-height:1.3;margin:5px 0 10px;color:#f5f8ff;animation:ap-login-appear .7s .6s both}
#authGate .auth-v1-brand p{font-size:13px;letter-spacing:3px;color:#69b9ff;margin:0;animation:ap-login-appear .7s .9s both}
#authGate .auth-card{
  box-sizing:border-box;width:100%;border:1px solid #29405e;
  background:linear-gradient(155deg,#14233bbf,#0d1527e8);
  color:#f5f8ff;box-shadow:0 20px 60px #0006;
  border-radius:24px;padding:28px 24px;
  animation:ap-login-rise .75s 1s both;
}
#authGate .auth-v1-title{font-size:20px;font-weight:700;line-height:1.35;margin:0 0 6px;color:#f5f8ff}
#authGate .auth-v1-hint{font-size:13px;color:#9bacc6;margin:0 0 25px;line-height:1.5}
#authGate .auth-form{padding:0;margin:0}
#authGate .auth-v1-step{opacity:0;transform:translate3d(0,29px,0);filter:blur(3px);animation:ap-login-step .56s cubic-bezier(.18,.72,.26,1) both}
/* Original 29px entrance unchanged: email, password + remember, login; action links appear with the card and authorization note. */
#authGate .auth-v1-email{animation-delay:1s;animation-duration:.56s}
#authGate .auth-v1-password,
#authGate .auth-v1-remember{animation-delay:1.52s}
#authGate .auth-v1-submit{animation-delay:2.04s}
#authGate .auth-v1-label{font-size:13px;font-weight:500;color:#c9d7ea;display:block;margin:0 0 8px}
#authGate .auth-v1-field{
  display:block;width:100%;height:auto;min-height:52px;box-sizing:border-box;
  border:1px solid #30415c;background:#0a1324;color:#fff;
  border-radius:12px;padding:15px 14px;font-size:16px;
  line-height:1.4;outline:none;margin:0 0 14px;
  box-shadow:none;transition:border-color .2s,box-shadow .2s;
}
#authGate .auth-v1-field::placeholder{color:#8da1ba;opacity:1}
#authGate .auth-v1-field:focus{border-color:#55a9ff;box-shadow:0 0 0 3px #268cff22}
#authGate .auth-v1-password .auth-v1-field{margin-bottom:10px}
#authGate .auth-v1-remember{
  display:inline-flex;max-width:100%;width:max-content;align-items:center;gap:10px;cursor:pointer;
  font-size:13px;font-weight:500;color:#c9d7ea;
  margin:0 0 18px;padding:1px 0;min-height:26px;
}
#authGate #authRememberEmail{
  -webkit-appearance:none;appearance:none;
  display:grid;place-items:center;flex:none;
  box-sizing:border-box;background:#0a1324;border:1px solid #30415c;
  border-radius:5px;width:19px;height:19px;min-width:19px;min-height:19px;
  padding:0;margin:0;box-shadow:none;outline:none;cursor:pointer;
}
#authGate #authRememberEmail:checked{background:#0a1324;border-color:#55a9ff}
#authGate #authRememberEmail:checked::after{
  content:"";display:block;width:9px;height:5px;
  border-left:2px solid #72b8ff;border-bottom:2px solid #72b8ff;
  transform:translateY(-1px) rotate(-45deg)
}
#authGate #authRememberEmail:focus-visible{box-shadow:0 0 0 3px #268cff44;border-color:#55a9ff}
#authGate #loginBtn{
  display:block;width:100%;min-height:53px;border:0;border-radius:12px;
  padding:16px;background:linear-gradient(100deg,#1674f5,#39a8ff);
  color:white;font-size:16px;line-height:1.3;font-weight:700;
  cursor:pointer;box-shadow:0 8px 25px #1277ff38;
  transition:transform .2s,filter .2s
}
#authGate #loginBtn:active{transform:scale(.985)}
#authGate #loginBtn:hover{filter:brightness(1.1)}
#authGate #loginBtn:disabled{cursor:wait;opacity:.7}
#authGate .auth-links.auth-v1-links{
  display:flex;align-items:center;justify-content:center;gap:32px;
  margin:17px 0 4px;flex-wrap:wrap
}
#authGate .auth-v1-links .text-btn{
  background:none;border:0;color:#72b8ff;
  font:600 14px -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  cursor:pointer;padding:6px 4px;min-height:34px
}
#authGate .auth-v1-links .text-btn:focus-visible{outline:2px solid #72b8ff;outline-offset:2px;border-radius:5px}
#authGate .auth-note{
  display:block;margin:15px 0 0;text-align:center;color:#8fa2bf;
  font-size:11px;line-height:1.65
}
#authGate .auth-message{
  min-height:18px;margin:12px 0 0;padding:0;border:0;background:none;
  color:#9bc9ff;text-align:center;font-size:12px;line-height:1.55
}
#authGate .auth-message.auth-error{
  padding:10px 12px;background:#40202b;border-radius:10px;color:#ffd6d5
}
#authGate #authPending{color:#c9d7ea;font-size:13px;line-height:1.6}
#authGate #authPending strong{overflow-wrap:anywhere;color:#fff}
#authGate #authPending .auth-links{gap:10px}
#authGate #authPending button{min-height:40px}
#authGate .auth-v1-footer{
  text-align:center;color:#c4d9f3;font-size:15px;font-weight:600;
  letter-spacing:.07em;margin:25px 0 0;line-height:1.8
}
@keyframes ap-login-draw{to{stroke-dashoffset:0}}
@keyframes ap-login-appear{to{opacity:1}}
@keyframes ap-login-rise{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@keyframes ap-login-step{
  from{opacity:0;transform:translate3d(0,29px,0);filter:blur(3px)}
  to{opacity:1;transform:translate3d(0,0,0);filter:blur(0)}
}
@media(max-width:360px){
  #authGate.auth-shell{padding-left:14px;padding-right:14px}
  #authGate .auth-card{padding:24px 17px}
  #authGate .auth-v1-brand h1{font-size:22px}
  #authGate .auth-links.auth-v1-links{gap:18px}
}
@media(prefers-reduced-motion:reduce){
  #authGate .auth-v1-shell,#authGate .auth-card,
  #authGate .auth-v1-brand h1,#authGate .auth-v1-brand p,
  #authGate .auth-v1-ap,#authGate .auth-v1-trace,#authGate .auth-v1-step{
    animation:none!important;transition:none!important;transform:none!important;
    filter:none!important;opacity:1!important
  }
  #authGate .auth-v1-trace{stroke-dashoffset:0!important}
}


/* Journal-only brand refresh: approved AP vector mark, calm blue accents.
   Login, functional risk statuses, report exports and trade calculations stay untouched. */
#journalApp .topbar{position:relative;padding-bottom:15px}
#journalApp .topbar::after{
  content:"";position:absolute;bottom:0;left:0;right:0;height:2px;
  border-radius:999px;
  background:linear-gradient(90deg,#4da7ff 0%,#79bfff 24%,#e1ecf8 48%,transparent 86%)
}
#journalApp .ap-brand-logo{
  width:56px;height:56px;object-fit:contain;border-radius:13px;
  border:0;background:transparent;
  box-shadow:0 5px 14px rgba(12,24,44,.14)
}
#journalApp .ap-brand-heading{gap:12px}
#journalApp .ap-brand-heading .eyebrow{color:#6082af}
#journalApp .journal-tab.active{color:#236cc7;box-shadow:0 2px 9px rgba(31,79,143,.09)}
#journalApp .journal-nav{background:#eaf0f8}
#journalApp .summary-card.highlight,#journalApp .analytics-metric.analytics-featured{
  background:#edf5ff;border-color:#d8e9fc
}
@media(max-width:420px){
  #journalApp .ap-brand-logo{width:46px;height:46px;border-radius:11px}
  #journalApp .topbar{padding-bottom:13px}
}

/* Right-shift the actual three-row cluster about 10px, not only text inset. */
#journalApp .header-account-actions{width:96px;flex:0 0 96px}
#journalApp .header-account-actions .admin-nav{padding-left:16px}
#journalApp .header-account-actions .account-menu summary{padding-left:16px}
#journalApp .header-account-actions .account-menu summary::before{left:4px}
#journalApp .header-account-actions .header-sync{padding-left:16px}
@media(max-width:420px){
  #journalApp .header-account-actions{width:90px;flex:0 0 90px}
}

/* v86: no login logo tile; the existing 2+2+2 form entrance timing remains unchanged. */
@media(max-height:720px){#authGate .auth-v1-mark{height:165px}#authGate .auth-v1-mark svg{width:210px;height:165px}}

/* v87 preview: four main cards + compact rolling curve with no extra prose.
   While expanded, the lower eight date-scoped cards are hidden, not deleted.
   Folding the curve restores them and the original date KPI selection. */
.analysis-scope-visually-hidden,
.analysis-count-compact{
  position:absolute!important;width:1px!important;height:1px!important;
  padding:0!important;margin:-1px!important;overflow:hidden!important;
  clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important;
}
.analysis-count-error{display:block;margin:10px 0;color:#b42318;font-weight:600}
#analysisMetrics{margin-top:9px}
#analysisFeaturedMetrics{gap:8px}
#analysisFeaturedMetrics>.analysis-metric{padding:10px 11px;border-radius:13px}
#analysisMetrics .analysis-rolling-disclosure{margin:10px 0 0}
#analysisMetrics .analysis-rolling-disclosure>summary{padding:11px 13px}
#analysisMetrics .rolling-disclosure-body{padding:9px 11px 11px}
#analysisMetrics .rolling-disclosure-body .rolling-switch button{min-height:36px;padding:7px 11px}
#analysisMetrics .rolling-note{margin:8px 0 4px}
#analysisMetrics .rolling-chart{max-width:480px;margin:4px auto 0}
#analysisMetrics .analysis-secondary-metrics{margin-top:12px}
#analysisMetrics .analysis-rolling-disclosure[open] ~ .analysis-secondary-metrics{display:none}
@media(max-width:600px){
  #analysisMetrics{margin-top:7px}
  #analysisFeaturedMetrics{gap:7px}
  #analysisFeaturedMetrics>.analysis-metric{padding:9px 10px}
  #analysisMetrics .rolling-disclosure-body{padding:8px}
  #analysisMetrics .analysis-rolling-disclosure>summary{padding:10px 11px}
}

/* v87 preview: only the AP animated logo is visible during verified auto-resume.
   Invalid/expired sessions show the existing 2+2+2 sign-in form unchanged. */
#authGate.auth-auto-checking .auth-card{visibility:hidden!important;pointer-events:none!important}
/* In rolling focus mode hide everything below the curve, not merely 8 KPIs.
   All date-filtered breakdowns return automatically when the curve closes. */
.journal-page[data-journal-page="analysis"]:has(#analysisRolling[open]) > .analysis-group,
.journal-page[data-journal-page="analysis"]:has(#analysisRolling[open]) > .analysis-note:last-of-type{display:none!important}

/* v87 phone preview: move the WHOLE three-line member / backup / sync
   cluster slightly right without moving the settings gear or changing
   the three individual text insets and baseline alignment. */
#journalApp .header-account-actions{position:relative;left:8px}
@media(max-width:350px){#journalApp .header-account-actions{left:4px}}

/* v87 preview refinement: shrink only the member pill's LEFT background.
   Old text inset 16px; new margin 11px + padding 5px = 16px, so text stays put.
   Old right edge 5em+17px; new margin 11px + width 5em+6px = same edge.
   Account/backup, sync and settings gear do not move. */
#journalApp .header-account-actions .admin-nav{margin-left:11px;width:calc(5em + 6px);padding-left:5px}

/* iPhone login density preview: preserve approved AP brand, logo, and animations. */
@media(max-width:600px){
  #authGate .auth-card{padding:22px 22px}
  #authGate .auth-v1-hint{margin-bottom:16px}
  #authGate .auth-v1-label{margin-bottom:6px}
  #authGate .auth-v1-field{min-height:50px;padding:12px 14px;margin-bottom:10px}
  #authGate .auth-v1-password .auth-v1-field{margin-bottom:8px}
  #authGate .auth-v1-remember{margin-bottom:12px}
  #authGate .auth-links.auth-v1-links{margin:11px 0 2px}
  #authGate .auth-note{margin-top:10px}
  #authGate .auth-message{margin-top:8px}
  #authGate .auth-v1-footer{margin-top:15px}
}
@media(max-width:360px){
  #authGate .auth-card{padding:20px 17px}
}

/* v90 compact iPhone welcome preview. Top AP logo, brand and animations stay unchanged. */
#authGate .auth-v1-heading{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 16px}
#authGate .auth-v1-heading .auth-v1-title,#authGate .auth-v1-heading .auth-v1-hint{margin:0}
#authGate .auth-message[hidden]{display:none!important}
@media(max-width:600px){
  #authGate .auth-card{padding:18px 21px}
  #authGate .auth-v1-heading{margin-bottom:11px}
  #authGate .auth-v1-label{margin-bottom:5px}
  #authGate .auth-v1-field{min-height:48px;padding:11px 14px;margin-bottom:8px}
  #authGate .auth-v1-password .auth-v1-field{margin-bottom:6px}
  #authGate .auth-v1-remember{margin-bottom:8px}
  #authGate .auth-links.auth-v1-links{margin:8px 0 0}
  #authGate .auth-note{margin-top:7px}
  #authGate .auth-message:not([hidden]){margin:7px 0 0}
  #authGate .auth-v1-footer{margin-top:10px}
}
@media(max-width:600px) and (max-height:780px){
  #authGate .auth-card{padding:12px 19px}
  #authGate .auth-v1-heading{margin-bottom:7px}
  #authGate .auth-v1-label{margin-bottom:3px}
  #authGate .auth-v1-field{min-height:46px;padding:10px 13px;margin-bottom:5px}
  #authGate .auth-v1-password .auth-v1-field{margin-bottom:3px}
  #authGate .auth-v1-remember{min-height:24px;margin-bottom:5px}
  #authGate .auth-links.auth-v1-links{margin:6px 0 0}
  #authGate .auth-note{margin-top:5px}
  #authGate .auth-message:not([hidden]){margin-top:5px}
  #authGate .auth-v1-footer{margin-top:8px;line-height:1.65}
}
@media(max-width:360px){
  #authGate .auth-card{padding-left:17px;padding-right:17px}
  #authGate .auth-v1-heading{column-gap:7px}
}

/* Signed-out iPhone: one continuous AP gradient on the document canvas.
   The auth shell is transparent to avoid differently sized radial layers and a
   visible seam when Safari scrolls or rubber-bands. */
html:has(#authGate:not([hidden])){
  background-color:#070b13;
  background-image:radial-gradient(ellipse at 50% 20%,#152b53 0%,#0a1222 46%,#070b13 90%);
  background-repeat:no-repeat;
  background-attachment:fixed;
}
body:has(#authGate:not([hidden])){background:transparent}
html:has(#authGate:not([hidden])) #authGate.auth-shell{background:transparent}

/* v90 fixed login status slot (preview only).
   Real errors appear between the login button and account links, without moving
   the links or authorization note. Longer server notices scroll inside this
   fixed-height area instead of covering the action links.
   Keep the approved AP logo, background and 53px button unchanged. */
#authGate .auth-status-slot{
  display:flex;align-items:center;justify-content:center;
  width:100%;height:30px;min-height:30px;overflow:hidden
}
#authGate .auth-status-slot .auth-message{
  box-sizing:border-box;width:100%;margin:0;max-height:30px;
  padding:0;overflow-y:auto;overscroll-behavior:contain;
  overflow-wrap:anywhere;font-size:12px;line-height:1.35
}
#authGate .auth-status-slot .auth-message.auth-error{
  padding:3px 7px;border-radius:8px
}
#authGate .auth-links.auth-v1-links{margin:0}
#authGate .auth-note{margin:0}
@keyframes ap-auth-status-reveal{from{opacity:0}to{opacity:1}}
#authGate .auth-status-slot .auth-message:not([hidden]){
  animation:ap-auth-status-reveal .18s ease-out both
}
@media(max-width:600px){
  #authGate .auth-card{padding-top:12px;padding-bottom:12px}
  #authGate .auth-v1-heading{margin-bottom:9px}
  #authGate .auth-v1-remember{margin-bottom:6px}
  #authGate .auth-v1-footer{margin-top:6px}
}
@media(max-width:600px) and (max-height:780px){
  #authGate .auth-status-slot{height:28px;min-height:28px}
  #authGate .auth-status-slot .auth-message{max-height:28px}
  #authGate .auth-card{padding-top:10px;padding-bottom:10px}
  #authGate .auth-v1-heading{margin-bottom:5px}
  #authGate .auth-v1-remember{margin-bottom:4px}
  #authGate .auth-v1-footer{margin-top:5px}
}
@media(prefers-reduced-motion:reduce){
  #authGate .auth-status-slot .auth-message{animation:none!important}
}


/* AP v91 night viewing mode. Scoped to the journal only; login and exports stay unchanged. */
html[data-ap-theme="night"] body{
  background:#101827;color:#e8eef7
}
html[data-ap-theme="night"] #journalApp{color:#e8eef7}
html[data-ap-theme="night"] #journalApp :is(.topbar h1,.section-head h2,.dialog-head h2,.analysis-group h3,.position-card h3,.closed-card h3,.position-card strong,.closed-card strong,.analytics-metric strong,.analysis-metric strong,.summary-card strong,.equity-card strong,.risk-card-head>div>strong){
  color:#e8eef7
}
html[data-ap-theme="night"] #journalApp :is(.eyebrow,.subtitle,.analysis-note,.capital-chart-note,.capital-chart-section>small,.analysis-metric span,.analysis-metric small,.summary-card span,.summary-card small,.equity-card span,.risk-card span,.risk-scale,.history-pagination span,.history-equity-caption,.history-equity-head span,.instrument-bars-legend,.instrument-bar-name small,.position-card small,.closed-card small,.risk-limit-item){
  color:#9aabc1
}
html[data-ap-theme="night"] #journalApp :is(.summary-card,.risk-card,.equity-card>div,.position-card,.closed-card,.analytics-panel,.analytics-metric,.analysis-metric,.analysis-group,.capital-equity-chart,.history-equity-section,.history-search,.capital-details,.stat-equity-details,.analysis-concentration-card,.analysis-rolling-disclosure,.discipline-editor,.discipline-warning-list,.account-strip,.account-menu-content,.sticky-head,.settings-formula>div,.settings-account-section .account-menu summary){
  background:#19263a;border-color:#304057;color:#e8eef7;box-shadow:none
}
html[data-ap-theme="night"] #journalApp :is(.summary-card.highlight,.analytics-metric.analytics-featured,.analysis-metric.analytics-featured){
  background:#20334c;border-color:#395675
}
html[data-ap-theme="night"] #journalApp :is(.journal-nav,.rolling-switch,.risk-progress,.instrument-bar-half,.capital-details-body,.rolling-disclosure-body){
  background:#202f45;border-color:#35475f
}
html[data-ap-theme="night"] #journalApp :is(.journal-tab,.date-filter-presets>button,.date-filter-custom-toggle,.rolling-switch button,.history-presets button){
  background:transparent;color:#b6c5d8;border-color:#3a4d66
}
html[data-ap-theme="night"] #journalApp :is(.journal-tab.active,.date-filter-presets>button[aria-pressed="true"],.rolling-switch button[aria-pressed="true"],.history-presets button[aria-pressed="true"]){
  background:#29496b;color:#dcecff;border-color:#527ba6
}
html[data-ap-theme="night"] #journalApp :is(input:not([type="checkbox"]),select,textarea,.history-search input,.date-filter-fields input[type="date"],.discipline-editor select,.discipline-editor textarea,.one-r-edit-control input){
  background:#101b2b;border-color:#3a4d66;color:#e8eef7
}
html[data-ap-theme="night"] #journalApp input::placeholder,
html[data-ap-theme="night"] #journalApp textarea::placeholder{color:#8295ae}
html[data-ap-theme="night"] #journalApp :is(.icon-btn,.secondary-btn,.edit-btn,.closed-correction-btn,.breakeven-btn){
  background:#26364c;border-color:#3a4d66;color:#d6e2f1;box-shadow:none
}
html[data-ap-theme="night"] #journalApp :is(.choice-chip,.segmented button,.empty-picker,.close-trade-name,.calc-preview,.rolling-metrics>div,.stat-equity-history-item,.auto-stop-row){
  background:#202f45;border-color:#3a4d66;color:#dce6f2
}
html[data-ap-theme="night"] #journalApp :is(.choice-chip.active,.segmented button.active,.date-filter-presets>button[aria-pressed="true"]){
  background:#29496b;border-color:#527ba6;color:#e2f0ff
}
html[data-ap-theme="night"] #journalApp :is(.analysis-table th,.analysis-table td,.history-equity-section,.stat-equity-details,.capital-details,.analysis-rolling-disclosure,.position-card,.closed-card){
  border-color:#304057
}
html[data-ap-theme="night"] #journalApp :is(.position-card.over-risk,.position-warning,.calc-preview.warning,.form-error,.full-reset-content .reset-danger-note){
  background:#3a2630;border-color:#70404a;color:#ffcfca
}
html[data-ap-theme="night"] #journalApp :is(.calc-preview.notice,.correlation-preview,.demo-banner){
  background:#382f20;border-color:#665334;color:#f2d9a7
}
html[data-ap-theme="night"] #journalApp :is(.status-pill.safe,.status-pill.warn,.status-pill.danger,.badge,.discipline-status){filter:brightness(.9) saturate(.9)}
html[data-ap-theme="night"] #journalApp dialog{
  background:#172438;border-color:#354961;color:#e8eef7
}
html[data-ap-theme="night"] #journalApp dialog :is(label,p,small,summary,.dialog-head h2,.settings-formula span){
  color:#c4d1e1
}
html[data-ap-theme="night"] #journalApp dialog input,
html[data-ap-theme="night"] #journalApp dialog select,
html[data-ap-theme="night"] #journalApp dialog textarea{
  background:#101b2b;border-color:#3a4d66;color:#e8eef7
}
html[data-ap-theme="night"] #journalApp dialog .settings-formula>div,
html[data-ap-theme="night"] #journalApp dialog .settings-account-section{
  background:#202f45;border-color:#354961
}
html[data-ap-theme="night"] #journalApp .account-menu-content{
  background:#19263a;border-color:#3a4d66
}
html[data-ap-theme="night"] #journalApp .history-search input{background:transparent}
html[data-ap-theme="night"] #journalApp .instrument-bar-amount{color:#e8eef7}
html[data-ap-theme="night"] #journalApp .instrument-bar-half{background:#26364c}
html[data-ap-theme="night"] #journalApp .instrument-bar-half.loss .instrument-bar-fill{background:#24513f}
html[data-ap-theme="night"] #journalApp .instrument-bar-half.gain .instrument-bar-fill{background:#63343a}
html[data-ap-theme="night"] #journalApp .analysis-table th,
html[data-ap-theme="night"] #journalApp .analysis-table td{border-bottom-color:#304057}
html[data-ap-theme="night"] #journalApp .date-filter-custom-toggle{color:#a9c7e8}
html[data-ap-theme="night"] #journalApp .ap-brand-heading .eyebrow{color:#8eb8e5}
html[data-ap-theme="night"] #journalApp .topbar::after{opacity:.65}
html[data-ap-theme="night"] #journalApp .empty-state,
html[data-ap-theme="night"] #journalApp .empty-picker{background:#19263a;border-color:#3a4d66;color:#9aabc1}

/* Theme control uses the same calm AP blue in both modes. */
.theme-preference{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:4px 0 18px;padding:13px;border:1px solid #dce5f0;border-radius:14px;background:#f6f9fd}
.theme-preference>div:first-child{display:grid;gap:3px}
.theme-preference strong{font-size:13px;color:#25364d}
.theme-preference small{font-size:11px;color:#718198;line-height:1.5}
.theme-choice-group{display:flex;gap:4px;padding:3px;border-radius:11px;background:#e8eef6;flex-shrink:0}
.theme-choice-group button{border:0;border-radius:8px;padding:8px 12px;background:transparent;color:#61738a;font-size:12px;font-weight:700;cursor:pointer}
.theme-choice-group button[aria-pressed="true"]{background:#fff;color:#2468b8;box-shadow:0 1px 5px #152d4a1a}
html[data-ap-theme="night"] #journalApp .theme-preference{background:#202f45;border-color:#3a4d66}
html[data-ap-theme="night"] #journalApp .theme-preference strong{color:#e8eef7}
html[data-ap-theme="night"] #journalApp .theme-preference small{color:#9aabc1}
html[data-ap-theme="night"] #journalApp .theme-choice-group{background:#152338}
html[data-ap-theme="night"] #journalApp .theme-choice-group button{color:#a9bad0}
html[data-ap-theme="night"] #journalApp .theme-choice-group button[aria-pressed="true"]{background:#315579;color:#e6f2ff;box-shadow:none}
@media(max-width:420px){
  /* The settings dialog sits outside #journalApp: keep title and switches
     on a single vertically centered line even on narrow iPhones. */
  #settingsDialog .theme-preference{align-items:center;flex-direction:row;gap:8px;padding:11px}
  #settingsDialog .theme-preference>div:first-child{min-width:0}
  #settingsDialog .theme-choice-group{width:auto;flex-shrink:0}
  #settingsDialog .theme-choice-group button{padding:8px 9px}
}


/* v91: settings and edit dialogs live outside #journalApp in the DOM. */
html[data-ap-theme="night"] body>dialog:not(#aboutApDialog){
  background:#172438;border-color:#354961;color:#e8eef7
}
html[data-ap-theme="night"] body>dialog:not(#aboutApDialog) :is(label,p,small,summary,.dialog-head h2,.settings-formula span,.settings-account-email){
  color:#c4d1e1
}
html[data-ap-theme="night"] body>dialog:not(#aboutApDialog) :is(input:not([type="checkbox"]),select,textarea){
  background:#101b2b;border-color:#3a4d66;color:#e8eef7
}
html[data-ap-theme="night"] body>dialog:not(#aboutApDialog) :is(.settings-formula>div,.settings-account-section,.theme-preference){
  background:#202f45;border-color:#354961
}
html[data-ap-theme="night"] #settingsDialog .theme-preference strong{color:#e8eef7}
html[data-ap-theme="night"] #settingsDialog .theme-preference small{color:#9aabc1}
html[data-ap-theme="night"] #settingsDialog .theme-choice-group{background:#152338}
html[data-ap-theme="night"] #settingsDialog .theme-choice-group button{color:#a9bad0}
html[data-ap-theme="night"] #settingsDialog .theme-choice-group button[aria-pressed="true"]{background:#315579;color:#e6f2ff;box-shadow:none}


/* AP night mode: position dialog is a body-level dialog, outside #journalApp.
   Keep its sticky header/footer and all form controls in the same dark palette. */
html[data-ap-theme="night"] body>dialog#positionDialog{
  background:#172438!important;
  border-color:#354961;
  color:#e8eef7;
  color-scheme:dark;
}
html[data-ap-theme="night"] body>dialog#positionDialog form{
  background:#172438;
  color:#e8eef7;
}
html[data-ap-theme="night"] body>dialog#positionDialog .sticky-head,
html[data-ap-theme="night"] body>dialog#positionDialog .sticky-actions{
  background:#172438!important;
  color:#e8eef7;
  border-color:#354961;
  box-shadow:0 8px 18px rgba(5,12,22,.18);
}
html[data-ap-theme="night"] body>dialog#positionDialog .form-section{
  border-top-color:#304057;
}
html[data-ap-theme="night"] body>dialog#positionDialog .form-section-title>span{
  background:#29496b;
  color:#dcecff;
}
html[data-ap-theme="night"] body>dialog#positionDialog .form-section-title strong,
html[data-ap-theme="night"] body>dialog#positionDialog .dialog-head h2{
  color:#e8eef7;
}
html[data-ap-theme="night"] body>dialog#positionDialog .form-section-title small,
html[data-ap-theme="night"] body>dialog#positionDialog .field-label,
html[data-ap-theme="night"] body>dialog#positionDialog label{
  color:#b8c7da;
}
html[data-ap-theme="night"] body>dialog#positionDialog :is(.choice-chip,.segmented button,.empty-picker){
  background:#202f45;
  border-color:#3a4d66;
  color:#dce6f2;
}
html[data-ap-theme="night"] body>dialog#positionDialog :is(.choice-chip.active,.segmented button.active){
  background:#29496b;
  border-color:#527ba6;
  color:#e2f0ff;
  box-shadow:none;
}
html[data-ap-theme="night"] body>dialog#positionDialog .segmented .long-choice.active{
  background:#493039;
  border-color:#89515a;
  color:#ffb8b0;
}
html[data-ap-theme="night"] body>dialog#positionDialog .segmented .short-choice.active{
  background:#1e443d;
  border-color:#397568;
  color:#8de0c4;
}
html[data-ap-theme="night"] body>dialog#positionDialog :is(.calc-preview,.auto-stop-row){
  background:#20334c;
  border-color:#395675;
  color:#dcecff;
}
html[data-ap-theme="night"] body>dialog#positionDialog .calc-preview :is(span,small){
  color:#a9bed8;
}
html[data-ap-theme="night"] body>dialog#positionDialog .calc-preview.warning{
  background:#3a2630;
  border-color:#70404a;
  color:#ffcfca;
}
html[data-ap-theme="night"] body>dialog#positionDialog .calc-preview.notice{
  background:#382f20;
  border-color:#665334;
  color:#f2d9a7;
}
html[data-ap-theme="night"] body>dialog#positionDialog .calc-preview.notice #riskPreviewNote{
  color:#f2d9a7;
}
html[data-ap-theme="night"] body>dialog#positionDialog .icon-btn{
  background:#26364c;
  border-color:#3a4d66;
  color:#d6e2f1;
  box-shadow:none;
}
html[data-ap-theme="night"] body>dialog#positionDialog .primary-btn{
  background:#286fef;
  color:#fff;
  box-shadow:none;
}
html[data-ap-theme="night"] body>dialog#positionDialog .form-error{
  background:#3a2630;
  border-color:#70404a;
  color:#ffcfca;
}
html[data-ap-theme="night"] body>dialog#positionDialog input::placeholder{
  color:#8295ae;
}
html[data-ap-theme="night"] body>dialog#positionDialog .dialog-head .eyebrow{
  color:#8eb8e5;
}

/* v91 visual QA corrections based on user screenshots. */
/* Keep the overview's six performance metrics as distinct cards. */
html[data-ap-theme="night"] #journalApp .analytics-panel{
  background:transparent;border-color:transparent;box-shadow:none;padding:0
}
html[data-ap-theme="night"] #journalApp .analytics-grid>.analytics-metric{
  background:#1b2a40;border:1px solid #354a64;border-radius:14px;box-shadow:none
}
html[data-ap-theme="night"] #journalApp .analytics-grid>.analytics-metric.analytics-featured{
  background:#203650;border-color:#426184
}
/* Keep the established futures P/L convention: profit red, loss green. */
html[data-ap-theme="night"] #journalApp :is(.stat-profit,#statNetPnl.positive,#statExpectancy.positive,#statNetPnl.profit,#statExpectancy.profit){
  color:#ff6b63!important
}
html[data-ap-theme="night"] #journalApp :is(.stat-loss,#statNetPnl.negative,#statExpectancy.negative,#statNetPnl.loss,#statExpectancy.loss){
  color:#36c995!important
}
/* Explicit P/L values in tables and concentration summaries must retain their sign color. */
html[data-ap-theme="night"] #journalApp .analysis-table .profit,
html[data-ap-theme="night"] #journalApp .analysis-concentration-card .profit,
html[data-ap-theme="night"] #journalApp .stat-profit{color:#ff6b63!important}
html[data-ap-theme="night"] #journalApp .analysis-table .loss,
html[data-ap-theme="night"] #journalApp .analysis-concentration-card .loss,
html[data-ap-theme="night"] #journalApp .stat-loss{color:#36c995!important}
/* Improve secondary information contrast without turning it into headline text. */
html[data-ap-theme="night"] #journalApp :is(.risk-limit-item,.risk-card .risk-limit-item strong,.overview-drawdown-rate,.overview-drawdown-rate b,.analytics-metric>small,.analytics-metric>span,.analytics-note,.rolling-note,.rolling-disclosure-action,.analysis-rolling-disclosure>summary,.analysis-rolling-disclosure>summary .rolling-disclosure-title,.analysis-rolling-disclosure>summary .rolling-disclosure-action){
  color:#b7c7dc!important
}
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary{
  background:#203149;color:#dce8f7
}
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary :is(svg,[aria-hidden="true"],.rolling-disclosure-action){
  color:#bcd0e8;fill:currentColor;opacity:1
}
/* The risk usage bar is an AP brand accent; the account/backup link keeps its original blue. */
html[data-ap-theme="night"] #journalApp .risk-progress i:not(.excess){
  background:linear-gradient(90deg,#1499f5 0%,#49c8ff 100%)
}
html[data-ap-theme="night"] #journalApp .risk-progress i.excess{
  background:#d92d20
}
html[data-ap-theme="night"] #journalApp .header-account-actions .account-menu summary{
  color:#2368d4!important
}


/* v91: preserve the semantic green "充足" status in night mode. */
html[data-ap-theme="night"] #journalApp .risk-card .status-pill.safe{
  background:#173f35!important;
  border:1px solid #28785f!important;
  color:#62d6a4!important;
  filter:none!important
}
html[data-ap-theme="night"] #journalApp .risk-card .status-pill.warn{
  background:#49391e!important;border:1px solid #80642c!important;
  color:#f2c66d!important;filter:none!important
}
html[data-ap-theme="night"] #journalApp .risk-card .status-pill.danger{
  background:#4b252c!important;border:1px solid #88434d!important;
  color:#ff8f91!important;filter:none!important
}


/* v91 follow-up: make the rolling performance title and icon clearly visible. */
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary .rolling-disclosure-title>b{
  color:#dce8f7!important;font-weight:800!important;opacity:1!important
}
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary .rolling-disclosure-title{
  color:#dce8f7!important;opacity:1!important
}
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary .rolling-disclosure-title>b::first-letter{
  color:#8fc9ff
}
html[data-ap-theme="night"] #journalApp .analysis-rolling-disclosure>summary .rolling-disclosure-action{
  color:#c5d8ee!important;font-weight:700;opacity:1!important
}
/* Profit concentration percentage was inheriting the light-theme dark ink. */
html[data-ap-theme="night"] #journalApp .analysis-concentration-card>strong{
  color:#e8eef7!important
}
html[data-ap-theme="night"] #journalApp .analysis-concentration-card>strong.stat-profit{
  color:#ff6b63!important
}
html[data-ap-theme="night"] #journalApp .analysis-concentration-card>strong.stat-loss{
  color:#36c995!important
}


/* v91: make night-mode profit concentration bar match the home risk bar. */
html[data-ap-theme="night"] #journalApp .analysis-concentration-track{
  height:8px;background:#202f45;border:0;border-radius:999px
}
html[data-ap-theme="night"] #journalApp .analysis-concentration-fill{
  background:linear-gradient(90deg,#1499f5 0%,#49c8ff 100%);
  border-radius:999px 0 0 999px
}


/* v91 night-mode chart readability: history and open-position equity charts. */
html[data-ap-theme="night"] #journalApp :is(.history-equity-head strong,.history-equity-meta,.history-equity-caption,.capital-chart-section>small,.capital-chart-note,.chart-axis-guide){
  color:#b8c9df!important
}
html[data-ap-theme="night"] #journalApp :is(.history-equity-head span,.history-equity-meta>span,.capital-chart-note){
  color:#a9bdd5!important
}
html[data-ap-theme="night"] #journalApp :is(.history-y-label,.capital-y-label,.capital-x-label,.history-date-label){
  fill:#a9bdd5!important
}
html[data-ap-theme="night"] #journalApp :is(.history-y-grid,.capital-y-grid){
  stroke:#40536d!important;stroke-width:1.1
}
html[data-ap-theme="night"] #journalApp :is(.history-zero-line,.capital-zero-line){
  stroke:#91a6c0!important
}
html[data-ap-theme="night"] #journalApp .history-equity-meta strong.stat-profit,
html[data-ap-theme="night"] #journalApp .capital-chart-note .capital-note-value.stat-profit{
  color:#ff6b63!important
}
html[data-ap-theme="night"] #journalApp .history-equity-meta strong.stat-loss,
html[data-ap-theme="night"] #journalApp .capital-chart-note .capital-note-value.stat-loss{
  color:#36c995!important
}
html[data-ap-theme="night"] #journalApp .history-equity-section{
  background:#1b2a40;border-color:#354a64
}
html[data-ap-theme="night"] #journalApp .capital-equity-chart{
  background:#1b2a40;border-color:#354a64
}


/* v91: make the user's trade review notes comfortably readable at night. */
html[data-ap-theme="night"] #journalApp .discipline-review{
  color:#b8c9df!important;
}
html[data-ap-theme="night"] #journalApp .discipline-review strong{
  color:#e2ecf8!important;
}


/* v91 layout consistency: analytics and trade-history pages share the same
   outer alignment, heading rhythm and date-filter toolbar geometry. */
#journalApp .journal-page[data-journal-page="history"] #closedArchive{
  margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none
}
#journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading{
  margin:0 0 12px;align-items:flex-end
}
#journalApp .journal-page[data-journal-page="history"] .history-search-heading .eyebrow,
#journalApp .journal-page[data-journal-page="analysis"]>.section-head .eyebrow{
  margin:0 0 5px;font-size:10px;line-height:1.4;letter-spacing:.15em;font-weight:800
}
#journalApp .journal-page[data-journal-page="history"] .history-search-heading h2,
#journalApp .journal-page[data-journal-page="analysis"]>.section-head h2{
  margin:0;font-size:21px;line-height:1.3;letter-spacing:-.02em
}
#journalApp .journal-page[data-journal-page="history"] #historyDateFilter,
#journalApp .journal-page[data-journal-page="analysis"] #analysisDateFilter{
  margin:14px 0 12px;gap:8px
}
#journalApp .journal-page[data-journal-page="history"] .date-filter-presets,
#journalApp .journal-page[data-journal-page="analysis"] .date-filter-presets{
  grid-template-columns:repeat(4,minmax(0,1fr));gap:6px
}
#journalApp .journal-page[data-journal-page="history"] .date-filter-presets>button,
#journalApp .journal-page[data-journal-page="analysis"] .date-filter-presets>button{
  min-height:43px;border-radius:11px;font-size:12px;font-weight:700
}
html[data-ap-theme="night"] #journalApp .journal-page[data-journal-page="history"] #closedArchive{
  background:transparent;border-color:transparent;box-shadow:none
}
@media(max-width:600px){
  #journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading{
    gap:10px;margin-bottom:12px
  }
  #journalApp .journal-page[data-journal-page="history"] .history-search-heading h2,
  #journalApp .journal-page[data-journal-page="analysis"]>.section-head h2{
    font-size:21px
  }
  #journalApp .journal-page[data-journal-page="history"] #historyDateFilter,
  #journalApp .journal-page[data-journal-page="analysis"] #analysisDateFilter{
    margin-top:14px
  }
}


/* AP v92: closing-position dialog must fully follow night theme and fit phones. */
html[data-ap-theme="night"] body>dialog#closeDialog{
  background:#172438!important;
  border-color:#354961;
  color:#e8eef7;
  color-scheme:dark;
}
html[data-ap-theme="night"] body>dialog#closeDialog form{
  box-sizing:border-box;
  width:100%;
  min-width:0;
  background:#172438;
  color:#e8eef7;
}
html[data-ap-theme="night"] body>dialog#closeDialog .dialog-head h2{
  color:#e8eef7;
}
html[data-ap-theme="night"] body>dialog#closeDialog .dialog-head .eyebrow{
  color:#8eb8e5;
}
html[data-ap-theme="night"] body>dialog#closeDialog .icon-btn,
html[data-ap-theme="night"] body>dialog#closeDialog .secondary-btn{
  background:#26364c;
  border:1px solid #3a4d66;
  color:#dce6f2;
  box-shadow:none;
}
html[data-ap-theme="night"] body>dialog#closeDialog .primary-btn{
  background:#286fef;
  color:#fff;
  box-shadow:none;
}
html[data-ap-theme="night"] body>dialog#closeDialog .close-trade-name{
  background:#202f45;
  border:1px solid #354961;
  color:#e2ecf8;
}
html[data-ap-theme="night"] body>dialog#closeDialog .price-stepper button{
  background:#26364c;
  border-color:#3a4d66;
  color:#a9c7e8;
}
html[data-ap-theme="night"] body>dialog#closeDialog .price-stepper button:active{
  background:#315579;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview{
  background:#20334c;
  border-color:#395675;
  color:#dcecff;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview :is(span,small){
  color:#a9bed8;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview strong{
  color:#f2f6fc;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview.warning{
  background:#3a2630;
  border-color:#70404a;
  color:#ffcfca;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview.notice{
  background:#382f20;
  border-color:#665334;
  color:#f2d9a7;
}
html[data-ap-theme="night"] body>dialog#closeDialog .calc-preview.notice :is(span,small){
  color:#f2d9a7;
}
html[data-ap-theme="night"] body>dialog#closeDialog .form-error{
  background:#3a2630;
  border-color:#70404a;
  color:#ffcfca;
}
html[data-ap-theme="night"] body>dialog#closeDialog :is(.close-price-note,.tick-subnote,#closeLotsHint){
  color:#9fb2ca;
}
html[data-ap-theme="night"] body>dialog#closeDialog #closeFeeActionHint{
  color:#a9c7e8;
}
html[data-ap-theme="night"] body>dialog#closeDialog .close-action-description{
  color:#a9bed8;
}
html[data-ap-theme="night"] body>dialog#closeDialog #closeCostsHint{
  color:#c4d1e1;
}
html[data-ap-theme="night"] body>dialog#closeDialog .close-fee-confirm-row{
  background:#332d22;
  border-color:#675539;
  color:#f2d9ad;
}
html[data-ap-theme="night"] body>dialog#closeDialog .close-preview-fee-note{
  color:#f2d9ad;
}
html[data-ap-theme="night"] body>dialog#closeDialog input[type="checkbox"]{
  accent-color:#4b91ff;
}
@media(max-width:600px){
  body>dialog#closeDialog{
    box-sizing:border-box;
    width:min(94vw,560px);
    max-width:calc(100vw - 20px);
  }
  body>dialog#closeDialog form{
    box-sizing:border-box;
    width:100%;
    min-width:0;
    padding:16px;
  }
  body>dialog#closeDialog .grid-2{
    grid-template-columns:minmax(0,1fr);
    gap:8px;
  }
  body>dialog#closeDialog label{
    min-width:0;
    overflow-wrap:anywhere;
  }
  body>dialog#closeDialog .dialog-actions{
    gap:10px;
  }
  body>dialog#closeDialog .dialog-actions>*{
    min-width:0;
    flex:1 1 0;
  }
}

/* Match desktop: mobile gear centers on the full member, backup and
   cloud-sync status stack without hard-coded vertical offsets. */
@media(max-width:600px){
  #journalApp .topbar-actions{align-items:center}
  #journalApp #settingsBtn{align-self:center;margin:0;transform:none;flex-shrink:0}
}



/* 2026-11-03: retain modal-local scrolling; block scroll chaining on mobile. */
body>dialog[open]{overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
html:has(dialog[open]){overscroll-behavior-y:none}
/* Night-mode protected stop: distinguish the pressed '已保本' state from
   the neutral '保本' action after the general night button reset rule. */
html[data-ap-theme="night"] #journalApp .breakeven-btn.is-protected,
html[data-ap-theme="night"] #journalApp .breakeven-btn[aria-pressed="true"]{
  background:#174c41;
  border:1px solid #31836b;
  color:#b2f7d9;
  box-shadow:inset 0 0 0 1px #286b5c;
}
html[data-ap-theme="night"] #journalApp .breakeven-btn.is-protected:active{
  background:#216553;
}
/* The unchecked night checkbox has exactly the same surface as the
   actual closing price input; checked state remains conspicuous and keyboard-safe. */
html[data-ap-theme="night"] body>dialog#closeDialog #closeYesterdayInput{
  -webkit-appearance:none;
  appearance:none;
  display:inline-grid;
  place-content:center;
  background:#101b2b;
  border:1px solid #3a4d66;
  border-radius:5px;
  box-shadow:none;
  color:#fff;
}
html[data-ap-theme="night"] body>dialog#closeDialog #closeYesterdayInput:checked{
  background:#286fef;
  border-color:#75a9f9;
}
html[data-ap-theme="night"] body>dialog#closeDialog #closeYesterdayInput:checked::after{
  content:"";
  display:block;
  width:10px;
  height:6px;
  border:solid #fff;
  border-width:0 0 2px 2px;
  transform:rotate(-45deg) translate(1px,-1px);
}
html[data-ap-theme="night"] body>dialog#closeDialog #closeYesterdayInput:focus-visible{
  outline:2px solid #8dbdff;
  outline-offset:3px;
}


/* Night-completeness 2026-11-03: custom analytics panels and body-level
   correction dialogs were outside the original generic dark-theme selectors.
   All overrides are scoped to night; no PDF, Excel or saved-data changes. */
html[data-ap-theme="night"] #journalApp,
html[data-ap-theme="night"] body>dialog:not(#aboutApDialog){color-scheme:dark}

/* Open-position empty state and recent trade title: readable without glare. */
html[data-ap-theme="night"] #journalApp .empty-state{
  background:#19263a;border-color:#40536d;color:#c0d0e3
}
html[data-ap-theme="night"] #journalApp .empty-state strong{
  color:#e6eefb;opacity:1
}
html[data-ap-theme="night"] #journalApp .recent-closed-trades>summary{
  color:#e6eefb;opacity:1
}
html[data-ap-theme="night"] #journalApp .recent-closed-trades>summary::marker{color:#b9cde7}
html[data-ap-theme="night"] #journalApp :is(.position-card .meta,.closed-card .meta,.closed-sub,.risk-history){color:#b9cadd}
html[data-ap-theme="night"] #journalApp :is(.closed-result.flat,.analysis-metric .flat){color:#c8d8ea!important}
html[data-ap-theme="night"] #journalApp .side.long{color:#ff756d}
html[data-ap-theme="night"] #journalApp .side.short{color:#41cc99}

/* Analytics date/filter/export entire custom panel, including white fieldset,
   native date shell and secondary report actions. Preserve control geometry. */
html[data-ap-theme="night"] #journalApp #analysisCustomDates{
  background:#1b2a40;border-color:#3b506a;color:#e5edf9
}
html[data-ap-theme="night"] #journalApp :is(#analysisCustomDates,#historyCustomDates) .date-input-shell{
  background:#101b2b;border-color:#405773
}
html[data-ap-theme="night"] #journalApp :is(#analysisCustomDates,#historyCustomDates) .date-input-shell>input[type="date"]{
  background:transparent;color:#e8eef7;color-scheme:dark
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates :is(.date-filter-fields label,.analysis-detail-filters>label,.analysis-rating-field legend){
  color:#c7d5e8
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-detail-filters>label>select{
  background:#101b2b;border-color:#405773;color:#e8eef7;color-scheme:dark
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-rating-field{
  background:#213149;border-color:#455a76
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-grade-choice{color:#e6eef9}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-grade-choice input[type="checkbox"]{
  background:#293c55!important;border-color:#8199b6!important
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-grade-choice input[type="checkbox"]:checked{
  background:#657d9d!important;border-color:#98b0cd!important
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .report-actions>button{
  background:#263950;border:1px solid #4b6180;color:#e8f1ff;box-shadow:none
}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .report-actions>button:active{background:#315578}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .report-explain{color:#b6c8dd}
html[data-ap-theme="night"] #journalApp .analysis-filter-active{background:#29456a;color:#d5e7fd}

/* Correction modal is a body child, NOT a descendant of #journalApp.
   Darken nested containers explicitly and preserve semantic profit colors. */
html[data-ap-theme="night"] body>dialog#correctionDialog{
  background:#172438;border-color:#354961;color:#e8eef7
}
html[data-ap-theme="night"] body>dialog#correctionDialog form{
  background:#172438;color:#e8eef7
}
html[data-ap-theme="night"] body>dialog#correctionDialog .dialog-head .eyebrow{color:#8eb8e5}
html[data-ap-theme="night"] body>dialog#correctionDialog :is(.close-trade-name,.discipline-editor,.discipline-warning-list){
  background:#203149;border:1px solid #3c526e;color:#e4edf9
}
html[data-ap-theme="night"] body>dialog#correctionDialog .close-trade-name{color:#e9f1fc}
html[data-ap-theme="night"] body>dialog#correctionDialog :is(.icon-btn,.secondary-btn){
  background:#283a52;border:1px solid #49617e;color:#e6effb;box-shadow:none
}
html[data-ap-theme="night"] body>dialog#correctionDialog .primary-btn{background:#286fef;color:#fff}
html[data-ap-theme="night"] body>dialog#correctionDialog .calc-preview{
  background:#20334c;border:1px solid #3c5878;color:#e6effc
}
html[data-ap-theme="night"] body>dialog#correctionDialog .calc-preview :is(span,small){color:#c0d1e6}
html[data-ap-theme="night"] body>dialog#correctionDialog .calc-preview strong:not(.profit):not(.loss):not(.stat-profit):not(.stat-loss){color:#e9f2ff}
html[data-ap-theme="night"] body>dialog#correctionDialog .calc-preview strong.flat{color:#ceddec!important}
html[data-ap-theme="night"] body>dialog#correctionDialog :is(.record-note,.tick-subnote,.discipline-waiver-controls>small){color:#b5c7dd}
html[data-ap-theme="night"] body>dialog#correctionDialog .discipline-editor :is(label,strong,.discipline-rule-preview){color:#dce7f7}
html[data-ap-theme="night"] body>dialog#correctionDialog textarea::placeholder{color:#a3b8d1;opacity:1}
html[data-ap-theme="night"] body>dialog#correctionDialog .form-error{
  background:#3a2630;border:1px solid #70404a;color:#ffd5cf
}
html[data-ap-theme="night"] body>dialog#correctionDialog .discipline-waived{color:#65dbab}

/* Other body-level utility dialogs with retained daytime secondary buttons. */
html[data-ap-theme="night"] body>dialog:is(#settingsDialog,#adminDialog,#confirmDialog,#fullResetDialog) :is(.secondary-btn,.icon-btn){
  background:#26364c;border:1px solid #405670;color:#e3eefc;box-shadow:none
}
html[data-ap-theme="night"] body>dialog:is(#settingsDialog,#adminDialog,#confirmDialog,#fullResetDialog) :is(.close-trade-name,.calc-preview,.discipline-editor,.sticky-head,.sticky-actions,.settings-formula>div){
  background:#202f45;border-color:#3b5069;color:#e6eef9
}
html[data-ap-theme="night"] body>dialog#settingsDialog .one-r-edit-control>span{color:#e9f1fc!important}
html[data-ap-theme="night"] body>dialog#fullResetDialog .reset-danger-note{
  background:#3a2630;border-color:#70404a;color:#ffd0cb
}

/* Correction input alignment 2026-11-03.
   Shared grid rows align both controls regardless of wrapped headings.
   Keeps the correction form independent from the global mobile .grid-2 rule. */
#correctionDialog .correction-edit-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-areas:
    "price-title costs-title"
    "price-input costs-input"
    "tick-note .";
  column-gap:12px;
  row-gap:6px;
  align-items:stretch;
  margin:2px 0 12px;
}
#correctionDialog .correction-edit-title{
  display:block;
  min-width:0;
  margin:0;
  align-self:end;
  font-size:13px;
  font-weight:700;
  line-height:1.4;
  overflow-wrap:anywhere;
}
#correctionDialog .correction-price-title{grid-area:price-title}
#correctionDialog .correction-costs-title{grid-area:costs-title}
#correctionDialog #correctionExitPrice{grid-area:price-input}
#correctionDialog #correctionCosts{grid-area:costs-input}
#correctionDialog .correction-edit-grid>input{
  box-sizing:border-box;
  min-width:0;
  width:100%;
  height:48px;
  margin:0;
}
#correctionDialog .correction-tick-note{
  grid-area:tick-note;
  display:block;
  min-width:0;
  margin:0;
  line-height:1.4;
}
#correctionDialog #correctionReviewNote{
  min-height:170px;
  resize:vertical;
}
@media(max-width:340px){
  #correctionDialog .correction-edit-grid{column-gap:8px}
  #correctionDialog .correction-edit-title{font-size:12px}
}

/* iOS/desktop: ordinary field captions are non-interactive. Only the actual
   input/select/textarea rectangle should focus the control. Checkbox labels
   intentionally remain interactive for accessible toggling. */
.passive-field{display:block;font-size:13px;color:#596579;margin-bottom:12px;min-width:0}
.passive-field small{color:#8892a4}
.passive-field input,.passive-field select{max-width:100%}
@media(max-width:600px){.passive-field{font-size:14px}.passive-field small{font-size:12px;line-height:1.55}}
#analysisCustomDates .analysis-detail-filters>.passive-field{min-width:0;max-width:100%;margin:0;font-size:12px;color:#64748b}
#analysisCustomDates .analysis-detail-filters>.passive-field>select{box-sizing:border-box;display:block;min-width:0;max-width:100%;width:100%;height:43px;margin-top:4px;padding:9px 5px;border:1px solid #dce4ed;border-radius:10px;background:#fff;color:#263449;font:inherit}
.passive-field[data-field="reset-phrase"]{display:flex;flex-direction:column;gap:7px;font-size:13px;font-weight:600}
.passive-field[data-field="reset-phrase"] input{max-width:100%;box-sizing:border-box;font-size:16px}
html[data-ap-theme="night"] body>dialog#positionDialog .passive-field{color:#b8c7da}
html[data-ap-theme="night"] #journalApp #analysisCustomDates .analysis-detail-filters>.passive-field>select{background:#101b2b;border-color:#405773;color:#e8eef7;color-scheme:dark}
/* Prevent the transient gray iOS tap flash on non-button field surfaces;
   retain the visible blue input focus treatment for keyboard accessibility. */
.passive-field{-webkit-tap-highlight-color:transparent}

/* Completed-trade risk budget basis: secondary information, not a warning. */
.closed-card .entry-risk-basis{margin:2px 0 4px;color:#66758b;font-size:11px;line-height:1.5;overflow-wrap:anywhere}
html[data-ap-theme="night"] #journalApp .closed-card .entry-risk-basis{color:#b6c9dc}

/* 2026-11: historical curve uses one consistent SVG aspect ratio, never forced
   to a short fixed height; allow proportionate growth on iPhone and desktop. */
.history-archive .history-equity-chart svg{
  display:block;
  width:100%;
  max-width:640px;
  height:auto;
  max-height:none;
  margin-inline:auto;
}
.history-archive .history-equity-meta{margin-top:2px}
.history-archive .history-equity-caption{margin-top:5px}

/* Compact November dashboard and correction audit, without hiding raw warnings. */
#statPayoffHint[hidden]{display:none!important}
#statNote{white-space:pre-line}
/* v102: give the two-line trade-summary note breathing room below the KPI
   grid, including night mode where the outer card has no regular padding. */
#journalApp .analytics-panel #statNote{
  margin:14px 12px 0;padding:0 0 4px;line-height:1.62;
  max-width:calc(100% - 24px);overflow-wrap:anywhere;word-break:normal
}
html[data-ap-theme="night"] #journalApp .analytics-panel{
  padding-bottom:18px
}
/* The bar endpoint below already shows its dynamic display scale. */
#journalApp .risk-card .risk-scale{font-size:15px;line-height:1.45;margin-top:9px}
#journalApp .risk-card .risk-scale>span{font-size:inherit;line-height:inherit;color:inherit}
/* Keep the new "closed only" scope note beside the custom-filter toggle.
   Wrapping on very narrow phones is preferable to horizontal clipping. */
#journalApp .analysis-filter-caption-row{
  display:flex;align-items:center;justify-content:space-between;
  flex-wrap:wrap;gap:5px 8px;min-width:0
}
#journalApp .analysis-filter-caption-row .date-filter-custom-toggle{
  flex:0 0 auto;justify-self:auto;max-width:100%
}
#journalApp .analysis-filter-scope-note{
  display:block;flex:0 1 auto;max-width:100%;min-width:0;
  color:#758399;font-size:clamp(10px,2.6vw,12px);line-height:1.45;
  white-space:nowrap;text-align:right;margin-left:auto
}
html[data-ap-theme="night"] #journalApp .analysis-filter-scope-note{color:#9aabc1}
@media(max-width:600px){
  /* The earlier highly specific history heading rule used flex-end.
     Its column layout then aligned the heading to the RIGHT on iPhone. */
  #journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading{
    align-items:stretch
  }
  #journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading>div{
    width:100%;max-width:100%;align-self:flex-start;text-align:left
  }
  #journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading h2{
    overflow-wrap:anywhere
  }
}
#correctionDialog .correction-risk-violation{color:#b42318;font-weight:750}
#correctionDialog .correction-risk-waived{color:#087a5a;font-weight:650}
#correctionDialog .correction-risk-basis{font-size:11px;color:#65758c;line-height:1.45}
#correctionDialog .correction-audit-details{border-top:1px solid #e2e8f0;margin-top:9px;padding-top:7px}
#correctionDialog .correction-audit-details>summary{cursor:pointer;list-style:auto;color:#5c6d83;font-size:12px;font-weight:650;padding:4px 0;touch-action:manipulation}
#correctionDialog .correction-audit-list{margin-top:5px;padding-top:5px;border-top:1px dashed #e2e8f0}
#correctionDialog .correction-audit-list p{font-size:11px;line-height:1.55;overflow-wrap:anywhere}
html[data-ap-theme="night"] body>dialog#correctionDialog .correction-risk-violation{color:#ff8c87}
html[data-ap-theme="night"] body>dialog#correctionDialog .correction-risk-waived{color:#65dbab}
html[data-ap-theme="night"] body>dialog#correctionDialog .correction-risk-basis,
html[data-ap-theme="night"] body>dialog#correctionDialog .correction-audit-details>summary{color:#bfd0e4}
html[data-ap-theme="night"] body>dialog#correctionDialog :is(.correction-audit-details,.correction-audit-list){border-color:#3c526e}

/* Distinguish actual discipline violations from ordinary correction notes. */
body>dialog#correctionDialog .discipline-rule-preview.discipline-preview-violated{color:#b42318}
html[data-ap-theme="night"] body>dialog#correctionDialog .discipline-rule-preview.discipline-preview-violated{color:#ff8c87}


/* PR #76: match the history curve's responsive canvas and desktop width. */
#journalApp .capital-chart-section .capital-equity-chart svg{
  display:block;
  width:100%;
  max-width:640px;
  height:auto;
  max-height:none;
  margin-inline:auto;
}

/* PR #76: latest-20 equity chart matches the date chart's responsive dimensions. */
#journalApp .capital-chart-section .capital-equity-chart svg{display:block;width:100%;max-width:640px;height:auto;max-height:none;margin-inline:auto}
/* Destructive reset is separated from routine account and sync controls. */
.settings-danger-zone{display:grid;gap:11px;margin:0 20px 20px;padding:14px;border:1px solid #f0d5d3;border-radius:14px;background:#fffafa}
.settings-danger-zone-head{display:grid;gap:4px}
.settings-danger-zone-head strong{font-size:13px;color:#9b3030}
.settings-danger-zone-head small{font-size:11px;line-height:1.5;color:#805f60}
.settings-danger-zone .danger-btn{width:100%;text-align:center}
/* Night-mode settings content sits outside #journalApp and needs explicit contrast. */
html[data-ap-theme="night"] #settingsDialog .stat-equity-details{background:#202f45;border-color:#354961}
html[data-ap-theme="night"] #settingsDialog .stat-equity-details summary{color:#e8eef7}
html[data-ap-theme="night"] #settingsDialog .stat-equity-details summary span{color:#b6c9df}
html[data-ap-theme="night"] #settingsDialog .stat-equity-history{border-top-color:#354961}
html[data-ap-theme="night"] #settingsDialog .stat-equity-history-item{color:#c4d1e1}
html[data-ap-theme="night"] #settingsDialog .stat-equity-history-item strong{color:#f0f5fc}
html[data-ap-theme="night"] #settingsDialog .stat-equity-history-empty,
html[data-ap-theme="night"] #settingsDialog .stat-equity-history-caption{color:#a9bad0}
html[data-ap-theme="night"] #settingsDialog .settings-account-email strong{color:#e8eef7}
html[data-ap-theme="night"] #settingsDialog .settings-danger-zone{background:#2b2630;border-color:#65404a}
html[data-ap-theme="night"] #settingsDialog .settings-danger-zone-head strong{color:#ffb8b3}
html[data-ap-theme="night"] #settingsDialog .settings-danger-zone-head small{color:#d3b4b7}
html[data-ap-theme="night"] #settingsDialog .settings-danger-zone .danger-btn{background:#512e38;border:1px solid #70404a;color:#ffd9d6}

/* v97: iPhone Safari uses the SAME dedicated value row for its R number
   and semantic status pill. No alignment by whole-header bottom margins:
   their actual centerlines are shared at any viewport width. */
#journalApp .risk-card-head{
  --risk-main-size:44px;
  display:block;
}
#journalApp .risk-card-head>.risk-card-label{display:block}
#journalApp .risk-card-head>.risk-card-main-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-width:0;
  margin-top:8px;
}
#journalApp .risk-card-head>.risk-card-main-row>strong{
  font-size:var(--risk-main-size);
  line-height:1;
  margin:0;
  white-space:nowrap;
}
/* The 600px-wide typography rule gives all header spans 1.4 line-height.
   Override it on the numeric R span or Safari inflates the numeral's box
   relative to the centered status badge (observed in Chromium at 390px). */
#journalApp .risk-card-head>.risk-card-main-row>strong>span{
  line-height:inherit!important;
}
#journalApp .risk-card-head>.risk-card-main-row>.status-pill{
  box-sizing:border-box;
  height:calc(var(--risk-main-size) * .76);
  min-height:calc(var(--risk-main-size) * .76);
  margin:0;
  padding:0 16px;
  flex:0 0 auto;
  font-size:19px!important;
  line-height:1;
  white-space:nowrap;
}
@media(max-width:600px){
  #journalApp .risk-card-head{--risk-main-size:clamp(34px,9.6vw,40px)}
  #journalApp .risk-card-head>.risk-card-main-row>.status-pill{
    font-size:clamp(15px,4.6vw,19px)!important;
    padding-inline:clamp(9px,3.5vw,16px)
  }
}
@media(max-width:360px){
  #journalApp .risk-card-head{--risk-main-size:clamp(30px,9.2vw,34px)}
  #journalApp .risk-card-head>.risk-card-main-row{gap:8px}
  #journalApp .risk-card-head>.risk-card-main-row>.status-pill{
    font-size:14px!important;padding-inline:8px
  }
}


/* Dual-R closed trade card: amount on its own line, both R units on the next.
   Used by recent-ten and date-filtered history; never changes touch targets. */
.closed-card .title-row>.closed-result{
  display:flex;
  flex:1 0 100%;
  flex-direction:column;
  align-items:flex-end;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  max-width:100%;
  gap:3px;
  margin:5px 0 0;
  text-align:right;
  white-space:normal;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.closed-card .closed-result-amount{
  display:block;
  max-width:100%;
  font-size:17px;
  font-weight:900;
  font-variant-numeric:tabular-nums;
}
.closed-card .closed-result-r{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  justify-content:flex-end;
  column-gap:14px;
  row-gap:3px;
  width:100%;
  min-width:0;
  font-size:12px;
  font-weight:600;
}
.closed-card .closed-result-r-item{
  min-width:0;
  max-width:100%;
  overflow-wrap:anywhere;
  /* Labels are neutral; only the numbers follow profit/loss colors. */
  color:#64748b;
}
.closed-card .closed-result-r-value{
  font-weight:800;
  font-variant-numeric:tabular-nums;
}
.closed-card .closed-result.profit .closed-result-r-value{color:#c4322b}
.closed-card .closed-result.loss .closed-result-r-value{color:#087a5a}
.closed-card .closed-result.flat .closed-result-r-value{color:#596579}
html[data-ap-theme="night"] #journalApp .closed-card .closed-result-r-item{
  color:#b9cadd;
}
html[data-ap-theme="night"] #journalApp .closed-card .closed-result.flat .closed-result-r-value{
  color:#c8d8ea;
}
@media(max-width:420px){
  .closed-card .closed-result-amount{font-size:15px}
  .closed-card .closed-result-r{column-gap:9px;font-size:11px}
}


/* Trade timeline: the two understated entry points never alter trade risk or P&L. */
#journalApp .position-card{grid-template-columns:minmax(0,1fr) auto;align-items:start}
#journalApp .position-card>div:first-child{min-width:0}
#journalApp .position-card .title-row>.position-timeline-trigger{margin-left:auto}
#journalApp .closed-card .title-row>.closed-timeline-trigger{margin-left:auto}
#journalApp .trade-timeline-trigger{
  display:inline-flex;align-items:center;justify-content:center;
  box-sizing:border-box;flex:0 0 auto;white-space:nowrap;
  min-height:36px;padding:7px 9px;gap:3px;
  border:1px solid transparent;border-radius:10px;
  background:transparent;color:#60748c;
  font-size:12px;font-weight:750;line-height:1.2;
  box-shadow:none;cursor:pointer;touch-action:manipulation;
}
#journalApp .trade-timeline-trigger:hover{background:#edf3fa;border-color:#e2e9f3}
#journalApp .trade-timeline-trigger:active{background:#dfe9f5}
#journalApp .trade-timeline-trigger:focus-visible{
  outline:2px solid #2563eb;outline-offset:2px;
}
@media(max-width:420px){
  #journalApp .trade-timeline-trigger{min-height:34px;padding:6px 5px;font-size:11px}
  #journalApp .position-card .title-row{column-gap:5px;row-gap:3px}
}
/* Preserve the existing neutral day/night palette; avoid bright blue pills. */
html[data-ap-theme="night"] #journalApp .trade-timeline-trigger{
  background:transparent;border-color:transparent;color:#b3c7dc;
}
html[data-ap-theme="night"] #journalApp .trade-timeline-trigger:hover,
html[data-ap-theme="night"] #journalApp .trade-timeline-trigger:active{
  background:#263b53;border-color:#405773;color:#e2edf8;
}

/* Modal is a direct child of body, outside #journalApp (same as edit/close). */
body>dialog#tradeTimelineDialog{
  width:min(94vw,540px);max-height:min(88dvh,760px);
  background:#fff;color:#19263a;overflow:auto;
}
#tradeTimelineDialog .trade-timeline-shell{padding:18px 19px 16px}
#tradeTimelineDialog .trade-timeline-head{margin-bottom:12px}
#tradeTimelineDialog .trade-timeline-head h2{font-size:20px;color:#18253b}
#tradeTimelineDialog .trade-timeline-identity{
  margin:0 0 11px;font-size:13px;font-weight:750;color:#4b5e75;
}
#tradeTimelineDialog .trade-timeline-summary{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;
}
#tradeTimelineDialog .trade-timeline-summary>div{
  padding:9px 8px;background:#f5f7fa;border:1px solid #edf0f4;
  border-radius:12px;min-width:0;
}
#tradeTimelineDialog .trade-timeline-summary small{
  display:block;font-size:10px;color:#7c8a9d;margin-bottom:5px;
}
#tradeTimelineDialog .trade-timeline-summary strong{
  display:block;font-size:13px;font-weight:800;overflow-wrap:anywhere;
  color:#1c293e;
}
#tradeTimelineDialog .trade-timeline-explanation{
  margin:13px 0 12px;font-size:11px;line-height:1.65;color:#68788c;
}
#tradeTimelineDialog .trade-timeline-date{
  display:block;background:#eff3f8;color:#43556c;
  border-radius:9px;padding:8px 11px;margin:14px 0 11px;
  font-size:12px;font-weight:800;text-align:center;
}
#tradeTimelineDialog .trade-timeline-event{
  position:relative;display:flex;gap:11px;
  padding:0 0 17px 7px;margin-left:10px;
  border-left:1px solid #dce4ed;min-width:0;
}
#tradeTimelineDialog .trade-timeline-event:last-child{padding-bottom:8px}
#tradeTimelineDialog .trade-timeline-dot{
  position:absolute;top:6px;left:-5px;box-sizing:border-box;
  width:9px;height:9px;background:#8297af;border:2px solid #fff;border-radius:50%;
}
#tradeTimelineDialog .trade-timeline-event-content{flex:1;min-width:0;padding-left:7px}
#tradeTimelineDialog .trade-timeline-event-head{
  display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;margin-bottom:4px;
}
#tradeTimelineDialog .trade-timeline-event-head time{
  font-size:11px;color:#8190a2;font-variant-numeric:tabular-nums;
}
#tradeTimelineDialog .trade-timeline-event-head strong{font-size:13px;color:#243249}
#tradeTimelineDialog .trade-timeline-event-content p{
  margin:0;font-size:12px;line-height:1.65;color:#627389;overflow-wrap:anywhere;
}
#tradeTimelineDialog .trade-timeline-profit{color:#c4322b!important}
#tradeTimelineDialog .trade-timeline-loss{color:#087a5a!important}
#tradeTimelineDialog .trade-timeline-foot{
  margin-top:10px;padding-top:10px;border-top:1px solid #edf0f4;justify-content:flex-end;
}
#tradeTimelineDialog .trade-timeline-foot button{min-height:40px}
@media(max-width:420px){
  #tradeTimelineDialog .trade-timeline-shell{padding:15px 14px 13px}
  #tradeTimelineDialog .trade-timeline-summary{gap:5px}
  #tradeTimelineDialog .trade-timeline-summary>div{padding:8px 6px}
  #tradeTimelineDialog .trade-timeline-summary strong{font-size:12px}
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog{
  background:#172438;border:1px solid #354961;color:#e8eef7;color-scheme:dark;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-head h2{
  color:#e8eef7
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-identity{
  color:#c2d2e5
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-summary>div{
  background:#202f45;border-color:#354961
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-summary small{
  color:#a5bad3
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-summary strong{
  color:#eef4ff
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-explanation{
  color:#b2c4da
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-date{
  background:#263a52;color:#dae8f8
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-event{
  border-left-color:#435875
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-dot{
  background:#9bb4cf;border-color:#172438
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-event-head time{
  color:#adc0d6
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-event-head strong{
  color:#edf4fd
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-event-content p{
  color:#c1d0e1
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-profit{
  color:#ff877f!important
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-loss{
  color:#63d9ad!important
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-foot{
  border-top-color:#354961
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog :is(.icon-btn,.secondary-btn){
  background:#26364c;border:1px solid #3a4d66;color:#d6e2f1;box-shadow:none
}


/* Saved close P&L reconciliation inside the timeline: crisp in day and night. */
#tradeTimelineDialog .trade-timeline-close-cash{
  margin:10px 0 2px;padding:11px 12px 9px;
  background:#f5f7fa;border:1px solid #e7ecf3;border-radius:12px;
  display:grid;gap:6px;
}
#tradeTimelineDialog .trade-timeline-cash-row{
  display:flex;justify-content:space-between;align-items:baseline;gap:12px;
  min-width:0;font-size:12px;line-height:1.5;
}
#tradeTimelineDialog .trade-timeline-cash-row>span{
  color:#596b82;flex:0 0 auto;
}
#tradeTimelineDialog .trade-timeline-cash-row>strong{
  color:#26364b;font-size:13px;font-weight:780;text-align:right;
  font-variant-numeric:tabular-nums;overflow-wrap:anywhere;
}
#tradeTimelineDialog .trade-timeline-cash-formula{
  text-align:right;color:#6e8095;font-size:10.5px;line-height:1.55;
  overflow-wrap:anywhere;word-break:normal;
}
#tradeTimelineDialog .trade-timeline-cash-total{
  padding-top:8px;margin-top:3px;border-top:1px solid #d8e0ea;
}
#tradeTimelineDialog .trade-timeline-cash-total .trade-timeline-cash-row>span{
  color:#334860;font-weight:800;
}
#tradeTimelineDialog .trade-timeline-cash-total .trade-timeline-cash-row>strong{
  font-size:16px;font-weight:850;
}
#tradeTimelineDialog .trade-timeline-cash-warning{
  margin:3px 0 0!important;color:#9b6420!important;
  font-size:11px!important;line-height:1.6!important;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-close-cash{
  background:#202f45;border-color:#354961;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-row>span{
  color:#bfd0e4;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-row>strong{
  color:#e6edf8;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-formula{
  color:#aec2d9;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-total{
  border-top-color:#455976;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-total .trade-timeline-cash-row>span{
  color:#e1ebf8;
}
html[data-ap-theme="night"] body>dialog#tradeTimelineDialog .trade-timeline-cash-warning{
  color:#f8c179!important;
}
@media(max-width:360px){
  #tradeTimelineDialog .trade-timeline-close-cash{padding:9px 8px}
  #tradeTimelineDialog .trade-timeline-cash-row{gap:7px}
  #tradeTimelineDialog .trade-timeline-cash-formula{font-size:10px}
}


/* Read-only grade edge popup. Grade-circle target expands only within its
   current table cell, with no navigation, filter mutation or broker action. */
#journalApp #analysisRatings .rating-insights-trigger{
  box-sizing:border-box;display:inline-grid;place-items:center;
  min-width:40px;min-height:40px;padding:5px;margin:-5px 0;
  border:0;border-radius:50%;background:transparent;
  cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;
}
#journalApp #analysisRatings .rating-insights-trigger:hover{background:#edf3fa}
#journalApp #analysisRatings .rating-insights-trigger:active{background:#e0eaf6}
#journalApp #analysisRatings .rating-insights-trigger:focus-visible{
  outline:2px solid #286fef;outline-offset:2px
}
html[data-ap-theme="night"] #journalApp #analysisRatings .rating-insights-trigger{
  background:transparent;border:0;box-shadow:none
}
html[data-ap-theme="night"] #journalApp #analysisRatings .rating-insights-trigger:hover,
html[data-ap-theme="night"] #journalApp #analysisRatings .rating-insights-trigger:active{
  background:#2a3d54;box-shadow:none
}
body>dialog#ratingInsightsDialog{
  box-sizing:border-box;width:min(94vw,550px);max-width:calc(100vw - 16px);
  max-height:min(89dvh,790px);overflow:auto;padding:0;
  background:#fff;border:1px solid #e1e9f3;border-radius:18px;
  color:#22334b;box-shadow:0 20px 70px #14203340
}
#ratingInsightsDialog .rating-insights-shell{
  box-sizing:border-box;padding:19px 18px 16px;min-width:0
}
#ratingInsightsDialog .rating-insights-head{margin-bottom:14px}
#ratingInsightsDialog .rating-insights-head h2{
  margin:0;color:#20304a;font-size:20px
}
#ratingInsightsDialog .rating-insights-overview{
  display:flex;align-items:center;gap:12px;min-width:0;
  padding:10px 12px;background:#f6f9fd;border:1px solid #e5ebf4;
  border-radius:12px
}
#ratingInsightsBadge .analysis-grade-badge{
  box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;
  width:42px;height:42px;min-width:42px;padding:0;border-radius:50%;
  font-size:15px;font-weight:800
}
#ratingInsightsDialog .rating-insights-overview>div{min-width:0;flex:1}
#ratingInsightsName{display:block;color:#23344f;font-size:14px}
#ratingInsightsDialog .rating-insights-scope{
  margin:3px 0 0;color:#66778e;font-size:11px;line-height:1.6;overflow-wrap:anywhere
}
#ratingInsightsDialog .rating-insights-sample{
  margin:12px 1px 11px;color:#68798f;font-size:12px;line-height:1.6
}
#ratingInsightsDialog .rating-insights-metrics{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px
}
#ratingInsightsDialog .rating-insights-metric{
  display:flex;flex-direction:column;gap:5px;min-width:0;
  border:1px solid #e5eaf2;background:#f8fafd;
  border-radius:12px;padding:11px 10px
}
#ratingInsightsDialog .rating-insights-metric span{
  color:#62758c;font-size:11px;font-weight:650;line-height:1.45
}
#ratingInsightsDialog .rating-insights-metric strong{
  color:#22344e;font-size:19px;line-height:1.3;
  overflow-wrap:anywhere;font-variant-numeric:tabular-nums
}
#ratingInsightsDialog .rating-insights-metric small{
  color:#8090a3;font-size:10px;line-height:1.55;overflow-wrap:anywhere
}
#ratingInsightsDialog .rating-insights-metric strong.stat-profit{color:#c4322b}
#ratingInsightsDialog .rating-insights-metric strong.stat-loss{color:#087a5a}
#ratingInsightsDialog .rating-insights-concentration{
  margin-top:11px;padding:12px;border:1px solid #e5eaf2;
  background:#f8fafd;border-radius:12px
}
#ratingInsightsDialog .rating-insights-concentration-top{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  font-size:12px;color:#60718a
}
#ratingInsightsDialog .rating-insights-concentration-top strong{
  font-size:17px;color:#253a56;font-variant-numeric:tabular-nums
}
#ratingInsightsDialog .rating-insights-concentration-track{
  margin:9px 0 7px;height:9px;overflow:hidden;
  border-radius:999px;background:#dce6f2
}
#ratingInsightsDialog .rating-insights-concentration-track>span{
  display:block;height:100%;background:#4775c7;border-radius:999px
}
#ratingInsightsDialog .rating-insights-concentration small,
#ratingInsightsDialog .rating-insights-empty{
  color:#71839b;font-size:11px;line-height:1.65
}
#ratingInsightsDialog .rating-insights-explanation{
  margin:13px 1px;color:#71839a;font-size:11px;line-height:1.7
}
#ratingInsightsDialog .rating-insights-foot{
  border-top:1px solid #e5eaf2;margin-top:12px;padding-top:13px;justify-content:flex-end
}
#ratingInsightsDialog .rating-insights-foot button{min-height:42px}
@media(max-width:390px){
  #ratingInsightsDialog .rating-insights-shell{padding:15px 12px 13px}
  #ratingInsightsDialog .rating-insights-metrics{gap:7px}
  #ratingInsightsDialog .rating-insights-metric{padding:10px 8px}
  #ratingInsightsDialog .rating-insights-metric strong{font-size:17px}
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog{
  background:#172438;border-color:#354961;color:#e8eef7;color-scheme:dark
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-head h2,
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog #ratingInsightsName{
  color:#eef4ff
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-overview,
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric,
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-concentration{
  background:#202f45;border-color:#354961
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog :is(.rating-insights-scope,.rating-insights-sample,
.rating-insights-explanation,.rating-insights-concentration small,.rating-insights-empty){
  color:#b5c8dd
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric span,
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-concentration-top{
  color:#b9cde4
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric strong,
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-concentration-top strong{
  color:#edf3ff
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric small{
  color:#aec2da
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric strong.stat-profit{
  color:#ff877f
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-metric strong.stat-loss{
  color:#63d9ad
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-concentration-track{
  background:#344c68
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-concentration-track>span{
  background:#6f98e0
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-foot{
  border-top-color:#354961
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog :is(.icon-btn,.secondary-btn){
  background:#26364c;border:1px solid #3a4d66;color:#d6e2f1;box-shadow:none
}

/* Opening-level rating trend windows. Only fully observed windows display KPIs. */
#ratingInsightsDialog .rating-insights-trends{
  margin-top:12px;padding:12px;border:1px solid #e5eaf2;
  background:#fbfcfe;border-radius:12px;min-width:0;
}
#ratingInsightsDialog .rating-insights-trends-head{
  display:flex;align-items:baseline;justify-content:space-between;
  flex-wrap:wrap;gap:5px 10px;margin-bottom:10px;
}
#ratingInsightsDialog .rating-insights-trends-head h3{
  margin:0;font-size:13px;font-weight:800;color:#253a56;
}
#ratingInsightsDialog .rating-insights-trends-head small{
  font-size:10px;color:#74869b;
}
#ratingInsightsDialog .rating-insights-trend-list{display:grid;gap:8px;min-width:0}
#ratingInsightsDialog .rating-insights-trend-card{
  min-width:0;padding:10px 11px;border:1px solid #e5ebf4;
  border-radius:10px;background:#fff;
}
#ratingInsightsDialog .rating-insights-trend-card.is-insufficient{
  background:#f8fafd;
}
#ratingInsightsDialog .rating-insights-trend-card-head{
  display:flex;align-items:baseline;justify-content:space-between;
  flex-wrap:wrap;gap:3px 8px;margin-bottom:8px;
}
#ratingInsightsDialog .rating-insights-trend-card-head strong{
  font-size:12px;color:#293f5c;
}
#ratingInsightsDialog .rating-insights-trend-card-head small{
  color:#708199;font-size:10px;line-height:1.5;
}
#ratingInsightsDialog .rating-insights-trend-metrics{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;
}
#ratingInsightsDialog .rating-insights-trend-metric{min-width:0}
#ratingInsightsDialog .rating-insights-trend-metric span{
  display:block;color:#71839a;font-size:10px;line-height:1.45;
}
#ratingInsightsDialog .rating-insights-trend-metric strong{
  display:block;margin-top:3px;font-size:14px;color:#263b54;
  font-variant-numeric:tabular-nums;overflow-wrap:anywhere;line-height:1.4;
}
#ratingInsightsDialog .rating-insights-trend-metric strong.stat-profit{color:#c4322b}
#ratingInsightsDialog .rating-insights-trend-metric strong.stat-loss{color:#087a5a}
#ratingInsightsDialog .rating-insights-trend-explanation{
  margin:9px 0 0;font-size:10px;line-height:1.65;color:#77879a;
}
@media(max-width:420px){
  #ratingInsightsDialog .rating-insights-trends{padding:10px 9px}
  #ratingInsightsDialog .rating-insights-trend-card{padding:9px 8px}
  #ratingInsightsDialog .rating-insights-trend-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 7px;
  }
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-trends{
  background:#202f45;border-color:#354961;
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-trend-card{
  background:#24374e;border-color:#3a506c;
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-trend-card.is-insufficient{
  background:#202f45;
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog :is(
.rating-insights-trends-head h3,.rating-insights-trend-card-head strong,
.rating-insights-trend-metric strong){color:#edf4ff}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog :is(
.rating-insights-trends-head small,.rating-insights-trend-card-head small,
.rating-insights-trend-metric span,.rating-insights-trend-explanation){color:#b4c5da}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-trend-metric strong.stat-profit{
  color:#ff877f
}
html[data-ap-theme="night"] body>dialog#ratingInsightsDialog .rating-insights-trend-metric strong.stat-loss{
  color:#63d9ad
}


/* v111: synchronized annual viewing on overview, analytics and trade history.
 * Selection only changes reports on screen, never cloud trades or cash ledgers. */
#journalApp .journal-year-picker{flex:0 0 auto;min-width:0;max-width:100%}
#journalApp .journal-year-picker>select{
  display:block;appearance:auto;-webkit-appearance:menulist;
  box-sizing:border-box;min-width:118px;max-width:142px;width:auto;
  min-height:44px;margin:0;padding:7px 9px;
  background:#f7f9fc;border:1px solid #dce4ed;border-radius:11px;
  color:#263449;font:inherit;font-size:16px;font-weight:700;line-height:1.35;
  cursor:pointer;touch-action:manipulation;color-scheme:light;
}
#journalApp .journal-year-picker>select:focus-visible{
  outline:2px solid #3574e7;outline-offset:2px;
}
#journalApp .analytics-head{align-items:center}
#journalApp .journal-annual-heading{min-width:0;display:grid;justify-items:start;gap:1px}
#journalApp .journal-annual-heading .eyebrow{margin:0 0 4px}
#journalApp .journal-annual-heading h2{margin:0}
#journalApp .journal-annual-heading .analytics-count{display:block;margin-top:3px;line-height:1.35;font-size:12px}
#journalApp .journal-page[data-journal-page="history"] .history-search-heading{
  align-items:center;flex-wrap:wrap;
}
#journalApp .history-heading-top{
  display:flex;flex:1 1 280px;align-items:center;justify-content:space-between;
  gap:10px;min-width:0;max-width:100%;
}
#journalApp .history-heading-title{min-width:0}
#journalApp .history-search-heading>.history-search{flex:0 1 235px;min-width:0}
@media(max-width:600px){
  #journalApp .journal-page[data-journal-page="history"] #closedArchive>.history-search-heading{
    flex-direction:column;align-items:stretch;gap:10px;
  }
  #journalApp .history-heading-top{flex:0 0 auto;width:100%;max-width:100%;align-self:stretch}
  #journalApp .history-search-heading>.history-search{
    flex:0 0 auto;align-self:stretch;width:100%;max-width:100%;
  }
  #journalApp .journal-year-picker>select{min-width:111px;max-width:132px}
}
@media(max-width:345px){
  #journalApp .journal-year-picker>select{min-width:104px;max-width:119px;padding:7px 6px;font-size:15px}
  #journalApp .history-heading-top{gap:6px}
}
html[data-ap-theme="night"] #journalApp .journal-year-picker>select{
  background:#202f45;border-color:#435a76;color:#e8eef7;color-scheme:dark;
  box-shadow:none;
}
html[data-ap-theme="night"] #journalApp .journal-year-picker>select:focus-visible{
  outline-color:#83b4ff;
}
html[data-ap-theme="night"] #journalApp .journal-annual-heading .analytics-count{
  color:#b6c8dd;
}

/* v116: aligned year selectors in History and Analytics. Two grid rows
 * keep the English eyebrow above while the select is vertically centered
 * on the Chinese H2. Overview keeps its independent title+count layout. */
#journalApp .journal-page[data-journal-page="analysis"]>.section-head,
#journalApp .journal-page[data-journal-page="history"] .history-heading-top{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-rows:auto minmax(44px,auto);
  column-gap:10px;
  row-gap:0;
  align-items:center;
}
#journalApp .journal-page[data-journal-page="analysis"]>.section-head>div:first-child,
#journalApp .journal-page[data-journal-page="history"] .history-heading-title{
  display:contents;
}
#journalApp .journal-page[data-journal-page="analysis"]>.section-head .eyebrow,
#journalApp .journal-page[data-journal-page="history"] .history-heading-title .eyebrow{
  grid-column:1;
  grid-row:1;
  justify-self:start;
}
#journalApp .journal-page[data-journal-page="analysis"]>.section-head h2,
#journalApp .journal-page[data-journal-page="history"] .history-heading-title h2{
  grid-column:1;
  grid-row:2;
  align-self:center;
  min-width:0;
}
#journalApp .journal-page[data-journal-page="analysis"]>.section-head>.journal-year-picker,
#journalApp .journal-page[data-journal-page="history"] .history-heading-top>.journal-year-picker{
  grid-column:2;
  grid-row:2;
  align-self:center;
  justify-self:end;
}

/* History chart: identical plot dimensions in date and trade modes. */
.history-equity-controls{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.history-chart-mode{display:inline-flex;gap:2px;padding:3px;border:1px solid #dbe4f0;border-radius:10px;background:#edf2f9}
.history-chart-mode button{min-height:36px;padding:5px 10px;border:0;border-radius:7px;background:transparent;color:#60718a;font:inherit;font-size:12px;font-weight:700;cursor:pointer}
.history-chart-mode button[aria-pressed="true"]{background:#fff;color:#1f65c7;box-shadow:0 1px 3px #172c4b18}
.history-chart-mode button:focus-visible{outline:2px solid #4388f4;outline-offset:2px}
html[data-ap-theme="night"] #journalApp .history-chart-mode{background:#202e43;border-color:#42536c}
html[data-ap-theme="night"] #journalApp .history-chart-mode button{color:#b9c9e0}
html[data-ap-theme="night"] #journalApp .history-chart-mode button[aria-pressed="true"]{background:#304766;color:#e8f2ff}
@media(max-width:390px){.history-equity-controls{justify-content:flex-start}}

/* Distinct instruments in the current analytics selection. */
.instrument-bars-count{text-align:center;margin:8px 0 12px;color:#8593a7;font-size:12px;line-height:1.6}
.instrument-bars-count strong{font-weight:700;color:#34435a;font-variant-numeric:tabular-nums}
html[data-ap-theme="night"] #journalApp .instrument-bars-count{color:#a8b9d0}
html[data-ap-theme="night"] #journalApp .instrument-bars-count strong{color:#e1eafb}

/* Chart title and filter dates share one row; mode switch stays centered below. */
.history-equity-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap;gap:6px}
.history-equity-head strong{flex:0 0 auto}
.history-equity-head #historyChartRange{flex:0 1 auto;min-width:0;text-align:right;font-size:clamp(9px,2.4vw,11px);font-variant-numeric:tabular-nums;white-space:nowrap}
.history-equity-controls{display:flex;justify-content:center;align-items:center;margin-top:8px}
@media(max-width:390px){.history-equity-controls{justify-content:center}.history-equity-head strong{font-size:clamp(11px,3.25vw,14px)}.history-equity-head #historyChartRange{font-size:clamp(8px,2.3vw,10px)}}

/* Rolling sample count appears beside the disclosure title only when expanded. */
.rolling-disclosure-title{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;min-width:0}
.rolling-disclosure-scope{display:none;font-size:11px;font-weight:400;color:#788699;line-height:1.4}
.analysis-rolling-disclosure[open] .rolling-disclosure-scope{display:inline}
@media(max-width:390px){.rolling-disclosure-title>b{font-size:14px}.rolling-disclosure-scope{font-size:10px}}
