/* Tariff pages. Token values are copied from web/src/styles/tokens.css: change both together. */
:root {
  --k-color-bg: #f5f7fb;
  --k-color-surface: #ffffff;
  --k-color-surface-sunken: #f5f7fb;
  --k-color-border: #e3e7ef;
  --k-color-text: #0d1220;
  --k-color-text-muted: #5a6275;
  --k-color-primary: #2b4ef0;
  --k-color-primary-hover: #2340d0;
  --k-color-on-primary: #ffffff;
  --k-color-primary-fg: #2b4ef0;
  --k-color-primary-tint: #e8ecfe;
  --k-color-focus: #2b4ef0;
  --k-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --k-text-sm: 0.875rem;
  --k-text-base: 1rem;
  --k-text-lg: 1.125rem;
  --k-text-xl: 1.25rem;
  --k-text-3xl: 1.875rem;
  --k-space-1: 4px; --k-space-2: 8px; --k-space-3: 12px; --k-space-4: 16px;
  --k-space-6: 24px; --k-space-8: 32px;
  --k-radius-md: 10px; --k-radius-lg: 14px;
  --k-shadow-1: 0 1px 3px rgb(13 18 32 / 0.06), 0 1px 2px rgb(13 18 32 / 0.04);
  --k-color-up: #c0261c; --k-color-down: #17803d; --k-color-warning-fg: #a15c00;
}

:root[data-theme="dark"] {
  --k-color-bg: #101114;
  --k-color-surface: #1a1c21;
  --k-color-surface-sunken: #101114;
  --k-color-border: #2b2e36;
  --k-color-text: #eef0f5;
  --k-color-text-muted: #9aa1b0;
  --k-color-primary: #7b92ff;
  --k-color-primary-hover: #9cb0fd;
  --k-color-on-primary: #0b1030;
  --k-color-primary-fg: #7b92ff;
  --k-color-primary-tint: #232a5a;
  --k-color-focus: #7b92ff;
  --k-shadow-1: 0 1px 3px rgb(0 0 0 / 0.5);
  --k-color-up: #ff8a80; --k-color-down: #6fdc8c; --k-color-warning-fg: #f5b94a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--k-color-bg);
  color: var(--k-color-text);
  font-family: var(--k-font);
  font-size: 0.9375rem;
  line-height: 1.5;
}
a { color: var(--k-color-primary-fg); }
a:focus-visible { outline: 2px solid var(--k-color-focus); outline-offset: 2px; }

.t-header, .t-main, .t-footer { max-width: 880px; margin: 0 auto; padding: var(--k-space-4); }
.t-header { display: flex; align-items: center; justify-content: space-between; gap: var(--k-space-3);
  padding: var(--k-space-3) var(--k-space-4); }
.t-brand { display: inline-flex; align-items: center; gap: var(--k-space-2); font-weight: 700; color: var(--k-color-text); text-decoration: none; }
.t-header__nav { display: flex; align-items: center; gap: var(--k-space-2); }
.t-header__nav a { text-decoration: none; }

.t-main {
  background: var(--k-color-surface);
  border: 1px solid var(--k-color-border);
  border-radius: var(--k-radius-lg);
  box-shadow: var(--k-shadow-1);
  padding: var(--k-space-6);
}
h1 { font-size: var(--k-text-3xl); line-height: 1.2; margin: var(--k-space-2) 0 var(--k-space-4); }
h2 { font-size: var(--k-text-xl); margin: var(--k-space-8) 0 var(--k-space-3); }

.t-crumbs ol { display: flex; flex-wrap: wrap; gap: var(--k-space-2); list-style: none; margin: 0; padding: 0; font-size: var(--k-text-sm); }
.t-crumbs li + li::before { content: "›"; margin-right: var(--k-space-2); color: var(--k-color-text-muted); }

