:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #182326;
  --muted: #66757a;
  --line: #dce4e7;
  --brand: #0d766e;
  --brand-dark: #095952;
  --accent: #bf6b21;
  --atugas-orange: #f58220;
  --danger: #aa2434;
  --ok: #237447;
  --shadow: 0 10px 28px rgba(24, 35, 38, .08);
  --control-height: 48px;
}
* { 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(--ink);
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  padding: 14px clamp(14px, 4vw, 34px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar-main {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}
.brand { min-width: 0; }
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.userbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.userbar span { overflow-wrap: anywhere; }
.shell {
  width: min(90vw, 1680px);
  max-width: none;
  margin: 0 auto;
  padding: 18px 0 40px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  overflow: visible;
  padding: 0 2px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.nav-toggle {
  display: none;
  width: 46px;
  min-height: 42px;
  padding: 8px;
  align-self: flex-start;
  gap: 5px;
  flex-direction: column;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.tab, button, .button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}
.tab.active, button.primary, .button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.danger, .button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.enrichment-panel {
  margin-bottom: 14px;
}
.enrichment-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.enrichment-head h2 {
  margin: 0;
  font-size: 18px;
}
.enrichment-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.enrichment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}
.progress-row strong {
  white-space: nowrap;
  font-size: 13px;
}
.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef0;
  border: 1px solid var(--line);
}
.progress-track span {
  display: block;
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, var(--brand), var(--atugas-orange));
  transition: width .25s ease;
}
.enrichment-detail {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.enrichment-source {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}
.enrichment-history {
  margin-top: 10px;
}
.enrichment-history summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 800;
}
.enrichment-history ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.enrichment-history li {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}
.enrichment-history li span {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 16px; }
.card { padding: 14px; }
.metric span { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; }
.metric strong { display: block; margin-top: 6px; font-size: 26px; }
.metric small { display: block; margin-top: 7px; color: var(--muted); font-weight: 700; line-height: 1.35; }
.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(160px, .75fr)) auto auto;
  gap: 10px;
  align-items: end;
}
.list-count { margin: 12px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.col-num { width: 64px; text-align: right; color: var(--muted); font-weight: 800; white-space: nowrap; }
.contact-col,
.contact-cell {
  width: 76px;
  text-align: center;
  white-space: nowrap;
}
.contact-cell .contact-action + .contact-action { margin-left: 5px; }
.contact-indicator {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #a8b4b8;
  background: #f5f7f8;
}
.contact-indicator.active {
  color: var(--brand);
  border-color: #b7dbd7;
  background: #edf8f7;
}
.contact-action {
  text-decoration: none;
  cursor: pointer;
}
.contact-action:hover,
.contact-action:focus-visible {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
  outline: none;
}
.contact-indicator svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
input, select {
  height: var(--control-height);
  min-height: var(--control-height);
  line-height: 1.2;
}
select {
  appearance: auto;
  -webkit-appearance: menulist;
}
button, .button {
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-button {
  width: var(--control-height);
  padding: 0;
}
.icon-button svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}
.admin-button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
textarea { padding: 10px 12px; }
textarea { min-height: 90px; resize: vertical; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; background: #f8fafb; }
tr:hover td { background: #fbfdfd; }
.tariff-network-table {
  min-width: 1080px;
}
.tariff-network-table th:nth-child(4),
.tariff-network-table td:nth-child(4),
.tariff-network-table th:nth-child(6),
.tariff-network-table td:nth-child(6),
.tariff-network-table th:nth-child(7),
.tariff-network-table td:nth-child(7) {
  text-align: right;
  white-space: nowrap;
}
.tariff-map-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 7px 10px;
}
.tariff-row-atugas td,
.tariff-row-atugas:hover td {
  background: #ffead8;
  font-weight: 800;
}
.tariff-policy {
  margin-top: 14px;
}
.tariff-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.tariff-policy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
}
.tariff-policy-card h3 {
  margin: 0;
  padding: 12px 12px 0;
  font-size: 15px;
}
.tariff-policy-card table {
  min-width: 520px;
}
.tariff-policy-card td:first-child {
  font-weight: 800;
}
.fuel-prices-public {
  margin: 14px 0;
  padding: clamp(16px, 2.4vw, 28px);
}
.fuel-prices-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.fuel-prices-head h2 {
  margin: 0;
  color: #101923;
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.08;
  text-transform: uppercase;
}
.fuel-prices-head p {
  margin: 6px 0 0;
  color: #52626b;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.fuel-price-card {
  margin-top: 18px;
  padding: clamp(16px, 2.4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(24, 35, 38, .06);
}
.fuel-price-card h3 {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #121e29;
  color: #fff;
  font-size: 16px;
  line-height: 1.15;
  text-transform: uppercase;
}
.fuel-price-table-wrap {
  overflow-x: auto;
}
.fuel-price-table {
  min-width: 760px;
}
.fuel-price-table th,
.fuel-price-table td {
  padding: 14px 16px;
}
.fuel-price-table th {
  color: #111a24;
  font-weight: 900;
}
.fuel-price-table th:not(:first-child),
.fuel-price-table td:not(:first-child) {
  text-align: right;
}
.fuel-price-table td:not(:first-child) {
  color: #111a24;
  font-weight: 900;
}
.fuel-price-note,
.fuel-price-legal {
  margin: 18px 0 0;
  color: #52626b;
  font-size: 13px;
  line-height: 1.45;
}
.fuel-price-legal {
  margin-top: 18px;
}
.dst-network-separator {
  display: flex;
  gap: clamp(14px, 2.4vw, 24px);
  align-items: center;
  margin: 14px 0;
  border-color: #cbd7dc;
  background: linear-gradient(90deg, #ffffff 0%, #f4f8f8 100%);
}
.dst-network-logo {
  flex: 0 0 clamp(160px, 24vw, 260px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.dst-network-logo img {
  display: block;
  width: 100%;
  height: auto;
}
.dst-network-separator span {
  display: block;
  color: #17232c;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}
.dst-network-separator p {
  margin: 8px 0 0;
  color: #52626b;
  font-size: 14px;
  font-weight: 800;
}
.atugas-station-separator {
  justify-content: flex-start;
  border-color: #8bc34a;
  background: linear-gradient(90deg, #ffffff 0%, #f4faef 100%);
  text-align: left;
}
.atugas-station-separator span {
  color: var(--atugas-orange);
  font-weight: 900;
}
.atugas-station-logo img {
  max-height: 116px;
  object-fit: contain;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #eef4f4; color: #24484a; font-size: 12px; font-weight: 800; }
.chip.ok { background: #e8f5ee; color: var(--ok); }
.chip.warn { background: #fff3e8; color: var(--accent); }
.chip.bad { background: #fbeaec; color: var(--danger); }
.client-head { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.client-head h2, .panel h2 { margin: 0 0 10px; font-size: 18px; }
.client-meta { color: var(--muted); line-height: 1.45; }
.activity { border-top: 1px solid var(--line); padding: 10px 0; }
.activity:first-child { border-top: 0; }
.notice { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.notice.error { border-color: #efb8c0; background: #fff4f5; color: var(--danger); }
.notice.ok { border-color: #bfe4cf; background: #f0fbf5; color: var(--ok); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.admin-setting-card {
  min-height: 178px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  align-content: start;
}
.admin-setting-card span {
  min-height: 34px;
  color: var(--ink);
  font-size: 13px;
}
.admin-setting-card input {
  border: 2px solid var(--brand);
  font-size: 28px;
  font-weight: 800;
  padding: 16px 14px;
}
.admin-setting-card small {
  color: var(--muted);
  line-height: 1.35;
  text-transform: none;
  font-weight: 600;
}
.admin-settings-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-settings-actions .footer-note { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.row-actions form {
  margin: 0;
}
.row-actions button {
  min-height: 38px;
  padding: 8px 10px;
}
.market-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.market-hero h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 30px);
  text-transform: uppercase;
}
.market-metrics {
  margin-bottom: 14px;
}
.market-chart-panel {
  margin-bottom: 14px;
}
.market-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.market-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.market-legend i {
  width: 24px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
}
.legend-atugas { background: var(--atugas-orange); }
.legend-average { background: var(--brand); }
.market-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.market-axis {
  stroke: #98a8ad;
  stroke-width: 1.2;
}
.market-gridline {
  stroke: #e8eef0;
  stroke-width: 1;
}
.market-line {
  fill: none;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.market-line-atugas { stroke: var(--atugas-orange); }
.market-line-average { stroke: var(--brand); }
.market-chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.market-chart-empty {
  margin-top: 12px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfd;
  font-weight: 800;
}
.market-summary-grid {
  margin-bottom: 14px;
}
.market-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.55;
}
.market-bullets li + li {
  margin-top: 8px;
}
.market-table td:not(:first-child),
.market-table th:not(:first-child) {
  text-align: right;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login .panel { width: min(430px, 100%); }
.footer-note { color: var(--muted); font-size: 12px; margin-top: 16px; }
.tariff-hero,
.tariff-footer {
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.tariff-footer { margin: 14px 0 0; }
.tariff-hero img,
.tariff-footer img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 980px) {
  .grid.two, .metrics, .form-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: 1 / -1; }
  .admin-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tariff-policy-grid { grid-template-columns: 1fr; }
  .enrichment-head { flex-direction: column; }
  .enrichment-actions { justify-content: flex-start; }
  .enrichment-history li { grid-template-columns: 1fr; }
  .topbar-main { align-items: flex-start; flex-direction: column; }
  .userbar { justify-content: flex-start; }
  table { min-width: 760px; }
}
@media (min-width: 561px) and (max-width: 1180px) {
  .topbar {
    gap: 10px;
    padding-inline: clamp(12px, 2.5vw, 28px);
  }
  .tabs {
    row-gap: 8px;
  }
  .tab {
    flex: 0 1 auto;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
  }
}
@media (max-width: 560px) {
  .shell { width: calc(100vw - 20px); }
  .panel, .card { padding: 12px; }
  .brand h1 { font-size: 18px; }
  .metric strong { font-size: 22px; }
  .filters { grid-template-columns: 1fr; }
  .filters label:first-child { grid-column: auto; }
  .tab, button, .button { width: auto; padding: 8px 10px; }
  .admin-settings-grid { grid-template-columns: 1fr; }
  .admin-setting-card input { font-size: 24px; }
  .progress-row { grid-template-columns: 1fr; }
  .fuel-prices-head { display: block; }
  .fuel-prices-head p { white-space: normal; }
  .fuel-price-card h3 { padding: 14px; }
  .fuel-price-table { min-width: 620px; }
  .dst-network-separator { align-items: flex-start; flex-direction: column; }
  .dst-network-logo { width: min(260px, 100%); flex-basis: auto; }
  .topbar {
    gap: 10px;
    padding: 12px 10px;
  }
  .topbar-main {
    flex-direction: row;
    align-items: flex-start;
  }
  .brand {
    flex: 1 1 auto;
  }
  .brand p {
    font-size: 12px;
  }
  .userbar {
    justify-content: flex-end;
  }
  .userbar span {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .topbar.nav-ready .tabs {
    display: none;
  }
  .topbar.nav-ready.nav-open .tabs {
    display: flex;
  }
  .tabs {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    padding: 0;
  }
  .tab {
    width: 100%;
    justify-content: flex-start;
    min-height: 42px;
  }
}
