:root{
  --dmk-bg:#f8fafc;
  --dmk-panel:#ffffff;
  --dmk-soft:#eef3f8;
  --dmk-border:#b8c4d3;
  --dmk-text:#172235;
  --dmk-muted:#57667b;
  --dmk-accent:#a65300;
  --dmk-accent-soft:#fff2df;
  --dmk-focus:#145da0;
  --dmk-shadow:0 28px 80px rgba(2,8,23,.38);
}

html[data-theme-mode="dawn"]{
  --dmk-bg:#dfe6ef;
  --dmk-panel:#edf2f7;
  --dmk-soft:#d5deea;
  --dmk-border:#8798ad;
  --dmk-text:#162235;
  --dmk-muted:#46576e;
  --dmk-accent:#854100;
  --dmk-accent-soft:#f3dfc3;
  --dmk-focus:#174b82;
}

html[data-theme="dark"]{
  --dmk-bg:#0c121b;
  --dmk-panel:#111a26;
  --dmk-soft:#182433;
  --dmk-border:#3b4a5e;
  --dmk-text:#eef3f8;
  --dmk-muted:#a9b7ca;
  --dmk-accent:#f7a33b;
  --dmk-accent-soft:#302313;
  --dmk-focus:#8ab4f8;
  --dmk-shadow:0 30px 90px rgba(0,0,0,.7);
}

.db-metric-explain{
  box-sizing:border-box;
  display:inline-flex;
  flex:0 0 auto;
  min-width:44px;
  min-height:44px;
  align-items:center;
  justify-content:center;
  margin:-11px -7px -11px auto;
  padding:7px;
  border-radius:7px;
  color:inherit;
  line-height:1;
  text-decoration:none;
  opacity:.78;
}

