@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #eceae6;
  --bg-main: #eceae6;
  --sidebar: #f4f3f0;
  --sidebar-active: #e4e9e2;
  --card: #ffffff;
  --ink: #1a1d1b;
  --muted: #6b736e;
  --line: #e4e2dd;
  --sage: #6f8f78;
  --sage-deep: #4f6b58;
  --online: #3f8f5a;
  --offline: #b04a4a;
  --warn: #9a6b2f;
  --warn-bg: #f7eedc;
  --radius: 16px;
  --gap: 1rem;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(26, 29, 27, 0.03), 0 10px 30px -12px rgba(26, 29, 27, 0.12);
  --shadow-hover: 0 2px 4px rgba(26, 29, 27, 0.04), 0 18px 40px -14px rgba(26, 29, 27, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
.brand,
.page-title {
  font-family: var(--font-display);
  font-weight: 550;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 15%, #e7eee4 0%, transparent 42%),
    linear-gradient(160deg, #f3f6f1 0%, var(--bg) 55%, #f0ebe3 100%);
}

.login-form {
  width: min(380px, 92vw);
  display: grid;
  gap: 0.95rem;
  padding: 2rem 1.75rem;
  border-radius: 20px;
  background: rgba(251, 250, 247, 0.88);
  border: 1px solid var(--line);
  animation: rise 420ms ease both;
}

.login-form h1 {
  margin: 0;
  font-size: 2.4rem;
}

.login-form .muted {
  margin: 0.2rem 0 0;
}

/* Public userscripts catalog */
.scripts-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 15%, #e7eee4 0%, transparent 42%),
    linear-gradient(160deg, #f3f6f1 0%, var(--bg) 55%, #f0ebe3 100%);
}

.scripts-panel {
  width: min(720px, 94vw);
  display: grid;
  gap: 1.25rem;
  padding: 2rem 1.75rem;
  border-radius: 20px;
  background: rgba(251, 250, 247, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 420ms ease both;
}

.scripts-header h1 {
  margin: 0.15rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: 2.2rem;
}

.scripts-kicker {
  margin: 0;
  color: var(--sage-deep);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scripts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.script-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}

.script-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.script-card .muted {
  margin: 0;
}

.script-meta {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.script-install {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: var(--sage);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.script-install:hover {
  background: var(--sage-deep);
}

.script-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.script-install:disabled {
  opacity: 0.65;
  cursor: wait;
}

.script-install-secondary {
  background: transparent;
  color: var(--sage-deep);
  border: 1px solid var(--line);
}

.script-install-secondary:hover {
  background: var(--sidebar-active);
}

.script-raw {
  color: var(--muted);
  font-size: 0.9rem;
}

.script-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.scripts-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
  font-size: 0.92rem;
}

.scripts-steps code {
  font-size: 0.85em;
  word-break: break-all;
}

.scripts-note {
  margin: 0;
  font-size: 0.9rem;
}

.scripts-note a {
  color: var(--sage-deep);
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"] {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(111, 143, 120, 0.18);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #f8f6f1;
  font: inherit;
  font-size: 0.9rem;
  /* font-weight: 600; */
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

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

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.error {
  color: var(--offline);
  font-size: 0.9rem;
  margin: 0;
}

.flash {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #e8f3ec;
  color: #2f6b45;
  border: 1px solid #c5dfce;
}

/* App shell */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 1.35rem 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  padding: 0.35rem 0.55rem;
}

.nav {
  display: grid;
  gap: 0.35rem;
}

.nav a {
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  transition: background 160ms ease, color 160ms ease;
}

.nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}

.nav a.active {
  background: var(--sidebar-active);
  color: var(--sage-deep);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 0.75rem;
}

.user-chip {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(226, 230, 223, 0.9);
  font-size: 0.9rem;
}

.user-chip strong {
  display: block;
  font-weight: 600;
}

.main {
  background: var(--bg-main);
  padding: 1.5rem 1.5rem 2.5rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.page-title {
  margin: 0;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  line-height: 1.15;
}

.page-header .muted {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

.content {
  display: grid;
  gap: var(--gap);
  width: 100%;
  flex: 1;
  min-height: 0;
}

#modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-content: start;
  width: 100%;
}

.module {
  --accent: var(--sage-deep);
  --accent-tint: #eef2ec;
  position: relative;
  background: var(--card);
  border: 1px solid rgba(228, 226, 221, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.35rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 220ms ease;
}

.module::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.85;
}

.module:hover {
  box-shadow: var(--shadow-hover);
}

.module.offline {
  border-color: rgba(176, 74, 74, 0.55);
}

.module.offline::before {
  background: var(--offline);
}

.module--munchy { --accent: #7a5230; --accent-tint: #efe3d5; }
.module--steam { --accent: #003362; --accent-tint: #e3eef7; }
.module--ozon { --accent: #005bff; --accent-tint: #e6edff; }
.module--cashback {
  --accent: #8a5a2b;
  --accent-tint: #f3ebe2;
  grid-column: 1 / -1;
}
.module--taxi {
  --accent: #ecdc44;
  --accent-tint: #fff0bd;
  position: relative;
}

.cashback-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  margin: 0 0 0.35rem;
}

.cashback-search-form input[type="search"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  background: #fbfaf8;
  color: var(--ink);
}

.cashback-search-form input[type="search"]:focus {
  outline: 2px solid rgba(138, 90, 43, 0.28);
  outline-offset: 1px;
  border-color: #c4a27a;
}

.cashback-search-form button {
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1.05rem;
  font: inherit;
  font-weight: 650;
  color: #fff8f0;
  background: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.cashback-search-form button:hover {
  filter: brightness(1.05);
}

.cashback-msg {
  margin: 0 0 0.55rem;
  min-height: 1.25em;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

.cashback-msg .cb-busy {
  display: none;
}

.cashback-msg.htmx-request .cb-busy {
  display: inline;
}

.cashback-msg.htmx-request .cb-ready {
  display: none;
}

.cashback-msg--err,
.cashback-msg .cb-ready.cashback-msg--err {
  color: var(--offline);
}

.cashback-table-wrap {
  overflow: auto;
  max-height: min(28rem, 55vh);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.cashback-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.86rem;
}

.cashback-table th,
.cashback-table td {
  padding: 0.45rem 0.45rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.cashback-table th {
  position: sticky;
  top: 0;
  background: #f7f5f1;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  z-index: 1;
}

/* Банк | Партнёр | Выгода | Тип | До | Категория | Почему */
.cashback-table th:nth-child(1),
.cashback-table td:nth-child(1) {
  width: 5rem;
}

.cashback-table th:nth-child(2),
.cashback-table td:nth-child(2) {
  width: 7rem;
}

.cashback-table th:nth-child(3),
.cashback-table td:nth-child(3) {
  width: 3.25rem;
}

.cashback-table th:nth-child(4),
.cashback-table td:nth-child(4) {
  width: 6rem;
}

.cashback-table th:nth-child(5),
.cashback-table td:nth-child(5) {
  width: 4.75rem;
}

.cashback-table th:nth-child(6),
.cashback-table td:nth-child(6) {
  width: 5.5rem;
}

.cashback-table th:nth-child(7),
.cashback-table td:nth-child(7) {
  width: 28%;
}

.cashback-table tbody tr:last-child td {
  border-bottom: 0;
}

.cashback-bank {
  font-weight: 600;
}

.cashback-partner {
  display: block;
  font-weight: 500;
}

.cashback-title {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
}

.cashback-benefit {
  font-weight: 500;
  color: var(--sage-deep);
}

.cashback-type {
  /* font-size: 0.84rem; */
  line-height: 1.3;
}

.cashback-until {
  white-space: nowrap;
  /* font-size: 0.84rem; */
}

.cashback-why {
  font-size: 0.82rem;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .cashback-search-form {
    grid-template-columns: 1fr;
  }

  .cashback-table {
    table-layout: auto;
  }

  .cashback-table th:nth-child(n),
  .cashback-table td:nth-child(n) {
    width: auto;
  }
}

.module--taxi .module-head {
  position: relative;
  padding-right: 0.25rem;
}

.taxi-toast {
  position: absolute;
  top: 0;
  right: 0;
  max-width: min(28rem, calc(100% - 3.5rem));
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: #d7ebe0;
  color: #1f3d2f;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  text-align: right;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2;
}

.taxi-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.module-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.3rem;
  /* margin-bottom: 0.9rem; */
}

.module-icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.module-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--offline);
  box-shadow: 0 0 0 4px rgba(176, 74, 74, 0.12);
  flex-shrink: 0;
}

.dot.on {
  background: var(--online);
  box-shadow: 0 0 0 4px rgba(63, 143, 90, 0.14);
}

.module-head .dot {
  margin-left: auto;
}

.extras {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.extras li {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 500;
}

.log {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.log li {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.9rem;
  /* font-size: 1rem; */
  font-size: 0.9rem;
  color: var(--ink);
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}

.log li:first-child {
  border-top: 0;
  padding-top: 0;
}

.log li > .muted {
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.5;
}

.log li span:last-child {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.module-foot {
  margin-top: auto;
  padding-top: 1rem;
}

.module-foot a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: gap 140ms ease, opacity 140ms ease;
}

.module-foot a:hover {
  gap: 0.55rem;
  opacity: 0.85;
}

.hint {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Munchy: крупные цифры + спарклайн */
.mono {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}

.mono-price {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mono-price .big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.mono-price .big-sub {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 550;
}

.metrics {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.metrics .metric-strong {
  color: var(--accent);
  font-weight: 600;
}

.card-chart-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  margin-top: 0.65rem;
}

/* Steam / Ozon: список позиций */
.items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.items li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.5rem 0;
  font-size: 1rem;
  /* font-size: 0.92rem; */
  border-top: 1px solid var(--line);
}

.items li:first-child {
  border-top: 0;
  padding-top: 0;
}

.item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-vals {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.item-vals strong {
  font-weight: 600;
}

.more-hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Munchy log: график цены */
.chart-card {
  grid-column: 1 / -1;
}

.chart-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.chart-head h2 {
  margin: 0;
}

.chart-range {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.chart-range a {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.chart-range a:hover {
  color: var(--ink);
}

.chart-range a.active {
  background: var(--sage-deep);
  border-color: var(--sage-deep);
  color: #f8f6f1;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(240px, 42vh, 380px);
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Settings: 2 колонки как на главной */
#settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-content: start;
  align-items: start;
  width: 100%;
}

.content > .module {
  display: grid;
  gap: var(--gap);
}

.module.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.settings-section .module-head {
  margin-bottom: 0.15rem;
}

.settings-section .hint {
  margin: 0;
  line-height: 1.35;
}

.settings-form {
  display: grid;
  gap: 0.65rem;
}

.settings-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  min-height: 2rem;
}

.settings-top .check {
  margin: 0;
  line-height: 1;
}

.settings-top .field-inline {
  display: grid;
  gap: 0.25rem;
  min-width: 7.5rem;
  flex: 0 1 8.5rem;
}

.settings-top .field-inline--row,
.field-inline--row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 0 0 auto;
  margin: 0;
  line-height: 1;
}

.settings-top .field-inline--row input,
.field-inline--row input,
.input-int,
.input-compact {
  width: 4.5rem;
  flex: 0 0 4.5rem;
}

/* Убираем стрелки у number-инпутов */
.input-int,
.input-compact,
.settings-section input[type="number"].input-int,
.settings-section input[type="number"].input-compact {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-int::-webkit-outer-spin-button,
.input-int::-webkit-inner-spin-button,
.input-compact::-webkit-outer-spin-button,
.input-compact::-webkit-inner-spin-button,
.settings-section input[type="number"].input-int::-webkit-outer-spin-button,
.settings-section input[type="number"].input-int::-webkit-inner-spin-button,
.settings-section input[type="number"].input-compact::-webkit-outer-spin-button,
.settings-section input[type="number"].input-compact::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.row-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
}

.row-card-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.settings-section label {
  gap: 0.25rem;
}

.settings-section input[type="text"],
.settings-section input[type="password"],
.settings-section input[type="number"],
.settings-section input[type="url"] {
  padding: 0.48rem 0.65rem;
  border-radius: 8px;
}

.settings-section .check input {
  accent-color: var(--accent);
}

.steam-item-row {
  display: flex;
  align-items: end;
  gap: 0.65rem;
  width: 100%;
}

.steam-item-row .steam-name {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.steam-item-row .steam-threshold {
  flex: 0 0 auto;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  text-align: center;
}

.steam-item-row .steam-threshold input,
.taxi-route-row .steam-threshold input {
  width: 7ch;
  min-width: 7ch;
  max-width: 7ch;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.taxi-route-row {
  display: flex;
  align-items: start;
  gap: 0.65rem;
  width: 100%;
}

.taxi-place {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.4rem;
}

.taxi-place > label {
  display: grid;
  gap: 0.25rem;
}

.taxi-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.taxi-coords input {
  width: 100%;
  min-width: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.taxi-coords input::-webkit-outer-spin-button,
.taxi-coords input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.taxi-route-row .steam-threshold {
  flex: 0 0 auto;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  text-align: center;
}

.settings-section button[type="submit"] {
  justify-self: start;
  margin-top: 0.15rem;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}

.settings-section.module--taxi button[type="submit"] {
  color: #1f1a0a;
}

.settings-section.module--cashback {
  grid-column: auto;
}

.settings-section.module--cashback .settings-actions--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.settings-section.module--cashback .settings-actions--split button {
  margin-top: 0;
  justify-self: auto;
}

.settings-section.module--cashback .settings-actions--split button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.settings-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.15rem 0 0.85rem;
}

.settings-subhead {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--ink);
}

.eda-item-row {
  display: flex;
  align-items: end;
  gap: 0.65rem;
  width: 100%;
  flex-wrap: wrap;
}

.eda-item-row .steam-name {
  flex: 1 1 10rem;
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.eda-item-row .eda-benefit {
  flex: 0 0 auto;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  text-align: center;
}

.eda-benefit-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.eda-benefit-controls input {
  width: 7ch;
  min-width: 7ch;
  max-width: 7ch;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.eda-benefit-controls select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.35rem;
  background: #fbfaf8;
  color: var(--ink);
  min-width: 3.5rem;
}

.eda-item-row .steam-threshold {
  flex: 0 0 auto;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  text-align: center;
}

.eda-item-row .steam-threshold input {
  width: 8ch;
  min-width: 8ch;
  max-width: 8ch;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.65rem;
}

.row-list {
  display: grid;
  gap: 0.55rem;
}

.row-card {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.7rem 0.75rem;
  display: grid;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
}

.row-card--new {
  border-style: dashed;
  background: transparent;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.check input {
  width: auto;
  accent-color: var(--sage-deep);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}

/* Taxi: таблица маршрутов на карточке */
.taxi-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5rem auto auto;
  grid-template-areas:
    "route thr btn clear"
    "body body body body";
  gap: 0.45rem;
  align-items: center;
  /* margin: -0.35rem 0 0.85rem; */
}

.taxi-track-form {
  display: contents;
}

.taxi-live {
  display: contents;
}

.taxi-track-untrack {
  grid-area: clear;
  display: flex;
  align-items: center;
  margin: 0;
}

.taxi-live-body {
  grid-area: body;
  min-width: 0;
}

/* .taxi-live-body .empty-state {
  min-height: 8.5rem;
} */

.taxi-stats {
  margin: 0 0 0.35rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #f4f6f3;
  font-size: 0.82rem;
  line-height: 1.35;
}

.taxi-stats-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.5rem;
}

.taxi-stats-price,
.taxi-stats-baselines,
.taxi-baseline,
.taxi-forecast-row {
  display: flex;
  align-items: baseline;
}

.taxi-stats-price {
  gap: 0.55rem;
  flex-wrap: wrap;
}

.taxi-stats-price .taxi-baseline {
  font-size: 0.82rem;
}

.taxi-stats-baselines {
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
}

.taxi-baseline {
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.taxi-history-coverage {
  margin-left: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.taxi-stats-now {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.taxi-stats-forecast {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.taxi-forecast-cell {
  min-width: 0;
  /* padding: 0.35rem 0.4rem; */
  padding: 0.15rem 0.1rem;
  border-radius: 8px;
  /* background: rgba(255, 255, 255, 0.52); */
}

.taxi-forecast-label {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.taxi-forecast-row {
  gap: 0.2rem;
  font-size: 0.77rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  white-space: nowrap;
}

.taxi-forecast-row--dow {
  color: var(--muted);
}

.taxi-forecast-value {
  font-weight: 650;
}

.taxi-forecast-range {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.15;
}

.taxi-delta.is-down {
  color: #1f7a4d;
  font-weight: 650;
}

.taxi-delta.is-up {
  color: #b42318;
  font-weight: 650;
}

@media (max-width: 520px) {
  .taxi-stats-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .taxi-stats-now {
    font-size: 1.2rem;
  }

  .taxi-forecast-label {
    font-size: 0.62rem;
  }

  .taxi-forecast-row {
    font-size: 0.69rem;
  }

  .taxi-forecast-range {
    font-size: 0.61rem;
  }
}

.taxi-track select,
.taxi-track-threshold {
  box-sizing: border-box;
  height: 2.15rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.2;
  padding: 0 0.55rem;
}

.taxi-track select {
  grid-area: route;
  width: 100%;
  min-width: 0;
}

.taxi-track-threshold {
  grid-area: thr;
  width: 5rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

.taxi-track-threshold::-webkit-outer-spin-button,
.taxi-track-threshold::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.taxi-track-btn {
  grid-area: btn;
  box-sizing: border-box;
  height: 2.15rem;
  border: none;
  border-radius: 10px;
  padding: 0 0.8rem;
  background: var(--accent);
  color: #1f1a0a;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.taxi-track-btn:hover {
  opacity: 0.9;
}

.taxi-track-btn:disabled,
.taxi-track-btn.is-disabled {
  background: #cfd5d1;
  color: #6b736e;
  cursor: not-allowed;
  opacity: 0.9;
}

.taxi-track-btn:disabled:hover,
.taxi-track-btn.is-disabled:hover {
  opacity: 0.9;
}

.taxi-track-clear {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  margin-left: 0.1rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: default;
  opacity: 0.35;
  transition: color 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.taxi-track-clear.is-active {
  color: #c0392b;
  opacity: 0.9;
  cursor: pointer;
}

.taxi-track-clear.is-active:hover {
  background: rgba(192, 57, 43, 0.1);
  opacity: 1;
}

.taxi-track-clear:disabled {
  pointer-events: none;
}

@media (max-width: 720px) {
  .taxi-track {
    grid-template-columns: minmax(0, 1fr) 5rem;
    grid-template-areas:
      "route route"
      "thr btn"
      "clear clear"
      "body body";
  }
}

.taxi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: auto;
}

.taxi-table th,
.taxi-table td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.taxi-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}

/* Время — ровно по контенту, небольшой отступ справа */
.taxi-table .col-when {
  width: 1px;
  white-space: nowrap;
  padding-right: 1rem;
}

/* Эконом / Комфорт — по ширине заголовка (цена всегда короче) */
.taxi-table .col-price {
  width: 1px;
  white-space: nowrap;
}

/* Откуда / Куда — делят оставшееся место поровну */
.taxi-table .col-place {
  width: 50%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taxi-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.taxi-table td.num {
  font-weight: 600;
}

.taxi-table .taxi-when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.taxi-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.pager {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
}

.pager--top {
  margin: -0.6rem 0 0.5rem;
}

.pager a {
  text-decoration: none;
  color: var(--sage-deep);
  font-weight: 600;
}

.pager-disabled {
  color: var(--muted);
  font-weight: 600;
  opacity: 0.55;
  user-select: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  #modules,
  #settings {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 1.15rem 1rem 2rem;
    min-height: auto;
  }

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

  .module-head {
    flex-direction: column;
    align-items: start;
  }

  .status {
    white-space: normal;
  }
}
