:root {
  --ink: #17211c;
  --muted: #69746e;
  --paper: #f5f5f1;
  --white: #fff;
  --green: #315646;
  --burgundy: #7d3c48;
  --line: #dfe3df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a {
  color: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(16, 41, 31, 0.76), rgba(16, 41, 31, 0.9)),
    url("/static/sala-weselna.png") center / cover;
}

.login-panel {
  width: min(440px, 100%);
  padding: 38px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.25);
}

.admin-brand {
  text-decoration: none;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.admin-kicker,
.admin-section-title p {
  margin: 28px 0 6px;
  color: var(--burgundy);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-panel h1 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 400;
}

.login-panel > p:not(.admin-kicker) {
  color: var(--muted);
  line-height: 1.55;
}

.login-panel form {
  display: grid;
  gap: 17px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
}

fieldset {
  min-width: 0;
}

button {
  min-height: 42px;
  padding: 9px 14px;
  color: var(--white);
  background: var(--green);
  border: 0;
  border-radius: 5px;
  font-weight: 800;
  cursor: pointer;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}

.alert {
  padding: 12px 14px;
  border-radius: 5px;
}

.alert-error {
  color: #65313a;
  background: #f0dbdf;
  border-left: 4px solid var(--burgundy);
}

.admin-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.admin-header > div {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-header > div > span {
  color: var(--muted);
  font-size: 13px;
}

.admin-header nav,
.admin-header nav form {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-header nav a {
  position: relative;
  padding: 10px 0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.admin-header nav a.is-active {
  color: var(--burgundy);
}

.admin-header nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--burgundy);
}

.button-secondary {
  min-height: 36px;
  color: var(--ink);
  background: #ecefeC;
}

.admin-main {
  padding: 28px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.admin-summary div {
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-summary span,
.admin-summary small {
  display: block;
}

.admin-summary span {
  margin-bottom: 4px;
  font-size: 29px;
  font-weight: 800;
}

.admin-summary small {
  color: var(--muted);
}

.admin-section {
  margin-bottom: 34px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow-x: auto;
}

.admin-section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-section-title p {
  margin-top: 0;
}

.admin-section-title h1 {
  margin: 0;
  font-size: 25px;
}

.admin-section-title input {
  max-width: 320px;
}

.section-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-form {
  display: grid;
  gap: 24px;
}

.settings-form fieldset {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.settings-form legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.switch {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f4f6f3;
  border-radius: 5px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch > span {
  position: relative;
  width: 38px;
  height: 22px;
  display: block;
  background: #bdc5c0;
  border-radius: 12px;
}

.switch > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  content: "";
  background: var(--white);
  border-radius: 50%;
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(49, 86, 70, 0.25);
}

.switch strong {
  font-size: 12px;
}

.settings-fields,
.location-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.location-settings textarea {
  min-height: 116px;
  resize: vertical;
}

.option-switch {
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  background: #edf3ef;
}

.option-switch > span {
  grid-row: 1 / 3;
}

.option-switch small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 400;
}

.wide-setting {
  grid-column: span 2;
}

.settings-save {
  justify-self: start;
  min-width: 190px;
}

.content-admin-groups {
  display: grid;
  gap: 24px;
}

.content-section-editor {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.content-section-editor:first-child {
  padding-top: 0;
  border-top: 0;
}

.content-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.content-editor-heading h2 {
  margin: 0;
  font-size: 18px;
}

.content-editor-heading span {
  min-width: 28px;
  padding: 5px 8px;
  color: var(--muted);
  background: #edf3ef;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.content-items-list {
  display: grid;
  gap: 8px;
}

.content-item-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.2fr) minmax(260px, 2fr) 90px auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  background: #f7f8f6;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.content-item-form textarea {
  min-height: 42px;
  resize: vertical;
}

.content-item-add {
  margin-top: 10px;
  background: #edf3ef;
  border-style: dashed;
}

.content-form-actions {
  display: flex;
  gap: 6px;
}

.content-form-actions button {
  white-space: nowrap;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  background: #edf3ef;
  border: 1px solid #d5ded8;
  border-radius: 6px;
}

.room-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-item-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr repeat(4, 0.7fr);
  gap: 10px;
  padding: 14px;
  background: #f5f6f3;
  border: 1px solid #e9ece9;
  border-radius: 6px;
}

.room-item-form-new {
  background: #edf3ef;
  border-color: #cddbd2;
}

.room-item-form label {
  gap: 5px;
  font-size: 11px;
}

.room-item-form input,
.room-item-form select {
  min-height: 36px;
  padding: 7px 8px;
}

.room-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.guest-table-wrap {
  overflow-x: auto;
}

.guest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.guest-table th {
  padding: 9px;
  color: var(--muted);
  text-align: left;
  background: #f2f4f1;
  font-size: 10px;
  text-transform: uppercase;
}

.guest-table td {
  padding: 7px 9px;
  border-bottom: 1px solid #edf0ed;
  vertical-align: middle;
}

.guest-table td:first-child strong,
.guest-table td:first-child span {
  display: block;
  white-space: nowrap;
}

.guest-table td:first-child span {
  color: var(--muted);
  font-size: 10px;
}

.guest-table input {
  min-width: 150px;
  min-height: 36px;
  padding: 7px 9px;
}

.guest-table input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  min-height: 16px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
}

.guest-table .code-input {
  min-width: 90px;
  width: 100px;
  font-family: Consolas, monospace;
}

.guest-table .tiny-input {
  min-width: 58px;
  width: 64px;
}

.guest-table .notes {
  max-width: 180px;
  color: var(--muted);
}

.row-actions {
  min-width: 156px;
  white-space: nowrap;
}

.row-actions button + button {
  margin-left: 6px;
}

.add-guest-form {
  display: grid;
  grid-template-columns: 200px 200px minmax(320px, 1.4fr) minmax(220px, 0.8fr) minmax(240px, 1fr) 150px;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  min-width: 1260px;
  padding: 14px;
  background: #edf3ef;
  border: 1px solid #d5ded8;
  border-radius: 6px;
}

.add-guest-form input {
  min-height: 38px;
  padding: 8px 10px;
}

.status {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-yes,
.status-approved {
  color: #245139;
  background: #dcebe1;
}

.status-no,
.status-rejected {
  color: #71313d;
  background: #f0dbe0;
}

.status-pending {
  color: #6b552b;
  background: #eee5cf;
}

.photo-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.request-list,
.wishes-admin-list {
  display: grid;
  gap: 8px;
}

.request-list article,
.wishes-admin-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 15px;
  background: #f5f6f3;
  border: 1px solid #e9ece9;
  border-radius: 5px;
}

.request-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.request-actions form {
  margin: 0;
}

.request-list article > div,
.wishes-admin-list article > div {
  display: grid;
  gap: 5px;
}

.request-list span,
.wishes-admin-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.wishes-admin-list form {
  display: flex;
  gap: 8px;
}

.photo-admin-grid article {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.photo-admin-grid img,
.photo-admin-grid video,
.photo-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: var(--muted);
  background: #ecefeb;
  font-size: 12px;
}

.photo-admin-grid article > div:not(.photo-placeholder) {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.photo-admin-grid small {
  color: var(--muted);
}

.photo-admin-grid form {
  display: flex;
  gap: 8px;
  padding: 0 13px 13px;
}

.button-danger {
  background: var(--burgundy);
}

.empty-state {
  padding: 36px;
  color: var(--muted);
  text-align: center;
  background: #f5f6f3;
  border-radius: 5px;
}

@media (max-width: 900px) {
  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-admin-grid,
  .room-item-form,
  .content-item-form,
  .password-form {
    grid-template-columns: 1fr 1fr;
  }

  .content-description {
    grid-column: span 2;
  }

  .switch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-fields,
  .location-settings {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .admin-header {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    padding: 8px 14px;
  }

  .admin-header > div > span {
    display: none;
  }

  .admin-header nav {
    width: 100%;
    justify-content: flex-start;
    gap: 18px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .admin-header nav a,
  .admin-header nav form {
    flex: 0 0 auto;
  }

  .admin-header nav a {
    display: block;
  }

  .admin-main {
    padding: 14px;
  }

  .admin-summary,
  .photo-admin-grid,
  .room-admin-grid,
  .room-item-form,
  .content-item-form,
  .password-form,
  .switch-grid,
  .settings-fields,
  .location-settings {
    grid-template-columns: 1fr;
  }

  .content-description {
    grid-column: auto;
  }

  .wide-setting {
    grid-column: auto;
  }

  .request-list article,
  .wishes-admin-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .add-guest-form button {
    width: 100%;
  }

  .admin-section {
    padding: 15px;
  }

  .admin-section-title {
    align-items: stretch;
    flex-direction: column;
  }
}
