.sheet-app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sheets {
  flex: 1;
  position: relative;
  min-height: 0;
  background: var(--bg);
}

.sheet-page {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
}

.sheet-page.on {
  display: flex;
}

.sheet-tabs {
  display: flex;
  align-items: stretch;
  gap: var(--size-2);
  margin-inline-start: var(--sheet-tabs-lead);
  padding-inline-end: var(--size-8);
  background:
    linear-gradient(to right, var(--tabs) 60%, transparent) 0 0 / var(--size-28) 100% no-repeat
      local,
    linear-gradient(to left, var(--tabs) 60%, transparent) 100% 0 / var(--size-28) 100% no-repeat
      local,
    radial-gradient(farthest-side at 0 50%, var(--scroll-edge), transparent) 0 0 / var(--size-12)
      100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-edge), transparent) 100% 0 /
      var(--size-12) 100% no-repeat,
    var(--tabs);
  border-top: var(--stroke-1) solid var(--line-strong);
  overflow-x: auto;
  min-height: var(--sheet-tabs-h);
}

@media (max-width: 720px) {
  .sheet-panel.find {
    position: fixed;
    inset-block-start: auto !important;
    inset-block-end: calc(var(--sheet-strip-h) + var(--size-8) * 2 + var(--size-48));
    inset-inline: var(--size-8) !important;
    width: auto;
    max-height: calc(
      100dvh - var(--topbar-h) - var(--sheet-strip-h) - var(--size-128) - var(--size-16)
    );
  }

  .sheet-tabs {
    visibility: hidden;
    scroll-snap-type: x mandatory;
  }

  .sheet-tabs .sheet-tab {
    scroll-snap-align: start;
  }
}

.sheet-tab {
  position: relative;
  display: flex;
  flex: none;
  width: var(--sheet-tab-w);
  align-items: center;
  gap: var(--size-6);
  font: inherit;
  padding: 0 var(--size-8) 0 var(--size-14);
  border: var(--stroke-1) solid transparent;
  border-block-start: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.12s,
    color 0.12s;
}

.sheet-tab + .sheet-tab::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--size-2) * -1);
  inset-block: var(--size-10);
  width: var(--stroke-1);
  background: var(--line-strong);
}

.sheet-tab.on::before,
.sheet-tab.on + .sheet-tab::before,
.sheet-tab:hover::before,
.sheet-tab:hover + .sheet-tab::before {
  display: none;
}

.sheet-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sheet-tab[draggable="true"]:active,
.sheet-tab.dragging {
  cursor: grabbing;
}
.sheet-tab.dragging {
  opacity: 0.5;
}
.sheet-tab.on {
  z-index: 1;
  margin-block-start: calc(var(--stroke-1) * -1);
  background: var(--bg);
  border-color: var(--line-strong);
  color: var(--accent-strong);
  font-weight: var(--fw-semibold);
}

.sheet-frame:has(.chat-app) .sheet-tab.on {
  background: var(--surface);
}

.sheet-tab.nudged {
  background-image: linear-gradient(
    100deg,
    transparent 35%,
    color-mix(in srgb, var(--accent) 26%, transparent) 50%,
    transparent 65%
  );
  background-size: 250% 100%;
  background-repeat: no-repeat;
  animation:
    sheet-tab-bump 1.6s cubic-bezier(0.22, 1, 0.36, 1),
    sheet-tab-sweep 0.9s cubic-bezier(0.45, 0, 0.25, 1) 0.15s both,
    sheet-tab-glow 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-tab.nudged::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: sheet-tab-ring 0.8s cubic-bezier(0.22, 1, 0.36, 1) 2 both;
}

@keyframes sheet-tab-bump {
  10% {
    transform: translateY(calc(var(--size-4) * -1));
  }
  22% {
    transform: translateY(0);
  }
  32% {
    transform: translateY(calc(var(--size-2) * -1));
  }
  44% {
    transform: translateY(0);
  }
}

@keyframes sheet-tab-sweep {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}

@keyframes sheet-tab-glow {
  12%,
  35% {
    background-color: color-mix(in srgb, var(--accent) 6%, transparent);
    color: var(--accent-strong);
  }
}

