/* Optimal Trend canonical design system.
   Stage D-pre Rev 2.1 DP1 - chassis rules extracted from asset_workbench.css.
   Pages depending on this stylesheet inherit the full McKinsey-aligned
   Optimal brand chassis. Page-specific rules live in each page's own
   stylesheet. */

:root {
  --navy: #002F65;
  --navy-dark: #001E44;
  --teal: #00A8CB;
  --teal-light: #E0F6FB;
  --ink: #0D1117;
  --ink-2: #1C2333;
  --ink-3: #3A4252;
  --ink-4: #6B7280;
  --rule: #D8D3CC;
  --rule-light: #EBEBEB;
  --paper: #FAFAF8;
  --white: #FFFFFF;

  /* Semantic tokens - resolve to light values by default. Dark values
   * are activated by [data-theme="dark"] in optimal-dark-mode.css. */
  --canvas:           var(--paper);
  --surface:          var(--white);
  --surface-alt:      var(--paper);
  --surface-elevated: var(--white);
  --surface-inset:    var(--paper);
  --surface-strip:    var(--navy);
  --ink-primary:      var(--ink);
  --ink-secondary:    var(--ink-3);
  --ink-tertiary:     var(--ink-4);
  --ink-on-accent:    var(--white);
  --accent:           var(--teal);
  --accent-soft:      var(--teal-light);
  --accent-strong:    #0086A3;
  --rule-c:           var(--rule);
  --rule-soft:        var(--rule-light);
  --rule-strip:       rgba(0,0,0,0.18);
  --focus-ring:       var(--teal);
  --shadow-card:      0 1px 0 var(--rule-light);
  --shadow-modal:     0 14px 40px rgba(0,0,0,0.18);
  --shadow-low:       0 1px 2px rgba(13,17,23,0.06);
  --shadow-mid:       0 8px 24px rgba(13,17,23,0.10);
  --shadow-high:      0 18px 48px rgba(13,17,23,0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--ink-primary);
  background: var(--canvas);
}

/* Shell topbar */
.ot-shell__topbar {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 28px;
  align-items: center;
  padding: 18px 28px;
  background: var(--navy);
  color: var(--white);
}

.ot-shell__topbar h1,
.ot-shell__topbar p,
.ot-panel__header h2,
.ot-context-band h2,
.ot-card h3 {
  margin: 0;
}

.ot-shell__topbar h1,
.ot-panel__header h2,
.ot-context-band h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.ot-eyebrow {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

/* Primary nav */
.ot-shell__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ot-shell__nav a,
.ot-link-row a,
.ot-link-list a {
  color: inherit;
  text-decoration: none;
}

.ot-shell__nav a {
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 14px;
}

.ot-shell__nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
}

/* User chip */
.ot-user-chip {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-size: 13px;
}

.ot-user-chip span:last-child {
  color: var(--teal-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

/* Panel headers */
.ot-panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-soft);
}

/* Buttons (chassis) */
.ot-icon-button {
  background: var(--navy);
  color: var(--white);
  border: 0;
  padding: 9px 12px;
  cursor: pointer;
}

/* Form fields (chassis) */
.ot-search {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.ot-search input {
  width: 100%;
  border: 1px solid var(--rule-c);
  padding: 9px 10px;
  color: var(--ink-primary);
  background: var(--surface);
}

/* Tabs */
.ot-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--surface);
}

.ot-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--ink-tertiary);
  font-size: 12px;
}

.ot-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink-2);
}

.ot-tab-panel {
  display: none;
  padding: 14px 18px 20px;
}

.ot-tab-panel.is-active {
  display: block;
}

/* Empty state */
.ot-empty {
  padding: 18px;
  border: 1px dashed var(--rule-c);
  background: var(--surface-alt);
  color: var(--ink-tertiary);
  margin-bottom: 12px;
}

/* Card */
.ot-card {
  border-bottom: 1px solid var(--rule-soft);
  padding: 15px 0;
}

.ot-card h3 {
  font-size: 14px;
  color: var(--navy);
  margin-bottom: 10px;
}

/* Facts */
.ot-facts {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.ot-fact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 6px;
}

.ot-fact span:first-child {
  color: var(--ink-tertiary);
}

/* Link rows / lists */
.ot-link-row,
.ot-link-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ot-link-row a,
.ot-link-list a {
  color: var(--navy);
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 6px;
}

/* Footer */
.ot-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  color: var(--ink-tertiary);
  border-top: 1px solid var(--rule-soft);
  background: var(--surface);
  font-size: 12px;
}

/* Responsive (chassis - page-specific responsive lives in the page CSS) */
@media (max-width: 820px) {
  .ot-shell__topbar {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   DP3c.1 (2026-05-24) Tier 2 canonical primitives
   Adopted by the workbench restoration and forward by DP4-DP7.
   Page-specific overrides remain in each page's own stylesheet.
   ============================================================ */

/* Buttons. Use .ot-btn as the base; pick one modifier. */
.ot-btn {
  display: inline-grid;
  place-items: center;
  height: 40px;
  padding: 0 16px;
  border: 0;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  min-width: max-content;
  text-decoration: none;
}

.ot-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ot-btn--primary {
  background: var(--navy);
  color: var(--white);
}

.ot-btn--primary:hover {
  background: var(--navy-dark);
}

.ot-btn--ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--rule-c);
}

