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

    body {
      font-family: var(--font-sans);
      background: var(--bg);
      color: var(--ink-primary);
      height: 100vh;
      display: flex;
      overflow: hidden;
    }

    /* ── Left Rail ── */
    #left-rail {
      width: var(--rail-width);
      min-width: var(--rail-width);
      height: 100vh;
      background: var(--bg);
      border-right: 1px solid var(--divider);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 14px 0 12px;
      gap: 0;
      position: fixed;
      left: 0; top: 0;
      z-index: 10;
    }

    .rail-icon {
      width: 32px; height: 32px;
      margin-bottom: 10px;
      flex-shrink: 0;
    }

    .rail-wordmark {
      writing-mode: vertical-rl;
      text-orientation: mixed;
      transform: rotate(180deg);
      font-family: var(--font-sans);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: -0.5px;
      color: var(--ink-primary);
      margin-bottom: 16px;
    }

    .rail-dots {
      display: flex;
      flex-direction: column;
      gap: 10px;
      flex: 1;
      align-items: center;
      padding-top: 4px;
    }

    .rail-dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      cursor: pointer;
      transition: transform 0.15s;
      flex-shrink: 0;
    }
    .rail-dot:hover { transform: scale(1.35); }
    .rail-dot[data-section="major_update"]  { background: var(--major-updates); }
    .rail-dot[data-section="tip_guide"]     { background: var(--tips-guides); }
    .rail-dot[data-section="editors_pick"]  { background: var(--editors-picks); }

    /* Edition status at the foot of the rail: the date in a ring, rainbow once
       the edition is live, dashed grey while it is a draft. #6B6B6B rather than
       --ink-meta so the 7–8px text stays readable. */
    .rail-status {
      display: flex; flex-direction: column; align-items: center; gap: 9px;
      margin-top: 8px; cursor: default;
    }
    .rail-status[hidden] { display: none; }
    .rail-date {
      width: 44px; height: 44px; box-sizing: border-box; border-radius: 50%;
      border: 2px dashed #C9C9C3;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
    }
    .rail-status.live .rail-date {
      border: 3px solid transparent;
      background:
        linear-gradient(var(--bg), var(--bg)) padding-box,
        conic-gradient(#FF2605, #FF6600, #FFB800, #3CB201, #02DEB6, #016FD0, #FF2605) border-box;
    }
    .rail-date-day {
      font-size: 15px; font-weight: 800; line-height: 1; letter-spacing: -0.5px;
      color: #6B6B6B;
    }
    .rail-status.live .rail-date-day { color: var(--ink-primary); }
    .rail-date-month, .rail-status-label {
      font-family: var(--font-mono); font-weight: 700; color: #6B6B6B;
      text-transform: uppercase;
    }
    .rail-date-month { font-size: 7px; letter-spacing: 0.1em; margin-top: 2px; }
    .rail-status-label {
      font-size: 8px; letter-spacing: 0.12em;
      display: flex; align-items: center; gap: 4px;
    }
    .rail-status.live .rail-status-label { color: var(--verified); }
    .rail-status.live .rail-status-label::before {
      content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
    }

    /* ── Main Pane ── */
    #main-pane {
      margin-left: var(--rail-width);
      flex: 1;
      height: 100vh;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
    }

    /* ── Top Bar ── */
    #top-bar {
      position: sticky; top: 0; z-index: 5;
      background: var(--bg);
      border-bottom: 1px solid var(--divider);
      padding: 10px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-height: 48px;
      flex-shrink: 0;   /* in the scrolling column it would shrink and clip a wrapped second row */
    }

    .top-bar-left {
      display: flex; align-items: center; gap: 6px;
      flex-wrap: wrap;
    }

    .meta-label {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.1em;
      color: var(--ink-meta);
    }

    /* Edition week strip: ≤4 weeks with a sliding rainbow underline + chevron paging. */
    .week-strip { display: inline-flex; align-items: center; gap: 2px; }
    .week-track { position: relative; display: flex; }
    .week-tab {
      font-family: var(--font-mono); font-size: 12px; font-weight: 600;
      letter-spacing: 0.02em; color: var(--ink-meta);
      background: none; border: none; cursor: pointer; white-space: nowrap;
      padding: 3px 10px 8px; transition: color 0.15s;
    }
    .week-tab:hover { color: var(--ink-secondary); }
    .week-tab.active { color: var(--ink-primary); font-weight: 700; }
    .week-tab:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0,0,0,0.10); border-radius: 4px; }
    .week-underline {
      position: absolute; bottom: 1px; left: 0; width: 0; height: 2.5px; opacity: 0;
      border-radius: 2px;
      background: linear-gradient(90deg,#FF5A5F 0%,#FF9F1C 22%,#FFD23F 40%,#3DDC84 60%,#3B82F6 80%,#8B5CF6 100%);
      transition: left 0.28s cubic-bezier(.4,0,.2,1), width 0.28s cubic-bezier(.4,0,.2,1), opacity 0.2s;
    }
    .week-arrow {
      display: inline-flex; align-items: center; justify-content: center;
      width: 22px; height: 22px; flex-shrink: 0;
      border: none; background: none; cursor: pointer; padding: 0;
      color: var(--ink-secondary); /* chevron inherits this — dark grey (light) / near-white (dark) */
      border-radius: 5px; transition: background 0.12s, transform 0.1s;
    }
    .week-arrow:hover:not(:disabled) { background: rgba(0,0,0,0.04); }
    .week-arrow:active:not(:disabled) { transform: scale(0.86); }
    .week-arrow:disabled { opacity: 0.22; cursor: default; }
    .week-arrow svg { width: 14px; height: 14px; display: block; }
    .week-arrow:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0,0,0,0.10); }

    @media (prefers-reduced-motion: reduce) {
      .week-underline, .week-arrow { transition: none; }
    }

    .top-bar-right {
      display: flex; align-items: center; gap: 8px;
      flex-wrap: wrap; justify-content: flex-end;
    }

    #save-status {
      font-family: var(--font-mono);
      font-size: 9px; letter-spacing: 0.05em;
      white-space: nowrap; display: none;
    }
    #save-status.unsaved { color: var(--annotation); }
    #save-status.saved   { color: var(--verified); }

    /* Connection status — matches the PUBLISHED label format, sits in the top-left */
    #conn-status {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.1em;
      color: var(--ink-meta); white-space: nowrap;
    }
    #conn-status::before { content: '·'; color: var(--divider); margin: 0 6px 0 2px; }
    #conn-status.unsaved { color: var(--annotation); }
    #conn-status.saved   { color: var(--verified); }

    /* Who is signed in: Owner (admin key or an owner's email) or Editor */
    #who {
      display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 280px;
      margin-left: 6px; padding: 3px 9px 3px 7px;
      font-family: var(--font-mono); font-size: 10px; color: var(--ink-secondary);
      background: var(--bg-off); border: 1px solid var(--divider); border-radius: 999px;
      white-space: nowrap;
    }
    #who[hidden] { display: none; }
    #who b { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
    .who-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--verified); flex-shrink: 0; }
    .who-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

    /* ── Buttons ── */
    .btn {
      font-family: var(--font-sans);
      font-size: 11.5px; font-weight: 500;
      padding: 5px 12px;
      border-radius: 6px;
      border: 1px solid var(--divider);
      background: var(--bg);
      color: var(--ink-secondary);
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.12s, border-color 0.12s;
    }
    .btn:hover { background: var(--bg-off); border-color: var(--ink-meta); }

    .btn-primary {
      background: var(--ink-primary);
      color: var(--bg);
      border-color: var(--ink-primary);
    }
    .btn-primary:hover { opacity: 0.85; }

    .btn:disabled { opacity: 0.4; cursor: not-allowed; }

    /* Toolbar: quiet tools (Reload, ⋯) | the edition's workflow (Save draft,
       Publish, Send). Publish is the one filled button. */
    .top-bar-right .btn {
      height: 30px; padding: 0 12px;
      display: inline-flex; align-items: center; gap: 6px;
      font-size: 12.5px; border-radius: 8px;
    }
    .top-bar-right .btn[hidden] { display: none; }
    .top-bar-right .btn:disabled:hover { background: var(--bg); border-color: var(--divider); }
    .top-bar-right .btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0,0,0,0.14); }
    .top-bar-right .btn svg {
      width: 14px; height: 14px; flex-shrink: 0;
      fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round;
    }
    .top-bar-right .btn-quiet { background: none; border-color: transparent; }
    .top-bar-right .btn-quiet:hover { background: var(--bg-off); border-color: transparent; color: var(--ink-primary); }
    .top-bar-right .btn-icon { width: 30px; padding: 0; justify-content: center; }
    .top-bar-right .btn-icon svg { fill: currentColor; stroke: none; }
    .top-bar-right .btn-quiet[aria-expanded="true"] { background: var(--bg-off); color: var(--ink-primary); }
    /* Narrow windows: Reload keeps only its icon (its title still names it),
       so the bar stays on one line. */
    @media (max-width: 1100px) {
      .top-bar-right .btn-label { display: none; }
      #btn-reload { width: 30px; padding: 0; justify-content: center; }
    }
    .bar-divider { width: 1px; height: 20px; background: var(--divider); margin: 0 4px; }

    /* ⋯ menu for the occasional actions */
    .menu { position: relative; }
    .menu-list {
      position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
      min-width: 200px; padding: 5px;
      background: var(--bg); border: 1px solid var(--divider); border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
    }
    .menu-item {
      display: block; width: 100%; text-align: left;
      font: 500 12.5px var(--font-sans); color: var(--ink-secondary);
      padding: 7px 10px; border: none; border-radius: 6px;
      background: none; cursor: pointer; white-space: nowrap;
    }
    .menu-item:hover, .menu-item:focus-visible { background: var(--bg-off); color: var(--ink-primary); outline: none; }
    .menu-sep { height: 1px; background: var(--divider); margin: 5px 4px; }
    .menu-item[hidden], .menu-acct[hidden] { display: none; }
    .menu-acct {
      display: grid; gap: 2px; max-width: 260px;
      padding: 7px 10px 9px; margin-bottom: 5px; border-bottom: 1px solid var(--divider);
    }
    .menu-acct span { font: 600 12px var(--font-sans); color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; }
    .menu-acct em {
      font-style: normal; font-family: var(--font-mono); font-size: 9.5px;
      letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-meta); white-space: nowrap;
    }

    /* ── Filter Bar ── */
    #filter-bar {
      position: sticky; top: 48px; z-index: 4;
      background: var(--bg);
      border-bottom: 1px solid var(--divider);
      padding: 8px 16px;
      display: flex; gap: 6px; flex-wrap: wrap;
    }

    .filter-chip {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.1em;
      padding: 4px 10px;
      border-radius: 100px;
      border: 1px solid var(--divider);
      background: var(--bg);
      color: var(--ink-meta);
      cursor: pointer;
      transition: all 0.12s;
    }
    .filter-chip:hover { border-color: var(--ink-meta); color: var(--ink-secondary); }

    .filter-chip.active[data-filter="all"]          { background: var(--ink-primary);   color: var(--bg);           border-color: var(--ink-primary); }
    .filter-chip.active[data-filter="major_update"] { background: var(--major-updates); color: #fff;                border-color: var(--major-updates); }
    .filter-chip.active[data-filter="tip_guide"]    { background: var(--tips-guides);   color: #fff;                border-color: var(--tips-guides); }
    .filter-chip.active[data-filter="editors_pick"] { background: var(--editors-picks); color: var(--ink-primary);  border-color: var(--editors-picks); }
    .filter-chip.active[data-filter="verified"]     { background: var(--verified);      color: #fff;                border-color: var(--verified); }

    /* ── Feed ── */
    #feed { padding: 16px; }

    /* Edition overview editor (top of the feed) */
    .overview-block {
      background: var(--bg-off);
      border: 1px solid var(--divider);
      border-radius: 8px;
      padding: 12px 14px;
      margin-bottom: 24px;
    }
    .overview-head {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 8px;
    }
    .overview-actions { display: inline-flex; align-items: center; gap: 10px; }
    .overview-label {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.1em;
      color: var(--ink-meta);
    }
    .overview-text {
      font-size: 13px; line-height: 1.65;
      color: var(--ink-secondary);
      min-height: 3em; display: block;
    }
    .overview-text:empty::before { content: 'the week in one paragraph (Claude Code: /oneshots:overview)…'; color: var(--divider); }

    .section-group { margin-bottom: 28px; }

    .section-label-row {
      display: flex; align-items: center; gap: 8px;
      padding: 7px 0 7px 10px;
      border-left: 3px solid;
      margin-bottom: 8px;
      border-radius: 0 3px 3px 0;
    }
    .section-label-row[data-section="major_update"] { border-color: var(--major-updates); background: rgba(217,102,43,0.05); }
    .section-label-row[data-section="tip_guide"]    { border-color: var(--tips-guides);   background: rgba(213,68,56,0.05); }
    .section-label-row[data-section="editors_pick"] { border-color: var(--editors-picks); background: rgba(242,197,55,0.07); }

    .section-label-text {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.1em;
      color: var(--ink-secondary);
    }
    .section-count {
      font-family: var(--font-mono);
      font-size: 9px; color: var(--ink-meta);
    }
    .section-lead-missing {
      font-family: var(--font-mono);
      font-size: 9px; font-weight: 700; color: #B4541F;
    }