@keyframes sheet-tab-ring {
  from {
    box-shadow: inset 0 0 0 var(--stroke-1) color-mix(in srgb, var(--accent) 75%, transparent);
  }
  to {
    box-shadow: inset 0 0 0 var(--stroke-1) transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-tab.nudged {
    animation: sheet-tab-glow 1.6s ease-out;
  }
  .sheet-tab.nudged::after {
    animation: none;
  }
}

.sheet-tab .name {
  flex: none;
  max-width: 70%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-tab .count {
  flex: none;
  min-width: var(--size-20);
  padding: 0 var(--size-4);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  line-height: var(--lh-loose);
  text-align: center;
}

.sheet-tab .count.mention-count {
  background: var(--danger);
  color: var(--danger-ink);
}

.sheet-tab em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
  font-size: var(--fs-micro);
  color: var(--muted);
}

.sheet-tab .dot {
  font-style: normal;
  font-size: var(--fs-micro);
  color: var(--warn);
}

.sheet-tab .x {
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  min-width: var(--size-24);
  min-height: var(--size-24);
  margin-inline-start: auto;
  padding: 0 var(--size-2);
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--fs-sm);
  opacity: 0;
  transition: opacity 0.12s;
}

.sheet-tab.on .x,
.sheet-tab:hover .x,
.sheet-tab:focus-visible .x {
  opacity: 1;
}

.sheet-tab .x:hover {
  background: var(--line);
  color: var(--text);
}

.sheet-tab.add {
  display: none;
  width: auto;
}

.sheet-tabs-note {
  flex: none;
  margin-inline-start: auto;
  padding-inline-start: var(--size-12);
  align-self: center;
  white-space: nowrap;
  font-size: var(--fs-sm);
  color: var(--warn);
}

.sheet-app kbd {
  font-family: var(--mono);
  background: var(--head);
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-xs);
  padding: var(--stroke-1) var(--size-4);
}

.grid {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.viewport {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  outline: none;
  position: relative;
}

.viewport:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 var(--stroke-2) var(--accent-soft);
}

.sheet-canvas {
  position: relative;
}

.keys-close {
  font: inherit;
  height: var(--size-28);
  border: var(--stroke-1) solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  padding: 0 var(--size-8);
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}

.dates-range {
  display: flex;
  gap: var(--size-6);
  padding: var(--size-4) var(--size-4) 0;
}

.dates-range > * {
  flex: 1;
}

.dates-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-4);
  padding-inline: var(--size-4);
}

.dates-presets button {
  font: inherit;
  height: var(--size-24);
  padding: 0 var(--size-8);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.dates-presets button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.dates-presets button.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--fw-medium);
}

.sheet-panel.find {
  display: flex;
  flex-direction: column;
  gap: var(--size-14);
  width: var(--size-560);
  max-height: calc(100vh - var(--size-144));
  padding: var(--size-16);
  overflow-y: auto;
}

.find .sheet-panel-acts {
  margin-top: 0;
  padding-top: var(--size-14);
}

.find .sheet-panel-acts .btn--ghost:has(+ .btn--ghost) {
  margin-inline-end: 0;
}

.find-back {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--size-4);
  height: var(--size-28);
  padding: 0 var(--size-6);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

.find-back:hover {
  background: var(--surface-2);
}

.find-drill .sheet-panel {
  position: static;
  width: auto;
  max-width: none;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.find-section {
  display: flex;
  flex-direction: column;
  gap: var(--size-8);
}

.find-section + .find-section {
  padding-top: var(--size-14);
  border-top: var(--stroke-1) solid var(--line);
}

.find-section h4 {
  margin: 0;
  padding-inline: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.find-presets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--size-8);
}

.find-presets .find-choices {
  grid-column: 1 / -1;
  grid-row: 2;
}

.find-choices__gap {
  align-self: stretch;
  width: var(--stroke-1);
  margin-inline: var(--size-2);
  background: var(--line);
}

.find-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--size-4);
}

