:root {
  --pn-card-ink: #145a86;
}

:root,
[data-bs-theme="light"] {
  --pn-accent: #88c3ed;
  --pn-accent-hover: #6eb3e4;
  --pn-accent-line: #3d86b8;
  --pn-accent-ink: #145a86;
  --pn-on-accent: #123044;
  --pn-brand: #145a86;
  --pn-paper: #f3f6f8;
  --pn-surface: #fff;
  --pn-edit: #e7f3fb;
  --pn-ink: #1c2428;
  --pn-muted: #5e6b73;
  --pn-line: #e1e7ec;
  --tap: 3rem;
}

[data-bs-theme="dark"] {
  --pn-accent: #88c3ed;
  --pn-accent-hover: #6eb3e4;
  --pn-accent-line: #88c3ed;
  --pn-accent-ink: #88c3ed;
  --pn-on-accent: #123044;
  --pn-brand: #88c3ed;
  --pn-paper: #101416;
  --pn-surface: #1b2228;
  --pn-edit: #3a556c;
  --pn-ink: #e7eef3;
  --pn-muted: #b7c2c9;
  --pn-line: #314049;
}

html {
  background: var(--pn-paper);
}

body {
  background: var(--pn-paper);
  color: var(--pn-ink);
}

.app-shell {
  width: min(100%, 32rem);
  max-width: 32rem;
  margin-inline: auto;
  min-height: 100vh;
  background: var(--pn-surface);
  color: var(--pn-ink);
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

.theme-label-light {
  display: none;
}

[data-bs-theme="dark"] .theme-label-dark {
  display: none;
}

[data-bs-theme="dark"] .theme-label-light {
  display: inline;
}

.app-header,
.app-main,
.app-footer {
  padding-left: 1rem;
  padding-right: 1rem;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: calc(0.85rem + env(safe-area-inset-top));
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--pn-line);
  position: sticky;
  top: 0;
  background: var(--pn-surface);
  z-index: 2;
}

.brand {
  color: var(--pn-brand);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.app-menu {
  position: relative;
}

.menu-button {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--pn-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-button:hover,
.menu-button:focus {
  background: var(--pn-paper);
  color: var(--pn-ink);
}

.menu-button:focus-visible,
.menu-action:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 5;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  border: 1px solid var(--pn-line);
  border-radius: 0.85rem;
  background: var(--pn-surface);
  display: grid;
  gap: 0.15rem;
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel form {
  margin: 0;
}

.menu-action {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
}

.menu-action:hover,
.menu-action:focus {
  background: var(--pn-paper);
  color: inherit;
}

.app-main {
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}

.app-footer {
  color: var(--pn-muted);
  font-size: 0.85rem;
  text-align: center;
  padding-bottom: 0.5rem;
}

.btn,
.form-control,
.form-select {
  min-height: var(--tap);
}

.btn {
  font-size: 1rem;
}

input,
textarea,
select,
.form-control {
  font-size: 16px;
}

textarea.form-control {
  min-height: 10rem;
}

.kind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.kind-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 5.5rem;
  padding: 0.85rem;
  border-radius: 0.9rem;
  text-decoration: none;
  background: var(--pn-accent);
  color: var(--pn-on-accent);
  border: 1px solid var(--pn-accent-line);
}

.kind-card:hover,
.kind-card:focus {
  background: var(--pn-accent-hover);
  color: var(--pn-on-accent);
}

.kind-card strong {
  font-size: 1.05rem;
}

.kind-card span {
  color: var(--pn-card-ink);
  font-size: 0.85rem;
}

.entry-link {
  display: block;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--pn-line);
  text-decoration: none;
  color: inherit;
  min-height: var(--tap);
}

.entry-link:hover,
.entry-link:focus {
  color: var(--pn-brand);
}

.list-rows {
  display: grid;
}

.list-row {
  --list-reveal: 5.9rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--pn-line);
}

.list-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.list-actions form {
  margin: 0;
  display: flex;
}

.list-face {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0.9rem 0;
  min-height: var(--tap);
  background: var(--pn-surface);
  color: inherit;
  text-decoration: none;
  touch-action: pan-y;
  transition: transform 160ms ease;
}

.list-face:hover,
.list-face:focus {
  color: var(--pn-brand);
}

.list-row.is-swiping .list-face {
  transition: none;
}

