.errorpage {
  max-width: 620px;
  margin: 0 auto;
  padding: 56px 20px 88px;
  text-align: center;
}

.errorpage .errico {
  display: block;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
}

.errorpage .errcode {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 12px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.errorpage h1 {
  margin: 4px 0 10px;
  font-size: clamp(24px, 4vw, 32px);
}

.errorpage .explain {
  margin: 0 auto 22px;
  max-width: 46ch;
  color: var(--ink-alt);
  font-size: 15.5px;
  line-height: 1.6;
}

.errorpage .recovery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.errorpage .powform {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: left;
}

.errorpage .powform label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-alt);
}

.errorpage .powform input {
  padding: 10px 13px;
  border: 2px solid var(--border);
  border-radius: 11px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.errorpage .powform input:focus-visible {
  border-color: var(--accent);
}

.errorpage .powform .btn {
  justify-content: center;
  margin-top: 6px;
}

.errorpage .fine {
  margin: 14px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

@media (max-width: 480px) {
  .errorpage {
    padding: 32px 14px 72px;
  }

  .errorpage .recovery {
    padding: 14px;
  }
}

.notif-pop,
.lang-pop {
  position: relative;
  display: inline-flex;
}

.notif-pop > summary,
.lang-pop > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
}

.notif-pop > summary::-webkit-details-marker,
.lang-pop > summary::-webkit-details-marker {
  display: none;
}

.notif-pop[open] > summary,
.lang-pop[open] > summary {
  border-color: var(--accent);
  background: var(--hover);
}

.badge-n {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  padding: 1px 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 9.5px;
  font-weight: 900;
  line-height: 12px;
  text-align: center;
}

.nmenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 90;
  width: 340px;
  max-width: calc(100vw - 20px);
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.nmenu.lang-menu {
  width: auto;
  min-width: 170px;
}

.nmenu .lang-opt {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1.5px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.nmenu .lang-opt:hover {
  background: var(--hover);
  text-decoration: none;
}

.nmenu .lang-opt .ico {
  font-size: 17px;
  line-height: 1.3;
}

.nmenu .lang-opt .tx b {
  font-family: var(--display);
  font-size: 13px;
}

.nmenu .lang-opt[aria-current="true"] {
  background: var(--accent-soft);
}

.nmenu .lang-opt:last-child {
  border-bottom: 0;
}

.lang-menu form {
  margin: 0;
}

.nmenu .nh {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-bottom: 1.5px solid var(--line-2);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
}

.nmenu .nh .spacer {
  flex: 1;
}

.nmenu .nh a {
  font-size: 12px;
  font-weight: 700;
  color: var(--link);
}

.nmenu .ni {
  display: flex;
  gap: 10px;
  padding: 10px 13px;
  border-bottom: 1.5px solid var(--line-2);
  color: var(--ink);
}

.nmenu .ni:last-child {
  border-bottom: 0;
}

.nmenu .ni:hover {
  background: var(--hover);
  text-decoration: none;
}

.nmenu .ni.unread {
  background: var(--accent-soft);
}

.nmenu .ni .ico {
  font-size: 17px;
  line-height: 1.3;
}

.nmenu .ni .tx {
  flex: 1;
  min-width: 0;
}

.nmenu .ni .tx b {
  display: block;
  font-family: var(--display);
  font-size: 13px;
}

.nmenu .ni .tx span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

.nmenu .nf {
  margin: 0;
  padding: 12px 13px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.empty {
  padding: 28px 18px;
  border: 2px dashed var(--border);
  border-radius: 13px;
  background: var(--surface);
  text-align: center;
}

.empty .em {
  display: block;
  margin-bottom: 6px;
  font-size: 34px;
  line-height: 1;
}

.empty b {
  display: block;
  font-family: var(--display);
  font-size: 16px;
}

.empty p {
  margin: 5px 0 14px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.swap-err {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 10px 0;
  padding: 10px 13px;
  border: 1.5px solid color-mix(in srgb, var(--tier-untrusted) 45%, transparent);
  border-radius: 11px;
  background: var(--tier-untrusted-soft);
  color: var(--ink);
  font-size: 13px;
}

.swap-err .spacer {
  flex: 1;
}

dialog.sheet {
  width: min(460px, 92vw);
  max-height: 85vh;
  overflow: auto;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog.sheet:not([open]) {
  display: none;
}

dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

/* The alpha notice keeps the shared sheet surface and adds one accent edge so it reads as
   project-status copy rather than a form or a system prompt. */
.alpha-sheet {
  width: min(540px, 92vw);
  border-top: 4px solid var(--accent);
}

.alpha-sheet .sheet-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alpha-mark {
  color: var(--link);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.alpha-sheet .alpha-lede,
.alpha-sheet .alpha-accent {
  color: var(--link);
  font-weight: 700;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 2px solid var(--border);
}

.sheet-head h3 {
  margin: 0;
  font-size: 17px;
}

.sheet-head .x {
  margin-left: auto;
  padding: 4px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.sheet-head .x:hover {
  background: var(--hover);
  color: var(--ink);
}

.sheet-body {
  padding: 15px 16px;
}

.sheet-body p {
  margin: 0 0 12px;
  color: var(--ink-alt);
}

.sheet-body p:last-child {
  margin-bottom: 0;
}

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1.5px solid var(--line-2);
}

.sheet-fallback {
  margin-right: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--link);
}

.spin {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: vsdb-spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes vsdb-spin {
  to {
    transform: rotate(360deg);
  }
}

.htmx-indicator {
  opacity: 0;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

.htmx-request.htmx-indicator {
  opacity: 1;
}

.dev-gallery {
  max-width: 900px;
}

.gal-block {
  margin: 26px 0 0;
}

.gal-block .sec {
  margin-bottom: 10px;
}

.demo-region {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 13px;
  background: var(--sunken);
}

.ov-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.gal-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-3);
}

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

.gal-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 2px solid var(--border);
  border-radius: 11px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.gal-row input:focus-visible {
  border-color: var(--accent);
}

#gal-result {
  margin-top: 12px;
}

@media (max-width: 480px) {
  .empty {
    padding: 22px 14px;
  }

  .sheet-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-foot .btn {
    justify-content: center;
  }

  .sheet-fallback {
    margin: 0 0 4px;
    text-align: center;
  }

  .gal-row {
    flex-direction: column;
    align-items: stretch;
  }
}
