/* ---------------------------------------------------------------------------
   /lt/vilkiko-prieziuros-kastai — page-local styles (charts, KPI strip, table).
   Tokens come from pages.css; the few chart-only colours are defined below.
   Server-rendered, no client JS — see components/content/MaintenanceCharts.tsx.
   --------------------------------------------------------------------------- */

.tk {
  --ch-amber: #e08a0b;
  --ch-slate: #8a9bb0;
  --ch-soft: #c9d4e2;
  --ch-blue-soft: #a9c2ff;
  --ch-violet: #9b5de5;
  --ch-young: #22a06b;
  --ch-mid: #c9d4e2;
}

/* ---------- KPI strip ---------- */
.tk .kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 14px;
  margin: 26px 0 8px;
}
.tk .kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tk .kpi .v {
  font-family: var(--disp);
  font-weight: 800;
  font-size: clamp(28px, 3.4vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tk .kpi .v small {
  font-size: 0.5em;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 4px;
}
.tk .kpi .l {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}
.tk .kpi .s {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 4px;
}
.tk .kpi.accent {
  background: linear-gradient(160deg, #ffffff 0%, var(--blue-soft) 100%);
  border-color: #d6e3ff;
}
.tk .kpi.accent .v {
  color: var(--blue-d);
}

/* ---------- chart frame ---------- */
.tk .ch {
  margin: 26px 0 30px;
  padding: 22px 24px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.tk .ch-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.tk .ch-title {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tk .ch-sub {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 80ch;
}
.tk .ch-src {
  margin: 14px 0 0 !important;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: none !important;
}
.tk .ch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 12px;
}
.tk .ch-legend .sw {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--c);
  margin-right: 7px;
  vertical-align: 3px;
}
.tk .ch-legend .sw.dashed {
  background: repeating-linear-gradient(
    90deg,
    var(--c) 0 4px,
    transparent 4px 7px
  );
}

/* ---------- line chart ---------- */
.tk .ch-line {
  padding-left: 30px;
}
.tk .ch-plot {
  position: relative;
  aspect-ratio: 5 / 2;
  min-height: 220px;
}
.tk .ch-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tk .ch-plot .grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tk .ch-plot .stroke {
  fill: none;
  stroke: var(--c);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.tk .ch-plot .stroke.gap {
  stroke-dasharray: 5 6;
  stroke-width: 2;
  opacity: 0.7;
}
.tk .ch-y {
  position: absolute;
  left: -30px;
  width: 22px;
  transform: translateY(-50%);
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.tk .ch-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--card);
  border: 2.5px solid var(--c);
  transform: translate(-50%, -50%);
}
.tk .ch-dot.edge {
  width: 12px;
  height: 12px;
  background: var(--c);
  border-color: var(--card);
  box-shadow: 0 0 0 1.5px var(--c);
}
.tk .ch-dot b {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--disp);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.85);
  padding: 0 3px;
  border-radius: 4px;
}
.tk .ch-note {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-d);
  background: var(--blue-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tk .ch-x {
  position: relative;
  height: 26px;
  margin-top: 8px;
}
.tk .ch-x span {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ---------- column chart ---------- */
.tk .ch-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 3vw, 28px);
  align-items: end;
  padding-top: 30px;
}
.tk .col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.tk .col-area {
  height: 220px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
}
.tk .col-bar {
  position: relative;
  width: 100%;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, #8fb0ff 0%, #5f8dff 100%);
}
.tk .col.cool .col-bar {
  background: linear-gradient(180deg, #bcd0ff 0%, #8fb0ff 100%);
}
.tk .col.hot .col-bar {
  background: linear-gradient(180deg, #2f6bff 0%, #1b4dd8 100%);
}
.tk .col-val {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--disp);
  font-weight: 800;
  font-size: clamp(16px, 2.2vw, 20px);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tk .col-delta {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.tk .col.cool .col-delta,
.tk .col .col-delta {
  color: rgba(255, 255, 255, 0.92);
}
.tk .col-lab {
  text-align: center;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- horizontal bars ---------- */
.tk .ch-hbars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tk .hb-row {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.tk .hb-lab {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.35;
}
.tk .hb-lab b {
  font-weight: 700;
  color: var(--ink);
}
.tk .hb-lab span {
  color: var(--muted);
  font-size: 12.5px;
}
.tk .hb-track {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.tk .hb-bar {
  display: block;
  height: 14px;
  min-width: 4px;
  border-radius: 4px;
  background: var(--c);
}
.tk .hb-bar.dashed {
  background: repeating-linear-gradient(
    135deg,
    var(--c) 0 6px,
    color-mix(in srgb, var(--c) 45%, #fff) 6px 11px
  );
}
.tk .hb-val {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tk .hb-val.muted {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
}
.tk .pairs .hb-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--line-2);
}
.tk .pairs .hb-row:last-child {
  border-bottom: none;
}
.tk .hb-pair {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tk .hb-track.thin .hb-bar {
  height: 7px;
}
.tk .pairs .hb-row.hl {
  background: var(--blue-soft);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 2px -10px;
  border-bottom-color: transparent;
}

/* ---------- table ---------- */
.tk .ch-table caption {
  caption-side: bottom;
  text-align: left;
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 10px;
}
.tk .ch-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tk .ch-table tr.hl td {
  font-weight: 700;
  background: var(--blue-soft);
}
.tk .cell-bar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.tk .cell-bar i {
  display: inline-block;
  height: 8px;
  border-radius: 4px;
}
.tk .cell-bar i.up {
  background: var(--ch-amber);
}
.tk .cell-bar i.down {
  background: var(--green);
}

/* ---------- formula ---------- */
.tk .formula {
  font-family: var(--mono);
  font-size: 14.5px;
  background: var(--card);
  border: 1px dashed #c9d6ea;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 18px 0;
  overflow-x: auto;
}

/* ---------- Baltic charts ---------- */
.tk .ch-line.wide-r {
  padding-right: 128px;
}
.tk .ch-plot .grid.base {
  stroke: #b9c6d8;
  stroke-dasharray: 4 4;
}
.tk .ch-plot .stroke.thin {
  stroke-width: 2.25;
  opacity: 0.9;
}
.tk .ch-end {
  position: absolute;
  left: calc(100% + 12px);
  transform: translateY(-50%);
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  padding-left: 12px;
}
.tk .ch-end::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--c);
  transform: translateY(-50%);
}
.tk .ch-end b {
  font-family: var(--disp);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tk .ch-end.strong {
  font-weight: 700;
  color: var(--ink);
}
.tk .ch-end.strong b {
  color: var(--blue-d);
  font-size: 14px;
}
.tk .ch-base {
  position: absolute;
  left: 4px;
  transform: translateY(-120%);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  padding: 0 4px;
  border-radius: 4px;
}

/* dumbbell */
.tk .ch-db {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tk .db-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) 3.5rem;
  gap: 14px;
  align-items: center;
  padding: 4px 0;
}
.tk .db-row.hl {
  background: var(--blue-soft);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 -10px;
}
.tk .db-lab {
  font-weight: 700;
  font-size: 14px;
}
.tk .db-track {
  position: relative;
  height: 30px;
  margin-right: 70px;
}
.tk .db-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed var(--line);
}
.tk .db-line {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0.45;
}
.tk .db-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2.5px solid var(--c);
  background: var(--card);
}
.tk .db-dot.to {
  background: var(--c);
}
.tk .db-dot b {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--disp);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tk .db-dot i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.tk .db-delta {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--amber);
  text-align: right;
}
.tk .db-axis {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* stacked fleet age */
.tk .ch-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tk .st-row {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.tk .st-row.hl .st-lab b {
  color: var(--blue-d);
}
.tk .st-lab {
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
  line-height: 1.35;
  min-width: 0;
}
.tk .st-lab b {
  font-weight: 700;
}
.tk .st-lab span {
  font-size: 12.5px;
  color: var(--muted);
}
.tk .st-bar {
  display: flex;
  height: 26px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line-2);
}
.tk .st-row.hl .st-bar {
  box-shadow: 0 0 0 2px var(--blue);
}
.tk .st-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}
.tk .st-seg.young {
  background: var(--ch-young);
  color: #fff;
}
.tk .st-seg.mid {
  background: var(--ch-mid);
  color: var(--ink-2);
}
.tk .st-seg.old {
  background: var(--ch-amber);
  color: #fff;
}

/* Baltic KPI strip */
.tk .kpis.baltic .kpi .v small {
  margin-left: 2px;
}

@media (max-width: 640px) {
  .tk .ch {
    padding: 18px 16px 14px;
  }
  .tk .hb-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .tk .ch-plot {
    aspect-ratio: 4 / 3;
  }
  .tk .ch-x span:not(.major) {
    display: none;
  }
  .tk .col-area {
    height: 180px;
  }
  .tk .ch-line.wide-r {
    padding-right: 98px;
  }
  .tk .ch-end {
    font-size: 11px;
  }
  .tk .db-row,
  .tk .st-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .tk .db-row {
    grid-template-columns: minmax(0, 1fr) 3rem;
  }
  .tk .db-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
