/* PRK Inventārs — "Shēma" (Preiļu robotikas kluba dizaina sistēma, resources/prk-design-system).
 *
 * Krāsas, atstarpes, rādiusi un fonts nāk no /prk/tokens.css. Šeit ir tikai lietotnes komponentes,
 * veidotas pēc sistēmas paraugiem: navy galvene ar shēmas līniju (izvēlne), kontūrpogas un pilnās
 * pogas, cilnes ar pasvītrojumu, skaitļi starp līnijām, gaišā kājene.
 *
 * Sistēmā nav krājumu statusa krāsu, tāpēc tās pievienotas zemāk (--st-*): klusinātas, katra
 * teksta un fona pāris ≥ 4.5:1. Zelts/sudrabs/bronza paliek tikai rezultātiem — šeit tos nelieto.
 */

:root {
  --font: var(--font-sans);

  /* krājumu statuss: teksts / fons / marķieris / atvilktnes tonis kartē un 3D */
  --st-full-ink: #1f6b43;   --st-full-bg: #e2f2e8;   --st-full: #2f9a5f;   --st-full-map: #9fdcb6;
  --st-low-ink: #7a4b00;    --st-low-bg: #fcefd6;    --st-low: #d18a12;    --st-low-map: #f5cd6b;
  --st-empty-ink: #a1261d;  --st-empty-bg: #fbe3e0;  --st-empty: #d0443a;  --st-empty-map: #f3a097;
  --st-unknown: #8a9bb0;
  --map-unfilled: #9fb0c2;  /* atvilktne bez satura */
  --map-match: #ffe27a;     /* meklēšanas atradums */

  /* ievades lauku kontūra: ≥ 3:1 pret card (tint-strong ir tikai dekoratīva, 1.3:1) */
  --line-input: #7b90a5;
  --backdrop: rgb(2 31 51 / 55%);
}

/* ---------- pamats ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--navy); }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.15; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 300; background: var(--solid); color: var(--on-solid); padding: 10px 16px; border-radius: var(--radius); font-weight: 700; }
.skip-link:focus { top: 8px; color: var(--on-solid); }

.prk-container { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- galvene: shēmas līnija ---------- */

.prk-header {
  position: relative; z-index: 30; padding-block: 20px; color: var(--bandink);
  background: radial-gradient(rgb(255 255 255 / 9%) 1px, transparent 1.5px) 0 0 / 18px 18px, var(--navy);
}
.prk-header :focus-visible { outline-color: var(--trace); }
.prk-header__inner { display: flex; align-items: flex-end; gap: 28px; }

.prk-brand { display: flex; align-items: center; gap: 18px; flex: none; color: inherit; }
.prk-brand:hover { color: inherit; }
.prk-logo { display: grid; justify-items: center; gap: 7px; color: inherit; }
.prk-logo svg { display: block; height: 46px; width: calc(46px * 250 / 108); }
.prk-logo small { font-size: 10px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--trace); line-height: 1; }
.prk-brand__app {
  align-self: stretch; display: flex; align-items: center; padding-left: 18px;
  border-left: 1px solid rgb(255 255 255 / 18%);
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: #fff;
}