.ot-btn--ghost:hover {
  background: var(--surface-alt);
}

.ot-btn--danger {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--ink-4);
}

/* Status pill. Base height 28px; .ot-status-pill--toolbar matches the
   40px button row so a LIVE/PAUSED indicator sits flush with toolbar
   buttons. */
.ot-status-pill {
  display: inline-grid;
  place-items: center;
  height: 28px;
  min-width: 96px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--white);
}

.ot-status-pill--toolbar {
  height: 40px;
  min-width: 110px;
  font-size: 12px;
}

.ot-status-pill--live {
  background: var(--accent);
}

.ot-status-pill--paused {
  background: var(--ink-4);
}

.ot-status-pill--no-capture {
  background: var(--rule);
  color: var(--ink-2);
}

.ot-status-pill--inactive {
  background: var(--ink-3);
}

/* Toolbar layout. Use .ot-toolbar as the filter+action strip wrapper;
   .ot-toolbar__group is the action button slot. The auto-fit track
   reflows on narrower viewports without forcing items to share heights
   with their tallest siblings. */
.ot-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule-soft);
}

.ot-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
}


/* ============================================================
   DP3c.1 (2026-05-24) Tier 2 expansion: sticky + compact
   Director directive: lock workbench header (topbar + context +
   tabs + toolbar) to viewport top during chart scroll; reduce
   vertical footprint so charts get more real estate. Opt-in via
   classes so existing pages are unaffected until refactored.
   ============================================================ */

:root {
  --navy: #002F65;
  --navy-dark: #001E44;
  --teal: #00A8CB;
  --teal-light: #E0F6FB;
  --ink: #0D1117;
  --ink-2: #1C2333;
  --ink-3: #3A4252;
  --ink-4: #6B7280;
  --rule: #D8D3CC;
  --rule-light: #EBEBEB;
  --paper: #FAFAF8;
  --white: #FFFFFF;

  /* Semantic tokens - resolve to light values by default. Dark values
   * are activated by [data-theme="dark"] in optimal-dark-mode.css. */
  --canvas:           var(--paper);
  --surface:          var(--white);
  --surface-alt:      var(--paper);
  --surface-elevated: var(--white);
  --surface-inset:    var(--paper);
  --surface-strip:    var(--navy);
  --ink-primary:      var(--ink);
  --ink-secondary:    var(--ink-3);
  --ink-tertiary:     var(--ink-4);
  --ink-on-accent:    var(--white);
  --accent:           var(--teal);
  --accent-soft:      var(--teal-light);
  --accent-strong:    #0086A3;
  --rule-c:           var(--rule);
  --rule-soft:        var(--rule-light);
  --rule-strip:       rgba(0,0,0,0.18);
  --focus-ring:       var(--teal);
  --shadow-card:      0 1px 0 var(--rule-light);
  --shadow-modal:     0 14px 40px rgba(0,0,0,0.18);
  --shadow-low:       0 1px 2px rgba(13,17,23,0.06);
  --shadow-mid:       0 8px 24px rgba(13,17,23,0.10);
  --shadow-high:      0 18px 48px rgba(13,17,23,0.18);
}

/* Sticky topbar (opt-in via .is-sticky on .ot-shell__topbar) */
.ot-shell__topbar.is-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
}

/* Sticky scroll-anchor wrapper for context+tabs+toolbar block.
   Pins below the sticky topbar; charts scroll underneath. */
.ot-sticky-header {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  background: var(--surface-alt);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Compact chassis modifiers. */
.ot-shell__topbar--compact {
  min-height: var(--topbar-h);
  padding: 8px 24px;
}

.ot-shell__topbar--compact .ot-shell-title {
  font-size: 22px;
  line-height: 1.1;
}

.ot-shell__topbar--compact .ot-eyebrow {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.ot-context-band--compact {
  padding: 10px 20px;
}

.ot-tabs--compact button {
  padding: 8px 14px;
  font-size: 12px;
}

.ot-toolbar--compact,
.ot-controls.is-compact {
  padding: 10px 16px;
  gap: 8px;
}

/* ============================================================
   DP4 Wave 1.1 (2026-05-24) brand-link canonical lift
   The .ot-shell__brand-link wraps eyebrow + title inside the
   topbar. Without explicit colour and text-decoration rules,
   browsers apply default :visited link styling (purple, underline).
   Lifted from asset_workbench.css to canonical so all pages
   consuming optimal-design-system.css inherit correct rendering.
   ============================================================ */

.ot-shell__brand-link,
.ot-shell__brand-link:hover,
.ot-shell__brand-link:visited,
.ot-shell__brand-link:active {
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 4px;
}

.ot-shell__brand-link:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 4px;
}

/* Canonical topbar fit and utility controls. */
.ot-shell__topbar {
  grid-template-columns: minmax(360px, max-content) minmax(0, 1fr) auto;
  gap: 16px;
  overflow: visible;
}

.ot-shell__brand-link {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.ot-shell-title {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  white-space: nowrap;
}

.ot-shell__nav {
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.ot-shell__nav::-webkit-scrollbar {
  display: none;
}

.ot-shell__nav a {
  flex: 0 0 auto;
  white-space: nowrap;
}

.ot-shell__utilities,
.ot-index-user-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: max-content;
}

.ot-notif-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--white);
  cursor: pointer;
  font: inherit;
}