.t-scroll { overflow-x: auto; margin: var(--k-space-4) 0; }
.t-table { width: 100%; border-collapse: collapse; font-size: var(--k-text-sm); }
.t-table caption { text-align: left; font-weight: 700; font-size: var(--k-text-lg); padding-bottom: var(--k-space-2); }
.t-table th, .t-table td { text-align: left; vertical-align: top; padding: var(--k-space-2); border-bottom: 1px solid var(--k-color-border); }
.t-table thead th { color: var(--k-color-text-muted); font-weight: 600; }
.t-table tbody th { font-weight: 600; }
.t-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-note { display: block; font-size: var(--k-text-sm); font-weight: 400; color: var(--k-color-text-muted); }
.t-list li, .t-links li { margin: var(--k-space-1) 0; }
.t-links { columns: 2 14rem; padding-left: var(--k-space-4); }

.t-cta { margin: var(--k-space-8) 0; padding: var(--k-space-6); border-radius: var(--k-radius-lg); background: var(--k-color-primary-tint); }
.t-cta h2 { margin-top: 0; }
.t-cta__buttons { display: flex; flex-wrap: wrap; gap: var(--k-space-3); }
.t-btn {
  display: inline-block;
  padding: var(--k-space-2) var(--k-space-4);
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--k-color-primary);
  color: var(--k-color-on-primary);
  font-weight: 600;
  text-decoration: none;
}
.t-btn:hover { background: var(--k-color-primary-hover); }
.t-btn--small { padding: var(--k-space-1) var(--k-space-3); font-size: var(--k-text-sm); white-space: nowrap; }
.t-btn--ghost { background: transparent; color: var(--k-color-primary-fg); border-color: var(--k-color-primary-fg); }
.t-btn--ghost:hover { background: var(--k-color-surface-sunken); }
/* The header «Увійти» is the landing ghost button: no border, text color. */
.t-header__nav .t-btn--ghost { border-color: transparent; color: var(--k-color-text); }
.t-header__nav .t-btn--ghost:hover { background: transparent; color: var(--k-color-primary-fg); }

.t-updated { color: var(--k-color-text-muted); font-size: var(--k-text-sm); }
.t-summary { color: var(--k-color-text); }
.t-footer { color: var(--k-color-text-muted); font-size: var(--k-text-sm); }

.t-tiles { margin: var(--k-space-4) 0 var(--k-space-6); }
.t-tiles__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(min(6.75rem, 50% - 3px), 1fr)); }
.t-tile { display: flex; flex-direction: column; padding: 10px 8px; border: 1px solid var(--k-color-border);
  border-radius: var(--k-radius-md); background: var(--k-color-surface); }
.t-tile__name { font-size: 13px; font-weight: 600; color: var(--k-color-text-muted); }
.t-tile__val { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.25; }
.t-tile__unit { font-size: 12px; font-weight: 600; color: var(--k-color-text-muted); }
.t-tiles__cta { margin: var(--k-space-3) 0 0; }
.t-tiles__place { margin: 0 0 var(--k-space-2); font-weight: 600; }
.t-tile--parts { grid-column: span 2; }
.t-tile__part { font-size: 13px; color: var(--k-color-text-muted); font-variant-numeric: tabular-nums; }
.t-tile__unit + .t-tile__part { margin-top: 4px; }

.t-rates { table-layout: fixed; font-size: 0.9375rem; }
.t-rates thead th:nth-child(2) { width: 10.5rem; }
.t-rates thead th:nth-child(3) { width: 7rem; }
.t-rates thead th:nth-child(4) { width: 6.5rem; }
.t-rates thead th:nth-child(5) { width: 9.5rem; }
.t-rates thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.t-rates th, .t-rates td { padding: 9px var(--k-space-2); vertical-align: baseline; }
/* Two classes or more: the .t-table rules (align left, tbody th 600) must not win. */
.t-rates .t-r, .t-rates .t-rate { text-align: right; }
.t-rates .t-group th { padding-top: var(--k-space-4); font-size: 0.9375rem; font-weight: 800; border-bottom: 0; }
.t-rates tbody .t-prov { font-weight: 400; }
.t-val { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-unit { font-size: 13px; font-weight: 600; color: var(--k-color-text-muted); white-space: nowrap; }
.t-sub { display: block; font-size: 13px; color: var(--k-color-text-muted); }
.t-mor { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--k-color-warning-fg); }
.t-up, .t-down, .t-same { font-weight: 700; font-variant-numeric: tabular-nums; }
.t-up { color: var(--k-color-up); }
.t-down { color: var(--k-color-down); }
.t-none { color: var(--k-color-text-muted); }
.t-date { font-variant-numeric: tabular-nums; }
.t-src { font-size: 13px; }
.t-act-btn { display: block; margin-top: 2px; padding: 0; border: 0; background: none; font: inherit;
  color: var(--k-color-text-muted); cursor: pointer; text-align: left; }
