:root {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #17202a;
  background: #f5f7f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 18px 0 14px;
  border-bottom: 1px solid #dde3ea;
}

h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
}

.mobile-title {
  display: none;
}

p {
  margin: 0;
  color: #647180;
  font-size: 14px;
}

.hotel-select {
  display: grid;
  gap: 6px;
  min-width: 280px;
  font-size: 14px;
}

select {
  height: 38px;
  border: 1px solid #cbd4dd;
  border-radius: 6px;
  background: white;
  padding: 0 10px;
  font: inherit;
}

.display-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.settings-toggle,
.contact-banner,
.markup-control,
.date-range-control,
.clear-date-btn {
  height: 46px;
  min-height: 46px;
}

.contact-banner {
  display: none;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  background: #fff;
  color: #17202a;
  max-width: 100%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

.markup-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: white;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  font-size: 14px;
}

.date-range-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: white;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  font-size: 14px;
}

.date-range-control > span {
  white-space: nowrap;
}

.markup-control > span {
  white-space: nowrap;
}

.markup-control input {
  width: 110px;
  height: 30px;
  border: 1px solid #cbd4dd;
  border-radius: 5px;
  padding: 0 8px;
  font: inherit;
}

.date-range-btn {
  min-width: 210px;
  min-height: 36px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid #cbd4dd;
  border-radius: 6px;
  background: #fff;
  color: #17202a;
  padding: 5px 10px;
  font: inherit;
  cursor: pointer;
}

.date-range-btn strong {
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.date-range-btn small {
  color: #647180;
  font-size: 12px;
  line-height: 1;
}

.date-picker {
  width: min(620px, 100%);
  max-height: 72vh;
  margin: 2px 0 14px;
  overflow: auto;
  padding: 0 0 12px;
  border: 1px solid #d7dfe7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(23, 32, 42, 0.14);
}

.date-picker-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  min-height: 44px;
  background: #fff;
  border-bottom: 1px solid #edf1f5;
}

.date-picker-head strong {
  grid-column: 2;
  text-align: center;
  font-size: 16px;
}

.date-picker-head button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #647180;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  position: sticky;
  top: 44px;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #edf1f5;
  color: #647180;
  font-size: 13px;
  text-align: center;
}

.weekday-row span {
  padding: 8px 0;
}

.month-title {
  margin: 0;
  padding: 14px 16px 8px;
  font-size: 20px;
  font-weight: 800;
}

.calendar-day {
  min-height: 80px;
  border: 0;
  background: transparent;
  color: #17202a;
  font: inherit;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  cursor: pointer;
}

.calendar-day.blank {
  cursor: default;
}

.calendar-day.disabled {
  color: #c3cad1;
  cursor: not-allowed;
}

.calendar-day.disabled .day-price {
  color: #c3cad1;
}

.calendar-day.in-range {
  background: #e7f2ff;
}

.calendar-day.selected {
  background: #0b7cff;
  color: #fff;
  border-radius: 7px;
}

.calendar-day .day-num {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.calendar-day .day-holiday {
  min-height: 13px;
  color: #d92d45;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.calendar-day .day-holiday.work {
  color: #647180;
}

.calendar-day .day-price {
  min-height: 14px;
  color: #647180;
  font-size: 12px;
  line-height: 1;
}

.calendar-day .day-change {
  min-height: 13px;
  color: transparent;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.calendar-day .day-change.up {
  color: #d97706;
}

.calendar-day .day-change.down {
  color: #16803a;
}

.calendar-day .day-tag {
  min-height: 13px;
  font-size: 11px;
  line-height: 1;
}

.calendar-day.selected .day-price,
.calendar-day.selected .day-holiday,
.calendar-day.selected .day-change,
.calendar-day.selected .day-tag {
  color: #fff;
}

.calendar-day.disabled .day-holiday {
  color: #c3cad1;
}

.clear-date-btn {
  padding: 0 12px;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  background: #fff;
  color: #17202a;
  font: inherit;
  cursor: pointer;
}

.settings-toggle {
  min-width: 160px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: white;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  color: #17202a;
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  user-select: none;
}

.settings-panel {
  display: contents;
}

.settings-panel[hidden] {
  display: none !important;
}

td.inventory-count,
.inventory-count {
  color: #0f766e;
  font-weight: 800;
}

.table-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 180px);
  background: white;
  border: 1px solid #dce3ea;
}