.prk-nav { flex: 1; position: relative; }
.prk-nav__list { position: relative; display: flex; justify-content: flex-end; list-style: none; padding: 0; margin: 0; }
.prk-nav__list::before { content: ''; position: absolute; left: 0; right: 0; bottom: 10px; height: 2px; background: color-mix(in srgb, var(--trace) 50%, transparent); }
.prk-nav__list > li { position: relative; width: 132px; }
.prk-nav__list > li > a {
  display: grid; justify-items: center; gap: 12px; padding: 0; text-align: center;
  font-size: 14.5px; font-weight: 700; line-height: 1.2; color: var(--nav-ink); transition: color 0.15s;
}
.prk-nav__list > li > a::after {
  content: ''; position: relative; z-index: 1; width: 14px; height: 14px; margin-block: 4px; border-radius: 50%;
  background: var(--navy); box-shadow: inset 0 0 0 2px var(--trace); transition: background-color 0.15s, box-shadow 0.15s;
}
.prk-nav__list > li > a:hover { color: #fff; }
.prk-nav__list > li > a:hover::after { background: var(--trace); }
.prk-nav__list > li > a[aria-current='page'] { color: #fff; }
.prk-nav__list > li > a[aria-current='page']::after { background: var(--trace); box-shadow: 0 0 0 5px color-mix(in srgb, var(--trace) 24%, transparent); }

/* ---------- kājene ---------- */

.prk-footer { margin-top: clamp(40px, 6vw, 72px); background: var(--ftr); color: var(--ink-soft); }
.prk-footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding-block: 28px 20px; font-size: 14.5px; }
.prk-footer__inner p { max-width: 56ch; }
.prk-logo--footer { color: var(--navy); }
.prk-logo--footer svg { height: 36px; width: calc(36px * 250 / 108); }
.prk-footer__legal { padding-block: 14px 22px; border-top: 1px solid var(--tint-strong); }
.prk-footer__legal p { font-size: 13.5px; color: var(--ink-faint); }

/* ---------- lapas karkass ---------- */

.app { padding-block: clamp(24px, 4vw, 40px) 0; outline: none; }
.app.narrow { max-width: calc(var(--prose) + 2 * var(--gutter)); }

.page-head { display: grid; gap: 8px; margin-bottom: clamp(20px, 3vw, 28px); }
.page-title { font-size: clamp(28px, 3.6vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
.page-lead { max-width: 56ch; font-size: 17px; line-height: 1.6; color: var(--ink-soft); }
.eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); line-height: 1.4; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.section-title { font-size: 21px; font-weight: 800; }
.section-meta { font-size: 14px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: var(--space-16); }

.card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tint-strong) 70%, transparent); padding: 20px; }
.card--flush { padding: 0; overflow: hidden; }
.card-head { margin: 0; padding: 16px 20px 12px; border-bottom: 1px solid var(--tint-strong); }

.loading, .empty { color: var(--ink-soft); font-size: 16px; }
.loading { padding-block: 40px; text-align: center; }
.empty { padding: 28px 20px; text-align: center; }
.empty strong { display: block; margin-bottom: 4px; color: var(--navy); font-size: 18px; font-weight: 800; }

/* ---------- pogas: viena platuma, kontūra vai pilna ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: var(--btn-w); min-height: 3.2rem; padding: 12px 18px;
  border: 0; border-radius: var(--radius); background: var(--card); color: var(--navy);
  box-shadow: inset 0 0 0 1.5px var(--navy);
  font-size: 15px; font-weight: 700; line-height: 1.25; text-align: center; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--solid); color: var(--on-solid); }
.btn--solid { background: var(--solid); color: var(--on-solid); box-shadow: none; }
.btn--solid:hover { background: var(--accent); }
.btn--sm { min-width: 0; min-height: 2.5rem; padding: 8px 14px; font-size: 14px; }
.btn--danger { color: var(--st-empty-ink); box-shadow: inset 0 0 0 1.5px var(--st-empty-ink); }
.btn--danger:hover { background: var(--st-empty-ink); color: #fff; }
.btn--text { min-width: 0; min-height: 2.5rem; padding: 8px 10px; background: transparent; box-shadow: none; color: var(--accent); }
.btn--text:hover { background: var(--tint); color: var(--navy); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-8); }

.icon-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: var(--radius); background: var(--tint); color: var(--navy);
  transition: background-color 0.15s;
}
.icon-btn:hover { background: var(--tint-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.link-more { font-size: 15px; font-weight: 800; white-space: nowrap; }

/* ---------- formas ---------- */

.form { display: grid; gap: var(--space-16); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.field-hint { font-size: 14px; color: var(--ink-faint); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-16); }
.input,
.field input[type=text], .field input[type=number], .field input[type=search], .field select, .field textarea {
  width: 100%; min-height: 3rem; padding: 10px 14px;
  border: 1px solid var(--line-input); border-radius: var(--radius); background: var(--card); color: var(--ink);
  font-size: 16px; line-height: 1.4;
}
.field textarea { min-height: 5.5rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 1px; border-color: var(--violet); }
.field input[type=color] { width: 4.5rem; height: 3rem; padding: 4px; border: 1px solid var(--line-input); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.check-field { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--ink); cursor: pointer; }
.check-field input { width: 20px; height: 20px; accent-color: var(--navy); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-8); padding-top: 4px; }

/* ---------- krājumu statuss ---------- */

