:focus-visible {
  outline: var(--alg-focus-w) solid var(--alg-focus);
  outline-offset: var(--alg-focus-offset);
}

/* Component contract for the nav/menu branch.
   .alg-sheet .alg-fab .alg-drawer .alg-menu-list .alg-bottomnav
   .alg-tabs .alg-chip .alg-row .alg-hscroll
   Icons are the MIT set in docs/restyle/icons, copied unchanged to /assets/icons.
   Each file is stroke="currentColor" and stroke-width="1.5". Inline them.
   Do not restyle, recolor, or redraw those SVG files. */

.ico { width: 24px; height: 24px; display: block; flex: none; color: inherit; }
html:is([data-theme="light"], [data-theme="dark"]) svg.i {
  fill: none; stroke: currentColor; stroke-width: 1.5;
}
.alg-ico-sm { width: 18px; height: 18px; }

.alg-rays {
  background-color: var(--alg-page);
  background-image:
    radial-gradient(ellipse 120% 46% at 50% -8%, rgba(212, 180, 124, 0.18), transparent 56%),
    repeating-conic-gradient(from -2deg at 50% -22%,
      rgba(212, 180, 124, 0.08) 0deg 0.22deg,
      transparent 0.22deg 1.9deg);
  background-repeat: no-repeat;
  background-size: auto, 100% 540px;
}

.alg-iconbtn {
  width: var(--alg-tap);
  height: var(--alg-tap);
  min-width: var(--alg-tap);
  min-height: var(--alg-tap);
  border-radius: 50%;
  border: 1px solid var(--alg-border);
  background: var(--alg-surface-2);
  color: var(--alg-ink);
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.alg-iconbtn:hover { border-color: var(--alg-gold); color: var(--alg-gold-bright); }

.alg-qa {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 76px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--alg-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.alg-qa-face {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid var(--alg-gold);
  background: radial-gradient(circle at 50% 36%, #3a3a40, #121214 70%);
  color: var(--alg-gold);
  display: grid;
  place-items: center;
}

.alg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--alg-tap);
  padding: 0 18px;
  border-radius: var(--alg-r-pill);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--alg-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
}
.alg-btn.primary {
  background: var(--alg-gold-bright);
  color: var(--alg-on-gold);
}
.alg-btn.secondary {
  background: var(--alg-surface-2);
  color: var(--alg-ink);
  border-color: var(--alg-gold);
}
.alg-btn.block { width: 100%; }

.alg-card {
  position: relative;
  background: var(--alg-surface);
  color: var(--alg-ink);
  border: 1px solid var(--alg-border);
  border-radius: var(--alg-r-card);
  padding: 20px;
}
.alg-card h3 { margin: 0 0 4px; font-size: var(--alg-fs-h3); letter-spacing: -0.02em; }
.alg-card p { margin: 0; color: var(--alg-text-muted); }
.alg-card .gold-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  color: var(--alg-gold-bright);
  font-weight: 700;
  text-underline-offset: 3px;
}

.alg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--alg-border);
  background: transparent;
  color: var(--alg-ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.alg-row:last-child { border-bottom: 0; }
.alg-row-ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--alg-gold);
  flex: none;
}
.alg-row-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.alg-row-copy strong {
  font-weight: 600;
  font-size: var(--alg-fs-item);
  color: var(--alg-heading);
  letter-spacing: 0;
  line-height: var(--alg-lh-item);
}
.alg-row-copy span {
  color: var(--alg-text-muted);
  font-size: var(--alg-fs-desc);
  font-weight: 400;
  letter-spacing: 0;
  line-height: var(--alg-lh-desc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alg-row .chev { color: var(--alg-text-muted); margin-left: auto; }

.alg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--alg-tap);
  min-width: var(--alg-tap);
  padding: 0 14px;
  border-radius: var(--alg-r-pill);
  border: 1px solid var(--alg-border);
  background: var(--alg-surface-2);
  color: var(--alg-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.alg-chip.is-on { border-color: var(--alg-gold); color: var(--alg-gold-bright); }
.alg-chip.icon {
  width: var(--alg-tap);
  height: var(--alg-tap);
  min-width: var(--alg-tap);
  padding: 0;
  border-radius: 50%;
}

.alg-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--alg-tap);
  padding: 0 16px;
  border-radius: var(--alg-r-pill);
  border: 1px solid var(--alg-border);
  background: var(--alg-surface-2);
  color: var(--alg-text-muted);
}
.alg-search input {
  flex: 1;
  min-width: 0;
  min-height: var(--alg-tap);
  border: 0;
  background: transparent;
  color: var(--alg-ink);
  font: inherit;
  font-size: 16px;
}
.alg-search input::placeholder { color: var(--alg-text-muted); }
.alg-search:focus-within { border-color: var(--alg-gold); }

