/* PETRU darbo sistema — dirbtuvės estetika: faniera, riešutmedis, žalvaris */
:root {
  --paper: #E8E5DE;      /* šviesi faniera */
  --card: #FBFAF7;
  --ink: #211D1A;
  --walnut: #4A3020;     /* riešutmedis — pagrindinis tamsus */
  --brass: #A8802F;      /* žalvaris — akcentas, laiko juostos */
  --brass-soft: #C9A55A;
  --groove: #CBC6BB;     /* linijos */
  --ok: #2F7A46;
  --warn: #A63D2E;
  --radius: 10px;
  --font-display: 'Archivo', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }

.topbar {
  background: var(--walnut);
  color: #F3EDE3;
  padding: 14px 18px;
  display: flex; align-items: baseline; gap: 12px;
}
.topbar .brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: 0.04em; }
.topbar .sub { font-size: 13px; opacity: 0.75; }
.topbar a { color: var(--brass-soft); text-decoration: none; margin-left: auto; font-size: 14px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 18px 14px 60px; }
.wrap.narrow { max-width: 560px; }

.card {
  background: var(--card);
  border: 1px solid var(--groove);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 17px; margin-bottom: 10px; }

/* ---- role/name pickers ---- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick-grid button {
  background: var(--card); border: 1.5px solid var(--walnut); border-radius: var(--radius);
  padding: 20px 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--walnut);
}
.pick-grid button:active { background: var(--walnut); color: #F3EDE3; }

/* ---- calendar ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { font-size: 18px; text-transform: capitalize; }
.cal-head button { background: none; border: 1.5px solid var(--walnut); border-radius: 8px; width: 40px; height: 40px; font-size: 18px; color: var(--walnut); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-grid .dow { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #7a7266; padding: 4px 0; }
.day {
  background: var(--card); border: 1px solid var(--groove); border-radius: 8px;
  min-height: 58px; padding: 5px 5px 7px; position: relative; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
}
.day.blank { visibility: hidden; }
.day .num { font-family: var(--font-mono); font-size: 13px; }
.day.today .num { color: var(--brass); font-weight: 700; }
.day.has-work { border-color: var(--brass); }
/* valandų skiltis: dirbtų valandų skaičius dienos langelyje */
.day .hrs {
  font-family: var(--font-mono); font-size: 17px; font-weight: 600;
  color: var(--walnut); align-self: flex-end; line-height: 1;
}
/* Išsiųsta: tamsesnė linija tarp apdailos grupių (NAT / BLA / WHT) */
tr.grp-start td { border-top: 2px solid var(--walnut); }
/* Kaimas: mažesnės KPI kortelės apdailoms */
.kpi.small .v { font-size: 20px; }
.kpi.small .l { font-size: 11px; }
/* plati lentelė (Operacijos) slenka savo rėmelyje */
.table-wrap { overflow-x: auto; }
.table-wrap table input, .table-wrap table select { font-size: 13px; padding: 4px 6px; }
/* Skydelio įspėjimai */
.alerts { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alerts li { padding: 8px 12px; border-radius: 8px; border-left: 4px solid; font-size: 14px; }
.alerts .al-bad { background: #fde7e7; border-color: #a11a1a; }
.alerts .al-warn { background: #fff4d6; border-color: #8a5a00; }
/* stočių grafikas (Gantt) */
.gantt { overflow-x: auto; }
.g-row { display: grid; grid-template-columns: 170px 1fr; border-top: 1px solid var(--groove); }
.g-row:first-child { border-top: none; }
.g-name { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.g-lanes { position: relative; padding: 6px 0; min-width: 520px;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% - 1px), var(--groove) calc(100% - 1px), var(--groove) 100%); }
.g-lane { position: relative; height: 30px; margin: 3px 0; }
.g-bar { position: absolute; top: 0; height: 30px; border-radius: 6px; color: #F3EDE3; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; padding: 0 8px; box-sizing: border-box; font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.g-bar i { font-style: normal; font-weight: 600; }
.g-bar small { opacity: .8; font-family: var(--font-mono); font-size: 11px; }
.g-bar.warn { outline: 2px solid var(--warn); }
.g-empty { position: absolute; left: 8px; top: 7px; font-size: 12px; }
.g-axis .g-lanes { background-image: none; padding: 0; }
.g-axis .g-lane { height: 22px; }
.g-tick { position: absolute; top: 4px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 11px; color: #6b6458; }
/* darbo planavimas: įvesto laiko skaičiai po juosta */
.w-times { display: flex; gap: 10px; flex-wrap: wrap; margin: 3px 0 6px; font-family: var(--font-mono); font-size: 12px; color: #6b6458; }
/* diagnostikos būsenos ženkliukai */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.st-ok      { background: #e6f4ea; color: #1e6b34; }
.badge.st-warn    { background: #fff4d6; color: #8a5a00; }
.badge.st-bad     { background: #fde7e7; color: #a11a1a; }
.badge.st-error   { background: #fde7e7; color: #a11a1a; }
.badge.st-unknown { background: #eeeae3; color: #6b6458; }
/* ženklo jungiklis: telefonų skaičių klaviatūroje nėra minuso */
.sign-toggle { display: flex; gap: 6px; margin-bottom: 6px; }
.sign-toggle button {
  flex: 1; padding: 9px 0; border-radius: 8px; cursor: pointer;
  background: var(--card); border: 1px solid var(--groove);
  font-size: 13px; color: var(--walnut); font-weight: 600;
}
.sign-toggle button.active {
  background: var(--walnut); border-color: var(--walnut); color: #F3EDE3;
}
/* Užsakymas: tiekėjų stulpeliai su varnelėmis */
.sup-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px; margin: 12px 0;
}
.sup-col {
  border: 1px solid var(--groove); border-top: 5px solid var(--c);
  border-radius: 8px; background: #fff; padding: 8px 8px 6px;
}
.sup-col h3 {
  font-size: 14px; color: var(--c); margin: 0 0 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
/* sąrašas stulpelyje — žemas, netilpus atsiranda slinkties juosta */
.sup-list {
  max-height: 190px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--c) transparent; padding-right: 2px;
}
.sup-list::-webkit-scrollbar { width: 6px; }
.sup-list::-webkit-scrollbar-thumb { background: var(--c); border-radius: 3px; }
.sup-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.sup-item:hover { background: #F6F1E4; }
.sup-item.on { background: #F6F1E4; background: color-mix(in srgb, var(--c) 14%, #fff); font-weight: 600; }
.sup-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--c); flex: none; }
.sup-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sup-open { font-size: 11px; }
.sup-col { display: flex; flex-direction: column; }
.sup-item.extra .sup-name { font-style: italic; }
.o-link { color: #2F6FA8; font-weight: 600; text-decoration: none; white-space: nowrap; }
.o-link:hover { text-decoration: underline; }
/* vienkartinė prekė + nuoroda stulpelio apačioje */
.sup-new { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.sup-new input {
  width: 100%; padding: 8px 9px; font-family: inherit; font-size: 14px;
  border: 1.5px dashed var(--c); border-radius: 7px; background: #fff;
}
.sup-new input:focus { outline: none; border-style: solid; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.sup-new .sup-new-link { display: none; }
.sup-new.has .sup-new-link { display: block; }
.sup-new.has .sup-new-name { border-style: solid; background: #F6F1E4; background: color-mix(in srgb, var(--c) 10%, #fff); font-weight: 600; }
.sup-col-acts {
  display: flex; gap: 6px; margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--groove);
}
.sup-col-acts .st-btn { flex: 1; padding: 10px 6px; font-size: 14px; }
.st-btn.st0 { background: #C0392B; color: #fff; }
.st-trash { background: none; border: 1.5px solid var(--groove); color: var(--warn); font-size: 17px; padding: 8px 12px; }
.sup-col-acts .btn:disabled { opacity: .4; cursor: default; }/* kiekio langelis lentelėje su ženklo apvertimo mygtuku */
.qty-cell { display: inline-flex; gap: 4px; align-items: center; }
.qty-cell input { width: 78px; }
.qty-cell .flip {
  width: 30px; padding: 7px 0; border-radius: 7px; cursor: pointer; flex: none;
  background: var(--card); border: 1px solid var(--groove);
  font-family: var(--font-mono); font-size: 14px; color: var(--walnut);
}
.qty-cell .flip:hover { border-color: var(--brass); }
/* kelių dienų žymėjimas valandų kalendoriuje */
.multi-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 10px; }
.multi-bar #hMultiTools { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.day.sel { background: var(--walnut); border-color: var(--walnut); }
.day.sel .num, .day.sel .hrs { color: #F3EDE3; }
/* greiti valandų mygtukai telefone */
.quick-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.quick-row button {
  flex: 1 1 52px; padding: 9px 0; border-radius: 8px; cursor: pointer;
  background: var(--card); border: 1px solid var(--groove);
  font-family: var(--font-mono); font-size: 14px; color: var(--walnut);
}
.quick-row button:hover { border-color: var(--brass); }
/* firminis elementas: dienos laiko takelis 6–22 val. */
.track { height: 6px; border-radius: 3px; background: var(--groove); position: relative; overflow: hidden; }
.track span { position: absolute; top: 0; bottom: 0; background: var(--brass); }
.track.big { height: 14px; border-radius: 7px; margin: 8px 0 4px; }
.track-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: #8a8172; }

/* ---- day sheet ---- */
.sheet-bg { position: fixed; inset: 0; background: rgba(33,29,26,0.45); display: none; }
.sheet-bg.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--card);
  border-radius: 16px 16px 0 0; padding: 18px 16px 26px; max-height: 82vh; overflow-y: auto;
  border-top: 3px solid var(--brass);
}
.sheet h3 { font-size: 18px; margin-bottom: 4px; }
.iv-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.iv-row input[type="time"] { flex: 1; padding: 10px; border: 1px solid var(--groove); border-radius: 8px; background: #fff; }
.iv-row .del { background: none; border: none; color: var(--warn); font-size: 20px; padding: 4px 8px; }
.btn {
  display: inline-block; background: var(--walnut); color: #F3EDE3; border: none;
  border-radius: 8px; padding: 12px 18px; font-weight: 600; font-size: 15px;
}
.btn.brass { background: var(--brass); color: #241C0C; }
.btn.ghost { background: none; border: 1.5px solid var(--walnut); color: var(--walnut); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; text-align: center; }

.month-total { font-family: var(--font-mono); font-size: 14px; color: var(--walnut); margin-top: 10px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #F3EDE3; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast { z-index: 60; }

/* ---- Priminimai kampe ---- */
.remind { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.remind[hidden], .remind-panel[hidden] { display: none; }
.remind-btn {
  border: none; border-radius: 999px; padding: 11px 16px; min-width: 52px;
  font-size: 16px; font-weight: 700; cursor: pointer; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.remind-btn.rm-red { background: #C0392B; animation: rm-pulse 2s ease-in-out infinite; }
.remind-btn.rm-warn { background: #D9822B; }
.remind-btn.rm-ok { background: var(--ok); opacity: .85; padding: 9px 13px; font-size: 14px; }
@keyframes rm-pulse { 0%, 100% { box-shadow: 0 4px 14px rgba(192,57,43,.35); } 50% { box-shadow: 0 0 0 8px rgba(192,57,43,.18); } }
.remind-panel {
  width: min(340px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--groove); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 14px; font-size: 14px;
}
.rm-head { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--walnut); margin-bottom: 6px; }
.rm-sec { border-left: 4px solid var(--groove); padding: 6px 0 6px 10px; margin: 8px 0; border-radius: 2px; }
.rm-sec.rm-red { border-color: #C0392B; background: #FCEDEB; }
.rm-sec.rm-warn { border-color: #D9822B; background: #FDF2E6; }
.rm-title { font-weight: 700; margin-bottom: 4px; }
.rm-sup { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #7a7266; margin-top: 4px; }
.rm-items { padding-right: 6px; }
.rm-low { padding: 2px 6px 2px 0; }
.rm-low.bad b { color: #C0392B; }

/* ---- admin ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  background: none; border: 1.5px solid var(--walnut); color: var(--walnut);
  border-radius: 20px; padding: 8px 16px; font-size: 14px; font-weight: 600;
}
.tabs button.active { background: var(--walnut); color: #F3EDE3; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #7a7266; padding: 6px 8px; border-bottom: 2px solid var(--walnut); }
td { padding: 7px 8px; border-bottom: 1px solid var(--groove); }
td.num, th.num { text-align: right; font-family: var(--font-mono); }
td .neg { color: var(--warn); font-weight: 600; }
td .pos { color: var(--ok); }
.week-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.week-nav .label { font-family: var(--font-mono); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.form-grid label { font-size: 12px; color: #7a7266; display: block; margin-bottom: 3px; }
.form-grid input, .form-grid select { width: 100%; padding: 9px; border: 1px solid var(--groove); border-radius: 8px; background: #fff; }
.reco {
  border-left: 4px solid var(--brass); background: #F6F1E4; padding: 12px 14px;
  border-radius: 0 8px 8px 0; font-size: 15px; margin-top: 12px;
}
.reco.short { border-left-color: var(--warn); background: #F7EAE6; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius); padding: 12px; }
.kpi .v { font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.kpi .l { font-size: 12px; color: #7a7266; }
.muted { color: #8a8172; font-size: 13px; }
@media (max-width: 600px) {
  .day { min-height: 52px; }
  td, th { padding: 6px 5px; }
}

/* ---- Planas: savaičių apžvalga ---- */
.wk-list { display: flex; flex-direction: column; gap: 8px; }
.wk-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--groove);
  border-left: 4px solid var(--groove);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.08s;
}
.wk-row:hover { border-color: var(--brass-soft); border-left-color: var(--brass); }
.wk-row:active { transform: scale(0.995); }
.wk-row.current { border-left-color: var(--brass); background: #FDFBF4; }
.wk-row.past { opacity: 0.62; }
.wk-dates { font-family: var(--font-mono); font-size: 14px; color: var(--walnut); }
.wk-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #7a7266; margin-top: 2px;
}
.wk-nums { display: flex; gap: 18px; }
.wk-nums > div { text-align: right; }
.wk-v { display: block; font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--ink); }
.wk-l { display: block; font-size: 11px; color: #7a7266; }
.wk-badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.wk-badge.ok { background: #E4F0E7; color: var(--ok); }
.wk-badge.short { background: #F7EAE6; color: var(--warn); }
.wk-badge.empty { background: #EFEBE3; color: #8a8172; }

/* ---- Planas: produktų eilutės ---- */
.plan-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr 0.8fr auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--groove);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.plan-row label { font-size: 12px; color: #7a7266; display: block; margin-bottom: 3px; }
.plan-row select, .plan-row input {
  width: 100%; padding: 9px; border: 1px solid var(--groove);
  border-radius: 8px; background: #fff; font-family: inherit; font-size: 15px;
}
.plan-row .pr-x { display: flex; align-items: flex-end; }
.plan-row .pDel {
  padding: 9px 12px; line-height: 1; font-size: 18px;
  color: var(--warn); border-color: var(--groove);
}
.plan-row .pDel:hover { border-color: var(--warn); background: #F7EAE6; }

@media (max-width: 640px) {
  .wk-row { grid-template-columns: 1fr; gap: 8px; }
  .wk-nums { justify-content: space-between; gap: 8px; }
  .wk-nums > div { text-align: left; }
  .plan-row { grid-template-columns: 1fr 1fr; }
  .plan-row .pr-f:first-child { grid-column: 1 / -1; }
  .plan-row .pr-x { justify-content: flex-end; }
}

/* ---- Darbo planavimas: dienų juosta ---- */
.day-chips { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.day-chips .chip {
  flex: 1 1 0; min-width: 44px;
  background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius);
  padding: 8px 4px; text-align: center; cursor: pointer; line-height: 1.2;
}
.day-chips .chip:hover { border-color: var(--brass-soft); }
.day-chips .chip.today { border-color: var(--brass); }
.day-chips .chip.sel { background: var(--walnut); border-color: var(--walnut); color: #F3EDE3; }
.c-dow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; }
.c-day { display: block; font-family: var(--font-mono); font-size: 17px; font-weight: 600; }

/* ---- skaičiavimo užuomina po forma ---- */
.calc-hint {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px;
  background: #F6F1E4; border-left: 3px solid var(--brass);
  font-size: 14px; font-family: var(--font-mono); color: var(--walnut);
}

/* ---- darbuotojo kortelė ---- */
.w-card { border: 1px solid var(--groove); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
.w-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.w-name { font-weight: 600; font-size: 15px; }
.w-meta { font-size: 12px; color: #7a7266; }
.w-meta.assumed { font-style: italic; opacity: 0.8; }
.w-free { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--ok); }
.w-free.neg { color: var(--warn); font-weight: 600; }

.track {
  position: relative; height: 18px; margin: 8px 0;
  background: repeating-linear-gradient(90deg, var(--groove) 0 1px, transparent 1px 6.25%);
  border-radius: 4px; overflow: hidden;
}
.track .seg { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.track .seg.avail { background: var(--brass-soft); opacity: 0.35; }
.track .seg.task { background: var(--brass); opacity: 0.9; top: 4px; bottom: 4px; }
.track .seg.task.warn { background: var(--warn); }

.t-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 5px 0; border-top: 1px solid var(--groove); font-size: 14px;
}
.t-row.warn { color: var(--warn); }
.t-time { font-family: var(--font-mono); font-size: 13px; min-width: 92px; }
.t-name { font-weight: 600; }
.t-qty { color: #7a7266; font-size: 13px; }
.t-warn { font-size: 12px; }
.t-row .btn { margin-left: auto; }

/* ---- savaitės poreikio lentelė ---- */
tr.dem { cursor: pointer; }
tr.dem:hover td { background: #F6F1E4; }
tr.dem.done td { opacity: 0.5; }

@media (max-width: 640px) {
  .t-row { font-size: 13px; }
  .t-time { min-width: 80px; }
  .c-day { font-size: 15px; }
}

/* ---- trūkstamos valandos / laikas neįvestas ---- */
.day-sum {
  font-size: 14px; color: var(--walnut); padding: 8px 10px; margin-bottom: 10px;
  background: #F6F1E4; border-radius: 8px; border-left: 3px solid var(--brass);
}
.day-sum .neg { color: var(--warn); }
.w-meta.none { color: var(--warn); font-style: italic; }
.w-card.no-time { border-style: dashed; }
.kpi.bad { border-color: var(--warn); background: #F7EAE6; }
.kpi.bad .v { color: var(--warn); }
.wk-v.neg { color: var(--warn); }
tr.dim td { opacity: 0.55; }

/* ---- laisvai įvesta (nestandartinė) detalė ---- */
.tag-free {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px; margin-left: 4px;
  background: #EFEBE3; color: #7a7266; border: 1px solid var(--groove);
}

/* ---- Užsakymo eilutės veiksmai ---- */
.o-acts { white-space: nowrap; }
.o-acts .btn + .btn { margin-left: 6px; }
#ordTable tr.dirty td { background: #FFF4D6; }
.o-save-all { display: flex; justify-content: flex-end; margin-top: 10px; }
.o-save-all .btn:disabled { opacity: .45; cursor: default; }
.o-acts .oDel {
  background: none; border: 1.5px solid var(--groove); color: var(--warn);
}
.o-acts .oDel:hover { border-color: var(--warn); background: #F7EAE6; }

/* ---- Ekranas (gyvas cecho vaizdas) ---- */
.board-clock { margin-left: auto; margin-right: 14px; font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--brass); }
.board-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
/* Ekranas: kuo tankiau — rodoma cecho ekrane */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.day-chips.compact { margin-bottom: 8px; gap: 4px; }
.day-chips.compact .chip { padding: 4px 8px; min-width: 44px; }
.b-card { padding: 8px 10px !important; }
.b-worker { margin-bottom: 4px !important; }
.b-label { margin: 6px 0 2px !important; }
.b-up-row { padding: 2px 0 !important; }
.b-now { padding: 2px 0 0 !important; }
.b-card {
  background: var(--card); border: 1px solid var(--groove); border-left: 6px solid var(--groove);
  border-radius: var(--radius); padding: 16px 18px;
}
.b-card.rank0 { border-left-color: var(--brass); box-shadow: 0 2px 10px rgba(74,48,32,0.08); }
.b-card.rank1 { border-left-color: var(--ok); }
.b-card.rank2 { opacity: 0.85; }
.b-card.rank3 { opacity: 0.55; }
.b-worker {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; margin-bottom: 10px;
}
.b-chip {
  font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.b-chip.work { background: var(--brass); color: #FBFAF7; }
.b-chip.wait { background: #EFEBE3; color: #7a7266; border: 1px solid var(--groove); }
.b-chip.done { background: #E4F0E7; color: var(--ok); }
.b-var { font-size: 13px; color: #7a7266; font-weight: 400; }

.b-now { padding: 4px 0 2px; }
.b-now.dim { opacity: 0.75; }
.b-now-task { font-weight: 700; font-size: 20px; line-height: 1.25; }
.b-now-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.b-now-time { font-family: var(--font-mono); font-size: 17px; color: var(--walnut); }
.b-now-units { font-family: var(--font-mono); font-size: 17px; font-weight: 600; }
.b-bar { height: 10px; background: var(--groove); border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
.b-bar span { display: block; height: 100%; background: var(--brass); border-radius: 5px; }
.b-progress { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 13px; color: var(--walnut); }

.b-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #7a7266; margin: 12px 0 4px; }
.b-up-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0; border-top: 1px solid var(--groove); font-size: 14px;
}
.b-up-time { font-family: var(--font-mono); font-size: 13px; color: var(--brass); min-width: 44px; }
.b-up-name { font-weight: 600; flex: 1; }
.b-up-qty { font-family: var(--font-mono); font-size: 13px; color: #7a7266; white-space: nowrap; }

.b-done { color: var(--ok); font-weight: 600; font-size: 16px; padding: 8px 0; }
.b-none { color: #8a8172; padding: 8px 0; }
.b-donecount { font-size: 12px; color: #7a7266; margin-top: 10px; border-top: 1px solid var(--groove); padding-top: 6px; }

@media (min-width: 1400px) {
  .board-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  .b-worker { font-size: 26px; }
  .b-now-task { font-size: 24px; }
}

/* ---- Ekranas: faktas iš įrenginio ---- */
.b-chip.idle { background: #F7EAE6; color: var(--warn); border: 1px solid var(--warn); }
.b-planline { font-size: 13px; color: #7a7266; margin-top: 6px; }
.b-planline b { color: var(--walnut); }
.b-planline.off { color: var(--warn); }
.b-up-row.done-row { opacity: 0.8; }
.b-up-row.done-row .b-up-time { color: var(--ok); }

/* ---- prisijungimas ---- */
.login-card { max-width: 420px; margin: 40px auto; }
.login-card label { font-size: 12px; color: #7a7266; display: block; margin: 14px 0 4px; }
.login-card input {
  width: 100%; padding: 12px; border: 1px solid var(--groove); border-radius: 8px;
  background: #fff; font-family: inherit; font-size: 17px;
}
.login-err { color: var(--warn); font-size: 14px; min-height: 20px; margin-top: 8px; }
.topbar .logout { margin-left: 12px; }

/* ---- Mobilus Valdymas ---- */
/* Plačios lentelės slenka horizontaliai savo konteineryje, o ne tempia puslapį */
#invTable, #ordTable, #weekDemand, #storageTable, #stTable, #prodTable,
#planResult, #allocTable, #wTable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#invTable table, #ordTable table, #weekDemand table, #storageTable table,
#stTable table, #prodTable table, #planResult table { min-width: 480px; }

@media (max-width: 600px) {
  .wrap { padding: 12px 8px 50px; }
  .card { padding: 12px 10px; }
  .card h2 { font-size: 15px; }
  .tabs { gap: 4px; }
  .tabs button { padding: 7px 11px; font-size: 12.5px; border-radius: 16px; }
  .topbar { padding-left: 10px; padding-right: 10px; }

  /* Formos telefone — 2 stulpeliai, mygtukas per visą plotį */
  .form-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .form-grid .btn { grid-column: 1 / -1; }
  .form-grid input, .form-grid select { padding: 10px 8px; font-size: 16px; } /* 16px — iOS nepriartina */

  .week-nav { flex-wrap: wrap; gap: 6px; }
  .week-nav .label { font-size: 12.5px; }
  .calc-hint { font-size: 12.5px; }

  .kpis { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .kpi { padding: 8px; }
  .kpi .v { font-size: 18px; }
  .kpi .l { font-size: 10.5px; }

  .wk-nums { gap: 10px; }
  .wk-v { font-size: 14px; }

  .o-acts { white-space: normal; }
  .o-acts .btn { display: block; width: 100%; margin: 3px 0; }
  .o-acts .btn + .btn { margin-left: 0; }

  .t-row .t-warn { flex-basis: 100%; }
  .day-sum { font-size: 12.5px; }
}

/* ---- Kaimas ---- */
tr.cur td { background: #F6F1E4; font-weight: 600; }

/* ---- darbuotojų sąrašo eilutė ---- */
.roster-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end;
  padding: 10px; background: var(--card); border: 1px solid var(--groove);
  border-radius: var(--radius); margin-bottom: 8px;
}
.roster-row label { font-size: 11px; color: #7a7266; display: block; margin-bottom: 3px; }
.roster-row input, .roster-row select {
  width: 100%; padding: 8px; border: 1px solid var(--groove);
  border-radius: 8px; background: #fff; font-family: inherit; font-size: 14px;
}
@media (max-width: 900px) { .roster-row { grid-template-columns: repeat(2, 1fr); } }

/* ---- „Slėpti nebedirbančius" jungiklis ---- */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 14px; cursor: pointer; user-select: none;
}
.switch input { width: 18px; height: 18px; accent-color: var(--walnut); cursor: pointer; }
.switch-count { font-size: 12px; color: #7a7266; font-family: var(--font-mono); }
.row-hidden { display: none !important; }
.row-inactive { opacity: 0.65; border-left: 3px solid var(--groove); }

/* ---- statistikos posekcijos ---- */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtabs button {
  background: none; border: 1px solid var(--groove); color: #7a7266;
  border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600;
}
.subtabs button.active { background: var(--brass-soft); border-color: var(--brass); color: var(--ink); }
tr.sum-row td { border-top: 2px solid var(--walnut); background: #F6F1E4; }

/* ---- statistikos lentelė: kaip Google Sheets ---- */
#stTableBox {
  max-height: 72vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--groove);
  border-radius: 8px;
}
#stTableBox table { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
#stTableBox th, #stTableBox td {
  border-right: 1px solid #E2E0DA; border-bottom: 1px solid #E2E0DA;
  padding: 5px 9px; white-space: nowrap;
}
/* užšaldyta viršutinė eilutė */
#stTableBox thead th {
  position: sticky; top: 0; z-index: 2;
  background: #DCE6F1; color: var(--ink);
  font-size: 11px; text-transform: none; letter-spacing: 0;
  border-bottom: 2px solid #9EB6CE; white-space: normal; min-width: 62px;
}
#stTableBox thead tr.sub-head th { top: 34px; background: #E8EEF6; }
/* užšaldytas pirmas stulpelis */
#stTableBox .sticky-col { position: sticky; left: 0; z-index: 3; }
#stTableBox thead th.sticky-col { z-index: 4; }
#stTableBox td.sticky-col {
  background: #EEF3F8; font-family: var(--font-mono); font-weight: 600;
  border-right: 2px solid #9EB6CE;
}
/* spalvų grupės — tos pačios kaip lape */
#stTableBox td.g-worker { background: #F7FAFD; }
#stTableBox td.g-total  { background: #E8F5E9; font-weight: 600; }
#stTableBox td.g-qty    { background: #F3E8FF; }
#stTableBox td.g-std    { background: #FFF3CD; }
#stTableBox td.g-eff    { background: #E3F2FD; }
#stTableBox td.g-dev    { background: #FCE4EC; }
#stTableBox td.g-act    { background: #FFF7ED; }
#stTableBox td.g-wk-a   { background: #F7FAFD; }
#stTableBox td.g-wk-b   { background: #FAFAFA; }
#stTableBox th.g-total  { background: #CDE8D2; }
#stTableBox th.g-qty    { background: #E4CFF7; }
#stTableBox th.g-std    { background: #F3E2A8; }
#stTableBox th.g-eff    { background: #C5E2F7; }
#stTableBox th.g-dev    { background: #F5CBDA; }
#stTableBox th.g-act    { background: #F7E2C8; }
/* vertikali linija po visų vardų */
#stTableBox .g-sep { border-right: 2px solid var(--walnut) !important; }
#stTableBox tbody tr:hover td { filter: brightness(0.96); }

/* ---- platesnis vaizdas dideliuose ekranuose ---- */
@media (min-width: 1250px) { .wrap { max-width: 1200px; } }
@media (min-width: 1500px) { .wrap { max-width: 1440px; } }
@media (min-width: 1800px) { .wrap { max-width: 1700px; } }
/* Statistika naudoja visą turimą plotį */
@media (min-width: 1250px) {
  #tab-stats { margin-left: calc((100% - min(96vw, 1900px)) / 2); width: min(96vw, 1900px); }
}

/* ---- plano partijos (eilė = prioritetas) ---- */
.batch-row { grid-template-columns: 28px 2fr 1.4fr 0.8fr auto; }
.pr-n { display: flex; align-items: center; justify-content: center; }
.batch-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--walnut); color: #F3EDE3;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
}
.batch-row .pr-x { display: flex; gap: 3px; align-items: flex-end; }
.batch-row .pUp, .batch-row .pDown { padding: 8px 7px; line-height: 1; }
@media (max-width: 640px) {
  .batch-row { grid-template-columns: 28px 1fr 1fr; }
  .batch-row .pr-f:nth-of-type(1) { grid-column: 2 / -1; }
  .batch-row .pr-x { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---- Ekranas: cecho ekranui — juodos raidės, didesnis šriftas (vardo dydis paliktas) ---- */
body.board .b-card, body.board .b-card * { color: #000; }
body.board .b-card.rank2 { opacity: 1; }
body.board .b-card.rank3 { opacity: 0.8; }
body.board .b-now.dim { opacity: 1; }
body.board .b-up-row.done-row { opacity: 1; }
body.board .b-chip.work { color: #FFF; }
body.board .b-chip.wait { background: #E4DFD4; border-color: #000; }
body.board .b-chip.idle { background: #F3DDD7; }
body.board .b-chip.done { background: #D6E9DB; }
body.board .board-head { font-size: 17px; color: #000; }
body.board .board-head .muted { color: #000; }
body.board .b-chip { font-size: 13px; }
body.board .b-var { font-size: 16px; }
body.board .b-now-task { font-size: 24px; }
body.board .b-now-time, body.board .b-now-units { font-size: 20px; }
body.board .b-progress { font-size: 16px; }
body.board .b-planline { font-size: 16px; }
body.board .b-label { font-size: 14px; }
body.board .b-up-row { font-size: 18px; }
body.board .b-up-time, body.board .b-up-qty { font-size: 16px; min-width: 50px; }
body.board .b-done { font-size: 18px; }
body.board .b-none { font-size: 18px; }
body.board .b-bar { height: 12px; }
@media (min-width: 1400px) {
  body.board .b-now-task { font-size: 27px; }
  body.board .b-up-row { font-size: 20px; }
  body.board .b-up-time, body.board .b-up-qty { font-size: 18px; }
}

/* ---- Telefonas: lentelės kaip kortelės (Darbo planavimas) ir slinkimas kitoms ---- */
.t-batch { display: none; }                      /* partija telefone rodoma pavadinimo priekyje, kompiuteryje — savo stulpelyje */
@media (max-width: 640px) {
  .t-cards, .t-cards tbody, .t-cards tr, .t-cards td { display: block; }
  .t-cards tr.t-head { display: none; }
  .t-cards tr {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px;
    background: var(--card); border: 1px solid var(--groove); border-left: 4px solid var(--groove);
    border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px;
  }
  .t-cards tr.grp-start { border-top: 1px solid var(--groove); margin-top: 14px; }
  .t-cards tr.done { opacity: 0.6; }
  .t-cards td { border: 0 !important; padding: 0; text-align: left !important; font-family: var(--font-body); font-size: 14px; min-width: 0; }
  .t-cards td.num { font-family: var(--font-mono); }
  .t-cards td::before { content: attr(data-l); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #7a7266; margin-bottom: 1px; }
  .t-cards td:not([data-l])::before, .t-cards td[data-l=""]::before { display: none; }
  .t-cards td.t-title { grid-column: 1 / -1; font-size: 15px; font-weight: 600; padding-bottom: 2px; border-bottom: 1px dashed var(--groove) !important; }
  .t-cards td.t-wide { grid-column: 1 / -1; }
  .t-cards td.t-hide { display: none; }
  .t-cards td .qty-cell input { width: 64px; }
  .t-batch { display: inline; }

  /* Kitos lentelės telefone — slenkamos į šoną, o ne laužomos */
  .card table:not(.t-cards) { display: block; overflow-x: auto; max-width: 100%; }
  .card table:not(.t-cards) th, .card table:not(.t-cards) td { white-space: nowrap; }

  /* Grafikas: siauresnis stoties stulpelis */
  .g-row { grid-template-columns: 96px 1fr; }
  .g-name { font-size: 12px; padding: 8px 6px; }
}

/* ---- Užšaldyta antraštė + pirmas stulpelis (Likučiai): lentelė slenka savo dėžėje, kad sticky veiktų ir telefone ---- */
.stick-wrap { overflow: auto; max-height: 75vh; max-width: 100%; border: 1px solid var(--groove); border-radius: var(--radius); }
.stick-wrap table { width: auto; min-width: 100%; }
.stick-wrap thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -2px 0 var(--walnut); border-bottom: 0; white-space: nowrap; }
.stick-wrap .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--card); border-right: 2px solid var(--groove); white-space: nowrap; }
.stick-wrap thead th.sticky-col { z-index: 3; }
.stick-wrap tr.grp-start td { border-top: 2px solid var(--walnut); }
/* Likučiai: sumų eilutės (grupė / produktas / bendra — apačioje užšaldyta) */
.stick-wrap tr.sum-row td { background: #F6F1E4; white-space: nowrap; }
.stick-wrap tr.sum-grp td { border-top: 1px solid var(--groove); font-size: 13px; color: var(--walnut); }
.stick-wrap tr.sum-prod td { background: #EFE7D4; }
.stick-wrap tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--walnut); color: #F3EDE3; border-top: 0; }
.stick-wrap tfoot td.sticky-col { z-index: 3; background: var(--walnut); }
.stick-wrap tfoot .neg { color: #FFB4A8; }
@media (max-width: 640px) {
  .card .stick-wrap table:not(.t-cards) { display: table; overflow: visible; }
  .stick-wrap { max-height: 70vh; }
}

/* ---- Likučiai: kokias rankenėles dėti ---- */
.kp-in { width: auto; }
.kp-in th, .kp-in td { padding: 4px 6px; text-align: center; border: 0; white-space: nowrap; }
.kp-in tbody th { text-align: left; font-family: var(--font-display); font-size: 15px; padding-right: 10px; }
.kp-in input { width: 76px; text-align: center; font-size: 16px; font-weight: 600; }
.knob { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #0005; vertical-align: -3px; margin-right: 6px; flex: none; }
.knob-BS { background: linear-gradient(135deg, #1D1D1D 55%, #C3C7CC 55%); }
.knob-BG { background: linear-gradient(135deg, #1D1D1D 55%, #D4AF37 55%); }
.knob-RG { background: linear-gradient(135deg, #1D1D1D 55%, #D99A86 55%); }
.knob-B  { background: #1D1D1D; }
.knob-WS { background: linear-gradient(135deg, #F7F7F5 55%, #B5B9BE 55%); }
.knob-WG { background: linear-gradient(135deg, #F7F7F5 55%, #D4AF37 55%); }
.wood { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid #0004; vertical-align: -1px; margin-right: 6px; }
.wood-NAT { background: #8A5A33; }
.wood-BLA { background: #1D1D1D; }
.wood-WHT { background: #F7F7F5; }
.kp-group { border: 1px solid var(--groove); border-left: 5px solid var(--brass); border-radius: var(--radius); padding: 10px 12px; margin-top: 12px; background: #fff; }
.kp-group.w-NAT { border-left-color: #8A5A33; }
.kp-group.w-BLA { border-left-color: #1D1D1D; }
.kp-group.w-WHT { border-left-color: #CFC9BF; }
.kp-group.kp-total { border-left-color: var(--walnut); background: #F6F1E4; }
.kp-group h3 { margin: 0 0 8px; font-size: 15px; }
.kp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kp-chip { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--groove); font-size: 14px; }
.kp-chip b { font-size: 18px; margin-right: 6px; }
.kp-group details { margin-top: 8px; font-size: 13px; }
.kp-group summary { cursor: pointer; color: var(--walnut); font-weight: 600; }
.kp-group .neg { color: var(--warn); font-weight: 600; }
.kp-group td { white-space: nowrap; }

/* ---- Darbo planavimas / Sandėlis: pakeistas suskaičiuotas kiekis ---- */
#skTable input.sk-in { font-family: var(--font-mono); text-align: right; }
#skTable input.sk-in.changed { border-color: var(--brass); background: #FFF6DE; font-weight: 600; }

/* ---- projektai (gaminių kūrimo lenta) ---- */
:root {
  --p-done: #2F7A46;      /* padaryta */
  --p-next: #D9B23A;      /* artimiausi darbai */
  --p-soon: #C97B2C;      /* greitai */
  --p-late: #A63D2E;      /* vėluoja */
}
.p-cell { flex: none; width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid var(--groove); background: #fff; margin-top: 3px; }
.p-s-done .p-cell { background: var(--p-done); border-color: var(--p-done); }
.p-s-next .p-cell { background: var(--p-next); border-color: var(--p-next); }
.p-s-soon .p-cell { background: var(--p-soon); border-color: var(--p-soon); }
.p-s-late .p-cell { background: var(--p-late); border-color: var(--p-late); }
.p-s-blocked .p-cell { background: repeating-linear-gradient(45deg, var(--groove) 0 2px, #fff 2px 4px); }
.p-s-failed .p-cell { background: #fff; border-color: var(--p-late); box-shadow: inset 0 0 0 2px #F7EAE6; }

.p-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #7a7266; margin: 8px 0 12px; }
.p-legend span { display: inline-flex; align-items: center; gap: 6px; }
.p-legend .p-cell { margin: 0; }

.p-task {
  display: flex; gap: 9px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--groove); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.p-task:hover { border-color: var(--brass-soft); }
.p-task .p-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.p-task .p-t { overflow-wrap: anywhere; }
.p-task .p-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; color: #7a7266; }
.p-task.p-s-done .p-t { color: #8a8172; text-decoration: line-through; }
.p-task.p-s-late { background: #F9ECE9; border-color: #D9B0A6; }
.p-task.p-s-soon { background: #FBF0E2; border-color: #E0C08E; }
.p-task.p-s-next { background: #FBF6DF; border-color: #DFCE93; }
.p-task.p-s-blocked { background: #F2F0EB; border-style: dashed; }
.p-task.p-s-blocked .p-t { color: #7a7266; }
.p-task.p-s-failed { border-color: #D9B0A6; }
.p-due { font-family: var(--font-mono); font-size: 11.5px; }
.p-due.over { color: var(--p-late); font-weight: 600; }
.p-att { font-family: var(--font-mono); font-size: 11px; color: var(--p-late); }

/* Kas toliau */
.p-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.p-pcard { background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: left; font: inherit; }
.p-pcard:hover { border-color: var(--brass-soft); }
.p-pcard .p-nm { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.p-pcard .p-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: #7a7266; }
.p-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.p-person { display: flex; flex-direction: column; gap: 8px; }
.p-person header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--walnut); padding-bottom: 6px; }
.p-person h2 { font-size: 18px; }
.p-person .p-role { font-size: 12px; color: #7a7266; }
.p-more { font-size: 12px; color: #8a8172; }
.p-wait { background: #FBF6DF; border: 1px solid #DFCE93; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 8px; }
.p-wait h2 { font-size: 15px; }
.p-wait .p-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }

/* Lenta */
.p-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.p-chips button { border: 1px solid var(--groove); background: var(--card); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--walnut); }
.p-chips button.active { background: var(--walnut); border-color: var(--walnut); color: #F3EDE3; }
.p-chips .p-n { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; font-weight: 400; margin-left: 5px; }
.p-bar { display: flex; align-items: flex-end; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 4px; }
.p-bar h1 { font-size: 24px; }
.p-bar .p-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.p-streams-wrap { overflow-x: auto; padding-bottom: 10px; }
.p-streams { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 250px); gap: 12px; align-items: start; }
.p-stream { background: #F2F0EB; border: 1px solid var(--groove); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.p-shead { border: 0; background: none; text-align: left; padding: 4px; border-radius: 6px; font: inherit; display: grid; grid-template-columns: 1fr auto; }
.p-shead:hover { background: var(--card); }
.p-shead .p-nm { font-family: var(--font-display); font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.p-shead .p-ct { font-family: var(--font-mono); font-size: 11px; color: #8a8172; align-self: center; }
.p-shead .p-ow { grid-column: 1 / -1; font-size: 12px; color: #7a7266; }
.p-stream ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p-donetog { border: 0; background: none; font: inherit; font-size: 12px; color: #8a8172; text-align: left; padding: 2px 4px; }
.p-add input { width: 100%; border: 1px dashed var(--groove); background: none; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; }
.p-add input:focus { border-style: solid; background: #fff; }
.p-empty { background: var(--card); border: 1px dashed var(--groove); border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; justify-items: start; max-width: 560px; }

/* Eiga */
.p-pipeline { background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 16px; }
.p-prow { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; gap: 12px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--groove); }
.p-prow:last-child { border-bottom: 0; }
.p-prow .p-nm { font-weight: 600; }
.p-prow .p-ow { font-size: 11.5px; color: #8a8172; }
.p-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.p-dots button { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--groove); background: #fff; padding: 0; }
.p-dots .p-s-done { background: var(--p-done); border-color: var(--p-done); }
.p-dots .p-s-next { background: var(--p-next); border-color: var(--p-next); }
.p-dots .p-s-soon { background: var(--p-soon); border-color: var(--p-soon); }
.p-dots .p-s-late { background: var(--p-late); border-color: var(--p-late); }
.p-dots .p-s-blocked { background: repeating-linear-gradient(45deg, var(--groove) 0 2px, #fff 2px 4px); }
.p-dots .p-s-failed { border-color: var(--p-late); box-shadow: inset 0 0 0 2px #F7EAE6; }
.p-prow .p-ct { font-family: var(--font-mono); font-size: 12px; color: #7a7266; }
.p-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.p-box { background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.p-box h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: #7a7266; font-family: var(--font-body); }
.p-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p-lines li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.p-lines .p-when { font-family: var(--font-mono); font-size: 11.5px; color: #8a8172; flex: none; }
.p-lines button { border: 0; background: none; font: inherit; text-align: left; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--groove); }
.p-big { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; }

/* Biblioteka */
.p-lib { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.p-liblist { display: flex; flex-direction: column; gap: 12px; }
.p-liblist .p-grp { display: flex; flex-direction: column; gap: 4px; }
.p-liblist .p-gh { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: #8a8172; }
.p-liblist .p-it { border: 1px solid transparent; background: none; font: inherit; text-align: left; border-radius: 8px; padding: 7px 10px; display: flex; justify-content: space-between; gap: 8px; }
.p-liblist .p-it:hover { background: var(--card); border-color: var(--groove); }
.p-liblist .p-it.active { background: var(--card); border-color: var(--walnut); }
.p-liblist .p-v { font-family: var(--font-mono); font-size: 11px; color: #8a8172; }
.p-sheetdoc { background: var(--card); border: 1px solid var(--groove); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.p-sheetdoc h1 { font-size: 26px; }
.p-sheetdoc h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: #7a7266; font-family: var(--font-body); margin-bottom: 10px; }
.p-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: pst; }
.p-steps li { display: grid; grid-template-columns: 34px 1fr; gap: 4px 10px; counter-increment: pst; }
.p-steps li::before { content: counter(pst); font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--brass); }
.p-steps .p-txt { white-space: pre-wrap; }
.p-shots { grid-column: 2; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.p-shot { width: min(220px, 100%); display: flex; flex-direction: column; gap: 4px; }
.p-shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 3px solid var(--p-done); background: #EFEBE3; }
.p-shot.bad img { border-color: var(--p-late); }
.p-shot span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--p-done); }
.p-shot.bad span { color: var(--p-late); }
.p-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p-hist li { display: grid; grid-template-columns: 100px 60px 1fr; gap: 10px; font-size: 13.5px; }
.p-hist .p-d, .p-hist .p-v { font-family: var(--font-mono); font-size: 12px; color: #7a7266; }

/* Redagavimo skydelis */
.psheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--card);
  border-left: 1px solid var(--groove); box-shadow: -8px 0 30px rgba(33,29,26,0.18); z-index: 60;
  display: flex; flex-direction: column;
}
.psheet.wide { width: min(680px, 100%); }
.psheet[hidden] { display: none; }
.p-track { height: 8px; border-radius: 4px; background: var(--groove); overflow: hidden; position: relative; }
.p-track i { display: block; height: 100%; background: var(--p-done); }
.p-track.big { height: 13px; border-radius: 7px; margin: 6px 0 4px; }

.psheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--groove); }
.psheet-head h3 { font-size: 16px; flex: 1; }
.p-x { border: 1px solid var(--groove); background: var(--card); border-radius: 6px; width: 30px; height: 30px; font: inherit; color: #7a7266; }
.psheet-body { padding: 14px 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.psheet-foot { padding: 10px 16px; border-top: 1px solid var(--groove); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.psheet-foot .p-sp { flex: 1; }
.p-fld { display: flex; flex-direction: column; gap: 5px; }
.p-fld > label, .p-fld > .p-lbl { font-size: 12px; color: #7a7266; }
.p-fld input, .p-fld select, .p-fld textarea { width: 100%; padding: 9px; border: 1px solid var(--groove); border-radius: 8px; background: #fff; font: inherit; font-size: 15px; }
.p-fld textarea { resize: vertical; min-height: 64px; }
.p-hint { font-size: 12px; color: #8a8172; }
.p-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.p-seg button { border: 1px solid var(--groove); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.p-seg button .p-cell { margin: 0; }
.p-seg button.active { border-color: var(--walnut); box-shadow: inset 0 0 0 1px var(--walnut); font-weight: 600; }
.p-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.p-check input { width: auto; margin-top: 3px; }
.p-deps { display: flex; flex-wrap: wrap; gap: 6px; }
.p-dep { display: inline-flex; align-items: center; gap: 6px; background: #F2F0EB; border: 1px solid var(--groove); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; max-width: 100%; }
.p-dep span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.p-dep button { border: 0; background: none; color: #7a7266; padding: 2px 5px; font: inherit; }
.p-picker { border: 1px solid var(--groove); border-radius: 8px; background: #F2F0EB; max-height: 230px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.p-picker .p-gh { padding: 6px 6px 2px; font-weight: 700; }
.p-picker button { border: 0; background: none; font: inherit; text-align: left; border-radius: 6px; padding: 5px 7px; display: flex; gap: 7px; align-items: flex-start; font-size: 13.5px; }
.p-picker button:hover { background: #fff; }
.p-branch { border: 1px solid #D9B0A6; background: #F9ECE9; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.p-branch h4 { font-family: var(--font-display); font-size: 14px; }
.p-rows { display: flex; flex-direction: column; gap: 8px; }
.p-erow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.p-erow input, .p-erow textarea { padding: 7px 8px; border: 1px solid var(--groove); border-radius: 8px; background: #fff; font: inherit; font-size: 14px; min-width: 0; }
.p-erow textarea { width: 100%; min-height: 54px; resize: vertical; }
.p-ico { border: 1px solid var(--groove); background: var(--card); border-radius: 6px; width: 30px; height: 30px; font: inherit; color: #7a7266; flex: none; }
.p-ico:hover { border-color: var(--brass); }
.p-del { color: var(--p-late); }
.p-del.armed { background: var(--p-late); color: #fff; border-color: var(--p-late); }
.p-stepbox { border: 1px solid var(--groove); border-radius: 8px; padding: 10px; background: #F2F0EB; display: flex; flex-direction: column; gap: 8px; }
.p-pick { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.p-pick img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; border: 2px solid var(--p-done); }
.p-pick.bad img { border-color: var(--p-late); }
.p-pick .p-lbl { font-weight: 700; text-transform: uppercase; font-size: 11px; color: var(--p-done); width: 36px; }
.p-pick.bad .p-lbl { color: var(--p-late); }
.p-file { position: relative; overflow: hidden; }
.p-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

@media (max-width: 760px) {
  .p-lib { grid-template-columns: 1fr; }
  .p-hist li { grid-template-columns: 86px 50px 1fr; }
  .p-bar h1, .p-sheetdoc h1 { font-size: 21px; }
}

/* ---- Ekranas: Apžvalga (užsakymai · savaitės planas · efektyvumas) — tankiai, juodos raidės ---- */
.board-tabs { margin: 0 0 8px; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ov-card { padding: 10px 12px !important; margin: 0 !important; }
.ov-card h2 { font-size: 16px; margin-bottom: 6px; }
.ov-wide { grid-column: 1 / -1; }
#bOverview .kpis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
#bOverview .kpi { padding: 6px 10px; min-width: 96px; flex: 1 1 auto; }
#bOverview .kpi .v { font-size: 22px; line-height: 1.1; }
#bOverview .kpi .l { font-size: 12px; }
#bOverview .kpi.small { min-width: 80px; }
#bOverview .kpi.small .v { font-size: 18px; }
.ov-foot { font-size: 13px; color: #000; margin-top: 2px; }
.ov-table { width: 100%; font-size: 15px; }
.ov-table th { font-size: 11px; padding: 4px 6px; color: #000; }
.ov-table td { padding: 4px 6px; }
.ov-table tr.ov-total td { border-top: 2px solid var(--walnut); border-bottom: 0; }
body.board .card, body.board .card * { color: #000; }
body.board .card .pos { color: var(--ok); }
body.board .card .neg { color: var(--warn); }
body.board .card .sup-col h3 { color: var(--c); }
body.board .card .st-btn.st0 { color: #fff; }
body.board .card .st-trash { color: var(--warn); }
body.board .card .o-link { color: #2F6FA8; }
@media (max-width: 900px) { .ov-grid { grid-template-columns: 1fr; } }
@media (min-width: 1400px) {
  .ov-card h2 { font-size: 18px; }
  #bOverview .kpi .v { font-size: 26px; }
  .ov-table { font-size: 17px; }
}

/* ---- Gyvai (Valdymas -> Gamyba): cecho būsena dabar ---- */
.lv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lv-head .subtabs { margin: 0; }
.lv-kpis { margin-top: 10px; grid-template-columns: repeat(6, 1fr); }
.lv-stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.lv-st { margin: 0 !important; padding: 10px 12px !important; border-left: 5px solid var(--groove); }
.lv-st.on { border-left-color: var(--ok); }
.lv-st-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin-bottom: 4px; }
.lv-open { padding: 4px 0 6px; border-bottom: 1px dashed var(--groove); }
.lv-open:last-of-type { border-bottom: 0; }
.lv-worker { font-weight: 600; }
.lv-big { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.1; }
.lv-big .muted { font-family: var(--font-body); font-size: 12px; font-weight: 400; }
.lv-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: #7a7266; }
.lv-meta b { color: var(--ink); font-weight: 600; }
.lv-none { padding: 6px 0; }
.lv-today { font-size: 13px; margin-top: 4px; }
.lv-queue { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lv-q { font-size: 12px; background: #F3EFE6; border: 1px solid var(--groove); border-radius: 12px; padding: 2px 8px; white-space: nowrap; }
.lv-pri { display: inline-block; min-width: 18px; text-align: center; }
tr.pri1 .lv-pri { color: var(--warn); }
tr.pri2 .lv-pri { color: #A8802F; }
tr.done td { opacity: 0.55; }
tr.lv-ev-start td, tr.lv-ev-end td, tr.lv-ev-force-end td { color: #7a7266; }
@media (max-width: 900px) { .lv-kpis { grid-template-columns: repeat(3, 1fr); } }