.list-row.is-revealed .list-face {
  transform: translateX(-5.9rem);
}

.list-trash {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 0.65rem;
  background: #d64545;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
}

.list-trash svg {
  width: 1.25rem;
  height: 1.25rem;
}

.list-trash:hover,
.list-trash:focus {
  background: #c33636;
  color: #fff;
}

.list-trash:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: visible;
  }

  .list-actions {
    position: static;
    flex: none;
    order: 1;
  }

  .list-face,
  .list-row.is-revealed .list-face {
    flex: 1;
    min-width: 0;
    order: 0;
    transform: none;
  }
}

.item-list {
  --swipe-reveal: 2.75rem;
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-list ::marker,
.item-row::marker {
  content: none;
}

.item-row {
  list-style: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.item-swipe {
  position: relative;
}

.item-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--swipe-reveal);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-face {
  position: relative;
  z-index: 1;
  background: var(--pn-surface);
  border-bottom: 1px solid var(--pn-line);
  transition: transform 160ms ease;
  touch-action: pan-y;
}

.item-row.is-swiping .item-face {
  transition: none;
}

.item-row.is-revealed .item-face {
  transform: translateX(-2.75rem);
}

.item-row.is-dragging {
  overflow: visible;
  z-index: 2;
}

.item-row.is-dragging .item-face {
  background: color-mix(in srgb, var(--pn-accent) 35%, var(--pn-surface));
  box-shadow: 0 0.35rem 0.9rem rgba(18, 48, 68, 0.14);
}

.item-face {
  --item-side: 0.15rem;
  --item-gap: 0.55rem;
  --item-check: 1.125rem;
  --item-edit-pad: 0.45rem;
}

.item-row.is-editing,
.item-row.is-editing.is-dragging {
  border-radius: 0.85rem;
  overflow: hidden;
}

.item-row.is-editing .item-face,
.item-row.is-editing.is-dragging .item-face {
  background: var(--pn-edit);
  box-shadow: none;
  padding-top: var(--item-edit-pad);
  border-bottom-width: 0;
  border-radius: 0.85rem;
}

.item-main {
  display: flex;
  align-items: center;
  gap: var(--item-gap);
  padding: 0 var(--item-side);
}

.item-grip,
.item-check,
.item-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--pn-accent-ink);
}

.item-grip {
  width: 2.25rem;
  min-height: var(--tap);
  flex: none;
  margin-left: 0.15rem;
  border: 0;
  color: var(--pn-muted);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.item-grip:active {
  cursor: grabbing;
}

.item-check-form {
  margin: 0;
  flex: none;
  display: flex;
  align-items: center;
}

.item-check {
  position: relative;
  width: var(--item-check);
  height: var(--item-check);
  min-height: 0;
  flex: none;
  border: 1.5px solid var(--pn-accent-ink);
  border-radius: 0.22rem;
  color: var(--pn-on-accent);
}

.item-check::after {
  content: "";
  position: absolute;
  inset: -0.7rem -0.35rem;
}

.item-check svg {
  width: 0.8rem;
  height: 0.8rem;
  opacity: 0;
}

.item-check[aria-pressed="true"] {
  background: var(--pn-accent);
  border-color: var(--pn-accent-ink);
}

.item-check[aria-pressed="true"] svg {
  opacity: 1;
}

.item-text {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0.35rem 0.15rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 1rem;
  line-height: 1.35;
}

.item-row.is-checked .item-text {
  text-decoration: line-through;
  color: var(--pn-muted);
}

.item-row.is-editing .item-text {
  display: none;
}

.item-editor {
  display: none;
  flex: 1;
  min-width: 0;
  margin: 0;
}

.item-row.is-editing .item-editor {
  display: block;
}

.item-edit-input {
  width: 100%;
}

.item-row.is-editing .item-edit-input,
.item-row.is-editing .item-edit-input:focus {
  background: transparent;
  color: var(--pn-ink);
  box-shadow: none;
  outline: none;
}

.item-extra {
  display: grid;
  gap: 0.5rem;
  padding: 0.15rem var(--item-side) var(--item-edit-pad) calc(var(--item-side) + var(--item-check) + var(--item-gap));
}

.item-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.item-tool {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--pn-line);
  background: var(--pn-paper);
}

