:root {
  color-scheme: light;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  background: #f3f6fa;
  color: #203247;
  --panel: #ffffff;
  --panel2: #f7f9fc;
  --border: #d7e0e9;
  --muted: #52657a;
  --accent: #12695e;
  --good: #146443;
  --bad: #ad293b;
  --warn: #82500c;
}
* { box-sizing: border-box; }
html { direction: rtl; scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; background: #f3f6fa; }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: #094b43; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.technical, bdi, code, pre, input[type="number"] {
  direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
bdi { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.block { display: block; margin-top: 4px; }
.skip-link { position: absolute; top: -100px; right: 20px; z-index: 30; padding: 12px; background: var(--panel2); }
.skip-link:focus { top: 8px; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner, .top-nav { max-width: 1520px; margin: auto; padding: 16px 32px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: grid; text-decoration: none; gap: 0; color: #203247; }
.brand b { font-family: "Segoe UI", Arial, sans-serif; font-size: 1.4rem; letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: .83rem; }
.identity { display: flex; align-items: center; gap: 18px; }
.identity > div { display: grid; line-height: 1.5; }
.identity small { color: var(--muted); font-size: .8rem; }
.top-nav { padding-top: 0; padding-bottom: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.top-nav > a, .nav-group > summary { padding: 9px 16px; color: #354c64; border-radius: 8px; text-decoration: none; font-size: .94rem; cursor: pointer; }
.top-nav > a:hover, .nav-group > summary:hover, .top-nav > a.active, .nav-group.active > summary, .nav-group[open] > summary { background: #eaf4f1; color: #115d53; }
.top-nav > a.active, .nav-group.active > summary { box-shadow: inset 0 -2px var(--accent); }
.nav-group { position: relative; }
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '⌄'; display: inline-block; margin-right: 10px; }
.nav-dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 225px; display: grid; z-index: 20; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 24px #233c571f; }
.nav-dropdown a { padding: 9px 14px; border-radius: 6px; color: #354c64; text-decoration: none; }
.nav-dropdown a:hover, .nav-dropdown a.active { background: #eaf4f1; color: var(--accent); }
.resource-strip { width: calc(100% - 64px); max-width: 1456px; margin: 0 auto 14px; padding: 10px 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; background: #f3f7fb; border: 1px solid var(--border); border-radius: 8px; font-size: .82rem; }
.resource-title { font-weight: 700; text-decoration: none; }
.resource-item { display: inline-flex; gap: 8px; align-items: center; }
.resource-item bdi { font-weight: 700; color: #203247; }
.resource-strip small { margin-inline-start: auto; font-size: .75rem; }
.resource-item.warn { background: #fff0d5; border-radius: 5px; padding: 0 5px; }
.resource-item.warn bdi { color: var(--warn); }
.resource-warning { font-size: .72rem; font-weight: 700; }
.resource-strip.is-stale [data-resource-freshness] { color: var(--bad); }
[hidden] { display: none !important; }
.shell { min-width: 0; }
.topbar, main, .flash-stack { max-width: 1520px; margin: auto; padding-left: 32px; padding-right: 32px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 28px; padding-bottom: 4px; }
.topbar > div { min-width: 0; }
.topbar > button { flex-shrink: 0; align-self: center; }
.topbar h1 { margin: 0; font-size: 1.7rem; font-weight: 700; line-height: 1.6; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
main { padding-bottom: 40px; }
section { margin-top: 20px; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 2px 5px #23456405; }
h2 { font-size: 1.2rem; margin: 0 0 18px; line-height: 1.7; }
h3 { font-size: 1.05rem; margin: 14px 0; }
p { color: var(--muted); margin: 10px 0; }
small { color: var(--muted); font-size: .85rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head a { white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.cards article { min-width: 0; padding: 20px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--border); display: grid; gap: 12px; align-content: start; }
.cards article > span { display: block; color: var(--muted); font-size: .87rem; line-height: 1.7; }
.cards strong { font-size: 1.12rem; line-height: 1.6; overflow-wrap: anywhere; }
.summary-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.service-cards h3 { overflow-wrap: anywhere; }
.service-cards dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; font-size: .9rem; }
.service-cards dt { color: var(--muted); }
.service-cards dd { margin: 0; text-align: left; }
.badge { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 7px; font-size: .85rem; font-weight: 700; }
.badge.ok { color: #146443; background: #e4f5ec; }
.badge.danger { color: #a42538; background: #fce9ed; }
.badge.neutral { color: #245c72; background: #e9f3f8; }
.good { color: var(--good) !important; }
.bad { color: var(--bad) !important; }
.warn { color: var(--warn) !important; }
.notice { padding: 16px 20px; border-right: 3px solid #568da5; border-radius: 6px; background: #eaf2f8; color: #36536b; line-height: 1.9; }
.empty-state { padding: 36px 20px; text-align: center; border: 1px dashed #a7b9ca; border-radius: 10px; background: #f9fbfd; }
.empty-state strong { display: block; margin-bottom: 8px; }
.empty-state span { color: var(--muted); }
.login { width: min(470px, calc(100% - 32px)); margin: 10vh auto; padding: 32px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); display: grid; gap: 14px; }
.login h1, .login p { margin: 0; }
.login form { display: grid; gap: 16px; margin-top: 8px; }
label { display: grid; gap: 8px; color: #263e56; }
label small { line-height: 1.8; }
input, select, button, .button-link { font: inherit; border-radius: 7px; border: 1px solid #afbfce; padding: 10px 14px; background: #fff; color: #203247; min-width: 0; }
input, select { width: 100%; min-height: 46px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; flex-shrink: 0; accent-color: #12695e; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
input[readonly], input:disabled, select:disabled { color: #4e6174; background: #eef3f7; }
button, .button-link { cursor: pointer; background: #166e63; border-color: #166e63; color: #fff; font-weight: 700; line-height: 1.5; min-height: 44px; height: auto; max-width: 100%; align-self: end; justify-self: start; }
button:hover, .button-link:hover { background: #11564e; color: #fff; }
button.ghost { background: #fff; color: #34516a; border-color: #afbfce; }
button.ghost:hover { background: #edf3f8; color: #203247; }
button.danger { background: #fff5f6; color: #a42538; border-color: #db9aa6; }
button.danger:hover { background: #fbe3e8; }
.button-link { display: inline-flex; text-decoration: none; }
.small { padding: 7px 11px; font-size: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 20px; align-items: stretch; }
.form-grid > label { display: flex; flex-direction: column; }
.form-grid > label input, .form-grid > label select { margin-top: auto; flex-shrink: 0; }
.form-grid > label small { order: 1; }
.form-grid > label input, .form-grid > label select { order: 2; }
.form-grid > .checkbox-label { flex-direction: row; align-items: center; }
.form-grid > .checkbox-label input { order: 0; margin-top: 0; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-grid > button { width: fit-content; }
.form-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.form-actions button { flex: 0 0 auto; align-self: center; padding: 12px 26px; }
.form-actions small { max-width: 100%; }
.settings-grid { align-items: stretch; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.settings-grid label { display: flex; flex-direction: column; align-items: stretch; }
.settings-grid input { margin-top: auto; flex-shrink: 0; }
.backup-weekdays { border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; margin: 0; min-width: 0; }
.backup-weekdays legend { padding: 0 8px; font-size: .95rem; }
.weekday-options { display: flex; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 10px; }
@supports selector(form:has(option:checked)) {
  .backup-form:not(:has([name="schedule_mode"] option[value="interval"]:checked)) .backup-interval { display: none; }
  .backup-form:not(:has([name="schedule_mode"] option[value="weekdays"]:checked)) .backup-weekdays { display: none; }
}
.password-section { border-color: #a9c9c3; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.filter-tabs a { display: inline-flex; gap: 10px; align-items: center; padding: 9px 14px; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; background: #fff; color: #34516a; }
.filter-tabs a.selected, .filter-tabs a:hover { color: #155e54; background: #e8f5f1; border-color: #75b5a7; }
.filter-tabs bdi { font-size: .85rem; background: #edf3f8; padding: 1px 7px; border-radius: 6px; }
section[id] { scroll-margin-top: 18px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-wrap bdi.symbol { white-space: nowrap; overflow-wrap: normal; }
.table-wrap bdi.record-id { min-width: 90px; }
.trade-table td:nth-child(5) .technical,
.trade-table td:nth-child(6) .technical,
.trade-table td:nth-child(7) .technical { white-space: nowrap; overflow-wrap: normal; }
.record-details { min-width: 120px; max-width: 340px; }
.record-details summary { cursor: pointer; color: var(--accent); white-space: nowrap; }
.record-details dl { margin: 12px 0 0; min-width: 220px; }
.record-details dt { color: var(--muted); font-size: .83rem; margin-top: 12px; }
.record-details dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.table-wrap::before { content: 'اسحب الجدول أفقيًا لرؤية بقية الأعمدة'; display: none; padding: 8px 12px; color: var(--muted); font-size: .8rem; background: #f7f9fc; }
table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: .9rem; }
th, td { text-align: right; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #344c63; background: #edf3f8; font-size: .92rem; font-weight: 700; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:nth-child(even) { background: #f8fafc; }
@media (hover:hover) and (pointer:fine) { tbody tr:hover { background: #eef6f4; } }
td .technical { font-size: .88rem; }
.row-actions, .control-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions form { display: flex; gap: 8px; }
.row-actions input { width: 155px; padding: 7px; }
.key-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 0; }
.key-values > div { display: grid; align-content: start; gap: 10px; padding: 16px; background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.key-values dt { color: var(--muted); font-size: .9rem; }
.key-values dd { display: block; margin: 0; font-weight: 600; line-height: 1.8; overflow-wrap: anywhere; }
.data-text { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 180px; max-width: 520px; line-height: 1.8; }
pre { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; background: #f1f5f9; padding: 16px; border-radius: 8px; color: #354e66; font-size: .85rem; }
code { display: block; text-align: left; overflow-wrap: anywhere; color: #354e66; font-size: .85rem; }
.technical-details { margin-top: 18px; }
.technical-details summary { color: var(--muted); cursor: pointer; padding: 8px 0; }
.flash { margin-top: 16px; padding: 14px 18px; border-radius: 8px; border: 1px solid; }
.flash.good, .flash.success { color: #146443; border-color: #9fcdb9; background: #e8f6ee; }
.flash.bad, .flash.error { color: #a42538; border-color: #dfa5b0; background: #fcecf0; }
@media (max-width: 900px) {
  .header-inner { gap: 16px; flex-wrap: wrap; }
  .mode-badge { order: 3; flex-basis: 100%; justify-content: center; }
  .header-inner, .top-nav, .topbar, main, .flash-stack { padding-left: 20px; padding-right: 20px; }
  .top-nav > a, .nav-group > summary { padding: 8px 11px; font-size: .88rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .table-wrap::before { display: block; }
  .resource-strip { width: auto; margin-left: 20px; margin-right: 20px; gap: 8px 16px; }
}
@media (max-width: 520px) {
  :root { font-size: 15px; }
  .header-inner { padding-top: 14px; padding-bottom: 14px; }
  .identity { gap: 10px; }
  .brand b { font-size: 1.2rem; }
  .brand small { font-size: .75rem; }
  .identity .small { padding: 6px 8px; }
  .header-inner, .top-nav, .topbar, main, .flash-stack { padding-left: 14px; padding-right: 14px; }
  .top-nav { gap: 4px; }
  .top-nav > a, .nav-group > summary { padding: 8px; }
  .nav-dropdown { min-width: 190px; }
  .topbar { padding-top: 20px; flex-wrap: wrap; gap: 14px; }
  .topbar h1 { font-size: 1.45rem; }
  section { padding: 18px; margin-top: 16px; }
  .cards, .form-grid, .key-values { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .resource-strip { margin-left: 14px; margin-right: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px; }
  .resource-title, .resource-strip small { grid-column: 1 / -1; margin: 0; }
  .resource-item { justify-content: space-between; font-size: .76rem; gap: 5px; }
  .form-actions { align-items: start; flex-direction: column; gap: 8px; }
  .form-actions button { align-self: start; }
  .control-actions form { max-width: 100%; }
  .service-cards dl { grid-template-columns: auto 1fr; }
}
:root { --credential-warning-bg: #fff0d5; }
.badge.warn-badge { color: #82500c; background: var(--credential-warning-bg); }
.credential-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.saved-key { color: #176747; font-weight: 700; }
.credential-test { border-top: 1px solid #dfe6ed; margin-top: 20px; padding-top: 16px; }
.credential-inline-message { margin: 14px 0; }
button:disabled { opacity: .55; cursor: not-allowed; }
#ui-progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: #166e63; z-index: 1000; }
.ui-status { position: fixed; bottom: 20px; right: 20px; max-width: min(560px,calc(100vw - 40px)); padding: 12px 18px; background: #fff; color: #203247; border: 1px solid #afbfce; border-radius: 9px; box-shadow: 0 4px 18px #20324722; z-index: 1001; display: flex; gap: 12px; align-items: center; }
.ui-status.is-error { border-color: #db9aa6; color: #a42538; }
.shell.is-stale { opacity: .7; }
#main-content:focus { outline: none; }
#trade-results { overflow-anchor: none; }
.ui-status.is-success { border-color: #87bca4; color: #146443; }
dialog { max-width: min(520px,calc(100vw - 32px)); padding: 28px; border: 1px solid var(--border); border-radius: 12px; color: #203247; background: #fff; box-shadow: 0 12px 48px #18344c30; }
dialog::backdrop { background: #18344c50; }
.record-group > summary { cursor: pointer; font-size: 1.1rem; font-weight: 700; color: #29465d; }
.record-group[open] > summary { margin-bottom: 18px; }
[data-nav-region][aria-busy="true"] { cursor: progress; }
@media (max-width: 600px) { .ui-status { flex-direction: column; align-items: stretch; } }
.watch-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 18px; font-size: .85rem; }
[data-view-status] { color: #52657a; }
[data-view-status].is-stale { color: var(--bad); font-weight: 700; }
.session-overview { padding: 20px; }
.watch-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin: 0; }
.metric { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: #f7f9fc; }
.metric dt { display: block; color: var(--muted); font-size: .83rem; line-height: 1.7; }
.metric dd { display: block; margin: 0; font-size: 1.18rem; font-weight: 700; line-height: 1.65; overflow-wrap: anywhere; }
.metric-hint { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); font-size: .73rem; line-height: 1.8; overflow-wrap: anywhere; }
.compact-note { font-size: .8rem; margin: 12px 0 4px; }
.current-watch { border-color: #70b5a5; border-inline-start: 5px solid var(--accent); background: #fafffd; }
.position-strip { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 16px; background: #edf5f2; padding: 16px 20px; border-radius: 9px; font-size: .88rem; margin: 0 0 20px; }
.position-strip > div { min-width: 0; display: grid; gap: 10px; align-content: start; }
.position-strip dt { color: var(--muted); font-size: .8rem; }
.position-strip dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.quiet-state { display: grid; gap: 6px; padding: 14px 0 2px; }
.quiet-state span { color: var(--muted); font-size: .85rem; }
.trade-cards { display: grid; gap: 24px; }
.trade-card { border: 1px solid var(--border); border-inline-start: 4px solid #96a9ba; background: #fff; border-radius: 12px; padding: 24px; overflow-anchor: none; }
.trade-card.is-open { border-color: #80bfae; border-inline-start-color: #128574; background: #f3fcf8; }
.trade-card.is-review { border-inline-start-color: #b57820; background: #fffaf0; }
.trade-card.is-pending { border-inline-start-color: #6988bd; background: #f7faff; }
.trade-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.trade-card-head > div:first-child { display: flex; align-items: center; gap: 12px; }
.trade-card-head .symbol { font-size: 1.1rem; }
.trade-net { margin-inline-start: auto; display: grid; gap: 8px; justify-items: end; }
.trade-net strong { font-size: 1.17rem; }
.trade-legs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0 14px; }
.trade-legs > div { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; align-items: center; padding: 16px; border: 1px solid #d9e9e2; border-radius: 8px; background: #ffffffb3; }
.trade-legs span { color: var(--muted); font-size: .86rem; }
.trade-legs small { grid-column: 1 / -1; font-size: .8rem; }
.trade-details > summary, .control-help > summary { cursor: pointer; color: #466079; font-size: .82rem; padding-top: 6px; }
.trade-details .key-values { margin-top: 14px; }
.trade-session-link { display: inline-block; font-size: .8rem; margin-bottom: 6px; }
.secondary-records section { padding: 16px 24px; margin-top: 12px; }
.secondary-records .record-group > summary { font-size: .96rem; }
.session-history { display: grid; gap: 24px; }
.session-card { border: 1px solid var(--border); border-radius: 12px; padding: 24px; background: #fff; }
.session-card.is-active { border-color: #70b5a5; background: #f2fbf7; }
.session-card h3 { margin: 0; }
.session-card small.session-id { display: block; margin-top: 5px; font-size: .75rem; }
.session-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; margin: 20px 0; padding: 16px 0; border-block: 1px solid var(--border); font-size: .88rem; }
.session-facts > div { min-width: 0; display: grid; gap: 10px; align-content: start; }
.session-facts dt { color: var(--muted); font-size: .8rem; }
.session-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.session-watch-link { display: inline-flex; align-items: center; min-height: 44px; padding: 7px 14px; text-decoration: none; border: 1px solid #99b9b1; border-radius: 7px; background: #eaf5f0; font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.trade-ledger-wrap { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.trade-ledger { min-width: 1000px; font-size: .86rem; }
.trade-ledger th, .trade-ledger td { padding: 20px 16px; }
.trade-ledger thead th { background: #edf3f8; font-size: .8rem; }
.trade-ledger tbody th { background: transparent; white-space: normal; min-width: 124px; }
.trade-ledger .symbol { white-space: nowrap; }
.trade-ledger .cell-value { display: block; font-weight: 700; white-space: nowrap; overflow-wrap: normal; }
.cell-secondary { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; margin-top: 8px; line-height: 1.8; max-width: 210px; overflow-wrap: anywhere; }
.cell-pairs { display: grid; gap: 8px; margin: 0; }
.cell-pairs > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.cell-pairs dt { color: var(--muted); font-size: .75rem; }
.cell-pairs dd { margin: 0; font-weight: 600; }
.trade-row.is-open { background: #edf9f4; }
.trade-row.is-review { background: #fff7e7; }
.trade-ledger .trade-details > summary { padding: 0; white-space: nowrap; min-height: 36px; }
.ledger-details { width: 240px; margin: 12px 0 0; display: grid; gap: 14px; }
.ledger-details dt { color: var(--muted); font-size: .75rem; }
.ledger-details dd { margin: 8px 0 0; overflow-wrap: anywhere; }
.trade-ledger .trade-session-link { display: block; margin-top: 6px; }
.history-search-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 20px; align-items: end; }
.history-search-form > div { min-width: 0; }
.history-search-form label { display: block; margin-bottom: 10px; }
.history-search-form input { width: 100%; min-width: 0; }
.history-search-form input[type=date] { direction: ltr; }
.history-search-form .search-actions { display: flex; gap: 16px; align-items: center; min-height: 46px; flex-wrap: wrap; }
.history-search-form button { min-height: 46px; align-self: auto; }
.history-pagination { display: flex; gap: 20px; margin-top: 20px; }
.value-updated { background-color: #fff1ba; outline: 2px solid #cc941b; outline-offset: -2px; border-radius: 5px; animation: value-update-fade 2.4s ease-out forwards; }
@keyframes value-update-fade { 0%,40% { background-color: #fff1ba; outline-color: #cc941b; } 100% { background-color: transparent; outline-color: transparent; } }
@media (prefers-reduced-motion:reduce) { .value-updated { animation: none; background-color: #fff1ba !important; } }
@media (max-width:1000px) { .history-search-form { grid-template-columns: 1fr 1fr; } .history-search-form .search-name { grid-column: 1 / -1; } }
@media (max-width:520px) { .history-search-form { grid-template-columns: 1fr; gap: 18px; } .history-search-form .search-name { grid-column: auto; } .history-search-form .search-actions { justify-content: flex-start; } }
@media (max-width:1100px) { .watch-metrics, .session-facts { grid-template-columns: 1fr 1fr; } .position-strip { grid-template-columns: 1fr 1fr; } .position-strip > div:last-child { grid-column: 1 / -1; } }
@media (max-width:760px) {
  .trade-ledger-wrap { overflow: visible; border: 0; }
  .trade-ledger, .trade-ledger tbody { display: block; min-width: 0; width: 100%; }
  .trade-ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .trade-ledger tr { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 20px; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
  .trade-ledger tr.is-open { background: #edf9f4; }
  .trade-ledger tr.is-review { background: #fff7e7; }
  .trade-ledger td, .trade-ledger tbody th { display: block; min-width: 0; padding: 0; border: 0; }
  .trade-ledger [data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .74rem; font-weight: 400; margin-bottom: 10px; }
  .trade-ledger td:last-child { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 14px; }
  .trade-ledger .cell-value { white-space: normal; overflow-wrap: anywhere; }
  .trade-ledger .ledger-details { width: auto; }
}
@media (max-width:520px) {
  .watch-metrics { grid-template-columns: 1fr; gap: 14px; }
  .metric { padding: 18px; }
  .metric dd { font-size: 1.1rem; }
  .position-strip { grid-template-columns: 1fr; }
  .trade-card { padding: 18px; }
  .trade-legs { grid-template-columns: 1fr; gap: 16px; }
  .trade-net { width: 100%; justify-items: start; }
  .current-watch { padding: 18px; }
  .session-card { padding: 20px; }
  .session-card .section-head { flex-direction: column; align-items: start; gap: 12px; }
  .session-facts { gap: 20px; }
  .cell-pairs > div { flex-wrap: wrap; gap: 4px 14px; }
}
