.entry-dialog {
  --entry-ink: #20211d;
  --entry-muted: #67665e;
  --entry-line: #e6e2da;
  --entry-paper: #f5f3ee;
  --entry-accent: #b6382b;
  box-sizing: border-box;
  width: min(100% - 24px, 592px);
  max-width: none;
  max-height: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--entry-line);
  border-radius: 16px;
  background: #fff;
  color: var(--entry-ink);
  box-shadow: 0 20px 70px #22181336;
  overflow: hidden;
}

.entry-dialog::backdrop {
  background: #251e1a73;
}

.entry-dialog [hidden] {
  display: none !important;
}

.entry-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  max-height: calc(100dvh - 34px);
  margin: 0;
}

.entry-header,
.entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 16px 24px;
}

.entry-header {
  border-bottom: 1px solid var(--entry-line);
}

.entry-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.035em;
  line-height: 1.35;
}

.entry-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 24px;
}

.entry-footer {
  border-top: 1px solid var(--entry-line);
}

.entry-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.entry-basics,
.entry-part-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.entry-basics {
  margin-bottom: 18px;
}

.entry-form fieldset {
  min-inline-size: 0;
  margin: 0;
}

.entry-mode {
  padding: 0;
  border: 0;
  font-size: 13px;
  font-weight: 650;
}

.entry-mode legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
}

.entry-segments-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--entry-line);
  border-radius: 8px;
  background: var(--entry-paper);
}

.entry-segments-control label {
  position: relative;
  display: grid;
  min-width: 0;
}

.entry-segments-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.entry-segments-control label span {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--entry-muted);
  cursor: pointer;
}

.entry-segments-control input:checked + span {
  border-color: var(--entry-line);
  background: white;
  color: var(--entry-ink);
  box-shadow: 0 1px 2px #2620180d;
}

.entry-segments-control input:focus-visible + span {
  outline: 2px solid var(--entry-accent);
  outline-offset: 1px;
}

.entry-parts {
  display: grid;
  gap: 12px;
}

.entry-part {
  position: relative;
  padding: 14px;
  border: 1px solid var(--entry-line);
  border-radius: 10px;
  background: #fbfaf7;
}

.entry-part legend {
  padding: 0 6px;
  color: var(--entry-muted);
  font-size: 12px;
  font-weight: 650;
  background: #fff;
}

.entry-part:has(.entry-remove:not([hidden])) {
  padding-top: 34px;
}

.entry-form .entry-remove {
  position: absolute;
  top: -2px;
  right: 11px;
  min-height: 32px;
  padding: 2px 8px;
  color: var(--entry-muted);
  font-size: 12px;
}

.entry-field,
.entry-pace {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

.entry-field span small {
  margin-left: 3px;
  color: var(--entry-muted);
  font-size: 11px;
  font-weight: 500;
}

.entry-field .entry-help {
  margin-top: -2px;
  color: var(--entry-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.entry-field input,
.entry-field select,
.entry-field textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #dcd8ce;
  border-radius: 7px;
  background: #fff;
  color: var(--entry-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 450;
  line-height: 1.35;
}

.entry-field input::placeholder,
.entry-field textarea::placeholder {
  color: #78766e;
}

.entry-field textarea {
  min-height: 56px;
  resize: vertical;
}

.entry-field [aria-invalid="true"] {
  border-color: var(--entry-accent);
}

.entry-form :is(input, select, textarea, button):focus-visible {
  outline: 2px solid var(--entry-accent);
  outline-offset: 2px;
}

.entry-pace-value {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #ebe5db;
  border-radius: 7px;
  background: #f1eee7;
  color: #675b53;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.entry-full {
  grid-column: 1 / -1;
}

.entry-form button {
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.entry-form button:disabled {
  opacity: .62;
  cursor: wait;
}

.entry-form .entry-close {
  min-width: 36px;
  min-height: 36px;
  color: var(--entry-muted);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.entry-close:hover,
.entry-remove:hover,
.entry-delete:hover {
  background: var(--entry-paper);
}

.entry-form .entry-add {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 1px dashed #cebab2;
  color: var(--entry-accent);
}

.entry-add:hover {
  background: #fbf1ee;
}

.entry-form .entry-primary,
.entry-form .entry-neutral {
  min-height: 40px;
  padding: 8px 13px;
  white-space: nowrap;
}

.entry-form .entry-neutral {
  border-color: var(--entry-line);
  background: #fff;
}

.entry-form .entry-neutral:hover {
  background: var(--entry-paper);
}

.entry-form .entry-primary {
  border-color: var(--entry-accent);
  background: var(--entry-accent);
  color: #fff;
}

.entry-form .entry-primary:hover {
  background: #9f2b20;
}

.entry-form .entry-delete {
  min-height: 40px;
  padding: 8px 4px;
  color: var(--entry-accent);
  white-space: nowrap;
}

.entry-error,
.entry-confirm {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #ecd0c8;
  border-radius: 8px;
  background: #fbf1ee;
  color: #8e271c;
  font-size: 13px;
}

.entry-error {
  flex: none;
  margin: 0 24px 12px;
}

.entry-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.entry-confirm p {
  margin: 0;
}

.entry-confirm div {
  display: flex;
  gap: 6px;
}

@media (max-width: 520px) {
  .entry-dialog {
    max-height: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  .entry-form {
    max-height: calc(100vh - 18px);
    max-height: calc(100dvh - 18px);
  }

  .entry-header,
  .entry-footer {
    padding: 12px;
  }

  .entry-body {
    padding: 14px 12px;
  }

  .entry-error {
    margin-inline: 12px;
  }

  .entry-basics,
  .entry-part-grid {
    gap: 12px 8px;
  }

  .entry-part {
    padding-inline: 10px;
  }

  .entry-help {
    min-height: 24px;
  }
}