.item-trash {
  width: 1.75rem;
  height: 1.75rem;
  min-height: 0;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  background: #d64545;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
}

.item-trash svg {
  width: 1rem;
  height: 1rem;
}

.item-trash:hover,
.item-trash:focus {
  background: #c33636;
  color: #fff;
}

.item-trash-edit {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.65rem;
}

.item-trash-edit svg {
  width: 1.25rem;
  height: 1.25rem;
}

.item-later {
  margin: 0;
  color: var(--pn-muted);
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .item-trash-swipe {
    display: none;
  }

  .item-delete {
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .item-face,
  .item-row.is-revealed .item-face {
    transform: none;
  }

  .item-row.is-editing .item-trash-edit {
    display: inline-flex;
  }
}

.item-grip:focus-visible,
.item-check:focus-visible,
.item-text:focus-visible,
.item-tool:focus-visible,
.item-trash:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

.edit-disclosure {
  margin: 0.15rem 0 0.85rem;
}

.edit-disclosure summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--pn-muted);
}

.stack-form {
  display: grid;
  gap: 0.75rem;
}

.item-add {
  display: flex;
  justify-content: flex-end;
  margin: 0.35rem 0 0.85rem;
}

.item-add-button {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--pn-accent);
  color: var(--pn-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.item-add-button:hover,
.item-add-button:focus {
  background: var(--pn-accent-hover);
  color: var(--pn-on-accent);
}

.item-add-button:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

.item-add-button {
  text-decoration: none;
}

.page-add {
  position: fixed;
  z-index: 3;
  right: max(1rem, calc(50vw - 16rem + 1rem));
  bottom: calc(1rem + env(safe-area-inset-bottom));
}

.page-add-spacer {
  height: 4.5rem;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  flex: none;
  padding: 0;
  border: 1px solid var(--pn-line);
  border-radius: 0.65rem;
  background: var(--pn-paper);
  color: var(--pn-accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover,
.icon-button:focus {
  background: var(--pn-surface);
  color: var(--pn-accent-ink);
}

.icon-button:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

.entry-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.back-button {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pn-accent) 38%, #fff);
  color: #145a86;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.back-button:hover,
.back-button:focus {
  background: color-mix(in srgb, var(--pn-accent) 55%, #fff);
  color: #145a86;
}

.back-button:focus-visible {
  outline: 2px solid var(--pn-accent-ink);
  outline-offset: 2px;
}

.list-title {
  flex: 1;
  min-width: 0;
}

.list-title-text {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.list-title-form {
  display: none;
  margin: 0;
}

.list-title.is-editing .list-title-text {
  display: none;
}

.list-title.is-editing .list-title-form {
  display: block;
}

.list-title-input.form-control,
.list-title-input.form-control:focus {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  min-height: 2.75rem;
  padding: 0.15rem 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--pn-line);
  background: transparent;
  color: var(--pn-ink);
  box-shadow: none;
}

.step-list {
  padding-left: 1.25rem;
}

.step-list li {
  margin-bottom: 0.75rem;
}

.btn-primary {
  --bs-btn-color: var(--pn-on-accent);
  --bs-btn-bg: var(--pn-accent);
  --bs-btn-border-color: var(--pn-accent-line);
  --bs-btn-hover-color: var(--pn-on-accent);
  --bs-btn-hover-bg: var(--pn-accent-hover);
  --bs-btn-hover-border-color: var(--pn-accent-line);
  --bs-btn-active-color: var(--pn-on-accent);
  --bs-btn-active-bg: var(--pn-accent-hover);
  --bs-btn-active-border-color: var(--pn-accent-line);
  --bs-btn-disabled-color: var(--pn-on-accent);
  --bs-btn-disabled-bg: var(--pn-accent);
  --bs-btn-disabled-border-color: var(--pn-accent-line);
  --bs-btn-focus-shadow-rgb: 20, 90, 134;
}

.alert-success {
  --bs-alert-color: #123044;
  --bs-alert-bg: #e7f3fb;
  --bs-alert-border-color: #88c3ed;
}

[data-bs-theme="dark"] .alert-success {
  --bs-alert-color: #e7f3fb;
  --bs-alert-bg: #163044;
  --bs-alert-border-color: #88c3ed;
}

.reveal-key {
  word-break: break-all;
  font-size: 0.95rem;
}
