/* base — reset, topbar, brand, nav, controls, status */

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.4;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    background: var(--bg);
    padding: 8px 0 0;
  }

  .topbar-inner {
    width: min(1700px, calc(100vw - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--header-pill-bg);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 4px 40px;
    box-shadow: 0 24px 48px rgba(15,15,15,0.32);
    backdrop-filter: blur(20px);
  }

  .layout {
    width: min(1600px, calc(100vw - 32px));
    margin: 0 auto;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Header nav buttons — IM admin headerNavBtn pattern */
  .navGroup {
    display: inline-flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .headerNavBtn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: var(--header-h);
    width: 180px;
    padding: 0 10px;
    gap: 2px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    line-height: 1.15;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  }

  .headerNavBtn:hover {
    background: rgba(255,255,255,0.05);
  }

  .headerNavBtn[data-active="true"] {
    background: #E5E7E1;
    border-color: #E5E7E1;
    color: #2C292A;
  }

  .headerNavBtn .title {
    font-weight: 600;
    font-size: 14px;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }

  .headerNavBtn .subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }

  .headerNavBtn[data-active="true"] .subtitle {
    color: rgba(44, 41, 42, 0.72);
  }

  /* DESIGN_SYSTEM.md — logo container in header */
  .tile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--header-h);
    padding: 0 10px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    background: transparent;
  }

  .tile img {
    display: block;
    height: calc(var(--header-h) - 8px);
    width: auto;
    margin: 2px 0;
  }

  .brand-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--header-h);
    padding: 0 4px;
  }

  .brand-copy h1 {
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.15;
    color: var(--text);
  }

  .brand-copy p {
    margin-top: 2px;
    color: rgba(255,255,255,0.72);
    font-size: 12px;
    line-height: 1.15;
  }


  .controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-right: 4px;
  }

  .controls select,
  .controls button {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 0 12px;
    font-family: inherit;
    font-size: var(--font-control);
    font-weight: 600;
    height: calc(var(--header-h) - 8px);
    line-height: 1;
  }

  /* Native dropdown arrow needs space; default <select> overlays content.
     Force the shared closed-control height (28px) for selects only — the
     .controls select,button rule's calc() height is shared with buttons. */
  .controls select {
    height: 28px;
    box-sizing: border-box;
    padding-right: 32px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1.5 6 6.5 11 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 7px;
  }

  .controls select option {
    background: var(--surface);
    color: var(--text);
    font-size: var(--font-control);
  }

  .controls button {
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  }

  .controls button:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
  }

  .controls .primary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text);
    font-weight: 600;
  }

  .controls .primary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
  }

  .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: calc(var(--header-h) - 8px);
    padding: 0 14px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    color: rgba(255,255,255,0.72);
    font-size: var(--font-control);
    font-weight: 500;
  }

  .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent-5);
  }
