:root {
  color-scheme: dark;
  --page: #1c1a1a;
  --surface: #272425;
  --ink: #f4eeee;
  --muted: #c0b8b8;
  --line: #443d3e;
  --accent: #C12025;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f7f5ef;
  --surface: #fffefa;
  --ink: #2c2a2a;
  --muted: #6b6566;
  --line: #e5e1d6;
  --accent: #C12025;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  transform: translateY(-160%);
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: white;
}

.skip-link:focus {
  transform: translateY(0);
}

.header {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem max(1rem, calc((100vw - 880px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.brand span {
  color: var(--accent);
}

.brand small {
  display: block;
  color: var(--muted);
  font: 600 0.7rem "Avenir Next", Avenir, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  display: grid;
  width: min(100% - 2rem, 880px);
  gap: 1.35rem;
  margin: 2rem auto 4rem;
}

.panel {
  padding: clamp(1.1rem, 4vw, 1.7rem);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
  box-shadow: 0 12px 35px rgb(43 53 42 / 6%);
}

.collapsible {
  padding: 0;
  overflow: hidden;
}

.collapsible summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.1rem, 4vw, 1.7rem);
  cursor: pointer;
  list-style: none;
}

.collapsible summary::-webkit-details-marker {
  display: none;
}

.collapsible summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
}

.collapsible[open] summary::after {
  content: "−";
}

.collapsible summary strong,
.summary-hint {
  display: block;
}

.summary-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.collapsible > :not(summary) {
  margin-inline: clamp(1.1rem, 4vw, 1.7rem);
}

.collapsible > :last-child {
  margin-bottom: 1.35rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.45rem, 5vw, 2rem);
}

h2 {
  font-size: 1.25rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h1,
.section-heading h2 {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

form {
  display: grid;
  gap: 0.55rem;
}

label {
  margin-top: 0.35rem;
  font-size: 0.87rem;
  font-weight: 650;
}

.remember-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-block: 0.45rem;
  font-weight: 500;
}

.remember-option input {
  width: 1.15rem;
  min-height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #777173;
  border-radius: 0.45rem;
  background: var(--page);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.45rem;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  filter: brightness(0.94);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button--quiet {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.text-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent);
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.inline-form select {
  flex: 1;
}

#schedule-date {
  max-width: 15rem;
}

.planner-subtitle {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.weekly-plan-list {
  display: grid;
  gap: 0.75rem;
}

.weekly-plan-row {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: minmax(8rem, 0.8fr) minmax(10rem, 1fr) auto;
  align-items: end;
}

.weekly-plan-row label {
  font-weight: 700;
}

@media (max-width: 42rem) {
  .weekly-plan-row {
    grid-template-columns: 1fr;
  }
}

.status {
  position: fixed;
  z-index: 10;
  top: 1rem;
  left: 50%;
  width: min(calc(100% - 2rem), 38rem);
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(0 0 0 / 22%);
  color: var(--muted);
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.status__close {
  flex: 0 0 auto;
  min-width: 2rem;
  min-height: 2rem;
  margin: -0.35rem -0.35rem 0 0;
  padding: 0.15rem 0.45rem;
  border: 0;
  border-radius: 0.35rem;
  color: inherit;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.status__close:hover,
.status__close:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.status[data-kind="error"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}

.status[data-kind="success"] {
  border-color: #73c995;
  color: #73c995;
  font-weight: 650;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.image-preview img {
  width: min(100%, 14rem);
  max-height: 10rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  object-fit: cover;
}

.plate-list,
.history-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plate-item,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.plate-item__details,
.history-item__details {
  min-width: 0;
}

.plate-item__name,
.history-item__name {
  display: block;
  font-weight: 700;
}

.plate-item__description {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
}

.plate-item__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.4rem;
}

.plate-item__actions .button {
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  main {
    margin-top: 1rem;
  }

  .inline-form,
  .plate-item {
    align-items: stretch;
    flex-direction: column;
  }

  .plate-item__actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