.db-metric-explain:hover{ color:var(--dmk-accent); opacity:1; }
.db-group-link + .db-metric-explain,
.db-markets-header-meta + .db-metric-explain,
.db-ot-header-controls .db-metric-explain{ margin-left:3px; }
.db-metric-explain:focus-visible,
.db-metric-dialog button:focus-visible,
.db-metric-dialog select:focus-visible,
.db-metric-dialog a:focus-visible{
  outline:2px solid var(--dmk-focus);
  outline-offset:2px;
}
.db-metric-explain.is-focus-restored:focus{ outline:none; box-shadow:none; }
.db-metric-explain svg{ width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.db-metric-modal{ position:fixed; z-index:12000; inset:0; font-family:var(--sans,system-ui,sans-serif); color:var(--dmk-text); }
.db-metric-modal[hidden]{ display:none !important; }
.db-metric-modal-backdrop{
  box-sizing:border-box;
  display:grid;
  width:100%;
  height:100%;
  place-items:center;
  padding:16px;
  background:rgba(3,8,18,.72);
  overscroll-behavior:contain;
}
.db-metric-dialog{
  box-sizing:border-box;
  display:grid;
  grid-template-rows:auto auto auto auto minmax(0,1fr) auto;
  width:min(1040px,100%);
  max-height:calc(100dvh - 32px);
  overflow:hidden;
  border:1px solid var(--dmk-border);
  border-radius:14px;
  background:var(--dmk-bg);
  box-shadow:var(--dmk-shadow);
}
.db-metric-dialog-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
  padding:22px 24px 16px;
  border-bottom:1px solid var(--dmk-border);
  background:var(--dmk-panel);
}
.db-metric-dialog-heading{ min-width:0; }
.db-metric-dialog-eyebrow{ display:block; margin-bottom:5px; color:var(--dmk-accent); font-size:.7rem; font-weight:750; letter-spacing:.08em; text-transform:uppercase; }
.db-metric-dialog h2{ margin:0; color:var(--dmk-text); font-size:clamp(1.35rem,2.5vw,2rem); line-height:1.08; }
.db-metric-dialog h2:focus{ outline:none; box-shadow:none; }
.db-metric-dialog-heading p{ max-width:750px; margin:8px 0 0; color:var(--dmk-muted); font-size:.88rem; line-height:1.45; }
.db-metric-dialog-actions{ display:flex; flex:0 0 auto; align-items:center; gap:6px; }
.db-metric-dialog button,.db-metric-dialog select{ font:inherit; }
.db-metric-copy,.db-metric-close,.db-metric-pager button,.db-metric-tabs button,.db-metric-error button{
  min-height:44px;
  border:1px solid var(--dmk-border);
  border-radius:8px;
  background:var(--dmk-panel);
  color:var(--dmk-text);
  cursor:pointer;
}
.db-metric-copy{ display:inline-flex; align-items:center; gap:7px; padding:0 7px; border-color:transparent; background:transparent; color:var(--dmk-muted); font-size:.7rem; font-weight:550; }
.db-metric-copy-label{ white-space:nowrap; }
.db-metric-close{ display:grid; width:44px; padding:0; place-items:center; }
.db-metric-close svg{ width:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.db-metric-copy:hover,.db-metric-close:hover,.db-metric-pager button:hover:not(:disabled),.db-metric-error button:hover{ border-color:var(--dmk-accent); color:var(--dmk-accent); }
.db-metric-copy:hover{ border-color:transparent; }
.db-metric-copy-glyph{ box-sizing:border-box; display:inline-flex; width:1.12rem; height:1.12rem; flex:0 0 auto; align-items:center; justify-content:center; border:1px solid rgba(255,255,255,.2); border-radius:.25rem; background:rgba(255,255,255,.06); color:var(--dmk-muted); font-size:.64rem; line-height:1; }
.db-metric-copy:hover .db-metric-copy-glyph,.db-metric-command-copy:hover .db-metric-copy-glyph{ color:#fff; border-color:rgba(255,255,255,.35); background:rgba(255,255,255,.12); }
.db-metric-pager{ display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:12px; padding:7px 24px; border-bottom:1px solid var(--dmk-border); background:var(--dmk-panel); }
.db-metric-pager button{ justify-self:start; padding:0 12px; border-color:transparent; background:transparent; font-size:.75rem; }
.db-metric-pager button:last-child{ justify-self:end; }
.db-metric-pager button:disabled{ cursor:not-allowed; opacity:.42; }
.db-metric-pager span{ color:var(--dmk-muted); font-size:.72rem; font-variant-numeric:tabular-nums; }
.db-metric-tabs{ display:flex; gap:4px; padding:8px 24px 0; border-bottom:1px solid var(--dmk-border); background:var(--dmk-panel); }
.db-metric-tabs button{ position:relative; padding:0 14px; border-color:transparent; border-radius:7px 7px 0 0; background:transparent; color:var(--dmk-muted); font-size:.8rem; font-weight:700; }
.db-metric-tabs button[aria-selected="true"]{ color:var(--dmk-text); }
.db-metric-tabs button[aria-selected="true"]::after{ content:""; position:absolute; right:10px; bottom:-1px; left:10px; height:3px; border-radius:2px 2px 0 0; background:var(--dmk-accent); }
.db-metric-mobile-index{ display:none; padding:10px 16px; border-bottom:1px solid var(--dmk-border); background:var(--dmk-panel); }
.db-metric-mobile-index label{ display:block; margin-bottom:5px; color:var(--dmk-muted); font-size:.68rem; font-weight:700; text-transform:uppercase; }
.db-metric-mobile-index select{ box-sizing:border-box; width:100%; min-height:44px; padding:0 38px 0 11px; border:1px solid var(--dmk-border); border-radius:8px; background:var(--dmk-soft); color:var(--dmk-text); }
.db-metric-dialog-body{ display:grid; min-height:0; grid-template-columns:220px minmax(0,1fr); }
.db-metric-index{ overflow:auto; padding:18px 12px; border-right:1px solid var(--dmk-border); background:var(--dmk-panel); }
.db-metric-index > p{ margin:0 8px 10px; color:var(--dmk-muted); font-size:.67rem; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
.db-metric-index button{ width:100%; min-height:44px; padding:9px 10px; border:0; border-left:3px solid transparent; border-radius:6px; background:transparent; color:var(--dmk-muted); cursor:pointer; font-size:.77rem; line-height:1.3; text-align:left; }
.db-metric-index button:hover{ background:var(--dmk-soft); color:var(--dmk-text); }
.db-metric-index button.is-active{ border-left-color:var(--dmk-accent); background:var(--dmk-accent-soft); color:var(--dmk-text); font-weight:700; }
.db-metric-content{ min-width:0; overflow:auto; padding:clamp(20px,3vw,34px); overscroll-behavior:contain; scroll-behavior:smooth; }
.db-metric-content > [hidden]{ display:none !important; }
.db-metric-loading,.db-metric-error{ max-width:600px; padding:24px; border:1px solid var(--dmk-border); border-radius:10px; background:var(--dmk-panel); color:var(--dmk-muted); }
.db-metric-error h3{ margin:0 0 8px; color:var(--dmk-text); }
.db-metric-error p{ margin:0 0 14px; }
.db-metric-error button{ padding:0 13px; }
.db-metric-error a{ display:inline-flex; min-height:44px; align-items:center; margin-left:8px; color:var(--dmk-accent); font-size:.78rem; font-weight:650; text-underline-offset:3px; }
.db-metric-article{ max-width:740px; margin:0 auto; }
.db-metric-kicker{ margin:0 0 18px; color:var(--dmk-accent); font-size:.72rem; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
.db-metric-section{ margin:0 0 25px; }
.db-metric-section h4,.db-metric-current h4{ margin:0 0 8px; color:var(--dmk-text); font-size:.91rem; }
.db-metric-section p,.db-metric-list,.db-metric-references{ margin:0; color:var(--dmk-muted); font-size:.87rem; line-height:1.62; }
.db-metric-lead p{ color:var(--dmk-text); font-size:1rem; line-height:1.65; }
.db-metric-caution{ padding:14px 16px; border-left:3px solid var(--dmk-accent); background:var(--dmk-accent-soft); }
.db-metric-caution h4{ font-size:.78rem; }
.db-metric-current{ margin:0 0 24px; padding:15px 16px; border:1px solid var(--dmk-border); border-radius:9px; background:var(--dmk-panel); }
.db-metric-current-row{ display:flex; align-items:baseline; justify-content:space-between; gap:20px; padding:5px 0; }
.db-metric-current-row span{ color:var(--dmk-muted); font-size:.76rem; }
.db-metric-current-row strong{ color:var(--dmk-text); font-size:.96rem; font-variant-numeric:tabular-nums; text-align:right; }
.db-metric-current > p{ margin:7px 0 0; color:var(--dmk-muted); font-size:.67rem; }
.db-metric-facts{ display:grid; grid-template-columns:minmax(120px,.36fr) minmax(0,1fr); margin:0 0 25px; border-top:1px solid var(--dmk-border); }
.db-metric-facts dt,.db-metric-facts dd{ margin:0; padding:9px 0; border-bottom:1px solid var(--dmk-border); font-size:.79rem; line-height:1.45; }
.db-metric-facts dt{ padding-right:16px; color:var(--dmk-muted); font-weight:650; }
.db-metric-facts dd{ color:var(--dmk-text); overflow-wrap:anywhere; }
.db-metric-list,.db-metric-references{ padding-left:20px; }
.db-metric-list li,.db-metric-references li{ margin:0 0 7px; }
.db-metric-references a{ color:var(--dmk-accent); text-underline-offset:3px; }
.db-metric-command-row{ display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:stretch; margin:8px 0; border:1px solid var(--dmk-border); border-radius:7px; overflow:hidden; background:#07101c; }
.db-metric-command{ box-sizing:border-box; max-width:100%; overflow:auto; margin:0; padding:12px 14px; border:0; background:#07101c; color:#e5edf7; font:500 .75rem/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
.db-metric-command-copy{ display:grid; min-width:44px; min-height:44px; padding:0; place-items:center; border:0; border-left:1px solid var(--dmk-border); background:var(--dmk-panel); color:var(--dmk-text); cursor:pointer; }
.db-metric-command-copy:hover{ color:var(--dmk-accent); }
.db-metric-example{ padding:16px; border:1px solid var(--dmk-border); border-radius:9px; background:var(--dmk-panel); }
.db-metric-glossary{ display:grid; gap:8px; }
.db-metric-glossary-term{ padding:10px 12px; border:1px solid var(--dmk-border); border-radius:8px; background:rgba(255,255,255,.025); }
.db-metric-glossary-term strong{ display:block; color:var(--dmk-text); font-size:.76rem; }
.db-metric-glossary-term p{ margin:3px 0 0; color:var(--dmk-muted); font-size:.72rem; line-height:1.48; }
.db-metric-action-status{ min-height:18px; margin:0; padding:2px 24px 5px; background:var(--dmk-panel); color:var(--dmk-muted); font-size:.68rem; text-align:right; }

@media (max-width:700px){
  .db-metric-explain{ margin:-11px -11px -11px auto; }
  .db-group-link + .db-metric-explain,
  .db-markets-header-meta + .db-metric-explain,
  .db-ot-header-controls .db-metric-explain{ margin-left:1px; }
  .db-metric-modal-backdrop{ padding:0; }
  .db-metric-dialog{ width:100%; height:100dvh; max-height:none; border:0; border-radius:0; grid-template-rows:auto auto auto auto minmax(0,1fr) auto; padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }
  .db-metric-dialog-header{ gap:10px; padding:15px 14px 12px; }
  .db-metric-dialog-heading p{ font-size:.78rem; }
  .db-metric-copy{ padding:0 4px; gap:5px; }
  .db-metric-pager{ padding:4px 10px; }
  .db-metric-tabs{ padding:4px 10px 0; }
  .db-metric-tabs button{ flex:1 1 50%; padding:0 5px; font-size:.75rem; }
  .db-metric-mobile-index{ display:block; }
  .db-metric-dialog-body{ display:block; min-height:0; overflow:hidden; }
  .db-metric-index{ display:none; }
  .db-metric-content{ box-sizing:border-box; height:100%; padding:22px 16px calc(34px + env(safe-area-inset-bottom)); }
  .db-metric-facts{ grid-template-columns:1fr; }
  .db-metric-facts dt{ padding:9px 0 2px; border-bottom:0; }
  .db-metric-facts dd{ padding:0 0 9px; }
  .db-metric-current-row{ align-items:flex-start; flex-direction:column; gap:2px; }
  .db-metric-current-row strong{ text-align:left; }
  .db-metric-command-copy{ min-width:44px; }
  .db-metric-action-status{ padding-right:14px; }
}

@media (prefers-reduced-motion:reduce){
  .db-metric-content{ scroll-behavior:auto; }
  .db-metric-modal,.db-metric-dialog,.db-metric-explain{ animation:none !important; transition:none !important; }
}

@media (forced-colors:active){
  .db-metric-tabs button[aria-selected="true"]::after{ background:Highlight; }
  .db-metric-index button.is-active{ border-left-color:Highlight; }
  .db-metric-caution{ border-left-color:Highlight; }
}