.status {
  display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 4px 11px 4px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.3; white-space: nowrap;
  background: var(--tint); color: var(--ink-soft);
}
.status i, .st-mark { display: block; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--st-unknown); }
.status--full { background: var(--st-full-bg); color: var(--st-full-ink); }
.status--low { background: var(--st-low-bg); color: var(--st-low-ink); }
.status--empty { background: var(--st-empty-bg); color: var(--st-empty-ink); }
.status--full i, .st-mark--full { background: var(--st-full); }
.status--low i, .st-mark--low { background: var(--st-low); }
.status--empty i, .st-mark--empty { background: var(--st-empty); }

.status-picker { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.status-picker button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 2.75rem; padding: 8px 14px;
  border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-input); font-size: 15px; font-weight: 700;
}
.status-picker button:hover { background: var(--tint); }
.status-picker button[aria-pressed='true'] { box-shadow: inset 0 0 0 2px var(--navy); background: var(--tint); color: var(--navy); }
.status-picker button[aria-pressed='true'][data-status-value='full'] { box-shadow: inset 0 0 0 2px var(--st-full-ink); background: var(--st-full-bg); color: var(--st-full-ink); }
.status-picker button[aria-pressed='true'][data-status-value='low'] { box-shadow: inset 0 0 0 2px var(--st-low-ink); background: var(--st-low-bg); color: var(--st-low-ink); }
.status-picker button[aria-pressed='true'][data-status-value='empty'] { box-shadow: inset 0 0 0 2px var(--st-empty-ink); background: var(--st-empty-bg); color: var(--st-empty-ink); }

/* ---------- atrašanās vietas kods, kategorijas ---------- */

.loc {
  display: inline-block; flex: none; padding: 5px 10px; border-radius: var(--radius);
  background: var(--tint); color: var(--navy);
  font-size: 14px; font-weight: 800; line-height: 1.3; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: var(--radius-pill);
  background: var(--tint); color: var(--ink-soft); font-size: 13px; font-weight: 700; line-height: 1.6;
}
.cat-chip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--st-unknown)); }
.swatch { width: 22px; height: 22px; flex: none; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); }

/* ---------- saraksti (rindas ar matlīnijām) ---------- */

.rows { display: grid; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; padding: 12px 20px; border: 0; border-top: 1px solid var(--tint-strong);
  background: transparent; text-align: left; color: inherit; font-size: 16px; line-height: 1.4;
  transition: background-color 0.15s;
}
.rows > .row:first-child { border-top: 0; }
button.row:hover, a.row:hover { background: var(--tint); color: inherit; }
.row__main { min-width: 0; }
.row__title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.row__title .val { color: var(--accent); }
.row__sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-size: 14px; color: var(--ink-soft); }
.row__end { display: flex; align-items: center; gap: 10px; }
.row__time { font-size: 13.5px; color: var(--ink-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- meklēšana ---------- */

.searchbar { position: relative; display: flex; align-items: center; }
.searchbar > svg { position: absolute; left: 16px; width: 20px; height: 20px; color: var(--ink-faint); pointer-events: none; }
.searchbar input {
  width: 100%; min-height: 3.5rem; padding: 12px 52px 12px 48px;
  border: 1px solid var(--line-input); border-radius: var(--radius-lg); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); font-size: 18px; outline: none;
}
.searchbar input::placeholder { color: var(--ink-faint); }
.searchbar input:focus-visible { outline: 3px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar .icon-btn { position: absolute; right: 8px; width: 38px; height: 38px; }
.search-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--ink-soft); }
.hint-chip {
  padding: 5px 12px; border: 0; border-radius: var(--radius-pill); background: var(--card); color: var(--navy);
  box-shadow: inset 0 0 0 1px var(--tint-strong); font-size: 14px; font-weight: 700;
}
.hint-chip:hover { background: var(--tint); }
.search-results { margin-top: var(--space-24); }

/* ---------- panelis ---------- */

.prk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: clamp(24px, 4vw, 40px); border-block: 1px solid var(--tint-strong); }
.prk-stats > div { display: grid; gap: 4px; align-content: start; padding: 22px 24px; border-left: 1px solid var(--tint-strong); }
.prk-stats > div:first-child { padding-left: 0; border-left: 0; }
.prk-stats b { font-size: clamp(32px, 4.6vw, 46px); font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--navy); font-variant-numeric: tabular-nums; }
.prk-stats b small { font-size: 0.45em; font-weight: 700; letter-spacing: 0; color: var(--ink-faint); }
.prk-stats span { font-size: 14px; color: var(--ink-soft); }
.dash-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-24); align-items: start; }