.find-tool {
  display: flex;
  align-items: center;
  min-width: 0;
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.find-tool:hover {
  border-color: var(--accent-line);
}

.find-tool.on {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.find-tool__use {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--size-6);
  min-width: 0;
  height: var(--size-32);
  padding-inline: var(--size-6) 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

.find-tool.on .find-tool__use {
  color: inherit;
  font-weight: var(--fw-medium);
}

.find-tool__use svg {
  flex: none;
}

.find-tool__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.find-tool__count {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.find-tool__star {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--size-24);
  height: var(--size-32);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.find-tool__star:hover {
  color: var(--text);
}

.find-tool__star.on {
  color: var(--warn);
}

.find-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-4);
}

.find-choices button {
  height: var(--size-28);
  padding: 0 var(--size-10);
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.find-choices button:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.find-choices button.on {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: var(--fw-medium);
}

.find-presets__name {
  display: flex;
  align-items: center;
  gap: var(--size-4);
}

.find-presets__name input {
  width: var(--size-160);
  height: var(--size-28);
}

.find-presets__manage {
  display: flex;
  align-items: center;
  height: var(--size-28);
  padding: 0 var(--size-6);
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
}

.find-presets__manage:hover {
  text-decoration: underline;
}

.find-choices .find-choices__manage {
  border-style: dashed;
  color: var(--muted);
}

.find-fields {
  display: flex;
  flex-direction: column;
  gap: var(--size-2);
}

.find-field {
  display: grid;
  grid-template-columns: var(--size-144) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--size-4) var(--size-8);
  padding: 0;
}

.find-field__head {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.find-field__box {
  display: flex;
  min-width: 0;
}

.find .find-field__box input,
.find .find-field__box .select {
  width: 100%;
  min-width: 0;
  height: var(--size-32);
  padding: 0 var(--size-8);
  border: var(--stroke-1) solid transparent;
  border-radius: var(--radius-sm);
  background-color: transparent;
  background-image: none;
  color: var(--text);
  font: inherit;
  text-align: start;
}

.find .find-field__box input:is(:hover, :focus),
.find .find-field__box .select:is(:hover, :focus-visible) {
  border-color: transparent;
  box-shadow: none;
  background-color: var(--surface-2);
}

.find .find-field__box input:focus-visible,
.find .find-field__box .select:focus-visible {
  outline: none;
}

.find .find-field__box .date-field input {
  padding-inline-end: var(--size-40);
}

.find .find-field__box .date-filter__op {
  flex: none;
  width: var(--size-40);
  padding: 0;
  text-align: center;
}

.find-field.bad .find-field__box input {
  border-color: var(--bad);
  background-color: var(--bad-soft);
}

.find-field__why {
  grid-column: 2;
  margin: 0;
  color: var(--bad);
  font-size: var(--fs-sm);
}

.find-field--dates .dates-range {
  padding: 0;
}

.find-field--dates {
  align-items: start;
}

.find-field--dates .find-field__head {
  display: flex;
  align-items: center;
  min-height: var(--size-32);
}

.find-field--dates .find-field__remove {
  margin-block-start: var(--size-2);
}

.find-field__period {
  flex-direction: column;
  gap: var(--size-2);
  padding-block-end: var(--size-4);
  border-radius: var(--radius-sm);
}

.find-field__period:is(:hover, :focus-within) {
  background-color: var(--surface-2);
}

.find-field__period .dates-presets {
  padding-inline: var(--size-2);
}

.find-field__period .dates-presets button:hover {
  background: none;
}

.find .find-field--dates .dates-range input:is(:hover, :focus) {
  background-color: transparent;
}

.find-field__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size-28);
  height: var(--size-28);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.find-field__remove:hover {
  background: var(--surface-2);
  color: var(--text);
}

.find-add {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--size-6);
  height: var(--size-28);
  padding: 0 var(--size-8);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  margin-inline-start: calc(var(--size-8) * -1);
}

.find-add:hover {
  background: var(--surface-2);
}

.find-pick {
  display: flex;
  flex-direction: column;
  gap: var(--size-4);
  padding: var(--size-2) 0;
}

.find-pick input {
  height: var(--size-28);
}

.find-pick__list {
  display: flex;
  flex-direction: column;
  max-height: var(--size-200);
  overflow-y: auto;
}

.find-pick__list button {
  flex: none;
  height: var(--size-28);
  padding: 0 var(--size-8);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.find-pick__list button:hover,
.find-pick__list button:first-child {
  background: var(--surface-2);
  color: var(--text);
}

@media (max-width: 560px) {
  .sheet-panel.find {
    inset-inline: var(--size-8) !important;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--size-200));
  }

  .find-field {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .find-field__head {
    grid-column: 1 / -1;
  }

  .find-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .find-field__why {
    grid-column: 1;
  }
}

