/* ============================================================
   Meniu planuoklė
   Estetika: šviesus „popieriaus“ pultas + tamsus šviesos stalas
   ============================================================ */

:root {
  --paper: #f4f2ec;
  --paper-2: #ecead2;
  --paper-2: #eae7df;
  --paper-3: #e0dcd2;
  --ink: #191b19;
  --ink-soft: #62675f;
  --ink-faint: #969b92;
  --line: #d6d2c6;
  --line-soft: #e4e1d8;

  --canvas: #16181a;
  --canvas-2: #1d2023;
  --canvas-line: #2b2f33;
  --canvas-text: #b9bfc4;

  --green: #009b4e;
  --green-dark: #007c3f;
  --green-glow: rgba(0, 200, 105, .45);
  --green-soft: #dff0e6;
  --amber: #d99114;
  --amber-soft: #f8ecd4;
  --red: #d5493a;
  --red-soft: #f9e4e1;

  --font-ui: 'Archivo', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --r: 5px;
  --shadow-1: 0 1px 2px rgba(25, 27, 25, .07), 0 2px 8px rgba(25, 27, 25, .05);
  --shadow-2: 0 4px 10px rgba(25, 27, 25, .10), 0 12px 32px rgba(25, 27, 25, .12);
  --shadow-pop: 0 6px 16px rgba(0, 0, 0, .16), 0 20px 48px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  height: 100%;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(0, 155, 78, .22); }

.boot {
  display: grid; place-items: center; min-height: 60vh;
  color: var(--ink-faint); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
}

.mono { font-family: var(--font-mono); }

/* ---------- Viršutinė juosta ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px; height: 58px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; user-select: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px; background: var(--green);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; padding: 5px;
}
.brand-mark i { background: #fff; border-radius: 1.5px; }
.brand-mark i:nth-child(2) { opacity: .72; }
.brand-mark i:nth-child(3) { opacity: .72; }
.brand-mark i:nth-child(4) { opacity: .45; }
.brand-name { font-weight: 700; font-size: 13.5px; letter-spacing: .17em; text-transform: uppercase; }
.brand-name small { display: block; font-weight: 500; font-size: 9.5px; letter-spacing: .30em; color: var(--ink-faint); margin-top: 1px; }

.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  text-decoration: none; padding: 7px 13px; border-radius: var(--r);
  font-size: 13px; font-weight: 500; color: var(--ink-soft); letter-spacing: .02em;
}
.topnav a:hover { background: var(--paper-2); color: var(--ink); }
.topnav a.active { background: var(--ink); color: var(--paper); font-weight: 600; }
.topbar-spacer { flex: 1; }

/* ---------- Mygtukai ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r);
  background: #fff; border: 1px solid var(--line);
  font-weight: 600; font-size: 13.5px; letter-spacing: .01em;
  box-shadow: var(--shadow-1);
  transition: transform .08s ease, box-shadow .12s ease, background .12s;
  white-space: nowrap;
}
.btn:hover { background: #fbfaf7; box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { background: var(--green); border-color: var(--green-dark); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); box-shadow: none; }
.btn-danger { color: var(--red); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- Filtrų juosta ---------- */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 14px 22px; border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
}
.fgroup { display: flex; align-items: center; gap: 8px; }
.fgroup > label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 600;
}
.chips { display: flex; gap: 4px; }
.chip {
  padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  transition: all .1s ease;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.on.chip-green { background: var(--green); border-color: var(--green); color: #fff; }
.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 99px;
  padding: 7px 14px; min-width: 240px;
}
.search input { border: none; outline: none; background: none; width: 100%; font-size: 13.5px; }
.search svg { flex: none; color: var(--ink-faint); }

/* ---------- Maketų sąrašas ---------- */
.list-wrap { padding: 24px 22px 60px; flex: 1; }
.list-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.list-head h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.list-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.cards {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  overflow: hidden; cursor: pointer; position: relative;
  box-shadow: var(--shadow-1);
  transition: transform .14s ease, box-shadow .18s ease;
  animation: cardIn .28s ease backwards;
}
.card:nth-child(n) { animation-delay: calc(var(--i, 0) * 28ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(7px); } }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card-thumb {
  background: var(--canvas);
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 14px 14px;
  padding: 14px 12px; height: 128px;
  display: flex; align-items: flex-start; justify-content: center; gap: 4px; overflow: hidden;
}
.tcol { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tcol-title {
  font-family: var(--font-mono); font-size: 6.5px; letter-spacing: .08em; text-transform: uppercase;
  color: #7b828a; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  margin-bottom: 1px;
}
.tblock { background: var(--canvas-2); border: 1px solid var(--canvas-line); border-radius: 2px; overflow: hidden; position: relative; }
.tblock img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tblock.empty::after {
  content: ''; position: absolute; inset: 3px;
  border: 1px dashed #3a4046; border-radius: 1px;
}
.card-body { padding: 12px 14px 13px; }
.card-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.005em; margin-bottom: 5px; }
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
}
.dotsep { color: var(--line); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 2.5px 7px; border-radius: 3px;
}
.badge-draft { background: var(--paper-2); color: var(--ink-soft); }
.badge-approved { background: var(--green-soft); color: var(--green-dark); }
.badge-archived { background: var(--ink); color: var(--paper); opacity: .55; }
.badge-exception { background: var(--amber-soft); color: #9a6a0a; }
button.badge-exception { cursor: pointer; }
button.badge-exception:hover { filter: brightness(.95); }
.card-kebab {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 5px;
  display: grid; place-items: center;
  background: rgba(22, 24, 26, .55); color: #dfe3e6;
  opacity: 0; transition: opacity .12s;
  backdrop-filter: blur(4px);
}
.card:hover .card-kebab { opacity: 1; }
.card-kebab:hover { background: rgba(22, 24, 26, .8); }
.empty-state {
  padding: 80px 20px; text-align: center; color: var(--ink-faint);
}
.empty-state b { display: block; font-size: 15px; color: var(--ink-soft); margin-bottom: 6px; }

/* ---------- Kontekstinis meniu ---------- */
.menu {
  position: fixed; z-index: 300; min-width: 210px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 5px;
  animation: popIn .12s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(-3px); } }
.menu button {
  display: flex; width: 100%; text-align: left; gap: 9px; align-items: center;
  padding: 8px 11px; border-radius: 5px; font-size: 13.5px; font-weight: 500;
}
.menu button:hover { background: var(--paper-2); }
.menu button.danger { color: var(--red); }
.menu hr { border: none; border-top: 1px solid var(--line-soft); margin: 5px 4px; }

