.notebook-button {
  border-color: color-mix(in srgb, var(--warning, #ffd866), transparent 44%);
  color: var(--text);
}
.command-button {
  border-color: color-mix(in srgb, var(--accent), transparent 55%);
  color: var(--muted);
}
.notebook-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(13px, 1.35vw, 26px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: linear-gradient(color-mix(in srgb, var(--grid), transparent 35%) 1px, transparent 1px), var(--panel-pattern);
  background-size: 100% 26px, auto;
  box-shadow: 0 12px 36px var(--shadow);
  outline: none;
  transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s;
}
.notebook-panel:focus-visible,
.notebook-panel.attention {
  border-color: var(--warning, #ffd866);
}
.notebook-panel.attention {
  box-shadow: 0 12px 42px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--warning, #ffd866), transparent 48%);
}
.notebook-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--warning, #ffd866), var(--accent), var(--danger), transparent 84%);
  opacity: 0.8;
}
.notebook-heading {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(480px, 1.18fr);
  gap: 24px;
  align-items: end;
  padding: 1px 2px 15px;
  border-bottom: 1px solid var(--border);
}
.notebook-heading-copy {
  min-width: 0;
}
.notebook-heading-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(17px, 1.3vw, 24px);
  line-height: 1;
}
.notebook-heading-copy p {
  max-width: 690px;
  margin: 7px 0 0;
  color: var(--quiet);
  font-size: 8px;
  line-height: 1.45;
}
.notebook-capture {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.45fr);
  gap: 8px;
}
.notebook-capture label {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.notebook-capture label span {
  color: var(--quiet);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.notebook-capture input {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 8px;
}
.notebook-capture input:focus {
  border-color: var(--warning, #ffd866);
}
.notebook-save {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid var(--warning, #ffd866);
  border-radius: 3px;
  background: color-mix(in srgb, var(--warning, #ffd866), var(--surface-2) 90%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: color 0.5s, border-color 0.5s, background-color 0.5s, transform 0.5s, box-shadow 0.5s;
}
.notebook-save span {
  font-size: 7px;
  font-weight: 950;
  letter-spacing: 0.04em;
}
.notebook-save small {
  color: var(--quiet);
  font-size: 5px;
}
.notebook-save:hover,
.notebook-save:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow);
}
.notebook-save:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}
.notebook-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 12px 3px 10px;
}
.notebook-status strong,
.notebook-status span {
  display: block;
}
.notebook-status strong {
  color: var(--text);
  font-size: 10px;
}
.notebook-status > div:first-child span {
  margin-top: 4px;
  color: var(--quiet);
  font-size: 7px;
}
.notebook-status-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.notebook-status-chips span {
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
#offline-state.ready {
  border-color: color-mix(in srgb, var(--success, #a6e22e), transparent 45%);
  color: var(--success, #a6e22e);
}
.notebook-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(520px, 1.12fr);
  gap: 9px;
}
.snapshot-deck,
.diff-deck {
  min-width: 0;
  padding: clamp(10px, 1vw, 17px);
  border: 1px solid var(--border);
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface-2), transparent 12%);
}
.notebook-deck-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}
.notebook-deck-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.notebook-deck-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
}
.notebook-deck-heading > span {
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.07em;
}
.snapshot-list {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}
.snapshot-card {
  --leader-color: var(--accent);
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
  min-height: 74px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  transition: border-color 0.5s, background-color 0.5s, transform 0.5s, box-shadow 0.5s;
}
.snapshot-card:hover {
  border-color: var(--leader-color);
  background: color-mix(in srgb, var(--leader-color), var(--surface) 96%);
  transform: translateX(3px);
  box-shadow: 0 8px 20px var(--shadow);
}
.snapshot-card.compare-a {
  box-shadow: inset 3px 0 var(--accent);
}
.snapshot-card.compare-b {
  box-shadow: inset -3px 0 var(--danger);
}
.snapshot-card img {
  width: 66px;
  height: 50px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--surface-3);
}
.snapshot-copy {
  min-width: 0;
}
.snapshot-copy strong,
.snapshot-copy span,
.snapshot-copy small {
  display: block;
}
.snapshot-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snapshot-copy span {
  margin-top: 3px;
  color: var(--leader-color);
  font-size: 7px;
  font-weight: 850;
}
.snapshot-copy small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 5px;
}
.snapshot-actions {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  gap: 4px;
}
.snapshot-actions button {
  min-height: 25px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--quiet);
  font-size: 6px;
  font-weight: 950;
  cursor: pointer;
  transition: color 0.5s, border-color 0.5s, background-color 0.5s, transform 0.5s;
}
.snapshot-actions button:hover,
.snapshot-actions button:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}
.snapshot-actions button[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--surface-2) 88%);
  color: var(--text);
}
.snapshot-actions button.assign-b[aria-pressed="true"] {
  border-color: var(--danger);
}
.snapshot-actions button.restore-snapshot {
  grid-column: 1/-1;
  color: var(--leader-color);
}
.notebook-empty {
  padding: 26px;
  border: 1px dashed var(--border);
  color: var(--quiet);
  font-size: 8px;
  line-height: 1.5;
  text-align: center;
}
.diff-heading {
  align-items: end;
}
.diff-selectors {
  display: grid;
  grid-template-columns: minmax(105px, 1fr) 18px minmax(105px, 1fr);
  gap: 4px;
  align-items: end;
}
.diff-selectors label {
  display: grid;
  gap: 3px;
}
.diff-selectors label span {
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
}
.diff-selectors select {
  min-width: 0;
  width: 100%;
  height: 29px;
  padding: 4px 22px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  font-size: 6px;
  font-weight: 750;
}
.diff-arrow {
  align-self: center;
  color: var(--accent);
  font-size: 11px;
  text-align: center;
}
.diff-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 92px;
  margin-top: 9px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}