.rules {
  width: var(--size-440);
}

.rules-add {
  display: flex;
  align-items: center;
  gap: var(--size-6);
  padding: var(--size-4) var(--size-4) 0;
}

.rules-add .select {
  flex: 1;
  min-width: 0;
}

.rules-add .sheet-panel-input {
  width: var(--size-128);
}

.rules-tones {
  display: flex;
  gap: var(--size-6);
  padding: var(--size-8) var(--size-4) var(--size-4);
}

.rules-why {
  margin: var(--size-4) var(--size-4) 0;
  color: var(--bad);
  font-size: var(--fs-sm);
}

.rules .swatch {
  width: var(--size-20);
  height: var(--size-20);
  border-radius: var(--radius-xs);
  border: var(--stroke-1) solid var(--line-strong);
  padding: 0;
  cursor: pointer;
  display: inline-block;
}

.rules .swatch.on {
  outline: var(--stroke-2) solid var(--accent);
  outline-offset: var(--stroke-1);
  border-color: transparent;
}

.rules .sw-red {
  background: var(--sheet-hl-red);
  border-color: var(--sheet-hl-red-ink);
}

.rules .sw-amber {
  background: var(--sheet-hl-amber);
  border-color: var(--sheet-hl-amber-ink);
}

.rules .sw-green {
  background: var(--sheet-hl-green);
  border-color: var(--sheet-hl-green-ink);
}

.rules .sw-blue {
  background: var(--sheet-hl-blue);
  border-color: var(--sheet-hl-blue-ink);
}

.rules .sw-purple {
  background: var(--sheet-hl-purple);
  border-color: var(--sheet-hl-purple-ink);
}

.rules .sw-teal {
  background: var(--sheet-hl-teal);
  border-color: var(--sheet-hl-teal-ink);
}

.rules .sw-pink {
  background: var(--sheet-hl-pink);
  border-color: var(--sheet-hl-pink-ink);
}

.rules ul {
  display: flex;
  flex-direction: column;
  gap: var(--stroke-1);
  list-style: none;
  margin: var(--size-4) 0 0;
  padding: var(--size-4) 0 0;
  border-top: var(--stroke-1) solid var(--line);
  max-height: var(--size-320);
  overflow-y: auto;
}

.rules li {
  display: flex;
  align-items: center;
  gap: var(--size-8);
  min-height: var(--size-28);
  padding: 0 var(--size-4) 0 var(--size-8);
  border-radius: var(--radius-sm);
}

.rules li:hover {
  background: var(--surface-2);
}

.rules li.muted {
  color: var(--text-3);
}

.rules li .swatch {
  width: var(--size-14);
  height: var(--size-14);
  cursor: default;
}

.rules li code {
  font-family: var(--mono);
  color: var(--text-2);
}

.rules li button {
  margin-inline-start: auto;
  height: var(--size-24);
  width: var(--size-24);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
}

.rules li button:hover {
  background: var(--surface-3);
  color: var(--text);
}

@media (hover: hover) {
  .rules li:not(:hover, :focus-within) button {
    visibility: hidden;
  }
}

.columns {
  width: var(--size-280);
}

.columns ul {
  display: flex;
  flex-direction: column;
  gap: var(--stroke-1);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: var(--size-320);
  overflow-y: auto;
}

.columns li {
  display: flex;
  align-items: center;
  gap: var(--size-8);
  min-height: var(--size-28);
  padding: 0 var(--size-6);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}

.columns li:hover {
  background: var(--surface-2);
}

.columns li.columns-anchor {
  padding-inline-start: var(--size-20);
  color: var(--muted);
  border-bottom: var(--stroke-1) solid var(--line);
  border-radius: 0;
  margin-bottom: var(--size-2);
}

.columns-handle {
  width: var(--size-8);
  cursor: grab;
  color: var(--muted);
  opacity: 0;
}

.columns li:hover .columns-handle {
  opacity: 1;
}

.columns li > button:where(:not(.picker)) {
  font: inherit;
  font-size: var(--fs-micro);
  height: var(--size-20);
  width: var(--size-20);
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  visibility: hidden;
}