/* ---------- Redaktorius ---------- */
.editor { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.ed-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 58px; flex: none;
  background: var(--paper); border-bottom: 1px solid var(--line);
  z-index: 40;
}
.ed-back { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 13px; padding: 7px 10px; border-radius: var(--r); }
.ed-back:hover { background: var(--paper-2); color: var(--ink); }
.ed-name {
  font-weight: 700; font-size: 15.5px; letter-spacing: -.01em;
  border: 1px solid transparent; border-radius: var(--r);
  padding: 6px 9px; min-width: 120px; max-width: 340px;
  background: transparent; outline: none;
}
.ed-name:hover { border-color: var(--line); background: #fff; }
.ed-name:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(0,155,78,.14); }
.ed-tags { display: flex; align-items: center; gap: 6px; }
.ed-spacer { flex: 1; }
.save-ind {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--ink-faint); display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.save-ind.saving { color: var(--amber); }
.save-ind.saved { color: var(--green-dark); }
.save-ind.error { color: var(--red); }

.mode-switch {
  display: flex; background: var(--paper-3); border-radius: 99px; padding: 3px; gap: 2px;
}
.mode-switch button {
  padding: 5px 14px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.mode-switch button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

/* Statuso pasirinkimas */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; border-radius: 99px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.status-pill.approved .dot { background: var(--green); }
.status-pill.archived .dot { background: #888; }

/* Kanvas — šviesos stalas */
.ed-canvas {
  flex: 1; overflow: auto;
  background: var(--canvas);
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  padding: 26px 30px 60px;
  scrollbar-color: #3a4046 var(--canvas);
}
.ed-canvas::-webkit-scrollbar { height: 11px; width: 11px; }
.ed-canvas::-webkit-scrollbar-track { background: var(--canvas); }
.ed-canvas::-webkit-scrollbar-thumb { background: #33383d; border-radius: 6px; border: 2px solid var(--canvas); }

.grid-row { display: flex; align-items: flex-start; gap: 18px; width: max-content; min-width: 100%; }

.gcol { flex: none; display: flex; flex-direction: column; }
.gcol[data-ratio="16:9"] { width: 300px; }
.gcol[data-ratio="9:16"] { width: 172px; }
.gcol[data-ratio="1:1"] { width: 236px; }

.gcol-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 9px; padding: 0 2px; position: relative;
}
.gcol-grip {
  cursor: grab; color: #596066; padding: 4px 2px; border-radius: 4px;
  display: grid; place-items: center; flex: none;
}
.gcol-grip:hover { color: #9aa2a9; background: rgba(255,255,255,.06); }
.gcol-grip:active { cursor: grabbing; }
.gcol-title {
  flex: 1; min-width: 0;
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: #d7dce0; font-family: var(--font-ui); font-weight: 600; font-size: 12.5px;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 5px 7px; outline: none;
}
.gcol-title:hover { border-color: #343a40; }
.gcol-title:focus { border-color: var(--green); background: rgba(0,0,0,.35); box-shadow: 0 0 0 3px rgba(0,155,78,.18); }
.gcol-zone {
  flex: none; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .05em;
  color: #8b939a; background: rgba(255,255,255,.07); border: 1px solid #343a40;
  border-radius: 3px; padding: 3px 6px; cursor: pointer; white-space: nowrap;
}
.gcol-zone:hover { color: #cfd5da; border-color: #4a5157; }
.gcol-x {
  flex: none; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center;
  color: #6a7278; opacity: 0; transition: opacity .1s;
}
.gcol-head:hover .gcol-x { opacity: 1; }
.gcol-x:hover { background: rgba(213, 73, 58, .18); color: #ff8a7a; }

.gcol-blocks { display: flex; flex-direction: column; }

/* Blokas */
.gblock {
  position: relative; border-radius: 4px; overflow: hidden;
  background: var(--canvas-2); border: 1px solid var(--canvas-line);
  cursor: grab;
  transition: box-shadow .12s ease, border-color .12s ease, transform .1s ease;
}
.gblock:active { cursor: grabbing; }
.gblock[data-ratio="16:9"] { aspect-ratio: 16/9; }
.gblock[data-ratio="9:16"] { aspect-ratio: 9/16; }
.gblock[data-ratio="1:1"] { aspect-ratio: 1/1; }
.gblock img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.gblock:hover { border-color: #454c53; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.gblock.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(0, 190, 100, .35); }
.gblock.dragging { opacity: .35; }
.gblock.uploading::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(10, 12, 13, .55);
}
.gblock.uploading::before {
  content: ''; position: absolute; z-index: 2; top: calc(50% - 11px); left: calc(50% - 11px);
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.25); border-top-color: var(--green);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gblock.empty { cursor: pointer; }
.gblock.empty .ph {
  position: absolute; inset: 7px; border: 1.5px dashed #383f45; border-radius: 3px;
  display: grid; place-items: center; color: #4c545b;
  transition: border-color .12s, color .12s;
}
.gblock.empty:hover .ph { border-color: #586169; color: #79828a; }
.gblock.empty .ph svg { width: 22px; height: 22px; }

/* Žymės — rėmelis aplink bloką (geltona: padaryta korekcija, animatoriui) */
.gblock[data-marker] { outline: 3px solid transparent; outline-offset: 2px; }
.gblock[data-marker="red"] { outline-color: #e0503e; }
.gblock[data-marker="yellow"] { outline-color: #eab308; }
.gblock[data-marker="green"] { outline-color: #22c55e; }

/* Pasikartojantis klipas: raudonas rėmelis per kelis kadrus (dedamas automatiškai) */
.clip-run {
  position: relative; display: flex; flex-direction: column; gap: inherit;
  border: 3px solid #e0503e; border-radius: 8px; padding: 5px; margin: -8px;
}

/* Pastabos tekstas ant bloko (palyginimas: jungiklis „Pastabos“, PDF'e — visada) */
.gb-note-text {
  position: absolute; left: 6px; bottom: 6px; z-index: 2; max-width: calc(100% - 12px);
  display: none; font-size: 10.5px; line-height: 1.3; background: rgba(8,10,11,.85); color: #e6eaed;
  padding: 3px 7px; border-radius: 3px; pointer-events: none;
}
.show-notes .gb-note-text { display: block; }
.show-notes .gb-note { display: none; }
.gblock[data-marker="yellow"] .gb-note-text, .gblock[data-marker="yellow"] .pv-note-tag { background: #eab308; color: #1a1400; font-weight: 600; }

/* Bloko ženkliukai */
.gb-dur {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: rgba(8, 10, 11, .78); color: #cbd2d8;
  padding: 2px 6px; border-radius: 3px; pointer-events: none;
}
.gb-note {
  position: absolute; left: 6px; bottom: 6px; z-index: 2;
  width: 18px; height: 18px; border-radius: 3px;
  background: rgba(8, 10, 11, .78); color: #cbd2d8;
  display: grid; place-items: center; pointer-events: none;
}
.gb-warn {
  position: absolute; left: 6px; top: 6px; z-index: 2;
  width: 19px; height: 19px; border-radius: 3px;
  background: rgba(217, 145, 20, .92); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  pointer-events: none;
}
.gb-x {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 22px; height: 22px; border-radius: 4px;
  background: rgba(8, 10, 11, .72); color: #aeb6bd;
  display: grid; place-items: center; opacity: 0; transition: opacity .1s;
}
.gblock:hover .gb-x { opacity: 1; }
.gb-x:hover { background: var(--red); color: #fff; }

/* Tarpo indikatorius (drop) */
.gap {
  height: 10px; margin: 0; border-radius: 3px; position: relative;
  transition: height .12s ease, background .12s ease, margin .12s ease;
}
.gap.active, body.dnd-file .gap.hint { }
.gap.active {
  height: 20px; margin: 2px 0;
  background: linear-gradient(90deg, transparent, var(--green-glow), transparent);
}
.gap.active::after {
  content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 1.5px);
  height: 3px; border-radius: 2px; background: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}

/* Numetimas ant bloko — pakeisti */
.gblock.drop-target { border-color: var(--green); }
.gblock.drop-target::after {
  content: 'Pakeisti'; position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center;
  background: rgba(0, 122, 62, .55); backdrop-filter: blur(1.5px);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  border: 2px solid var(--green);
}

/* Pridėjimo zona stulpelio gale */
.gcol-add {
  margin-top: 8px; border: 1.5px dashed #33393f; border-radius: 4px;
  color: #565e65; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 8px; font-size: 12px; font-weight: 600; letter-spacing: .05em;
  cursor: pointer; transition: all .12s ease;
}
.gcol-add:hover { border-color: #4c545b; color: #939ba3; background: rgba(255,255,255,.03); }
.gcol-add.drop-target { border-color: var(--green); color: var(--green); background: rgba(0, 155, 78, .12); border-style: solid; }

/* Naujo stulpelio mygtukas */
.add-col {
  flex: none; width: 46px; border-radius: 6px;
  border: 1.5px dashed #33393f; color: #565e65;
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; cursor: pointer; transition: all .12s;
  writing-mode: vertical-rl; gap: 8px; font-weight: 600; font-size: 12px; letter-spacing: .12em;
  align-self: stretch;
}
.add-col:hover { border-color: #4c545b; color: #939ba3; background: rgba(255,255,255,.03); }

/* Stulpelio vilkimas */
.gcol.col-dragging { opacity: .35; }
.col-gap { flex: none; width: 6px; align-self: stretch; border-radius: 3px; transition: all .12s ease; }
.col-gap.active { width: 16px; background: linear-gradient(180deg, transparent, var(--green-glow), transparent); position: relative; }
.col-gap.active::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: calc(50% - 1.5px);
  width: 3px; border-radius: 2px; background: var(--green); box-shadow: 0 0 12px var(--green-glow);
}

/* ---------- Bloko savybių kortelė ---------- */
.popover {
  position: fixed; z-index: 320; width: 262px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 14px;
  animation: popIn .13s ease;
}
.popover h4 {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 10px;
}
.pop-row { margin-bottom: 11px; }
.pop-row label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.pop-row input[type="number"], .pop-row input[type="text"], .pop-row textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px;
  font-size: 13px; outline: none; background: var(--paper);
}
.pop-row input:focus, .pop-row textarea:focus { border-color: var(--green); background: #fff; }
.pop-row textarea { resize: vertical; min-height: 54px; }
.markers { display: flex; gap: 7px; }
.marker-dot {
  width: 26px; height: 26px; border-radius: 6px; border: 2px solid transparent;
  display: grid; place-items: center; transition: transform .1s;
}
.marker-dot:hover { transform: scale(1.12); }
.marker-dot span { width: 14px; height: 14px; border-radius: 4px; display: block; }
.marker-dot[data-m="none"] span { background: transparent; border: 1.5px dashed var(--ink-faint); border-radius: 4px; }
.marker-dot[data-m="red"] span { background: #e0503e; }
.marker-dot[data-m="yellow"] span { background: #eab308; }
.marker-dot[data-m="green"] span { background: #22c55e; }
.marker-dot.on { border-color: var(--ink); }
.pop-hint { font-size: 11px; line-height: 1.4; color: var(--ink-soft); margin-top: 7px; }
.pop-sub { font-weight: 400; color: var(--ink-faint); font-size: 10.5px; }
.dlg-hint { font-size: 11.5px; line-height: 1.4; color: var(--ink-soft); margin-top: 6px; }
/* Vaizdo komentaras kortelėje */
.img-comment {
  margin-top: 5px; font-size: 11.5px; line-height: 1.35; color: #5e4306; background: var(--amber-soft);
  border-radius: 4px; padding: 3px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-wide { width: 100%; justify-content: center; }
.apply-what { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 6px 0 14px; }
.am-list { display: flex; flex-direction: column; gap: 7px; }
.mk-dot { display: inline-block; width: 13px; height: 13px; border-radius: 3px; flex: none; }
.mk-dot[data-m="none"] { border: 1.5px dashed var(--ink-faint); }
.mk-dot[data-m="red"] { background: #e0503e; }
.mk-dot[data-m="yellow"] { background: #eab308; }
.mk-dot[data-m="green"] { background: #22c55e; }
.pop-file {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 10px;
}
.pop-warn {
  background: var(--amber-soft); color: #7d5708;
  border: 1px solid #ecd9a8; border-radius: 6px;
  font-size: 11.5px; line-height: 1.45;
  padding: 8px 10px; margin-bottom: 11px;
}
.pop-file a { color: var(--green-dark); }
.pop-actions { display: flex; gap: 7px; border-top: 1px solid var(--line-soft); padding-top: 11px; }

/* ---------- Istorijos stalčius ---------- */
.drawer-veil { position: fixed; inset: 0; z-index: 200; background: rgba(15, 17, 15, .28); animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210; width: 330px;
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0,0,0,.14);
  display: flex; flex-direction: column;
  animation: slideIn .2s cubic-bezier(.2, .8, .25, 1);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: .02em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.vitem {
  border: 1px solid var(--line-soft); background: #fff; border-radius: 8px;
  padding: 11px 12px; margin-bottom: 9px; cursor: pointer;
  transition: border-color .1s, box-shadow .12s;
}
.vitem:hover { border-color: var(--ink-faint); box-shadow: var(--shadow-1); }
.vitem-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.vitem-no { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--green-dark); }
.vitem-date { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); }
.vitem-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.vitem.current { border-color: var(--green); }
.vitem-badge { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; color: var(--green-dark); text-transform: uppercase; margin-left: auto; }

/* ---------- Modalai ---------- */
dialog {
  border: none; border-radius: 12px; padding: 0;
  margin: auto; /* centras vertikaliai ir horizontaliai (CSS reset'as panaikina UA numatytąjį) */
  box-shadow: var(--shadow-pop); background: var(--paper);
  max-width: min(92vw, 560px); width: 480px;
}
dialog::backdrop { background: rgba(15, 17, 15, .38); }
.dlg { padding: 22px 24px; }
.dlg h2 { font-size: 17px; font-weight: 700; margin-bottom: 18px; letter-spacing: -.01em; }
.dlg-row { margin-bottom: 16px; }
.dlg-row > label {
  display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px;
}
.dlg input[type="text"], .dlg input[type="number"], .dlg select {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 11px; font-size: 14px; outline: none; background: #fff;
}
.dlg input:focus, .dlg select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,155,78,.13); }
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.type-pick button {
  border: 1.5px solid var(--line); border-radius: 9px; background: #fff;
  padding: 13px 12px; text-align: left; transition: all .1s;
}
.type-pick button:hover { border-color: var(--ink-faint); }
.type-pick button.on { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(0,155,78,.12); }
.type-pick b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.type-pick small { color: var(--ink-soft); font-size: 11.5px; font-family: var(--font-mono); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.seg-custom { width: 74px !important; }

/* Versijos peržiūros modalas */
.vpreview { width: min(94vw, 1100px); max-width: 94vw; }
.vpreview .dlg { padding: 0; }
.vp-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.vp-head h2 { font-size: 15px; margin: 0; }
.vp-head .mono { font-size: 11px; color: var(--ink-soft); }
.vp-canvas {
  background: var(--canvas);
  background-image: radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 22px 22px;
  padding: 22px; overflow: auto; max-height: 62vh;
}
.vp-canvas .grid-row { zoom: .78; }

/* ---------- Peržiūros režimas ---------- */
.preview-page { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; }
.pv-bar {
  display: flex; align-items: center; gap: 14px; padding: 0 18px; height: 52px;
  background: rgba(22, 24, 26, .92); border-bottom: 1px solid var(--canvas-line);
  position: sticky; top: 0; z-index: 30; color: #c6ccd1;
}
.pv-bar .ed-back { color: #9aa2a9; }
.pv-bar .ed-back:hover { background: rgba(255,255,255,.07); color: #dfe3e6; }
.pv-title { font-weight: 700; font-size: 14.5px; color: #e8ebee; letter-spacing: .01em; }
.pv-meta { font-family: var(--font-mono); font-size: 10.5px; color: #7b838a; }
.pv-canvas {
  flex: 1; overflow: auto; padding: 34px 34px 70px;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px;
}
.gcol-title-static {
  text-align: center; color: #d7dce0; font-weight: 600; font-size: 12.5px;
  letter-spacing: .16em; text-transform: uppercase; margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-canvas .gblock { cursor: default; }
.pv-note-tag {
  position: absolute; left: 6px; bottom: 6px; z-index: 2; max-width: calc(100% - 12px);
  font-size: 10.5px; background: rgba(8,10,11,.82); color: #d6dbdf;
  padding: 3px 7px; border-radius: 3px;
}

/* ---------- Degalinės ---------- */
.stations-wrap { padding: 24px 22px 60px; }
.stations-wrap h1 { font-size: 19px; margin-bottom: 4px; }
.stations-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.sta-table { width: 100%; border-collapse: collapse; background: #fff; }
.sta-table-wrap { border-radius: 9px; overflow: clip; border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.sta-table th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--paper);
  position: sticky; top: 58px; z-index: 5;
}
.sta-table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: top; }
.sta-table tr:last-child td { border-bottom: none; }
.sta-table tr:hover td { background: #fbfaf7; }
.sta-plk { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.sta-seg { font-family: var(--font-mono); font-size: 12px; }
.sta-link { color: var(--green-dark); text-decoration: none; font-weight: 600; font-size: 12.5px; }
.sta-link:hover { text-decoration: underline; }
.sta-muted { color: var(--ink-faint); font-size: 12px; }
.sta-edit-input { border: 1px solid var(--line); border-radius: 4px; padding: 4px 7px; font-size: 12.5px; width: 100%; background: #fff; outline: none; }
.sta-edit-input:focus { border-color: var(--green); }
.sta-thumb {
  display: inline-flex; align-items: flex-end; gap: 2px;
  background: var(--canvas); border: 1px solid var(--canvas-line); border-radius: 5px;
  padding: 4px; margin-top: 5px; cursor: zoom-in;
  transition: box-shadow .12s, border-color .12s;
}
.sta-thumb:hover { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,155,78,.15); }
.sta-thumb .tblock { flex: none; }
.sta-assign { display: flex; align-items: center; gap: 5px; margin-top: 7px; }

/* ---------- Vaizdų biblioteka ---------- */
.img-sec { margin-bottom: 30px; }
.img-sec h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.img-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
.img-card {
  background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow-1);
  transition: transform .12s ease, box-shadow .16s ease;
}
.img-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.img-thumb {
  aspect-ratio: 1/1; background: var(--canvas);
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 14px 14px;
  display: grid; place-items: center; overflow: hidden;
}
.img-thumb[data-ratio="16:9"] { aspect-ratio: 16/9; }
.img-thumb[data-ratio="9:16"] { aspect-ratio: 9/16; }
/* Absoliutus pozicionavimas: procentinis aukštis tinklelio elemente neveikia, todėl stati vaizdai būdavo apkerpami */
.img-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.img-grid.portrait { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.img-grid + .img-grid { margin-top: 14px; }
.img-body { padding: 9px 11px 11px; }
.img-name {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px;
}
.img-stcount { color: var(--green-dark); font-weight: 700; }

/* Vaizdo keitimas bibliotekoje */
.img-thumb { position: relative; }
.img-replace {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 99px; background: rgba(255,255,255,.94); color: var(--ink);
  font-size: 11.5px; font-weight: 600; box-shadow: var(--shadow-1);
  opacity: 0; transform: translateY(-3px); transition: opacity .12s, transform .12s, background .1s;
}
.img-card:hover .img-replace, .img-replace:focus-visible { opacity: 1; transform: none; }
.img-replace:hover { background: var(--green); color: #fff; }
.img-replaced {
  margin-top: 5px; font-family: var(--font-mono); font-size: 10.5px; color: #9a6a0a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rp-dialog { width: 560px; }
.rp-compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-bottom: 14px; }
.rp-side { min-width: 0; text-align: center; }
.rp-thumb {
  aspect-ratio: 1/1; background: var(--canvas); border-radius: 8px;
  display: grid; place-items: center; overflow: hidden; margin-bottom: 7px;
}
.rp-thumb { position: relative; }
.rp-thumb[data-ratio="16:9"] { aspect-ratio: 16/9; }
.rp-thumb[data-ratio="9:16"] { aspect-ratio: 9/16; max-height: 260px; margin: 0 auto 7px; }
.rp-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.rp-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-dim { font-size: 10.5px; color: var(--ink-faint); }
.rp-arrow { font-size: 22px; color: var(--ink-faint); }
.rp-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
}
.rp-item input { accent-color: var(--green); width: 15px; height: 15px; flex: none; margin: 0; }
.rp-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-item b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-item .mono { font-size: 10.5px; color: var(--ink-soft); }
.rp-item-all { margin-bottom: 8px; background: var(--paper-2); border-color: transparent; }
.rp-list { max-height: 240px; }
.rp-note { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.rp-dialog .pop-warn { margin-bottom: 14px; }

/* Keitimų istorija (biblioteka) */
.aitem { cursor: default; }
.aitem:hover { border-color: var(--line-soft); box-shadow: none; }
.aitem.undone { opacity: .6; }
.aitem-desc { font-size: 13px; font-weight: 600; margin: 2px 0 4px; word-break: break-word; }
.aitem-badge-undone { color: var(--ink-faint); }
.rp-arrow-sm { color: var(--ink-faint); margin: 0 3px; }
.vitem-actions { display: flex; gap: 6px; margin-top: 9px; }
.drawer-note { font-size: 11.5px; color: var(--ink-faint); padding: 6px 2px; line-height: 1.45; }

/* ---------- Palyginimas ---------- */
.cmp-page { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; }
.cmp-canvas {
  flex: 1; overflow: auto; padding: 6px 28px 40px;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px;
  scrollbar-color: #3a4046 var(--canvas);
}
.cmp-sec { padding: 20px 0 14px; border-bottom: 1px solid #23272b; transition: box-shadow .1s; }
.cmp-sec:last-of-type { border-bottom: none; }
.cmp-sec.ins-top { box-shadow: inset 0 3px 0 var(--green); }
.cmp-sec.ins-bottom { box-shadow: inset 0 -3px 0 var(--green); }
.cmp-sec.col-dragging { opacity: .4; }
.cmp-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.cmp-grip {
  cursor: grab; color: #596066; padding: 4px 3px; border-radius: 4px;
  display: grid; place-items: center; flex: none;
}
.cmp-grip:hover { color: #9aa2a9; background: rgba(255,255,255,.06); }
.cmp-grip:active { cursor: grabbing; }
.cmp-name { color: #e8ebee; font-weight: 700; font-size: 14.5px; text-decoration: none; letter-spacing: .01em; }
.cmp-name:hover { text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; }
.cmp-meta { font-family: var(--font-mono); font-size: 10.5px; color: #7b838a; }
.cmp-x {
  flex: none; width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center;
  color: #6a7278; background: rgba(255,255,255,.04);
}
.cmp-x:hover { background: rgba(213, 73, 58, .2); color: #ff8a7a; }
.cmp-zoomwrap { width: max-content; min-width: 100%; }
.cmp-hint { padding: 16px 2px 0; }
.cmp-stations {
  margin-top: 12px; font-family: var(--font-mono); font-size: 10.5px; line-height: 2;
  color: #8b939a;
}
.cmp-st-label { letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-right: 6px; }
.cmp-st {
  display: inline-block; background: rgba(255,255,255,.05); border: 1px solid #2b2f33;
  border-radius: 4px; padding: 1px 8px; margin: 0 5px 5px 0; white-space: nowrap;
}
.cmp-st b { color: #c6ccd1; font-weight: 600; }
.cmp-st-none { color: #5b636a; }
.cmp-st.manual { border-color: var(--amber); border-style: dashed; }
.cmp-st-x {
  display: inline-grid; place-items: center; width: 14px; height: 14px;
  margin-left: 5px; border-radius: 3px; color: #8b939a; vertical-align: -2px;
}
.cmp-st-x:hover { background: rgba(213, 73, 58, .25); color: #ff8a7a; }
.cmp-st-add {
  display: inline-block; border: 1px dashed #3a4046; border-radius: 4px;
  padding: 1px 8px; margin: 0 5px 5px 0; color: #79828a;
  font-family: var(--font-mono); font-size: 10.5px;
}
.cmp-st-add:hover { border-color: var(--green); color: var(--green); }
.cmp-add-block.drop-target::after { content: 'Pridėti'; }
.cmp-col-grip { cursor: grab; }
.cmp-col-grip:hover { color: #f2f5f7; }
.cmp-col-grip:active { cursor: grabbing; }
.chip-dark { background: rgba(255,255,255,.06); border-color: #3a4046; color: #aab2b9; }
.chip-dark:hover { border-color: #4c545b; color: #dfe3e6; }
.chip.chip-dark.on { background: var(--green); border-color: var(--green); color: #fff; }
.ca-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.ca-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  transition: border-color .1s, box-shadow .12s;
}
.ca-item:hover { border-color: var(--green); box-shadow: var(--shadow-1); }
.ca-item b { font-size: 13.5px; }
.ca-item .mono { font-size: 10.5px; color: var(--ink-soft); }

/* ---------- Žymėjimo režimas (palyginimui) ---------- */
.selbar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 150;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper);
  border-radius: 99px; padding: 9px 10px 9px 20px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-pop);
  animation: toastIn .22s cubic-bezier(.2, .8, .25, 1);
}
.selbar[hidden] { display: none; }
.selbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.sel-check {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 700; font-size: 13px;
  display: none; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.card.sel .sel-check { display: grid; }
.card.sel { outline: 3px solid var(--green); outline-offset: -1px; }
body.selecting .card-kebab { display: none; }
body.selecting .card:hover { transform: none; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper);
  border-radius: 8px; padding: 10px 16px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-pop);
  animation: toastIn .22s cubic-bezier(.2, .8, .25, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }
.toast button { color: #6ee7a0; font-weight: 700; letter-spacing: .02em; }
.toast button:hover { text-decoration: underline; }
.toast.error { background: var(--red); }
.toast.error button { color: #fff; }

/* ---------- Naudojamų vaizdų sąrašas su komentarais (palyginimas: su „Pastabos“; PDF: pirmas lapas) ---------- */
.cmp-images { display: none; padding: 20px 0 16px; border-bottom: 1px solid #23272b; }
.show-notes .cmp-images { display: block; }
.cmp-images-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.cmp-images-head h2 { font-size: 14.5px; font-weight: 700; color: #e8ebee; letter-spacing: .01em; }
.cmp-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.cimg { background: #16181a; border: 1px solid #23272b; border-radius: 6px; padding: 8px; min-width: 0; }
.cimg.has-comment { border-color: #eab308; }
.cimg-thumb { position: relative; height: 84px; background: #0c0e0f; border-radius: 3px; overflow: hidden; }
.cimg-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cimg-name { font-family: var(--font-mono); font-size: 10px; color: #c6ccd1; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cimg-meta { font-family: var(--font-mono); font-size: 9.5px; color: #7b838a; margin-top: 2px; }
.cimg-comment { margin-top: 6px; font-size: 11.5px; line-height: 1.35; font-weight: 600; background: #eab308; color: #1a1400; border-radius: 4px; padding: 4px 7px; }

/* ---------- Vaizdų šoninė juosta palyginime ---------- */
.cmp-main { display: flex; flex: 1; min-height: 0; }
.cmp-main > .cmp-canvas { min-width: 0; }
.cmp-lib {
  flex: none; width: 304px; align-self: flex-start; position: sticky; top: 52px; height: calc(100vh - 52px);
  display: flex; flex-direction: column; background: #121416; border-left: 1px solid var(--canvas-line); color: #c6ccd1;
}
.cmp-lib[hidden] { display: none; }
.cmp-lib-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px 14px; }
.cmp-lib-head b { color: #e8ebee; font-size: 13.5px; letter-spacing: .01em; }
.cmp-lib-ic { width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; color: #8b939a; font-size: 15px; line-height: 1; }
.cmp-lib-ic:hover { background: rgba(255,255,255,.07); color: #e8ebee; }
.cmp-lib-q {
  margin: 0 12px 8px; background: #1d2023; border: 1px solid #2b2f33; border-radius: 6px; color: #e8ebee;
  padding: 7px 9px; font-size: 12.5px; outline: none; font-family: inherit;
}
.cmp-lib-q:focus { border-color: var(--green); }
.cmp-lib-q::placeholder { color: #6a7278; }
.cmp-lib-hint { margin: 0 14px 8px; font-size: 11px; line-height: 1.45; color: #7b838a; }
.cmp-lib-hint b { color: #aeb6bd; font-weight: 600; }
.cmp-lib-body {
  flex: 1; overflow-y: auto; padding: 0 12px 28px; scrollbar-color: #3a4046 #121416;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; align-content: start;
}
.cmp-lib-group { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #7b838a; margin: 14px 2px 6px; }
.cmp-lib-cat { border-top: 1px solid #23272b; min-width: 0; }
.cmp-lib-cat, .cmp-lib-group, .cmp-lib-empty { grid-column: 1 / -1; }
.cmp-lib-cat.single { grid-column: auto; }
.cmp-lib-cat.single .cmp-lib-grid { grid-template-columns: minmax(0, 1fr); }
.cmp-lib-cat > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 2px;
  font-size: 12px; font-weight: 600; color: #d7dce0; user-select: none;
}
.cmp-lib-cat > summary::-webkit-details-marker { display: none; }
.cmp-lib-cat > summary::before { content: '▸'; color: #6a7278; font-size: 10px; width: 10px; }
.cmp-lib-cat[open] > summary::before { content: '▾'; }
.cmp-lib-cat > summary b { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-lib-cat > summary span { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: #7b838a; flex: none; }
.cmp-lib-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 0 10px; }
.cmp-lib-grid[data-ratio="9:16"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cmp-lib-item { min-width: 0; cursor: grab; border-radius: 5px; padding: 3px; border: 1px solid transparent; }
.cmp-lib-item:hover { border-color: #3a4046; background: rgba(255,255,255,.04); }
.cmp-lib-item:active { cursor: grabbing; }
.cmp-lib-item.dragging { opacity: .4; }
.cmp-lib-thumb { position: relative; background: #0c0e0f; border-radius: 3px; overflow: hidden; }
.cmp-lib-thumb[data-ratio="1:1"] { aspect-ratio: 1/1; }
.cmp-lib-thumb[data-ratio="16:9"] { aspect-ratio: 16/9; }
.cmp-lib-thumb[data-ratio="9:16"] { aspect-ratio: 9/16; }
.cmp-lib-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.cmp-lib-cmt { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #eab308; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.cmp-lib-name { font-family: var(--font-mono); font-size: 9.5px; color: #8b939a; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-lib-empty { padding: 20px 4px; color: #7b838a; font-size: 12px; }
/* Velkant vaizdą iš bibliotekos stulpelių tarpai paryškinami – ten atsiras naujas stulpelis */
body.dnd-lib .cmp-canvas .col-gap { width: 12px; background: repeating-linear-gradient(180deg, rgba(0, 200, 105, .3) 0 6px, transparent 6px 12px); }
body.dnd-lib .cmp-canvas .col-gap.active { width: 18px; background: linear-gradient(180deg, transparent, var(--green-glow), transparent); }

/* ---------- Spauda / PDF eksportas (palyginimas) ---------- */
.print-head { display: none; }

@media print {
  /* Šviesus PDF: baltas fonas, tamsus tekstas */
  @page { size: A4 landscape; margin: 10mm; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  html, body { background: #fff !important; }

  /* Paslepiam visą aplikacijos chrome */
  .cmp-lib { display: none !important; }
  .cmp-main { display: block; }
  .pv-bar, .cmp-hint, .cmp-x, .cmp-grip, .gb-x, .gb-note, .gb-warn,
  .cmp-add-block, .cmp-canvas .col-gap, #toasts, .selbar, .menu, .popover, dialog { display: none !important; }

  .cmp-page { background: #fff; min-height: auto; display: block; }
  .cmp-canvas { overflow: visible; padding: 0; background: none !important; }

  .print-head {
    display: block;
    font-family: var(--font-mono); font-size: 10px; font-weight: 600;
    letter-spacing: .14em; text-transform: uppercase; color: #777;
    padding: 0 0 4mm;
  }

  /* Vienodas mastelis visiems maketams — plačiausias telpa į lapą */
  .cmp-zoomwrap { zoom: var(--print-zoom, 1) !important; }
}

/* Stačias lapas (jei naršyklė nepritaiko gulsčio automatiškai, pvz., Safari) */
@media print and (orientation: portrait) {
  .cmp-zoomwrap { zoom: calc(var(--print-zoom, 1) * 0.69) !important; }
}

@media print {

  .cmp-sec { border-bottom: 1px solid #e5e3dc; padding: 3mm 0 5mm; break-inside: avoid; }
  .cmp-sec:last-of-type { border-bottom: none; }
  .cmp-sec-head { margin-bottom: 8px; }
  .cmp-name { color: #111 !important; text-decoration: none !important; }
  /* PDF'e rodomas maketo pavadinimas be meta/ženkliukų; segmentų antraštės — trumpos, viena eilutė */
  .cmp-sec-head .cmp-meta, .cmp-sec-head .badge { display: none !important; }
  .gcol-title-static {
    color: #333 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 10px; letter-spacing: .06em; line-height: 1.4;
    margin-bottom: 5px;
  }

  .cmp-stations { color: #444 !important; break-inside: avoid; margin-top: 6px; line-height: 1.9; }
  .cmp-st { background: #f5f4f0; border-color: #ddd; }
  .cmp-st b { color: #111; }
  .cmp-st-label { color: #666; }

  /* Tarpai tarp blokų — be interaktyvių gap elementų */
  .gap { display: none !important; }
  .gblock {
    margin-bottom: 10px; break-inside: avoid;
    box-shadow: none; border: 1px solid #ddd; border-radius: 3px;
    background: #101214;
  }
  .gblock.empty { background: #fbfbfa; }
  /* Rėmeliai ir pastabos PDF'e: raudonas per kelis kadrus, geltonas aplink bloką, pastabos tekstas visada */
  .cmp-images { display: block !important; border: none; padding: 0 0 4mm; }
  .cmp-images::after { content: ''; display: block; height: 0; break-after: page; } /* maketai nuo antro lapo; break-after ant pačios sekcijos ar break-before ant maketo WebKit'e (Safari) įterpia tuščią lapą */
  .cmp-images-head h2 { color: #111 !important; }
  .cmp-images-head .cmp-meta { display: inline !important; }
  .cmp-images-grid { grid-template-columns: repeat(6, 1fr); gap: 7px; }
  .cimg { background: #fff; border-color: #ddd; break-inside: avoid; padding: 6px; }
  .cimg.has-comment { border: 2px solid #eab308; }
  .cimg-thumb { height: 62px; background: #101214; }
  .cimg-name { color: #333; }
  .cimg-meta { color: #666; }
  .clip-run { break-inside: avoid; margin-bottom: 2px; }
  .clip-run .gblock:last-child { margin-bottom: 0; }
  .gb-note-text { display: block !important; }
  .gblock.empty .ph { border-color: #d5d5d0; color: #c5c5c0; }
}

/* ---------- Smulkmenos ---------- */
.hint-bar {
  font-family: var(--font-mono); font-size: 10.5px; color: #5b636a; letter-spacing: .04em;
  padding: 10px 30px 0;
}
kbd {
  font-family: var(--font-mono); font-size: 10px; background: rgba(255,255,255,.08);
  border: 1px solid #343a40; border-radius: 3px; padding: 1px 5px; color: #9aa2a9;
}
.spin { animation: spin .7s linear infinite; }

/* ---------- Prisijungimas ---------- */
.login-page { flex: 1; display: grid; place-items: center; padding: 32px 16px; min-height: 100vh; }
.login-card {
  width: min(100%, 384px); background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 30px 30px 26px;
}
.login-brand { margin-bottom: 26px; }
.login-card h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 16px; }
.login-text { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: -8px 0 16px; }
.login-notice { font-size: 13px; background: var(--amber-soft); color: #5e4306; border-radius: 6px; padding: 8px 11px; margin-bottom: 14px; }
.login-field { display: block; margin-bottom: 14px; }
.login-field > span, .users-new-grid label > span:first-child {
  display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px;
}
.login-field em, .users-new-grid em { font-style: normal; font-weight: 400; letter-spacing: .04em; text-transform: none; }
.login-field input {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; font-size: 15px; outline: none; background: #fff;
}
.login-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,155,78,.13); }
.login-hint { font-size: 11.5px; color: var(--ink-soft); margin: -6px 0 14px; }
.login-err { font-size: 13px; line-height: 1.4; background: var(--red-soft); color: #9c2f23; border-radius: 6px; padding: 8px 11px; margin-bottom: 14px; }
.login-code { font-family: var(--font-mono); font-size: 12px; background: var(--paper-2); border-radius: 6px; padding: 10px 12px; overflow-x: auto; }
.login-card .btn-wide { padding: 11px 14px; font-size: 14.5px; margin-top: 4px; }

/* ---------- Vartotojo meniu ir vartotojų valdymas ---------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 240px;
  padding: 6px 10px; border-radius: var(--r); font-size: 13px; font-weight: 500; color: var(--ink-soft);
}
.user-chip:hover { background: var(--paper-2); color: var(--ink); }
.user-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-caret { font-size: 10px; color: var(--ink-faint); }
.badge-view { background: var(--amber-soft); color: #9a6a0a; white-space: nowrap; }
.dlg input[type="password"] {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 11px; font-size: 14px; outline: none; background: #fff;
}
.users-dialog { width: min(94vw, 660px); max-width: 94vw; }
.users-sub { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); margin: -8px 0 14px; }
.users-list { display: flex; flex-direction: column; gap: 6px; max-height: 36vh; overflow-y: auto; margin-bottom: 18px; }
.users-row {
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.users-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.users-who b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-who .mono { font-size: 10.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-row select { width: auto; flex: none; padding: 6px 8px; font-size: 13px; }
.users-row select[disabled] { opacity: .55; }
.users-nodel { width: 34px; flex: none; }
.users-new { border-top: 1px solid var(--line); padding-top: 16px; }
.users-new h3 { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; }
.users-new-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 14px; }
.users-pass { display: flex; gap: 6px; }
.users-pass input { flex: 1; min-width: 0; }
.users-created { font-size: 13px; line-height: 1.45; background: var(--green-soft); color: #0b5a31; border-radius: 8px; padding: 10px 12px; margin-bottom: 4px; }
.users-cred { margin: 7px 0 9px; font-size: 13px; color: var(--ink); background: #fff; border-radius: 5px; padding: 7px 9px; user-select: all; overflow-wrap: anywhere; }
.img-comment-full { white-space: normal; margin-top: 0; }
@media (max-width: 600px) {
  .users-new-grid { grid-template-columns: 1fr; }
  .users-row { flex-wrap: wrap; }
}

/* ---------- Rolė „Peržiūra“: palyginime blokai nevelkami ir nespaudžiami ---------- */
body.readonly .cmp-canvas .gblock, body.readonly .cmp-canvas .gblock:active, body.readonly .cmp-canvas .gblock.empty { cursor: default; }
body.readonly .cmp-canvas .gblock.empty:hover .ph { border-color: #383f45; color: #4c545b; }

/* ---------- Viršutinė juosta: nuorodos nelūžta; siaurame lange slepiamas pavadinimo tekstas ---------- */
.topnav a { white-space: nowrap; }
@media (max-width: 940px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .topbar .brand-name { display: none; }
}

/* ---------- Palyginimo juosta: paslėpti mygtukai; siaurame lange lūžta į antrą eilutę ---------- */
.pv-bar [hidden] { display: none !important; }
.cmp-page .pv-bar { height: auto; min-height: 52px; flex-wrap: wrap; gap: 8px 12px; padding: 8px 18px; }
.cmp-page .pv-bar > * { flex: none; white-space: nowrap; }
.cmp-page .pv-bar > .cmp-tools {
  flex: 0 1 auto; min-width: 0; margin-left: auto;
  display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 10px;
}
.cmp-lib { top: var(--cmp-bar-h, 52px); height: calc(100vh - var(--cmp-bar-h, 52px)); }

/* ---------- „Maketai ▾“: išskleidžiamas meniu (Videowall / Šviesdėžės) ---------- */
/* fonas — ant viso punkto (nuoroda + rodyklė), kad tarp jų nesimatytų siūlės */
.nav-dd { position: relative; display: inline-flex; align-items: stretch; border-radius: var(--r); }
.nav-dd > a, .nav-dd > a.active, .nav-dd > a:hover { background: transparent; padding-right: 5px; }
.nav-dd-caret { padding: 0 10px 0 4px; font-size: 9.5px; line-height: 1; color: var(--ink-faint); }
.nav-dd:hover, .nav-dd.open { background: var(--paper-2); }
.nav-dd:hover > a, .nav-dd.open > a, .nav-dd:hover > .nav-dd-caret, .nav-dd.open > .nav-dd-caret { color: var(--ink); }
.nav-dd.active { background: var(--ink); }
.nav-dd.active > a, .nav-dd.active > .nav-dd-caret { color: var(--paper); }
.nav-dd-menu {
  position: absolute; top: 100%; left: 0; padding-top: 6px; z-index: 60;
  visibility: hidden; opacity: 0; transition: opacity .1s ease, visibility 0s linear .1s;
}
.nav-dd:hover > .nav-dd-menu, .nav-dd:focus-within > .nav-dd-menu, .nav-dd.open > .nav-dd-menu {
  visibility: visible; opacity: 1; transition: opacity .1s ease .08s, visibility 0s linear .08s;
}
/* ką tik spustelėjus „Maketai“ meniu neiššoka, kol pelė nepasitraukia (rodyklė jį vis tiek atveria) */
.nav-dd.hold:not(.open) > .nav-dd-menu { visibility: hidden; opacity: 0; transition: none; }
.nav-dd-box {
  min-width: 176px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 5px;
}
.topnav .nav-dd-box a {
  display: block; padding: 8px 11px; border-radius: 5px;
  font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: 0;
}
.topnav .nav-dd-box a:hover { background: var(--paper-2); }

/* ---------- „Pridėti maketą į palyginimą“: paieška pagal degalinės PLK ---------- */
.ca-item .ca-st { color: var(--green-dark); }
.ca-item.ca-here { background: var(--paper-2); }
.cmp-sec { scroll-margin-top: calc(var(--cmp-bar-h, 52px) + 6px); }
@keyframes cmpFlash { 0%, 55% { background-color: rgba(0, 200, 105, .13); } 100% { background-color: transparent; } }
.cmp-sec.cmp-flash { animation: cmpFlash 2.2s ease-out; }

/* ---------- Maketo peržiūra: degalinės po maketu, vaizdų šoninė juosta, didesnis vaizdas ---------- */
.pv-main { display: flex; flex: 1; min-height: 0; }
.pv-main > .pv-canvas { min-width: 0; }
.pv-stations { margin-top: 28px; }
.cmp-lib.view-only .cmp-lib-item, .cmp-lib.view-only .cmp-lib-item:active { cursor: zoom-in; }
.img-view .vp-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-view .vp-head .mono { white-space: nowrap; }
.iv-comment { padding: 9px 18px; font-size: 13px; line-height: 1.4; color: #5e4306; background: var(--amber-soft); }
.iv-canvas { background: var(--canvas); padding: 18px; display: grid; place-items: center; border-radius: 0 0 12px 12px; }
.iv-canvas img { max-width: 100%; max-height: 72vh; object-fit: contain; display: block; }

/* ---------- Redaktorius: vaizdų šoninė juosta ---------- */
.ed-main { display: flex; flex: 1; min-height: 0; }
.ed-main > .ed-canvas { min-width: 0; }
.ed-main > .cmp-lib { position: static; height: auto; min-height: 0; align-self: stretch; }
body.dnd-lib .ed-canvas .col-gap { width: 12px; background: repeating-linear-gradient(180deg, rgba(0, 200, 105, .3) 0 6px, transparent 6px 12px); }
body.dnd-lib .ed-canvas .col-gap.active { width: 18px; background: linear-gradient(180deg, transparent, var(--green-glow), transparent); }

/* ---------- Redaktorius: priskirtos degalinės po maketu ---------- */
#ed-stations .cmp-stations { margin-top: 28px; }

/* ---------- Spaudos failai (PDF) prie vaizdo ---------- */
.img-print {
  margin-top: 5px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--green-dark);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.img-print.none { font-weight: 400; color: var(--ink-faint); }
/* Vaizdo langas: žemame ekrane traukiasi tik maketų sąrašas, antraštė, failai ir mygtukai lieka matomi */
.img-dlg { width: 540px; }
.img-dlg[open] { display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.img-dlg .dlg { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.img-dlg .dlg > * { flex: none; }
.img-dlg .dlg > .im-uses { flex: 0 1 auto; min-height: 132px; display: flex; flex-direction: column; margin-bottom: 0; }
.img-dlg .im-uses .ca-list { flex: 0 1 auto; min-height: 0; }
.pf-list { display: flex; flex-direction: column; gap: 6px; }
.pf-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 8px 10px 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.pf-item.missing { background: var(--red-soft); border-color: #ecc4be; }
.pf-fmt { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.pf-fmt b { font-size: 13.5px; }
.pf-fmt span { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.pf-sub {
  flex-basis: 100%; min-width: 0; display: flex; gap: 10px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
}
.pf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-meta { white-space: nowrap; }
.pf-del { padding: 5px 7px; }
.pf-del:hover { color: var(--red); }
.pf-del-ph { width: 28px; flex: none; }
.pf-missing { font-size: 11.5px; color: var(--red); white-space: nowrap; }
.pf-empty { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; }
.pf-tools { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.pf-tools .btn { flex: none; }
.pf-tools .dlg-hint { margin-top: 0; }
.pop-print { margin-top: -7px; }
.iv-files {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 9px 18px;
  border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft);
}
.iv-files > span:first-child { margin-right: 4px; }
.iv-files .mono { font-size: 10.5px; margin-right: 10px; }