.diff-leader {
  --leader-color: var(--accent);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
}
.diff-leader img {
  width: 58px;
  height: 43px;
  object-fit: cover;
  border-radius: 2px;
}
.diff-leader strong,
.diff-leader span,
.diff-leader small {
  display: block;
}
.diff-leader strong {
  overflow: hidden;
  color: var(--leader-color);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diff-leader small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 5px;
}
.diff-leader > span:last-child {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}
.diff-shift {
  color: var(--quiet);
  font-size: 13px;
  text-align: center;
}
.diff-shift.changed {
  color: var(--danger);
}
.diff-rows {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}
.diff-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.45fr) minmax(100px, 1fr) 32px minmax(100px, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 38px;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}
.diff-row > strong {
  color: var(--muted);
  font-size: 7px;
}
.diff-row > span {
  overflow: hidden;
  color: var(--quiet);
  font-size: 6px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diff-row > i {
  color: var(--accent);
  font-size: 8px;
  font-style: normal;
  text-align: center;
}
.diff-weight-row {
  --before-position: 0%;
  --after-position: 0%;
}
.diff-weight-row .diff-weight-track {
  position: relative;
  height: 3px;
  overflow: visible;
  background: var(--surface-3);
}
.diff-weight-row .diff-weight-track::before {
  content: '';
  position: absolute;
  left: var(--segment-start);
  width: var(--segment-size);
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--danger));
}
.diff-weight-row .diff-weight-track i,
.diff-weight-row .diff-weight-track b {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.diff-weight-row .diff-weight-track i {
  left: var(--before-position);
  background: var(--accent);
}
.diff-weight-row .diff-weight-track b {
  left: var(--after-position);
  background: var(--danger);
}
.notebook-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 3px 0;
}
.notebook-footer > div {
  display: flex;
  gap: 5px;
}
.notebook-footer > span {
  color: var(--quiet);
  font-size: 6px;
  font-weight: 850;
  letter-spacing: 0.05em;
}
.notebook-file-button {
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  cursor: pointer;
  transition: color 0.5s, border-color 0.5s, transform 0.5s;
}
.notebook-file-button:hover,
.notebook-file-button:focus-visible {
  border-color: var(--warning, #ffd866);
  color: var(--text);
  transform: translateY(-2px);
}
.command-palette {
  width: min(680px, calc(100vw - 18px));
  max-width: none;
  max-height: calc(100vh - 18px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0,0,0,0.72), 0 0 30px color-mix(in srgb, var(--accent), transparent 82%);
}
.command-palette::backdrop {
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(7px);
}
.command-shell {
  display: grid;
  grid-template-rows: auto auto minmax(100px, 1fr) auto;
  max-height: calc(100vh - 20px);
}
.command-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 11px;
  border-bottom: 1px solid var(--border);
}
.command-heading h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 16px;
}
.command-close {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--quiet);
  font-size: 6px;
  font-weight: 900;
  cursor: pointer;
}
.command-search {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.command-search > span {
  color: var(--accent);
  font-size: 18px;
}
.command-search input {
  min-width: 0;
  height: 34px;
  padding: 5px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 10px;
}
.command-search kbd {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--quiet);
  font-family: var(--font-body);
  font-size: 6px;
}
.command-results {
  display: grid;
  align-content: start;
  gap: 3px;
  max-height: 440px;
  overflow: auto;
  padding: 7px;
  scrollbar-width: thin;
}
.command-result {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 39px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.command-result > span:first-child {
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.command-result strong {
  font-size: 8px;
}
.command-result small {
  color: var(--quiet);
  font-size: 6px;
}
.command-result:hover,
.command-result:focus-visible,
.command-result.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--surface-2) 92%);
}
.command-footer {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 8px 13px;
  border-top: 1px solid var(--border);
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
body.chart-focus .notebook-panel {
  display: none;
}
html[data-theme="minimal-paper"] .notebook-panel {
  background-image: linear-gradient(rgba(21,94,239,0.06) 1px, transparent 1px);
  background-size: 100% 26px;
}
html[data-theme="retro-terminal"] .notebook-panel,
html[data-theme="retro-terminal"] .snapshot-card,
html[data-theme="retro-terminal"] .diff-deck,
html[data-theme="retro-terminal"] .snapshot-deck,
html[data-theme="retro-terminal"] .command-palette {
  border-radius: 0;
}
html[data-theme="manga-ink"] .notebook-panel,
html[data-theme="manga-ink"] .snapshot-deck,
html[data-theme="manga-ink"] .diff-deck {
  border-width: 2px;
}
html[data-theme="manga-ink"] .snapshot-card {
  box-shadow: 3px 3px 0 rgba(0,0,0,0.08);
}
@media (min-width: 2300px) {
  .notebook-heading {
    grid-template-columns: minmax(440px, 0.82fr) minmax(860px, 1.18fr);
  }
  .snapshot-card {
    grid-template-columns: 106px minmax(0, 1fr) auto;
    min-height: 96px;
    padding: 10px;
  }
  .snapshot-card img {
    width: 106px;
    height: 72px;
  }
  .snapshot-copy strong {
    font-size: 12px;
  }
  .diff-summary {
    min-height: 118px;
  }
  .diff-leader {
    grid-template-columns: 94px minmax(0, 1fr) auto;
  }
  .diff-leader img {
    width: 94px;
    height: 66px;
  }
}
@media (max-width: 1240px) {
  .notebook-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .notebook-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .notebook-heading {
    gap: 14px;
  }
  .notebook-capture {
    grid-template-columns: 1fr;
  }
  .notebook-status {
    display: grid;
  }
  .notebook-status-chips {
    justify-content: flex-start;
  }
  .notebook-deck-heading,
  .diff-heading {
    align-items: flex-start;
  }
  .diff-heading {
    display: grid;
  }
  .diff-selectors {
    width: 100%;
  }
  .snapshot-card {
    grid-template-columns: 54px minmax(0, 1fr) auto;
  }
  .snapshot-card img {
    width: 54px;
    height: 46px;
  }
  .diff-summary {
    grid-template-columns: 1fr;
  }
  .diff-shift {
    transform: rotate(90deg);
  }
  .diff-row {
    grid-template-columns: 70px minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 5px;
  }
  .notebook-footer {
    display: grid;
  }
  .command-palette {
    width: calc(100vw - 10px);
    max-height: calc(100vh - 10px);
  }
  .command-shell {
    max-height: calc(100vh - 12px);
  }
  .command-heading {
    padding: 11px;
  }
  .command-result {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .command-result small {
    display: none;
  }
}
