:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #69736f;
  --line: #d9ded7;
  --accent: #0d6f68;
  --accent-2: #b43d2a;
  --ok: #16835f;
  --bad: #a13b35;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 750;
}

h2 {
  font-size: 16px;
  font-weight: 720;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}

button,
.iconBtn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

button:hover,
.iconBtn:hover {
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.primary {
  min-height: 300px;
}

.side {
  grid-row: span 2;
}

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

.metric {
  color: var(--accent);
  font-size: 20px;
  font-weight: 760;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e9eee6;
  color: var(--muted);
  font-size: 13px;
}

.tableWrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.price {
  font-weight: 740;
}

.fareOptions {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  max-width: 360px;
}

.fareOptions a {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  background: #fbfcf8;
}

.fareOptions a:hover {
  border-color: var(--accent);
}

.fareOptions b {
  color: var(--accent);
  font-size: 12px;
  font-weight: 740;
}

.fareOptions span {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sources {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.source {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.source.ok {
  border-left-color: var(--ok);
}

.source.bad {
  border-left-color: var(--bad);
}

.source span,
.source em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.reviewList {
  display: grid;
  gap: 10px;
}

.review {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review span,
.review p {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.review a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 650;
}

.empty {
  color: var(--muted);
  padding: 22px 8px;
}

.gridForm {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
  min-height: 40px;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

label input {
  width: auto;
  min-height: auto;
}

textarea {
  min-height: 88px;
  resize: vertical;
  grid-column: span 2;
}

form button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 0 16px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    grid-row: auto;
  }

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

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .layout {
    padding: 12px;
  }

  .gridForm {
    grid-template-columns: 1fr;
  }

  textarea {
    grid-column: auto;
  }
}


.priceMonitor {
  min-height: 260px;
}

.priceStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.priceStats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcf8;
}

.priceStats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.priceStats strong {
  font-size: 16px;
}

.priceTrend {
  display: flex;
  align-items: end;
  gap: 4px;
  min-height: 86px;
  padding: 10px 0 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trendBar {
  display: flex;
  align-items: end;
  width: 10px;
  height: 76px;
}

.trendBar span {
  display: block;
  width: 100%;
  min-height: 8px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}

.latestFares {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.fareLine {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.fareLine span {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .priceStats {
    grid-template-columns: 1fr;
  }
}


.monitorBadges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.monitorNext {
  color: var(--muted);
  font-size: 13px;
  margin: -2px 0 8px;
}


.searchPanel {
  grid-column: 1 / -1;
}

.searchForm {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 5px;
  align-items: start;
  color: var(--text);
  font-size: 13px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.searchForm .field:nth-child(3),
.searchForm .field:nth-child(4) {
  grid-column: span 2;
}

.searchForm button {
  grid-column: span 2;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

@media (max-width: 1180px) {
  .searchForm {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .searchForm {
    grid-template-columns: 1fr;
  }

  .searchForm .field:nth-child(3),
  .searchForm .field:nth-child(4),
  .searchForm button {
    grid-column: auto;
  }
}


@media (max-width: 720px) {
  body {
    background: #fff;
  }

  .topbar {
    gap: 14px;
    padding: 14px;
  }

  h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .topbar p {
    font-size: 13px;
    line-height: 1.35;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
    white-space: normal;
  }

  .layout {
    gap: 10px;
    padding: 10px;
  }

  .panel {
    padding: 12px;
  }

  .panelHead {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .metric {
    font-size: 18px;
  }

  .monitorBadges {
    justify-content: flex-start;
  }

  .tableWrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
  }

  td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border-bottom: 0;
    padding: 6px 0;
    font-size: 13px;
  }

  td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
  }

  td:empty {
    display: none;
  }

  td.price {
    font-size: 16px;
  }

  td .iconBtn {
    justify-self: start;
  }

  td[colspan] {
    display: block;
    padding: 16px 0;
  }

  td[colspan]::before {
    content: none;
  }

  .fareOptions {
    max-width: none;
  }

  .fareOptions a {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .fareLine {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .fareLine span {
    white-space: normal;
  }

  .priceTrend {
    overflow-x: auto;
  }

  .review {
    grid-template-columns: 1fr;
  }

  .gridForm button,
  .searchForm button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .layout {
    padding-left: 0;
    padding-right: 0;
  }

  .searchForm,
  .gridForm {
    gap: 8px;
  }

  input,
  select,
  textarea,
  button,
  .iconBtn {
    font-size: 16px;
  }

  td {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}


@media (max-width: 720px) {
  td[data-label=""] {
    grid-template-columns: 1fr;
  }

  td[data-label=""]::before {
    content: none;
  }

  .fareOptions a {
    min-width: 0;
  }
}