@media (min-width: 769px) {
  .table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
  }
}

.price-watermark-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.price-watermark-layer[hidden] {
  display: none;
}

.price-watermark-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 68px;
  align-content: space-around;
  width: 100%;
  min-height: 100%;
  padding: 18px 12px;
}

.price-watermark-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: rgba(15, 97, 90, 0.19);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(-24deg);
}

.date-picker {
  position: relative;
}

.date-picker-watermark {
  position: absolute;
  top: 88px;
  left: 0;
  z-index: 1;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.date-picker-watermark[hidden] {
  display: none;
}

.date-picker-watermark-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 58px;
  align-content: space-around;
  width: 100%;
  min-height: 100%;
  padding: 8px 6px;
}

.date-picker-watermark-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: rgba(15, 97, 90, 0.18);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(-24deg);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

th,
td {
  height: 34px;
  padding: 6px 10px;
  border-bottom: 1px solid #edf1f5;
  text-align: center;
  white-space: nowrap;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f7;
  font-weight: 700;
}

td.price {
  color: inherit;
  font-weight: 600;
}

tfoot td {
  position: sticky;
  bottom: 0;
  background: #fff8f0;
  border-top: 1px solid #d7dfe7;
  font-weight: 700;
}

td.total-price {
  color: inherit;
  font-weight: 800;
}

.mark-col {
  width: 96px;
}

.refresh-date-btn {
  min-width: 48px;
  height: 28px;
  border: 1px solid #cfdbe0;
  border-radius: 7px;
  background: #fff;
  color: #0f615a;
  font-weight: 700;
  cursor: pointer;
}

.mark-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.mark-actions .refresh-date-btn {
  min-width: 40px;
  padding: 0 6px;
}

.refresh-date-btn:disabled {
  color: #7b8b93;
  background: #eef3f5;
  cursor: not-allowed;
}

tr.marked-refresh-row td {
  color: #c81e1e;
  font-weight: 700;
}

tr.marked-refresh-row td.price {
  color: #c81e1e;
}

.empty {
  display: none;
  padding: 36px;
  text-align: center;
  color: #7c8793;
}

@media (max-width: 768px) {
  .app {
    margin-top: 10px;
  }

  .toolbar {
    align-items: flex-end;
    flex-direction: row;
    gap: 12px;
  }

  .toolbar-title {
    flex: 0 0 auto;
  }

  .toolbar h1 {
    margin: 0;
    font-size: 22px;
    white-space: nowrap;
  }

  .toolbar-title p {
    display: none;
  }

  .desktop-title {
    display: none;
  }

  .mobile-title {
    display: inline;
  }

  .hotel-select {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
  }

  .hotel-select > span {
    display: none;
  }

  .hotel-select select {
    width: 100%;
  }

  .display-controls {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .settings-toggle {
    grid-column: 1;
    grid-row: 1;
    min-width: auto;
    width: max-content;
    padding: 0 14px;
  }

  .contact-banner {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    height: 46px;
    min-height: 46px;
    align-self: start;
  }

  .price-watermark-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 58px;
    padding: 12px 6px;
  }

  .price-watermark-grid span {
    font-size: 13px;
  }

  .date-picker-watermark-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 54px;
  }

  .date-picker-watermark-grid span {
    font-size: 12px;
  }

  .settings-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: stretch;
    gap: 10px 6px;
    padding-top: 0;
  }

  .settings-panel[hidden] {
    display: none;
  }

  .markup-control {
    grid-column: 1 / -1;
    justify-content: space-between;
    width: 100%;
  }

  .date-range-control {
    grid-column: 1;
    min-width: 0;
    justify-content: space-between;
    width: 100%;
  }

  .markup-control input {
    width: 100%;
  }

  .date-range-btn {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding-right: 6px;
    padding-left: 6px;
  }

  .date-range-btn strong {
    max-width: 100%;
    font-size: 13px;
  }

  .clear-date-btn {
    grid-column: 2;
    width: auto;
    padding: 0 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  .date-picker {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 30;
    width: auto;
    max-height: min(82vh, calc(100dvh - 96px));
    border-radius: 10px 10px 0 0;
  }

  .calendar-day {
    min-height: 76px;
  }

  .month-title {
    padding: 12px 16px 6px;
  }

  .calendar-day .day-num {
    font-size: 18px;
  }
}