.ot-notif-bell:hover,
.ot-shell__signout:hover {
  background: var(--navy-dark);
}

.ot-notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  padding: 1px 5px;
  border: 1px solid var(--navy);
  background: var(--accent);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.ot-notif-badge[hidden],
.ot-notif-panel[hidden] {
  display: none;
}

.ot-shell__signout {
  color: var(--white);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.22);
  padding: 13px 14px;
  white-space: nowrap;
}

.ot-notif-panel {
  position: fixed;
  right: 24px;
  top: calc(var(--topbar-h) + 8px);
  width: min(340px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  z-index: 50;
  box-shadow: 0 16px 38px rgba(13, 17, 23, 0.18);
}

.ot-notif-panel__header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-2);
  font-size: 12px;
}

.ot-notif-panel__list {
  max-height: 420px;
  overflow-y: auto;
}

.ot-notif-empty {
  padding: 18px;
  color: var(--ink-tertiary);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .ot-shell__topbar {
    grid-template-columns: minmax(300px, max-content) minmax(0, 1fr) auto;
    gap: 12px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .ot-shell__nav a {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 820px) {
  .ot-shell__topbar {
    grid-template-columns: 1fr;
  }

  .ot-shell__nav {
    justify-content: flex-start;
  }

  .ot-shell__utilities,
  .ot-index-user-controls {
    justify-content: flex-start;
    min-width: 0;
  }
}


/* AR1 semantic surface bridge and utility controls. */
.ot-card,
.ot-panel,
.ot-context-band,
.ot-index-tile,
.ot-notif-panel,
.ot-modal,
.ot-dialog {
  background: var(--surface);
  border-color: var(--rule-soft);
  color: var(--ink-primary);
}

.ot-panel__header,
.ot-notif-panel__header {
  border-color: var(--rule-soft);
}

.ot-theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--white);
  cursor: pointer;
  font: inherit;
}

.ot-theme-toggle:hover,
.ot-theme-toggle:focus-visible {
  background: var(--navy-dark);
}

.ot-theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ot-theme-toggle__icon {
  display: inline-grid;
  place-items: center;
}

.ot-theme-toggle__sun {
  display: none;
}

html[data-theme="dark"] .ot-theme-toggle__moon {
  display: none;
}

html[data-theme="dark"] .ot-theme-toggle__sun {
  display: block;
}

.ot-audit-table.is-compact th,
.ot-audit-table.is-compact td,
.ot-data-table.is-compact th,
.ot-data-table.is-compact td {
  padding-top: 5px;
  padding-bottom: 5px;
  min-height: 28px;
  font-size: 12px;
}

.ot-toolbar.is-compact,
.ot-controls.is-compact {
  min-height: 34px;
}

/* theme_toggle.css (v2)
 * AR1 build pack 2026-05-26 - amended after Codex Rev 3 alignment.
 *
 * Compact labelled theme toggle. The toggle shows the TARGET theme as
 * a label ("Dark" in light mode, "Light" in dark mode) so the button
 * label is the action the user will trigger by clicking. Matches
 * Codex Rev 3 toggle amendment 2026-05-26 (replaces icon-only form).
 *
 * Light-mode rule lives here. Dark override lives in
 * optimal-dark-mode.css OR at the bottom of this file as a guard.
 *
 * Insertion target: end of optimal-design-system.css. The compact
 * height (30px) lines up with the AR1 v4 topbar utility buttons.
 */

.ot-shell__utilities .ot-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 30px;
  gap: 5px;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 8px;
  margin: 0;
}

.ot-shell__utilities .ot-theme-toggle:hover {
  background: rgba(255,255,255,0.08);
}

.ot-shell__utilities .ot-theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring, var(--teal));
  outline-offset: 2px;
}

.ot-theme-toggle__icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: conic-gradient(var(--accent, var(--teal)) 50%, transparent 50%);
  border: 1px solid currentColor;
}

.ot-shell__utilities .ot-theme-toggle::after {
  content: "Dark";
  font-family: var(--font-sans, "Helvetica Neue", Arial, sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-theme="dark"] .ot-shell__utilities .ot-theme-toggle::after {
  content: "Light";
}

[data-theme="dark"] .ot-shell__utilities .ot-theme-toggle__icon {
  background: conic-gradient(transparent 50%, var(--accent, var(--teal)) 50%);
}