.alg-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.alg-tabs a, .alg-tabs button {
  flex: none;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  min-height: var(--alg-tap);
  min-width: var(--alg-tap);
  padding: 0 14px;
  border: 0;
  border-radius: var(--alg-r-pill);
  background: transparent;
  color: var(--alg-text-muted);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.alg-tabs .is-on, .alg-tabs [aria-current="page"] {
  background: var(--alg-heading);
  color: var(--alg-on-gold);
}

.alg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--alg-r-pill);
  background: var(--alg-gold-bright);
  color: var(--alg-on-gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.alg-badge.quiet {
  background: var(--alg-surface-3);
  color: var(--alg-ink);
}
.alg-badge[data-status]::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.alg-badge[data-status="draft"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3.5h9l3.5 3.5v13.5H6z'/%3E%3Cpath d='M15 3.5V7h3.5'/%3E%3Cpath d='M9 11h6.5'/%3E%3Cpath d='M9 14.5h6.5'/%3E%3Cpath d='M9 18h3.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3.5h9l3.5 3.5v13.5H6z'/%3E%3Cpath d='M15 3.5V7h3.5'/%3E%3Cpath d='M9 11h6.5'/%3E%3Cpath d='M9 14.5h6.5'/%3E%3Cpath d='M9 18h3.5'/%3E%3C/svg%3E");
}
.alg-badge[data-status="review"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
}
.alg-badge-corner {
  position: absolute;
  top: 0;
  right: 0;
  padding: 7px 12px 8px 14px;
  border-radius: 0 var(--alg-r-card) 0 12px;
  background: var(--alg-gold-bright);
  color: var(--alg-on-gold);
  font-size: 12px;
  font-weight: 700;
}

.alg-ticker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--alg-r-pill);
  border: 1px solid var(--alg-border);
  background: var(--alg-surface-2);
  color: var(--alg-ink);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.alg-ticker .up { color: var(--alg-up); display: inline-flex; align-items: center; gap: 3px; }
.alg-ticker .down { color: var(--alg-down); display: inline-flex; align-items: center; gap: 3px; }

.alg-hhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--alg-heading);
}
.alg-hhead h2, .alg-hhead h3 { margin: 0; font-size: 1.35rem; letter-spacing: -0.03em; }
.alg-hscroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  max-width: 100%;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.alg-hscroll > * { flex: 0 0 220px; scroll-snap-align: start; }

.alg-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(11, 11, 12, 0.72);
}
.alg-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: min(78vh, 520px);
  overflow: auto;
  padding: 8px 8px 20px;
  border: 1px solid var(--alg-border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--alg-surface);
  color: var(--alg-ink);
}
.alg-grab {
  width: 36px;
  height: 4px;
  margin: 6px auto 12px;
  border-radius: var(--alg-r-pill);
  background: #3a3a3e;
}
.alg-sheet h2 { margin: 0 0 8px; padding: 4px 16px 0; font-size: var(--alg-fs-section); font-weight: 700; letter-spacing: -0.01em; line-height: var(--alg-lh-section); }

.alg-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(340px, 88vw);
  overflow: auto;
  padding: 28px 16px 20px;
  border-right: 1px solid var(--alg-border);
  background: var(--alg-page);
  color: var(--alg-ink);
}
.alg-medallion {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1.5px solid var(--alg-gold);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 32%, #2c2c30, #101012 72%);
  color: var(--alg-gold-bright);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.alg-serif {
  margin: 12px 0 0;
  font-family: var(--alg-font-serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  font-optical-sizing: auto;
  color: var(--alg-heading);
}
.alg-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--alg-gold-bright);
  font-weight: 650;
  text-decoration: none;
}
.alg-goldline {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, #c9a86a 18%, #d4b47c 50%, #c9a86a 82%, transparent);
}
.alg-drawer .alg-card { padding: 4px 0; }
.alg-logout { color: var(--alg-heading); font-weight: 700; }

.alg-menu-list { display: flex; flex-direction: column; }
.alg-menu-list .alg-row { min-height: 72px; padding-left: 0; padding-right: 0; }

