:root {
  --pico-font-size: 87.5%;
  --sl-done: #2ecc71;
  --sl-done-dark: #27ae60;
}

[data-theme="dark"] {
  --sl-done: #3ddc84;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pico-muted-border-color);
  text-align: center;
}

footer .footer-source {
  display: block;
  margin-top: 0.35rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.list-edit-header {
  margin-bottom: 1rem;
}

.list-edit-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.list-edit-title-row h1 {
  margin-bottom: 0;
  min-width: 0;
  flex: 1;
}

.page-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}

.page-action-btn {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.inline-form {
  margin: 0;
  display: inline;
}

.inline-form button {
  margin: 0;
  width: auto;
}

.theme-toggle-btn {
  padding: 0.25rem 0.5rem;
  min-width: auto;
  margin: 0;
  width: auto;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

.flash-error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.35);
}

.flash-success {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
}

.copy-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.copy-input {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}

.copy-btn.copied {
  border-color: var(--sl-done);
}

.field-hint {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  cursor: pointer;
}

.checkbox-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.inline-add {
  display: flex;
  gap: 0.5rem;
}

.inline-add input {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.inline-add button {
  width: auto;
  margin-bottom: 0;
  white-space: nowrap;
}

.add-list-form {
  margin-bottom: 1.5rem;
}

.list-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.list-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  text-decoration: none;
  color: inherit;
}

.list-card:hover {
  border-color: var(--pico-primary);
}

.list-card-title {
  display: block;
  font-weight: 600;
}

.list-card-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  margin-top: 0.2rem;
}

.empty-state {
  text-align: center;
  color: var(--pico-muted-color);
  padding: 1.5rem 0;
}

.todo-items {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.todo-item.completed .item-text {
  text-decoration: line-through;
  color: var(--pico-muted-color);
}

.toggle-form,
.delete-form {
  margin: 0;
  flex-shrink: 0;
}

.item-check {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.todo-item.completed .item-check {
  background: var(--sl-done);
  border-color: var(--sl-done-dark);
  color: #fff;
}

.item-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.4;
}

.item-delete {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.items-section {
  margin-top: 0;
}

.settings-dialog {
  padding: 0;
  border: none;
  max-width: 32rem;
  width: calc(100% - 2rem);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.settings-dialog article {
  margin: 0;
  max-height: min(85vh, 40rem);
  overflow-y: auto;
}

.settings-dialog header {
  position: relative;
  padding-right: 2.5rem;
}

.settings-dialog header h2 {
  margin-bottom: 0;
}

.dialog-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.dialog-footer button {
  width: auto;
  margin: 0;
}

.danger-zone {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.danger-zone h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.landing {
  text-align: center;
  max-width: 28rem;
  margin: 0 auto;
}

.landing-header {
  margin-bottom: 1.5rem;
}

.landing-icon {
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

.landing-lead {
  font-size: 1.05rem;
  line-height: 1.5;
}

.owner-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
  text-align: left;
}

.owner-section h2 {
  margin-bottom: 0.35rem;
}

.install-hint {
  margin-top: 2rem;
  text-align: left;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.install-hint summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--pico-color);
}

.install-hint ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

@media (display-mode: standalone) {
  .install-hint {
    display: none;
  }
}

@media (max-width: 576px) {
  .copy-row {
    flex-direction: column;
  }

  .copy-row .copy-btn {
    width: 100%;
  }

  .list-edit-title-row {
    flex-wrap: wrap;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 720px;
  }
}