/* ---------- citi skapji: moduļa atvilktņu režģis ---------- */

.module-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.module-head .swatch { width: 14px; height: 36px; border-radius: 4px; }
.drawer-grid { display: grid; gap: 6px; }
.drawer-cell {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; min-height: 64px; padding: 8px 6px;
  border: 0; border-radius: var(--radius); background: var(--tint); color: var(--ink); text-align: center;
  box-shadow: inset 0 0 0 1px var(--tint-strong); transition: box-shadow 0.15s;
}
.drawer-cell:hover { box-shadow: inset 0 0 0 1.5px var(--navy); }
.drawer-cell.has { background: var(--card); }
.drawer-cell.st-full { background: var(--st-full-bg); }
.drawer-cell.st-low { background: var(--st-low-bg); }
.drawer-cell.st-empty { background: var(--st-empty-bg); }
.drawer-pos { font-size: 11px; font-weight: 700; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.drawer-label { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; font-weight: 800; line-height: 1.2; color: var(--navy); word-break: break-word; }
.count-chip { position: absolute; top: 4px; right: 4px; min-width: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; font-variant-numeric: tabular-nums; }

/* ---------- pārvaldīt ---------- */

.manage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; }
.manage-head h2 { font-size: 21px; font-weight: 800; }
.manage-head p { margin-top: 2px; font-size: 14px; color: var(--ink-soft); }
.manage-actions { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.manage-card .rows { border-top: 1px solid var(--tint-strong); }
.manage-card .row { grid-template-columns: auto minmax(0, 1fr) auto; }
.manage-foot { padding: 14px 20px 18px; border-top: 1px solid var(--tint-strong); }
.section-gap { margin-top: clamp(32px, 5vw, 48px); }
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; }

/* sākuma karte, kad skapju vēl nav: zīme 14 % navy uz tint */
.start { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(24px, 4vw, 48px); align-items: center; padding: clamp(24px, 4vw, 40px); }
.start__text { display: grid; gap: 14px; justify-items: start; }
.start__text h1 { font-size: clamp(28px, 3.6vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
.start__text p { max-width: 46ch; color: var(--ink-soft); }
.start__mark { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: var(--radius-xl); background: var(--tint); color: color-mix(in srgb, var(--navy) 14%, transparent); }
.start__mark svg { width: min(56%, 220px); height: auto; aspect-ratio: 250 / 108; }

/* ---------- modālais logs ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--backdrop); }
.modal {
  width: 100%; max-width: 620px; max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
  animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; background: var(--card); border-bottom: 1px solid var(--tint-strong); }
.modal-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.modal-head .eyebrow { margin-bottom: 6px; }
.modal-body { display: grid; gap: 20px; padding: 20px 24px 24px; }
.modal-section { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--tint-strong); }
.modal-section .section-title { font-size: 19px; }

.comp { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--tint); }
.comp.is-hl { box-shadow: inset 0 0 0 2px var(--accent); }
.comp__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.comp__name { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.comp__name .val { color: var(--accent); }
.comp__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; color: var(--ink-soft); }
.comp__notes { font-size: 14px; color: var(--ink-soft); }
.comp .btn-row { margin-top: 6px; }
.comp-form { display: grid; gap: var(--space-16); padding: 18px; border-radius: var(--radius-lg); background: var(--tint); box-shadow: inset 0 0 0 1.5px var(--tint-strong); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 200; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: var(--radius);
  background: var(--solid); color: var(--on-solid); box-shadow: var(--shadow-pop);
  font-size: 15px; font-weight: 700; animation: modal-in 0.15s ease-out;
}

/* ---------- rotējošais skapis: 3D + pušu karte ---------- */

.tower-layout { display: grid; gap: var(--space-24); }
.tower-main, .tower-side { min-width: 0; }
.tower-side { display: grid; gap: var(--space-16); align-content: start; }
.tower-side > div:empty { display: none; }
.tower-main .searchbar { margin-bottom: 12px; }

.tower-stage {
  position: relative; height: 56vh; min-height: 360px; max-height: 640px; overflow: hidden;
  border-radius: var(--radius-xl);
  background: radial-gradient(color-mix(in srgb, var(--navy) 14%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px, var(--tint);
  box-shadow: inset 0 0 0 1px var(--tint-strong);
}
.tower-stage .tower-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.tower-stage .tower-canvas.dragging { cursor: grabbing; }
.tower-stage .tower-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--violet); border-radius: var(--radius-xl); }
.tower-hint { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 1; margin: 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink-soft); pointer-events: none; transition: opacity 0.5s; }
.tower-hint.gone { opacity: 0; }
.hint-coarse { display: none; }
@media (pointer: coarse) { .hint-fine { display: none; } .hint-coarse { display: inline; } }
.tower-fallback { position: absolute; inset: 56px 24px auto; text-align: center; color: var(--ink-soft); font-size: 15px; }

/* pušu pogas: kvadrāti, pašreizējā aizpildīta (kā lapu numuri) */
.tower-faces { position: absolute; left: 12px; bottom: 12px; z-index: 1; display: flex; gap: 6px; }
.tower-zoom { position: absolute; right: 12px; bottom: 12px; z-index: 1; display: flex; flex-direction: column; gap: 6px; }
.tower-zoom svg { width: 18px; height: 18px; }
.tower-faces button, .tower-zoom button {
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius);
  background: var(--card); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy);
  font-size: 16px; font-weight: 800; transition: background-color 0.15s, color 0.15s;
}
.tower-faces button:hover, .tower-zoom button:hover { background: var(--tint); }
.tower-faces button[aria-pressed='true'] { background: var(--solid); color: var(--on-solid); box-shadow: none; }

