:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #fffdf8;
  --ink: #1d2a22;
  --muted: #657369;
  --line: #d9d0bd;
  --accent: #355f4a;
  --accent-strong: #244634;
  --soft: #ebe4d4;
  --warm: #8e5e2c;
  --shadow: 0 14px 28px rgba(29, 42, 34, 0.08);
}

* {
  box-sizing: border-box;
}

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

.widget {
  padding: 14px;
}

.toolbar,
.result-buttons {
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: 150px 120px 88px minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.field {
  display: block;
}

.toolbar-side {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}

input,
select,
button,
.action-link,
.result-button {
  min-height: 48px;
  border-radius: 14px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

button,
.action-link,
.result-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

button:hover,
.action-link:hover,
.result-button:hover {
  transform: translateY(-1px);
}

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

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: var(--soft);
  color: var(--ink);
}

.status {
  min-height: 24px;
  padding: 0 2px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status.error {
  color: #8b3028;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.result-buttons.expanded {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
}

.result-button {
  flex: 1 1 0;
  padding: 0 16px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.result-button.available {
  background: #eff6ef;
  border-color: #a9c2ac;
}

.result-button.selected {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.result-button.unavailable {
  opacity: 0.65;
  cursor: default;
}

.results[hidden] {
  display: none !important;
}

.toolbar[hidden] {
  display: none !important;
}

.action-link {
  padding: 0 16px;
}

.inline-action {
  white-space: nowrap;
}

.back-button {
  min-height: 48px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  justify-content: center;
}

.arrow-submit {
  min-width: 56px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

@media (max-width: 920px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) 120px 88px;
    align-items: center;
  }

  .toolbar-side {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .widget {
    padding: 10px;
  }

  .toolbar {
    grid-template-columns: 42px 110px 42px auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }

  .toolbar-side {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  #arrivalInput {
    width: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: 14px;
    font-size: 0;
    color: transparent;
    caret-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%231d2a22' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
  }

  #arrivalInput::placeholder {
    color: transparent;
  }

  #nightsInput {
    min-width: 110px;
    padding: 0 30px 0 12px;
  }

  .arrow-submit {
    min-width: 42px;
    width: 42px;
    min-height: 42px;
    border-radius: 14px;
    font-size: 1.2rem;
  }

  .toggle-row {
    gap: 6px;
    font-size: 0.82rem;
  }

  .toggle-row input {
    width: 16px;
    height: 16px;
    min-height: 16px;
  }

  .result-buttons,
  .result-buttons.expanded {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    scrollbar-width: none;
  }

  .result-buttons::-webkit-scrollbar {
    display: none;
  }

  .result-button,
  .action-link,
  .back-button {
    width: auto;
    flex: 0 0 auto;
  }

  .result-buttons.expanded .result-button.selected {
    flex: 0 0 auto;
    min-width: max-content;
  }
}
