:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --text: #202124;
  --muted: #686d73;
  --line: #d9ddd7;
  --accent: #0f766e;
  --danger: #b42318;
  --ok: #157347;
}

* {
  box-sizing: border-box;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}

button.secondary {
  border-color: var(--line);
  background: white;
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input {
  min-height: 40px;
  width: min(100%, 360px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.shell {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 18px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
}

.login-title {
  margin-bottom: 18px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
}

.destination-picker {
  display: grid;
  gap: 10px;
}

.destination-card {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.destination-link {
  grid-template-columns: minmax(0, 1fr);
  color: inherit;
  text-decoration: none;
}

.destination-link:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.destination-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.destination-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.destination-card span {
  display: grid;
  gap: 4px;
}

.destination-card strong {
  color: var(--text);
  font-size: 17px;
}

.destination-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-error {
  min-height: 40px;
  border: 1px solid rgba(180, 35, 24, 0.35);
  border-radius: 6px;
  background: #fff8f7;
  color: var(--danger);
  display: grid;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
}

.ticker-panel,
.tabs,
.tab-panel {
  width: min(560px, 100%);
  justify-self: center;
}

.ticker-panel {
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101514;
  color: #d7fff8;
  display: grid;
  align-items: center;
  padding: 0 16px;
}

.ticker-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 4px;
}

.tab-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.otp-title {
  margin-bottom: 18px;
}

.otp-row {
  display: grid;
  grid-template-columns: 132px minmax(120px, 1fr) 84px;
  gap: 10px;
  align-items: center;
}

.otp-value {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 4px 12px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

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

.otp-actions {
  display: grid;
  grid-template-columns: 44px max-content minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-height: 40px;
  place-items: center;
  padding: 0;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.serial-value {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  display: grid;
  align-items: center;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.otp-timer {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.otp-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.otp-bar > div {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms linear;
}

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

.item-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.interval-field {
  display: grid;
  grid-template-columns: max-content 96px max-content 72px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.interval-field input {
  width: 96px;
  text-align: right;
}

.item-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 10px;
  align-items: center;
}

.item-form input {
  width: 100%;
}

.item-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.item-row,
.item-empty {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 44px;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
}

.item-label {
  display: grid;
  gap: 3px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.selected-option {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.item-empty {
  display: grid;
  align-items: center;
  color: var(--muted);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.item-remove {
  border-color: transparent;
  color: var(--danger);
}

.item-search {
  min-height: 34px;
  padding: 0 10px;
}

.item-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 8px 8px 0;
  font-size: 13px;
  font-weight: 800;
}

.latest-result-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 8px 10px 0;
}

.latest-result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.latest-result-header strong {
  color: var(--accent);
}

.latest-result-empty,
.latest-result-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.result-option,
.result-preview {
  min-height: 34px;
  height: auto;
  justify-content: start;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.option-checks,
.result-preview-list {
  display: grid;
  gap: 6px;
}

.option-check {
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 6px 10px;
}

.option-lowest-price {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.selected-lowest-price {
  min-height: 36px;
  display: grid;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 6px;
  background: #eefaf7;
  color: var(--accent);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
}

.option-check input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.result-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f7f4;
  color: var(--muted);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.result-field {
  display: grid;
  gap: 2px;
}

.result-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.result-field strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.price-watch-actions {
  display: grid;
  grid-template-columns: 84px 84px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.price-status {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  display: grid;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
}

.status {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.status.ok {
  border-color: rgba(21, 115, 71, 0.35);
  color: var(--ok);
}

.status.error {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 24px 0;
}

.launch-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 0 24px;
}

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

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

.job {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 14px;
}

.job-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.job-type {
  font-weight: 800;
}

.job-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

pre {
  overflow: auto;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

@media (max-width: 620px) {
  .header,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    text-align: left;
  }

  .toolbar button {
    flex: 1 1 140px;
  }

  .otp-row {
    grid-template-columns: 1fr;
  }

  .otp-actions {
    grid-template-columns: 44px 1fr;
  }

  .item-form {
    grid-template-columns: 1fr;
  }

  .interval-field {
    grid-template-columns: 1fr 96px max-content;
  }

  .interval-field button {
    grid-column: 1 / -1;
  }

  .serial-value {
    grid-column: 1 / -1;
  }

  .price-watch-actions {
    grid-template-columns: 1fr;
  }

  .launch-form input,
  .launch-form button {
    flex: 1 1 100%;
  }
}