/* krāsojuma cilnes: pasvītrojums virs līnijas */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--tint-strong); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  flex: none; margin-bottom: -2px; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none;
  font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--ink-soft); white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover, .tabs a:hover { color: var(--navy); border-bottom-color: var(--tint-strong); }
.tabs [aria-pressed='true'], .tabs [aria-current='page'] { color: var(--navy); border-bottom-color: var(--navy); }
.tower-under { display: grid; gap: 12px; margin-top: 14px; }
.tower-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ink-soft); }
.lg-item { display: inline-flex; align-items: center; gap: 7px; }
.lg-item i { display: block; width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgb(2 47 75 / 22%); }
.lg-item b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* meklēšanas rezultāti skapī */
.tower-results .rows { max-height: 300px; overflow-y: auto; }
.tower-results .row.is-sel { background: var(--tint); box-shadow: inset 3px 0 0 var(--navy); }
.tower-results .note { padding: 10px 20px 14px; font-size: 14px; color: var(--ink-faint); border-top: 1px solid var(--tint-strong); }

/* izvēlētā atvilktne */
.td-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.td-code { margin-top: 4px; font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; color: var(--navy); font-variant-numeric: tabular-nums; }
.td-where { margin-top: 6px; font-size: 15px; color: var(--ink-soft); }
.td-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 18px 0 12px; padding-top: 16px; border-top: 1px solid var(--tint-strong); }
.td-label-text { font-size: 20px; font-weight: 800; color: var(--navy); }
.td-label-text.is-none { font-size: 16px; font-weight: 600; color: var(--ink-faint); }
.td-missing { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--navy-deep); color: #fff; font-size: 15px; }
.td-comps { display: grid; gap: 8px; margin-bottom: 16px; }
.td-comps .comp { padding: 12px 14px; }
.td-empty { margin-bottom: 16px; font-size: 15px; color: var(--ink-soft); }
.td-notes { margin: -4px 0 16px; font-size: 15px; color: var(--ink-soft); }