.t-act-btn::after { content: " ▾"; }
.t-act-btn[aria-expanded="true"]::after { content: " ▴"; }
.t-act-btn:focus-visible { outline: 2px solid var(--k-color-focus); outline-offset: 2px; }
.t-act-row[hidden] { display: none; }
.t-act-row td { padding: 8px 12px; background: var(--k-color-surface-sunken); font-size: 14px; color: var(--k-color-text); }
.t-national { margin: var(--k-space-8) 0 0; }
.t-national summary { list-style: none; cursor: pointer; border-radius: var(--k-radius-md); }
.t-national summary::-webkit-details-marker { display: none; }
.t-national summary:focus-visible { outline: 2px solid var(--k-color-focus); outline-offset: 2px; }
.t-national h2 { display: inline; margin: 0; }
.t-national h2::after { content: " ▾"; color: var(--k-color-text-muted); }
.t-national[open] h2::after { content: " ▴"; }
.t-national__line { display: block; margin-top: var(--k-space-1); color: var(--k-color-text-muted); }
.t-cards .t-num { text-align: right; font-weight: 800; }
.t-cards thead th:last-child { text-align: right; }

@media (max-width: 600px) {
  .t-main { padding: var(--k-space-4); border-radius: 0; }
  /* One header row at 320 px. */
  .t-header { gap: var(--k-space-2); padding-inline: var(--k-space-3); }
  .t-header__nav { gap: var(--k-space-1); }
  h1 { font-size: var(--k-text-xl); }

  /* On a phone each table row is a card: the columns do not fit, and a long legal act made every row very tall.
     The ARIA roles in the template keep the table semantics for screen readers. */
  .t-scroll:has(.t-cards) { overflow-x: visible; }
  .t-cards, .t-cards tbody, .t-cards tfoot, .t-cards tr, .t-cards th, .t-cards td { display: block; }
  .t-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .t-cards tbody tr { padding: var(--k-space-2) 0; border-bottom: 1px solid var(--k-color-border); }
  .t-cards th, .t-cards td { padding: var(--k-space-1) 0; border-bottom: 0; }
  .t-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--k-color-text-muted); }
  .t-cards .t-num { white-space: normal; text-align: left; }
}

/* The phone layout of the tariff table up to 760 px: from 601 px the provider column was too narrow. */
@media (max-width: 760px) {
  .t-scroll:has(.t-rates) { overflow-x: visible; }
  .t-rates, .t-rates tbody, .t-rates tr, .t-rates th, .t-rates td { display: block; }
  .t-rates thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .t-rates .t-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--k-space-2);
    grid-template-areas: "prov prov rate" "date src change"; padding: 10px 0; border-bottom: 1px solid var(--k-color-border); }
  .t-rates .t-row > * { padding: 0; border: 0; }
  .t-rates .t-group th { padding-left: 0; padding-right: 0; }
  .t-rates .t-prov { grid-area: prov; }
  .t-rates .t-rate { grid-area: rate; }
  .t-rates .t-change { grid-area: change; text-align: right; }
  .t-rates .t-date, .t-rates .t-src { font-size: 13px; color: var(--k-color-text-muted); }
  .t-rates .t-date { grid-area: date; }
  .t-rates .t-date::before { content: "з "; }
  .t-rates .t-src { grid-area: src; }
  .t-rates .t-src a { color: inherit; }
  .t-rates .t-change .t-none { display: none; }
  .t-rates .t-act-row td { display: block; margin-bottom: var(--k-space-2); border-radius: var(--k-radius-md); }
}