.columns li:is(:hover, :focus-within) > button:where(:not(.picker)),
.columns li > button.columns-wrap[aria-pressed="true"] {
  visibility: visible;
}

.columns li > button:where(:not(.picker)):hover {
  background: var(--surface-3);
  color: var(--text);
}

.columns li > button:first-of-type:where(:not(.picker)) {
  margin-inline-start: auto;
}

.columns li > button.columns-wrap {
  width: auto;
  padding: 0 var(--size-6);
}

.columns li > button.columns-wrap[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.columns li > button:disabled {
  opacity: 0.35;
  cursor: default;
}

.sort-levels ul {
  align-items: flex-start;
}

.sort-levels li {
  gap: var(--size-10);
}

.sort-levels-by {
  min-width: var(--size-56);
  color: var(--muted);
}

.sort-levels .select {
  min-width: var(--size-128);
  text-align: start;
}

.sort-levels {
  width: auto;
}

.views {
  width: var(--size-440);
}

.views ul {
  display: flex;
  flex-direction: column;
  gap: var(--stroke-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.views li {
  display: flex;
  align-items: center;
  gap: var(--size-4);
  min-height: var(--size-32);
  padding: 0 var(--size-4);
  border-radius: var(--radius-sm);
}

.views li:hover {
  background: var(--surface-2);
}

.views li.on {
  background: var(--accent-soft);
}

.views-slot {
  width: var(--size-20);
  text-align: center;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.views-name {
  flex: 1;
  min-width: 0;
  padding-inline: var(--size-8);
}

.views .views-name.sheet-panel-input {
  height: var(--size-28);
  padding-inline: var(--size-8);
  border: none;
  border-color: transparent;
  background: transparent;
}

.views .views-name.sheet-panel-input:focus {
  border-color: transparent;
  box-shadow: none;
  background: var(--surface);
}

.views .views-name.sheet-panel-input::placeholder {
  color: var(--text-3);
}

.views-built li {
  cursor: pointer;
}

.views .views-built {
  padding-bottom: var(--size-4);
  margin-bottom: var(--size-4);
  border-bottom: var(--stroke-1) solid var(--border);
}

.views li .btn {
  height: var(--size-24);
  padding: 0 var(--size-8);
  font-weight: var(--fw-normal);
  color: var(--muted);
}

.views li .btn:disabled {
  display: none;
}

.views li .btn.on {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: var(--fw-medium);
}

.views li.on .btn.on {
  background: var(--surface);
}

@media (hover: hover) {
  .views li:not(:hover, :focus-within) .btn:not(.on, [data-pending]) {
    visibility: hidden;
  }
}

.keys {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: var(--size-16);
  max-height: calc(100% - var(--sheet-tabs-h, 0));
  padding: var(--size-14) var(--size-16);
  background: var(--surface);
  border-bottom: var(--stroke-1) solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-base);
}

.keys--page {
  position: sticky;
  max-height: none;
}

.keys__groups {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--size-10) var(--size-32);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.keys h4 {
  margin: 0 0 var(--size-6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

.keys ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.keys li {
  display: flex;
  align-items: baseline;
  gap: var(--size-8);
  padding: var(--size-2) 0;
}

.keys li kbd {
  flex: none;
  min-width: var(--size-80);
  padding: var(--size-2) var(--size-6);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text);
  text-align: center;
}

.board {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--surface-2);
}

.board-said {
  margin: var(--size-8) var(--size-12) 0;
  padding: var(--size-6) var(--size-10);
  border-radius: var(--radius-xs);
  background: var(--bad-soft);
  color: var(--bad);
  font-size: var(--fs-sm);
}

.board-lanes {
  display: flex;
  flex: 1;
  gap: var(--size-10);
  min-height: 0;
  padding: var(--size-12);
  overflow-x: auto;
}

.board-lane {
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--size-280);
  min-height: 0;
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--head);
}

.board-lane.over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 var(--stroke-2) var(--accent-soft);
}

.board-lane__head {
  display: flex;
  align-items: baseline;
  gap: var(--size-6);
  padding: var(--size-8) var(--size-10);
  border-block-end: var(--stroke-1) solid var(--line);
  font-size: var(--fs-sm);
}