.alg-bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 72px;
  padding: 4px 76px 4px 4px;
  border-top: 1px solid var(--alg-border);
  background: #0b0b0c;
}
.alg-bottomnav a {
  flex: 1;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--alg-text-muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.alg-bottomnav a.is-on { color: var(--alg-gold-bright); }
.alg-fab {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid var(--alg-gold);
  background: #141416;
  color: var(--alg-ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-transparency: reduce) {
  .alg-rays { background-image: none; }
  .alg-scrim { background: #0b0b0c; }
  .alg-qa-face, .alg-medallion {
    background: #141416;
  }
}
@media (prefers-reduced-motion: reduce) {
  .alg-hscroll, .alg-tabs { scroll-behavior: auto; }
  .alg-sheet, .alg-drawer, .alg-fab, .alg-btn, .alg-chip, .alg-row {
    transition: none;
  }
}
@media (forced-colors: active) {
  .alg-btn, .alg-iconbtn, .alg-chip, .alg-fab, .alg-qa-face, .alg-card, .alg-ticker, .alg-search {
    border: 1px solid ButtonText;
  }
}

/* Default theme only. Sunlight and dark keep the chrome they already had.
   Loaded after news.css and markets.css. */
html:is([data-theme="light"], [data-theme="dark"]) body{
  background-color:#0B0B0C;
  background-image:
    radial-gradient(ellipse 120% 46% at 50% -8%, rgba(212,180,124,.18), transparent 56%),
    repeating-conic-gradient(from -2deg at 50% -22%, rgba(212,180,124,.08) 0deg .22deg, transparent .22deg 1.9deg);
  background-repeat:no-repeat;
  background-size:auto, 100% 540px;
}
h1{font-size:var(--alg-fs-title);font-weight:700;letter-spacing:var(--alg-track-title);line-height:var(--alg-lh-title)}
h2{font-size:var(--alg-fs-section);letter-spacing:var(--alg-track-section);line-height:var(--alg-lh-section)}
html:is([data-theme="light"], [data-theme="dark"]) h1{
  font-weight:700;
  font-size:var(--alg-fs-title);
  letter-spacing:var(--alg-track-title);
  line-height:var(--alg-lh-title);
  color:var(--alg-heading);
}
html:is([data-theme="light"], [data-theme="dark"]) h2{
  font-size:var(--alg-fs-section);
  letter-spacing:var(--alg-track-section);
  line-height:var(--alg-lh-section);
}
html:is([data-theme="light"], [data-theme="dark"]) h2, html:is([data-theme="light"], [data-theme="dark"]) h3{color:var(--alg-heading); letter-spacing:-.02em}
html:is([data-theme="light"], [data-theme="dark"]) .pm{
  --pm-ink:var(--alg-ink);
  --pm-muted:var(--alg-text-muted);
  --pm-line:var(--alg-border);
  --pm-pri:var(--alg-gold-bright);
  --pm-pri2:#E0C48E;
  --pm-ok:var(--alg-up);
  --pm-warn:var(--alg-warning);
  --pm-bad:var(--alg-down);
  --pm-bg:var(--alg-page);
  color:var(--alg-ink);
}
html:is([data-theme="light"], [data-theme="dark"]) .stat b,
html:is([data-theme="light"], [data-theme="dark"]) .alg-kpi b,
html:is([data-theme="light"], [data-theme="dark"]) .mkt-stat b{
  font-weight:300;
  letter-spacing:-.04em;
  color:var(--alg-heading);
}
html:is([data-theme="light"], [data-theme="dark"]) header.top{
  background:#0B0B0C;
  color:#F2F0EB;
  border-bottom:1px solid #2A2A2D;
}
html:is([data-theme="light"], [data-theme="dark"]) .albas,
html:is([data-theme="light"], [data-theme="dark"]) .proj-slot .proj-job{color:#A8A6A1}
html:is([data-theme="light"], [data-theme="dark"]) .theme-btn[aria-pressed="true"]{background:#D4B47C; color:#14110C}
html:is([data-theme="light"], [data-theme="dark"]) .nav{
  gap:4px;
  padding:6px 8px 8px;
  border-top-color:#2A2A2D;
}
html:is([data-theme="light"], [data-theme="dark"]) .nav a{
  border-bottom:0;
  border-radius:999px;
  color:#A8A6A1;
}
html:is([data-theme="light"], [data-theme="dark"]) .nav a.on,
html:is([data-theme="light"], [data-theme="dark"]) .nav a[aria-current="page"]{
  background:#D4B47C;
  color:#14110C;
  border-bottom-color:transparent;
}
html:is([data-theme="light"], [data-theme="dark"]) .btn.secondary,
html:is([data-theme="light"], [data-theme="dark"]) .secondary,
html:is([data-theme="light"], [data-theme="dark"]) .pm-btn.sec{
  background:#141416;
  color:#F2F0EB;
  border-color:#C9A86A;
}
html:is([data-theme="light"], [data-theme="dark"]) .tabs,
html:is([data-theme="light"], [data-theme="dark"]) .pm-tabs{border-bottom:0; gap:4px}
html:is([data-theme="light"], [data-theme="dark"]) .tabs a,
html:is([data-theme="light"], [data-theme="dark"]) .pm-tabs a{border-bottom:0; border-radius:999px}
html:is([data-theme="light"], [data-theme="dark"]) .tabs a.on,
html:is([data-theme="light"], [data-theme="dark"]) .pm-tabs a.on{
  background:#D4B47C;
  color:#14110C;
  border-bottom-color:transparent;
}
html:is([data-theme="light"], [data-theme="dark"]) .card,
html:is([data-theme="light"], [data-theme="dark"]) .tcard,
html:is([data-theme="light"], [data-theme="dark"]) .alg-kpi,
html:is([data-theme="light"], [data-theme="dark"]) .mkt-card,
html:is([data-theme="light"], [data-theme="dark"]) .mkt-stat,
html:is([data-theme="light"], [data-theme="dark"]) .pm-tablewrap{
  border-radius:18px;
}
html:is([data-theme="light"], [data-theme="dark"]) .badge,
html:is([data-theme="light"], [data-theme="dark"]) .nav-flag,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st,
html:is([data-theme="light"], [data-theme="dark"]) .pm-badge,
html:is([data-theme="light"], [data-theme="dark"]) .meter{border-radius:999px}
html:is([data-theme="light"], [data-theme="dark"]) .badge{
  background:#222226;
  color:#F2F0EB;
}
html:is([data-theme="light"], [data-theme="dark"]) .badge.pass,
html:is([data-theme="light"], [data-theme="dark"]) .coi-current,
html:is([data-theme="light"], [data-theme="dark"]) .st-approved,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-answered,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-closed,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-approved{
  background:var(--alg-success-tint);
  color:var(--alg-on-success-tint);
}
html:is([data-theme="light"], [data-theme="dark"]) .badge.fail,
html:is([data-theme="light"], [data-theme="dark"]) .coi-expired,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-over,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-rejected{
  background:var(--alg-danger-tint);
  color:var(--alg-on-danger-tint);
}
html:is([data-theme="light"], [data-theme="dark"]) .badge.prog,
html:is([data-theme="light"], [data-theme="dark"]) .badge.test,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-sent,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-open{
  background:var(--alg-warning-tint);
  color:var(--alg-on-warning-tint);
}
html:is([data-theme="light"], [data-theme="dark"]) .badge.lock,
html:is([data-theme="light"], [data-theme="dark"]) .alg-st-draft{
  background:var(--alg-surface-2);
  color:var(--alg-text-muted);
}
html:is([data-theme="light"], [data-theme="dark"]) .btn.danger{
  background:#9B1C14;
  color:#fff;
}
html:is([data-theme="light"], [data-theme="dark"]) input[type="search"],
html:is([data-theme="light"], [data-theme="dark"]) .pm-filter input{border-radius:999px}
html:is([data-theme="light"], [data-theme="dark"]) #newsRoot .ns-list{
  display:flex;
  gap:12px;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  max-width:100%;
}
html:is([data-theme="light"], [data-theme="dark"]) #newsRoot .ns-list > a{
  flex:0 0 min(260px, 78vw);
  scroll-snap-align:start;
}
html:is([data-theme="light"], [data-theme="dark"]) .mkt-banner{
  background:#3A2A08;
  color:#FFE2A8;
  border-color:#FFC766;
}
html:is([data-theme="light"], [data-theme="dark"]) .mkt-stat,
html:is([data-theme="light"], [data-theme="dark"]) .mkt-card{
  background:var(--alg-surface);
  color:var(--alg-ink);
}
html:is([data-theme="light"], [data-theme="dark"]) .mkt-cards{
  display:flex;
  gap:12px;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  margin:12px 0;
}
html:is([data-theme="light"], [data-theme="dark"]) .mkt-card{
  flex:0 0 240px;
  scroll-snap-align:start;
}
@media (prefers-reduced-transparency: reduce){
  html:is([data-theme="light"], [data-theme="dark"]) body{background-image:none}
}
@media (prefers-reduced-motion: reduce){
  html:is([data-theme="light"], [data-theme="dark"]) #newsRoot .ns-list,
  html:is([data-theme="light"], [data-theme="dark"]) .mkt-cards{scroll-behavior:auto}
}
