.work { --subnav-w: clamp(184px, 15vw, 214px); }

.subnav-title {
  padding: 0 10px 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; color: var(--text);
}
.subnav-title[hidden] { display: none; }
.subnav-card {
  display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 7px 8px 7px 7px; white-space: normal;
  border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg-raised, #fff);
  box-shadow: 0 1px 2px rgba(14, 26, 43, 0.05);
}
.subnav-card-ico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--t50); color: var(--t750); box-shadow: inset 0 0 0 1px var(--t200);
}
.subnav-card-ico > svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.subnav-card-ico:has(> .ei, > .ei-pair) { background: none; box-shadow: none; }
.subnav-card-ico > .ei { width: 30px; height: 30px; border-radius: 8px; }
.subnav-card-ico > .ei-none { background-size: 18px; }
.subnav-card-ico:has(> .ei-pair) { width: auto; }
.subnav-card-ico > .ei-pair .ei { width: 23px; height: 23px; border-radius: 7px; }
.subnav-card-ico > .ei-pair .ei-none { background-size: 14px; }
.subnav-card-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.subnav-card-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; color: var(--text);
}
.subnav-card-kind {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-ui); font-size: 10.5px; font-weight: 500; line-height: 1.3; color: var(--dim);
}
.subnav-list { display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.subnav-list::-webkit-scrollbar { display: none; }
.subnav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 9px 0 10px; margin: 0;
  border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--muted);
  transition: background 0.14s ease, color 0.14s ease;
}
.subnav-ico {
  width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; color: rgba(14, 26, 43, 0.5);
}
.subnav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subnav-item:hover { background: rgba(14, 26, 43, 0.045); color: var(--text); }
.subnav-item[aria-selected="true"] { background: var(--t100); color: var(--t800); font-weight: 600; }
.subnav-item[aria-selected="true"] .subnav-ico { color: var(--t750); }
.subnav-item:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

@media (min-width: 1033px) {
  .subnav {
    position: fixed; z-index: 4; top: 0; bottom: 0; left: 232px; width: var(--subnav-w); box-sizing: border-box;
    display: flex; flex-direction: column; padding: 31px 12px 16px;
    background: var(--bg); border-right: 1px solid var(--line-soft);
  }
  .subnav-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .app > .rail:has(~ .work .subnav) { z-index: 5; }
  .work:has(.subnav) { padding-left: calc(var(--subnav-w) + clamp(22px, 3.4vw, 46px)); }
}

@media (max-width: 1032px) {
  .subnav { margin-top: 22px; border-bottom: 1px solid var(--line-soft); }
  .subnav-title { display: none; }
  .subnav-list { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .subnav-item {
    position: relative; flex: 0 0 auto; width: auto; gap: 7px; height: 40px; min-height: 0; padding: 0 12px;
    border-radius: 9px 9px 0 0; font-size: 13.5px;
  }
  .subnav-ico { width: 15px; height: 15px; }
  .subnav-item[aria-selected="true"] { background: none; }
  .subnav-item[aria-selected="true"]::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px;
    background: var(--t500);
  }
}
.tab-n {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bg-soft); color: var(--muted); font-size: 11px; font-weight: 600;
}
.tab-n.bad { background: var(--r50); color: var(--red); }
.tab-panel { margin-top: 18px; }
.tab-panel > .sec-h:first-child { margin-top: 0; }
.tab-panel:not(.tab-titled) > .sec-h:first-child { justify-content: flex-end; min-height: 0; }
.tab-panel:not(.tab-titled) > .sec-h:first-child > h2 {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.tab-panel:not(.tab-titled) > .sec-h:first-child:not(:has(> :not(h2))) { display: none; }
.tab-panel .sec-h[id] { scroll-margin-top: 16px; }
.tabs {
  display: flex; gap: 2px; margin-top: 24px; border-bottom: 1px solid var(--line-soft);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; height: 40px;
  padding: 0 13px; border: 0; border-radius: 9px 9px 0 0; background: none; color: var(--dim); cursor: pointer;
  font-family: var(--font-ui); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(14, 26, 43, 0.03); }
.tab[aria-selected="true"] { color: var(--t800); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--t500);
}
.tab:focus-visible { outline: 2px solid var(--text); outline-offset: -3px; }
@media print {
  .subnav { display: none; }
  .work:has(.subnav) { padding-left: 0; }
}