.board-lane__name {
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.board-lane__count {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.board-lane__cards {
  display: flex;
  flex-direction: column;
  gap: var(--size-6);
  flex: 1;
  min-height: 0;
  padding: var(--size-8);
  overflow-y: auto;
}

.board-lane__empty {
  margin: 0;
  padding: var(--size-8) var(--size-2);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.board-lane__more {
  padding: var(--size-6);
  border: var(--stroke-1) dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.board-lane__more:hover {
  background: var(--surface);
  color: var(--text);
}

.board-card {
  display: flex;
  flex-direction: column;
  gap: var(--size-2);
  padding: var(--size-8) var(--size-10);
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  user-select: none;
}

.board-card:hover {
  border-color: var(--line-strong);
}

.board-card:focus-visible {
  outline: none;
}

.board-card-slot {
  position: relative;
  display: flex;
  flex-direction: column;
}

.board-card__tools {
  position: absolute;
  inset-block-end: var(--size-6);
  inset-inline-end: var(--size-6);
  display: flex;
  gap: var(--size-2);
}

.board-card__tools button {
  display: grid;
  place-items: center;
  width: var(--size-24);
  height: var(--size-24);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.board-card__tools button svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

.board-card__tools button:hover {
  background: var(--head);
  color: var(--accent);
}

.board-card.lifted {
  opacity: 0.4;
}

.board-lane.hl-red {
  --hl-ground: var(--sheet-hl-red);
  --hl-ink: var(--sheet-hl-red-ink);
}

.board-lane.hl-amber {
  --hl-ground: var(--sheet-hl-amber);
  --hl-ink: var(--sheet-hl-amber-ink);
}

.board-lane.hl-green {
  --hl-ground: var(--sheet-hl-green);
  --hl-ink: var(--sheet-hl-green-ink);
}

.board-lane.hl-blue {
  --hl-ground: var(--sheet-hl-blue);
  --hl-ink: var(--sheet-hl-blue-ink);
}

.board-lane.hl-purple {
  --hl-ground: var(--sheet-hl-purple);
  --hl-ink: var(--sheet-hl-purple-ink);
}

.board-lane.hl-teal {
  --hl-ground: var(--sheet-hl-teal);
  --hl-ink: var(--sheet-hl-teal-ink);
}

.board-lane.hl-pink {
  --hl-ground: var(--sheet-hl-pink);
  --hl-ink: var(--sheet-hl-pink-ink);
}

.board-lane.hl .board-lane__head {
  background: var(--hl-ground);
  color: var(--hl-ink);
}

.board-lane.hl .board-lane__count {
  color: var(--hl-ink);
}

.board-card--ghost {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg);
}

.board.dragging,
.board.dragging * {
  cursor: grabbing;
}

.board-card__title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
}

.board-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-4);
  margin-block: var(--size-2);
}

.board-card__badge {
  padding: var(--stroke-1) var(--size-6);
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.board-card__badge.hl {
  border-color: transparent;
  background: var(--hl-ground);
  color: var(--hl-ink);
}

.board-card__badge.hl-red {
  --hl-ground: var(--sheet-hl-red);
  --hl-ink: var(--sheet-hl-red-ink);
}

.board-card__badge.hl-amber {
  --hl-ground: var(--sheet-hl-amber);
  --hl-ink: var(--sheet-hl-amber-ink);
}

.board-card__badge.hl-blue {
  --hl-ground: var(--sheet-hl-blue);
  --hl-ink: var(--sheet-hl-blue-ink);
}

.board-card__detail {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-base);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-card__figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--size-12);
  margin-top: var(--size-4);
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}