/* 2D pušu karte: skapja korpuss navy, atvilktnes gaišas */
.face-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; }
.face-head h3 { font-size: 21px; font-weight: 800; }
.face-level { margin-top: 16px; }
.face-level-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.face-level-head b { color: var(--navy); font-weight: 800; font-variant-numeric: tabular-nums; }
.face-level-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.face-level-head small { font-size: 14px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.face-row { display: grid; grid-template-columns: minmax(0, 76fr) minmax(0, 24fr); gap: 5px; padding: 5px; border-radius: var(--radius); background: var(--navy); }
.face-row.rev { grid-template-columns: minmax(0, 24fr) minmax(0, 76fr); }
.face-row.rev .face-grid { order: 2; }
.face-panel { min-width: 0; border-radius: 4px; background: var(--navy-deep); }
.face-grid { display: grid; gap: 3px; padding: 3px; border-radius: 4px; background: color-mix(in srgb, var(--navy) 70%, var(--trace)); }
.fc {
  display: flex; align-items: center; justify-content: center; min-width: 0; height: 32px; padding: 0 2px; overflow: hidden;
  border: 0; border-radius: 3px; background: var(--map-unfilled); color: var(--ink);
  font-size: 10.5px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 -5px 0 rgb(255 255 255 / 45%);
}
.face-grid.size-L .fc { height: 46px; font-size: 11.5px; }
.fc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc:hover { filter: brightness(1.06); }
.fc.has { background: var(--card); }
.fc.st-full { background: var(--st-full-map); }
.fc.st-low { background: var(--st-low-map); }
.fc.st-empty { background: var(--st-empty-map); }
.fc.missing { background: var(--navy-deep); box-shadow: none; cursor: default; }
.fc.dim { opacity: 0.3; }
.fc.match { background: var(--map-match); opacity: 1; }
/* izvēlētā atvilktne: kā pašreizējās lapas "pēda" galvenē — aizpildīta trace krāsā ar oreolu */
.fc.sel { position: relative; z-index: 1; background: var(--trace); color: var(--navy); opacity: 1; outline: 2px solid #fff; outline-offset: -2px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--trace) 45%, transparent); }

/* ---------- platums ---------- */

@media (min-width: 1000px) {
  .tower-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 28px; }
  .tower-main { position: sticky; top: 20px; }
  .tower-stage { height: calc(100vh - 240px); min-height: 460px; max-height: 760px; }
  .fc { height: 34px; font-size: 11px; }
  .face-grid.size-L .fc { height: 52px; }
}

@media (max-width: 1000px) {
  :root { --btn-w: 100%; }
  .btn:not(.btn--sm):not(.btn--text) { min-width: 11.5rem; }
  .dash-cols { grid-template-columns: minmax(0, 1fr); gap: var(--space-16); }
}

/* telefons: logotips augšā, shēmas līnija ar četrām pēdām zem tā visā platumā */
@media (max-width: 900px) {
  .prk-header { padding-block: 14px 8px; }
  .prk-header__inner { flex-direction: column; align-items: stretch; gap: 14px; }
  .prk-logo svg { height: 34px; width: calc(34px * 250 / 108); }
  .prk-logo small { display: none; }
  .prk-brand { gap: 14px; }
  .prk-brand__app { padding-left: 14px; font-size: 19px; }
  .prk-nav__list { justify-content: space-between; }
  .prk-nav__list::before { left: 12.5%; right: 12.5%; }
  .prk-nav__list > li { flex: 1; width: auto; }
  .prk-nav__list > li > a { gap: 8px; padding-top: 2px; font-size: 14px; }
  .prk-nav__list > li > a::after { width: 16px; height: 16px; margin-block: 3px; }
  .prk-nav__list > li > a { min-height: 44px; }
}

@media (max-width: 760px) {
  .start { grid-template-columns: minmax(0, 1fr); }
  .start__mark { order: -1; aspect-ratio: 16 / 7; }
  .prk-stats > div { padding: 16px 12px; }
  .cat-form { grid-template-columns: minmax(0, 1fr) auto; }
  .cat-form .btn { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 92vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-head { padding: 18px 18px 14px; }
  .modal-head h2 { font-size: 22px; }
  .modal-body { padding: 18px 18px 22px; }
  .row { padding: 12px 16px; gap: 12px; }
  .card:not(.card--flush) { padding: 16px; }
  .manage-head, .manage-foot { padding-inline: 16px; }
  .card-head { padding-inline: 16px; }
  .btn-row > .btn:not(.btn--sm):not(.btn--text), .form-actions > .btn { flex: 1 1 auto; }
  .td-code { font-size: 26px; }
}

@media (max-width: 520px) {
  body { font-size: 16.5px; }
  .status-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.row--stack { grid-template-columns: minmax(0, 1fr) auto; }
  .row.row--stack .loc { grid-column: 1 / -1; justify-self: start; }
  .prk-stats span { font-size: 13px; }
}

@media (max-width: 380px) {
  .prk-nav__list > li > a { font-size: 13px; }
  .prk-brand__app { font-size: 17px; }
}
