:root { color-scheme: light; font-family: system-ui, sans-serif; color: #1c2934; background: #f3f5f7; }
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.5; }
header {
  background: #172632;
  color: white;
  padding: 20px max(20px, calc((100% - 1100px) / 2));
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
header strong { font-size: 22px; }
.brand-logo {
  width: auto;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
}
header span { align-self: center; color: #cdd6dd; }
main { max-width: 1140px; padding: 24px 20px; margin: auto; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
nav form { margin-left: auto; }
nav button { background: #e4e9ed; color: #172632; }
a { color: #365a73; }
h1 { font-size: 25px; font-weight: 600; margin: 0 0 20px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.panel { padding: 20px; border: 1px solid #d9e0e5; border-radius: 8px; background: white; margin-bottom: 20px; }
.option { text-decoration: none; color: inherit; }
.option:hover { border-color: #947125; }
.metric { font-size: 30px; font-weight: 600; margin: 6px 0; }
.narrow { max-width: 460px; }
label { display: block; margin-bottom: 16px; }
input:not([type=hidden]):not([type=checkbox]) { display: block; width: 100%; padding: 10px; margin-top: 6px; border: 1px solid #a3b2bd; border-radius: 4px; font: inherit; }
button { padding: 9px 14px; border: 0; border-radius: 4px; background: #365a73; color: white; cursor: pointer; font: inherit; }
button.danger { background: #963d3d; }
.notice { border-left: 4px solid #947125; padding: 12px 16px; background: #fffbec; }
.error { border-color: #963d3d; background: #fff0f0; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid #d9e0e5; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e3e8ec; vertical-align: top; }
th { background: #eaf0f4; }
td label { font-size: 12px; margin: 0 0 6px; }
.identifier { font-family: ui-monospace, monospace; }
.activation-code { display: block; font-family: ui-monospace, monospace; font-size: 19px; word-break: break-word; user-select: all; }
.activation-qr { display: block; width: 328px; max-width: 100%; height: auto; background: white; }
footer { max-width: 1140px; margin: auto; padding: 20px; color: #526573; font-size: 13px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #947125; outline-offset: 3px; }


/* Devices only: two compact field rows, with no table/nowrap scroll container. */
.device-list { display: grid; gap: 16px; min-width: 0; }
.device-record { padding: 16px; background: white; border: 1px solid #d9e0e5; border-radius: 8px; min-width: 0; }
.device-summary, .device-details { display: grid; gap: 16px; margin: 0; }
.device-summary { grid-template-columns: minmax(0, 2fr) repeat(5, minmax(0, 1fr)); }
.device-details { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); border-top: 1px solid #e3e8ec; padding-top: 14px; margin-top: 14px; }
.device-summary > div, .device-details > div { min-width: 0; overflow-wrap: anywhere; }
.device-record dt { font-size: 13px; color: #526573; margin-bottom: 4px; }
.device-record dd { margin: 0; }
.device-number { color: #526573; font-size: 13px; }
.device-installation, .device-time, .device-delivery-time { display: block; }
.device-installation { margin-top: 4px; }
.device-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.device-actions form { display: grid; grid-template-rows: 1fr auto; gap: 8px; min-width: 0; margin: 0; }
.device-actions label { font-size: 14px; margin: 0; }
.device-actions button { width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.device-pairing-credential { display: block; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .device-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .device-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-action-field { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .device-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-identity { grid-column: 1 / -1; }
  .device-actions { grid-template-columns: minmax(0, 1fr); }
}

.device-actions .device-test-action { grid-column: 1 / -1; }

/* Strategy forms and previews stay readable on narrow screens. */
.strategy-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:12px; }
.strategy-fields label { min-width:0; overflow-wrap:anywhere; }
.strategy-fields span { display:block; margin-top:8px; }
fieldset { min-width:0; border:1px solid #d9e0e5; margin:16px 0; border-radius:6px; }
select, textarea { display:block; width:100%; padding:10px; margin-top:6px; font:inherit; border:1px solid #a3b2bd; border-radius:4px; }
.strategy-version { border-top:1px solid #d9e0e5; padding:12px 0; }
.strategy-version pre { white-space:pre-wrap; overflow-wrap:anywhere; }
summary { cursor:pointer; font-weight:600; }

.backtest-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); gap:1rem; }
.backtest-cards .panel { min-width:0; overflow-wrap:anywhere; }
.backtest-equity { display:block; width:100%; max-height:280px; background:#171717; }
.backtest-page figure { margin:0; }

.backtest-page pre { white-space:pre-wrap; overflow-wrap:anywhere; }
.backtest-page code, .backtest-page p { overflow-wrap:anywhere; }

/* TASK039C: scoped administration guides and read-only strategy definitions. */
.admin-guide { max-width: 1000px; margin: auto; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,280px),1fr)); gap: 14px; }
.admin-guide .panel, .guide-parameter { border-color: #bba16a; box-shadow: 0 2px 5px #17263212; }
.guide-number { color: #80652e; font-size: 24px; font-weight: 700; }
.guide-group { margin: 14px 0; border: 1px solid #bba16a; border-radius: 9px; padding: 14px; background: #fff; }
.guide-group summary { cursor: pointer; font-weight: 650; min-height: 32px; color: #684f1f; }
.guide-parameter { min-width: 0; padding: 14px; border: 1px solid #d9cfb7; border-radius: 8px; background: #fdfcf8; }
.guide-parameter h3 { font-size: 16px; margin: 4px 0 8px; }
.guide-parameter code, .guide-parameter p, .strategy-version pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.strategy-version > details, .strategy-version .guide-group { margin-top: 12px; }
.admin-guide a, .guide-group a { overflow-wrap: anywhere; }

.admin-guide table { table-layout: fixed; white-space: normal; }
.admin-guide th, .admin-guide td { overflow-wrap: anywhere; white-space: normal; }
.device-transfer { max-width: 70rem; margin: auto; overflow-wrap: anywhere; }
.device-transfer select,.device-transfer input:not([type=checkbox]) { max-width: 100%; width: 100%; min-width: 0; box-sizing: border-box; }
.device-transfer button { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.transfer-counts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,14rem),1fr)); gap: 1rem; padding: 1rem; border: 1px solid #b89550; border-radius: .6rem; }
.transfer-counts dt { font-weight: 600; } .transfer-counts dd { margin: .3rem 0 0; }