.board-card__figures > [data-type="money"] {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.board-card__owner {
  position: absolute;
  inset-block-start: var(--size-8);
  inset-inline-end: var(--size-8);
  display: grid;
  place-items: center;
  width: var(--size-24);
  height: var(--size-24);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
}

.board-card-slot:has(.board-card__owner) .board-card__title {
  padding-inline-end: var(--size-28);
}

.board-card-slot:has(.board-card__tools) .board-card {
  padding-block-end: var(--size-36);
}

.board-card__badges .sheet-tag {
  margin: 0;
  padding: var(--stroke-1) var(--size-8);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
}

.board-lane__sum {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.board-lane.hl .board-lane__sum {
  color: var(--hl-ink);
}

.board-card--new {
  gap: var(--size-6);
  cursor: default;
}

.board-card__input {
  width: 100%;
  padding: var(--size-4) var(--size-6);
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  resize: vertical;
}

.board-card__input:first-child {
  font-weight: var(--fw-semibold);
}

.board-card__input:focus-visible {
  outline: none;
}

.board-card__refused {
  margin: 0;
  color: var(--bad);
  font-size: var(--fs-sm);
}

.board-card__acts {
  display: flex;
  justify-content: flex-end;
  gap: var(--size-6);
}

.groups {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

.groups-levels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--size-6);
  padding: var(--size-8) var(--size-12);
  border-block-end: var(--stroke-1) solid var(--line);
  background: var(--surface);
  font-size: var(--fs-sm);
}

.groups-levels__label {
  color: var(--muted);
}

.groups-level {
  display: inline-flex;
  align-items: center;
  gap: var(--size-2);
}

.groups-level .picker {
  font-size: var(--fs-sm);
}

.groups-level__remove {
  display: grid;
  place-items: center;
  width: var(--size-24);
  height: var(--size-24);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.groups-level__remove:hover {
  background: var(--surface-2);
  color: var(--text);
}

.groups-levels__add {
  padding: var(--size-4) var(--size-8);
  border: var(--stroke-1) dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.groups-levels__add:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.groups-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.groups-row {
  display: grid;
  grid-template-columns: var(--size-14) minmax(0, 1fr) var(--size-72) minmax(
      var(--size-96),
      var(--size-144)
    );
  align-items: center;
  gap: var(--size-8);
  width: 100%;
  padding-block: var(--size-6);
  padding-inline-end: var(--size-12);
  border: 0;
  border-block-end: var(--stroke-1) solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  text-align: start;
  cursor: pointer;
}

.groups-row:hover {
  background: var(--surface-2);
}

.groups-row[aria-expanded="true"] .groups-row__label {
  color: var(--accent-strong);
}

.groups-row__caret {
  color: var(--muted);
  transition: transform 0.12s ease;
}

.groups-row[aria-expanded="true"] .groups-row__caret {
  color: var(--accent);
  transform: rotate(90deg);
}

.groups-row__label {
  overflow: hidden;
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.groups-row__count,
.groups-row__sum {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.groups-top {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

.groups-row--head {
  padding-inline-start: var(--size-12);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: default;
}

.groups-row--head:hover {
  background: var(--surface-2);
}

.groups-row--head .groups-row__label {
  grid-column: 2;
  font-weight: var(--fw-medium);
}

.groups-row--total {
  padding-inline-start: var(--size-12);
  border-block-end: var(--stroke-2) solid var(--accent-line);
  background: var(--surface);
  cursor: default;
}

.groups-row--total:hover {
  background: var(--surface);
}

.groups-row--total .groups-row__count,
.groups-row--total .groups-row__sum {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.groups-row--total .groups-row__label {
  grid-column: 2;
}

.groups-leaf {
  overflow-x: auto;
}

.groups-record {
  display: grid;
  align-items: baseline;
  gap: var(--size-12);
  width: max-content;
  min-width: 100%;
  padding-block: var(--size-6);
  padding-inline-end: var(--size-12);
  border: 0;
  border-block-end: var(--stroke-1) solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-base);
  text-align: start;
  cursor: pointer;
}

.groups-record:hover {
  background: var(--surface-2);
}

.groups-record--head {
  padding-block: var(--size-4);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: default;
}

.groups-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.groups-cell--end {
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.groups-record:not(.groups-record--head) .groups-cell:first-child {
  color: var(--link);
  font-weight: var(--fw-medium);
}

.groups-record:not(.groups-record--head) .groups-cell:first-child:hover {
  text-decoration: underline;
}

.groups-more {
  margin-block: var(--size-6);
  padding: var(--size-4) var(--size-8);
  border: var(--stroke-1) dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.groups-more:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.groups-empty {
  margin: 0;
  padding-block: var(--size-8);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.groups-empty p {
  margin: 0;
}

.reads {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.reads-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 var(--size-24) var(--size-24);
}

.reads-head {
  display: flex;
  justify-content: flex-end;
  max-width: var(--size-1180);
  margin: var(--size-24) auto 0;
}

.reads-head + .reads-panel {
  margin-top: var(--size-12);
}

.reads-panel {
  max-width: var(--size-1180);
  margin: var(--size-24) auto 0;
  overflow: clip;
  border: var(--stroke-1) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.reads-record {
  display: grid;
  align-items: baseline;
  gap: var(--size-16);
  width: 100%;
  padding: var(--size-12) var(--size-20);
  border: 0;
  border-block-end: var(--stroke-1) solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.reads-record:hover {
  background: var(--surface-2);
}

.reads-record--head {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  padding-block: var(--size-10);
  border-block-end-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  cursor: default;
}

.reads-record--head .reads-cell {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.reads-record--head .reads-cell:hover {
  color: var(--text);
}

.reads-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reads-cell--end,
.reads-record--head .reads-cell--end {
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.reads-record:not(.reads-record--head) .reads-cell:first-child {
  color: var(--link);
  font-weight: var(--fw-medium);
}

.reads-record:not(.reads-record--head) .reads-cell:first-child:hover {
  text-decoration: underline;
}

.reads-record:last-child {
  border-block-end: 0;
}

.reads-chip {
  padding: var(--stroke-1) var(--size-6);
  border-radius: var(--radius-xs);
}

.reads-chip.hl {
  background: var(--hl-ground);
  color: var(--hl-ink);
}

.reads-chip.hl-red {
  --hl-ground: var(--sheet-hl-red);
  --hl-ink: var(--sheet-hl-red-ink);
}

.reads-chip.hl-amber {
  --hl-ground: var(--sheet-hl-amber);
  --hl-ink: var(--sheet-hl-amber-ink);
}

.reads-chip.hl-green {
  --hl-ground: var(--sheet-hl-green);
  --hl-ink: var(--sheet-hl-green-ink);
}

.reads-chip.hl-blue {
  --hl-ground: var(--sheet-hl-blue);
  --hl-ink: var(--sheet-hl-blue-ink);
}

.reads-chip.hl-purple {
  --hl-ground: var(--sheet-hl-purple);
  --hl-ink: var(--sheet-hl-purple-ink);
}

.reads-chip.hl-teal {
  --hl-ground: var(--sheet-hl-teal);
  --hl-ink: var(--sheet-hl-teal-ink);
}

.reads-chip.hl-pink {
  --hl-ground: var(--sheet-hl-pink);
  --hl-ink: var(--sheet-hl-pink-ink);
}

.reads-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--size-8);
  padding: var(--size-48) var(--size-20);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.reads-empty p {
  margin: 0;
}

.reads-more {
  margin: var(--size-12) var(--size-20);
}

@media (max-width: 560px) {
  .reads-list {
    padding: 0 var(--size-12) var(--size-12);
  }

  .reads-panel {
    margin-block-start: var(--size-12);
  }

  .reads-record {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--size-6) var(--size-8);
    width: 100%;
    padding: var(--size-14) var(--size-16);
    grid-template-columns: none !important;
  }

  .reads-record .reads-cell,
  .reads-record .reads-cell--end {
    text-align: start;
  }

  .reads-record .reads-cell:empty,
  .reads-record.reads-record--head {
    display: none;
  }

  .reads-record:not(.reads-record--head) .reads-cell:first-child {
    flex: 1 0 100%;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
  }

  .reads-record:not(.reads-record--head) .reads-cell:nth-child(2) {
    display: -webkit-box;
    flex: 1 0 100%;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--text-2);
    white-space: normal;
  }

  .reads-record:not(.reads-record--head) .reads-cell:nth-child(n + 3) {
    flex: none;
    max-width: 100%;
    color: var(--muted);
    font-size: var(--fs-sm);
  }

  .reads-record .reads-cell:nth-child(n + 3) .reads-chip {
    display: inline-block;
  }
}

@media (max-width: 560px) {
  .groups-row {
    grid-template-columns: var(--size-14) minmax(0, 1fr) var(--size-40) minmax(var(--size-72), auto);
    gap: var(--size-6);
  }

  .groups-row__sum {
    padding-inline-start: var(--size-10);
  }
}
