/* =====================================================================
   Įrankių valdymo sistema — stiliai
   Firminė spalva #009591. Tipografija: sisteminiai šriftai.
   ===================================================================== */

:root {
    --teal:        #00807d;
    --teal-bright: #009591;
    --teal-soft:   #e3f1f0;

    --ink:         #16181a;
    --ink-2:       #43474b;
    --muted:       #6b7075;
    --faint:       #9aa0a5;

    --bg:          #ffffff;
    --surface:     #f6f5f1;
    --surface-2:   #fbfaf7;
    --line:        #e4e2db;
    --line-2:      #cfccc3;

    --danger:      #a32d2d;
    --danger-bg:   #fdeeee;
    --danger-line: #f0c9c9;
    --warn:        #8a5108;
    --warn-bg:     #fdf2e2;
    --warn-line:   #f2ddb9;
    --ok:          #3a6b12;
    --ok-bg:       #eef5e5;

    --r:    8px;
    --r-lg: 12px;

    --shadow:    0 1px 2px rgba(22, 24, 26, .04);
    --shadow-lg: 0 8px 28px rgba(22, 24, 26, .10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
          system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body.center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- viršus ---------- */

.logo {
    font-style: italic;
    font-weight: 700;
    color: var(--teal-bright);
    font-size: 18px;
    letter-spacing: -0.5px;
}
.logo-sub {
    font-size: 8px;
    letter-spacing: 2.4px;
    color: var(--faint);
    margin-left: 5px;
}

.top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); }

.nav {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 30;
    overflow-x: auto;
}
.nav-item {
    padding: 12px 13px;
    font-size: 14px;
    color: var(--muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.nav-item:hover { color: var(--ink); text-decoration: none; }
.nav-item.active {
    color: var(--ink);
    font-weight: 500;
    border-bottom-color: var(--teal-bright);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 24px 60px; }

/* ---------- tipografija ---------- */

h1 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 2px;
}
h2.sec { font-size: 14px; font-weight: 600; margin: 28px 0 10px; }
.card h2 { font-size: 13px; font-weight: 600; margin: 20px 0 9px; }
.card h2:first-child { margin-top: 0; }

.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.empty { padding: 34px 0; }
.mono {
    font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
    font-size: 0.94em;
    letter-spacing: -0.2px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

/* ---------- kortelės ---------- */

.card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}
.cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

/* ---------- mygtukai ---------- */

button { font: inherit; cursor: pointer; border-radius: var(--r); }

.btn {
    display: inline-block;
    padding: 9px 15px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
    box-shadow: var(--shadow);
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface); border-color: var(--muted); text-decoration: none; }

button.primary {
    width: 100%;
    height: 44px;
    margin-top: 22px;
    background: var(--ink);
    color: #fff;
    border: 0;
    font-size: 15px;
    font-weight: 500;
    transition: background .12s;
}
button.primary:hover { background: #000; }
button.inline-btn { width: auto; margin: 0; padding: 10px 18px; height: auto; }
.big-btn { padding: 14px 26px; font-size: 16px; }

button.link {
    background: none; border: 0; color: var(--muted);
    font-size: 13px; text-decoration: underline;
}
.inline { display: inline; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 4px; }

/* ---------- formos ---------- */

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    margin: 16px 0 6px;
}

input[type=text], input[type=password], input[type=search],
input[type=date], select, textarea {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 15px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--bg);
    color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
}
select { height: 42px; }
textarea { resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal-bright);
    box-shadow: 0 0 0 3px rgba(0, 149, 145, .14);
}
::placeholder { color: var(--faint); }

.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form .row { grid-template-columns: 1fr; } }
.form.big input, .form.big select, .form.big textarea { font-size: 16px; }

label.check {
    display: flex; align-items: center; gap: 9px;
    margin-top: 16px; font-weight: 400; color: var(--ink);
}
label.check input { width: auto; }

label.chk {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin: 0 0 8px;
    font-size: 15px; font-weight: 400; color: var(--ink);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
label.chk:hover { background: var(--surface); border-color: var(--line-2); }
label.chk input { width: 20px; height: 20px; accent-color: var(--teal); }
label.chk.danger-chk {
    border-color: var(--danger-line);
    background: var(--danger-bg);
    margin-top: 18px;
}

.search { margin-bottom: 18px; }

.error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    color: var(--danger);
    padding: 11px 13px;
    border-radius: var(--r);
    font-size: 13px;
    margin-bottom: 14px;
}

.inline-new {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px;
    margin-top: 12px;
}

/* ---------- prisijungimas ---------- */

.login {
    width: 380px;
    padding: 32px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    border-color: var(--line);
}
.login .brand { margin-bottom: 22px; }
.login h1 { font-size: 17px; margin-bottom: 18px; }

/* ---------- lentelės ---------- */

table.list { width: 100%; border-collapse: collapse; }
table.list th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--faint);
    padding: 0 10px 9px 0;
    border-bottom: 1px solid var(--line-2);
}
table.list td {
    padding: 12px 10px 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    vertical-align: middle;
}
table.list tbody tr { cursor: pointer; transition: background .1s; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list.compact td { padding: 8px 8px 8px 0; }

table.kv { width: 100%; font-size: 14px; }
table.kv td { padding: 7px 0; }
table.kv td:first-child { color: var(--muted); width: 42%; }

/* ---------- ženkleliai ---------- */

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.pill.warn   { background: var(--warn-bg);   color: var(--warn); }
.pill.ok     { background: var(--ok-bg);     color: var(--ok); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.plain  { background: var(--surface);   color: var(--muted); }

.late { color: var(--danger); }

/* ---------- suvestinė ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0 22px;
}
.kpi {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 15px 17px;
}
.kpi span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 3px;
}
.kpi b {
    display: block;
    font-size: 27px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.5px;
}
.kpi b.w { color: var(--warn); }
.kpi b.d { color: var(--danger); }

.alerts { margin-bottom: 4px; }
.alert {
    border-radius: var(--r);
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 10px;
    border: 1px solid transparent;
}
.alert.d {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    color: var(--danger);
}
.alert.w {
    background: var(--warn-bg);
    border-color: var(--warn-line);
    color: var(--warn);
}
.alert a { margin-left: 8px; color: inherit; text-decoration: underline; }

/* ---------- remontas ---------- */

.found {
    background: var(--ok-bg);
    border: 1px solid #d6e5c4;
    border-radius: var(--r);
    padding: 14px 16px;
}
.found-h {
    font-size: 12px;
    font-weight: 600;
    color: var(--ok);
    margin-bottom: 8px;
}
.found .kv td { padding: 4px 0; }

.tl { display: flex; gap: 11px; margin-bottom: 13px; }
.tl-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--teal-bright);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ---------- profilaktika (planšetė) ---------- */

.mtask {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    margin-bottom: 10px;
    background: var(--bg);
    box-shadow: var(--shadow);
}
.mtask.late { border-color: var(--danger-line); background: var(--danger-bg); }
.mtask.soon { border-color: var(--warn-line);   background: var(--warn-bg); }

/* `.late` naudojama ir teksto spalvai — kortelėje ji neturi dažyti visko. */
.mtask.late, .mtask.soon { color: var(--ink); }

.mtask-d {
    min-width: 58px; height: 58px;
    padding: 0 9px;
    border-radius: var(--r);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    background: var(--surface);
    color: var(--muted);
}
.mtask.late .mtask-d { background: #f6c9c9; color: #7d2222; }
.mtask.soon .mtask-d { background: #f7d69a; color: #6b3d06; }
.mtask-d b { font-size: 20px; line-height: 1; font-weight: 600; }
.mtask-d i {
    font-size: 10px;
    font-style: normal;
    margin-top: 3px;
    white-space: nowrap;   /* „d. vėluoja" neturi lūžti per dvi eilutes */
    letter-spacing: -0.2px;
}

.mtask-t { flex: 1; min-width: 0; }
.mtask-n { font-size: 16px; font-weight: 500; margin-bottom: 2px; }

.mtask-b {
    padding: 13px 24px;
    border-radius: var(--r);
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
}
.mtask-b:hover { background: #000; text-decoration: none; }

/* ---------- filtrai ---------- */

.filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .f {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--muted);
    border: 1px solid var(--line-2);
    background: var(--bg);
}
.filters .f:hover { background: var(--surface); text-decoration: none; }
.filters .f.on {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

/* ---------- nustatymai ---------- */

.set-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.set-card {
    display: block;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    color: var(--ink);
    background: var(--bg);
    box-shadow: var(--shadow);
    transition: border-color .12s, background .12s;
}
.set-card:hover {
    background: var(--surface-2);
    border-color: var(--line-2);
    text-decoration: none;
}
.set-t { display: block; font-weight: 500; margin-bottom: 3px; }

table.perm { width: 100%; border-collapse: collapse; }
table.perm th {
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--faint);
    padding: 0 6px 10px;
}
table.perm th:first-child { text-align: left; }
table.perm td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.perm td.c { text-align: center; width: 92px; }
table.perm td.c input { accent-color: var(--teal); width: 17px; height: 17px; }
table.perm tr.grp td {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--faint);
    padding-top: 18px;
    border-bottom: 1px solid var(--line-2);
}

/* ---------- paieškos laukas ---------- */

.picker { position: relative; }
.picker-input { width: 100%; }
.picker-list {
    position: absolute;
    z-index: 40;
    left: 0; right: 0;
    margin-top: 4px;
    max-height: 290px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
}
.picker-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 13px;
    font-size: 14px;
    cursor: pointer;
}
.picker-item:hover, .picker-item.on { background: var(--surface); }
.picker-sub { font-size: 12px; color: var(--muted); margin-left: auto; }
.picker-tuscia { padding: 13px; font-size: 13px; color: var(--muted); }

/* ---------- ataskaitos ---------- */
.chart {
    position: relative;
    width: 100%;
    height: 260px;
    margin-bottom: 26px;
}
.chart.tall { height: 320px; }

.leg {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: baseline;
}

.note {
    background: var(--surface);
    border-left: 3px solid var(--teal-bright);
    border-radius: 0 var(--r) var(--r) 0;
    padding: 13px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-2);
    margin-bottom: 20px;
}
.note strong { color: var(--ink); }

/* ---------- piktogramos ---------- */
.set-card { position: relative; padding-top: 18px; }
.set-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--teal-soft);
    color: var(--teal);
    margin-bottom: 12px;
}
.set-card:hover .set-ico { background: var(--teal); color: #fff; }
.ico { display: block; }

.okmsg {
    background: var(--ok-bg);
    border: 1px solid #d6e5c4;
    color: var(--ok);
    padding: 11px 13px;
    border-radius: var(--r);
    font-size: 13px;
    margin-bottom: 14px;
}
pre.kodas {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 10px 12px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12.5px;
    overflow-x: auto;
    margin: 8px 0;
}

/* ---------- nuotraukos ---------- */
.foto { margin-bottom: 4px; }

.foto-zona {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    padding: 16px;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r-lg);
    background: var(--surface-2);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, transform .1s;
}
.foto-zona:hover {
    border-color: var(--teal-bright);
    background: var(--teal-soft);
}
.foto-zona:focus-visible {
    outline: none;
    border-color: var(--teal-bright);
    box-shadow: 0 0 0 3px rgba(0, 149, 145, .14);
}
.foto-zona.virs {
    border-color: var(--teal-bright);
    border-style: solid;
    background: var(--teal-soft);
    transform: scale(1.01);
}
.foto-zona.dirba { cursor: progress; opacity: .7; }
.foto-zona.pilna {
    cursor: default;
    border-style: solid;
    border-color: var(--line);
    background: var(--surface);
}
.foto-zona.pilna:hover { border-color: var(--line); background: var(--surface); }

.foto-zona-t { display: flex; flex-direction: column; gap: 3px; }
.foto-zona-t strong { font-size: 14px; font-weight: 500; }

.foto-sarasas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.foto-el {
    position: relative;
    width: 116px;
    margin: 0;
}
.foto-el img {
    width: 116px;
    height: 86px;
    object-fit: cover;
    border-radius: var(--r);
    border: 1px solid var(--line);
    display: block;
}
.foto-el figcaption {
    font-size: 11px;
    text-align: center;
    margin-top: 4px;
}
.foto-x {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity .12s;
}
.foto-el form { position: static; }
.foto-el:hover .foto-x, .foto-x:focus-visible { opacity: 1; }
.foto-el a { display: block; }
@media (hover: none) { .foto-x { opacity: 1; } }

.foto-galerija { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.foto-galerija img {
    width: 104px;
    height: 78px;
    object-fit: cover;
    border-radius: var(--r);
    border: 1px solid var(--line);
    display: block;
    transition: border-color .12s, transform .12s;
}
.foto-galerija a:hover img {
    border-color: var(--teal-bright);
    transform: scale(1.03);
}

table.list tr.disabled { opacity: .55; }
table.list tr.disabled:hover { background: transparent; }

.filters .f-n {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    opacity: .6;
}

/* ---------- profilaktikos šablonai ---------- */
.sab-head {
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.sab {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.sab-turi { opacity: .6; }
.sab-l {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    flex: 1;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}
.sab-turi .sab-l { cursor: default; }
.sab-l input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); }
.sab-t { display: flex; flex-direction: column; gap: 2px; }
.sab-t strong { font-size: 14.5px; font-weight: 500; }
.sab-p { font-size: 12px; line-height: 1.45; }
.sab-d { flex-shrink: 0; text-align: right; }
.sab-d label { margin: 0 0 4px; }

/* ---------- įrangos nuotrauka kortelėje ---------- */
.ir-foto {
    position: relative;
    display: block;
    flex-shrink: 0;
}
.ir-foto img {
    width: 92px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--r);
    border: 1px solid var(--line);
    display: block;
}
.ir-foto:hover img { border-color: var(--teal-bright); }
.ir-foto-n {
    position: absolute;
    right: 4px;
    bottom: 4px;
    background: rgba(22, 24, 26, .78);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}
.foto-esama img {
    width: 92px; height: 70px;
    object-fit: cover;
    border-radius: var(--r);
    border: 1px solid var(--line);
    display: block;
}

/* ---------- nuotraukų peržiūra ---------- */
.lb {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: rgba(16, 18, 20, .88);
    backdrop-filter: blur(3px);
}
.lb.on { display: flex; }

.lb-f {
    margin: 0;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.lb-f img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: var(--r);
    display: block;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .4);
}
.lb-c {
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
}

.lb button {
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background .12s;
    flex-shrink: 0;
}
.lb button:hover { background: rgba(255, 255, 255, .24); }

.lb-p, .lb-n {
    width: 46px;
    height: 46px;
    font-size: 28px;
    line-height: 1;
    padding-bottom: 4px;
}
.lb-x {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    font-size: 26px;
    line-height: 1;
}

@media (max-width: 700px) {
    .lb { padding: 12px; gap: 4px; }
    .lb-p, .lb-n { width: 38px; height: 38px; font-size: 24px; }
}

/* ---------- puslapiavimas ---------- */
.pg {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.pg-info { font-size: 13px; color: var(--muted); }
.pg-n { display: flex; gap: 4px; margin-left: auto; }
.pg-d { display: flex; gap: 4px; align-items: center; }

.pg-b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--ink);
    background: var(--bg);
}
.pg-b:hover { background: var(--surface); text-decoration: none; }
.pg-b.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pg-b.off { color: var(--faint); border-color: var(--line); }
.pg-t { color: var(--faint); padding: 0 2px; align-self: center; }

@media (max-width: 700px) {
    .pg { flex-direction: column; align-items: stretch; gap: 10px; }
    .pg-n { margin-left: 0; justify-content: center; }
    .pg-d { justify-content: center; }
}

/* ---------- profilaktikos punktai ---------- */
.pkt { display: flex; gap: 14px; align-items: flex-start; }
.pkt-sk {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border-radius: 20px;
    padding: 3px 11px;
    white-space: nowrap;
}
.pkt-l { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.pkt-l li { display: flex; gap: 8px; padding: 2px 0; }
.pkt-l li.ok { color: var(--ink-2); }
.pkt-l li.ne { color: var(--danger); }
.pkt-z { width: 12px; flex-shrink: 0; }

/* Filtro juosta be nuorodų (valdoma JS) */
.filters .f[data-tipas] { cursor: pointer; user-select: none; }

/* =====================================================================
   Mobilioji sąsaja
   Cechas naudos telefoną ir planšetę, ne darbastalį.
   ===================================================================== */

@media (max-width: 640px) {

    /* --- viršus --- */
    .top { padding: 10px 14px; gap: 8px; }
    .logo { font-size: 16px; }
    .logo-sub { display: none; }
    .who { font-size: 12px; white-space: nowrap; }
    .who-role { display: none; }   /* vardo užtenka, rolė netelpa */

    /* Meniu laužiamas į kelias eilutes, o ne slenkamas.
       Slinkimo žmonės nepastebi — punktai tiesiog dingsta. */
    .nav {
        padding: 4px 10px;
        overflow: visible;
        flex-wrap: wrap;
        gap: 0;
        position: static;
    }
    .nav-item {
        padding: 9px 11px;
        font-size: 14px;
        border-bottom: 0;
        border-radius: var(--r);
        margin: 2px;
    }
    .nav-item.active {
        background: var(--ink);
        color: #fff;
        font-weight: 500;
    }
    .nav-item.active:hover { color: #fff; }

    .wrap { padding: 18px 14px 48px; }

    /* --- antraštės --- */
    h1 { font-size: 19px; }
    .page-head { flex-direction: column; gap: 12px; margin-bottom: 16px; }
    .page-head .actions,
    .page-head > .actions { margin: 0; width: 100%; }
    .page-head .btn { flex: 1; text-align: center; }

    /* --- kortelės --- */
    .card { padding: 16px; border-radius: 10px; }
    .cols { gap: 12px; }

    /* --- suvestinė --- */
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 18px; }
    .kpi { padding: 12px 14px; }
    .kpi b { font-size: 22px; }

    .quick { gap: 8px; }
    .quick .btn { flex: 1 1 calc(50% - 4px); text-align: center; }

    /* --- profilaktikos užduotys --- */
    .mtask {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px;
    }
    .mtask-d { min-width: 52px; height: 52px; padding: 0 8px; }
    .mtask-d b { font-size: 18px; }
    .mtask-d i { font-size: 9.5px; }
    /* Tekstas lieka šalia ženkliuko, mygtukas — per visą plotį apačioje. */
    /* Tekstas lieka šalia ženkliuko, mygtukas — per visą plotį apačioje. */
    .mtask-t { flex: 1 1 0; min-width: 0; }
    .mtask-n { font-size: 15px; }
    .mtask-b {
        flex: 1 1 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 16px;
    }

    /* --- lentelės: siauruose ekranuose slenkamos --- */
    .lentele-slink {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }
    table.list { font-size: 13px; }
    table.list td { padding: 10px 8px 10px 0; }
    table.list th { font-size: 10px; }

    /* --- formos --- */
    .form .row { grid-template-columns: 1fr; gap: 0; }
    /* 16px neleidžia iOS priartinti ekrano paspaudus lauką */
    input[type=text], input[type=password], input[type=search],
    input[type=date], select, textarea { font-size: 16px; }
    .actions { flex-direction: column; }
    .actions .btn,
    .actions button { width: 100%; text-align: center; }
    button.inline-btn { width: 100%; }

    /* --- filtrai --- */
    .filters { gap: 6px; }
    .filters .f { padding: 8px 12px; font-size: 13px; }

    /* --- nustatymai --- */
    .set-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .set-card { padding: 14px; }
    .set-ico { width: 32px; height: 32px; margin-bottom: 8px; }

    /* --- ataskaitos --- */
    .chart { height: 220px; }
    .chart.tall { height: 280px; }

    /* --- nuotraukos --- */
    .foto-el, .foto-el img { width: 96px; }
    .foto-el img { height: 72px; }
}

@media (max-width: 400px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .set-grid { grid-template-columns: 1fr; }
    .quick .btn { flex: 1 1 100%; }
}

/* =====================================================================
   Apatinė navigacija — tik telefone
   ===================================================================== */

.tabbar { display: none; }
.sheet { display: none; }
.sheet[hidden] { display: none; }

@media (max-width: 640px) {

    /* Viršutinis meniu paslepiamas — jį pakeičia apatinis. */
    .nav { display: none; }

    .wrap { padding-bottom: 88px; }   /* vietos apatinei juostai */

    .tabbar {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 50;
        background: var(--bg);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 -1px 12px rgba(22, 24, 26, .05);
    }

    .tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 56px;
        padding: 8px 2px;
        border: 0;
        background: none;
        color: var(--muted);
        font: inherit;
        font-size: 10.5px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .tab:hover { text-decoration: none; }
    .tab span { line-height: 1.15; text-align: center; }
    .tab.on { color: var(--teal); font-weight: 500; }
    .tab.on .ico { transform: translateY(-1px); }

    /* --- „Daugiau" lapas --- */
    .sheet { display: block; position: fixed; inset: 0; z-index: 60; }
    /* `.sheet` klasė nustelbia naršyklės [hidden] taisyklę — be šito
       lapas niekada neužsidarytų. */
    .sheet[hidden] { display: none; }
    .sheet-bg {
        position: absolute; inset: 0;
        background: rgba(16, 18, 20, .4);
    }
    .sheet-k {
        position: absolute;
        left: 0; right: 0; bottom: 0;
        background: var(--bg);
        border-radius: 16px 16px 0 0;
        padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -8px 32px rgba(0, 0, 0, .18);
    }
    .sheet-r {
        width: 38px; height: 4px;
        background: var(--line-2);
        border-radius: 2px;
        margin: 4px auto 12px;
    }
    .sheet-i {
        display: flex;
        align-items: center;
        gap: 13px;
        width: 100%;
        min-height: 50px;
        padding: 0 10px;
        border: 0;
        background: none;
        border-radius: var(--r);
        font: inherit;
        font-size: 16px;
        color: var(--ink);
        text-align: left;
        cursor: pointer;
    }
    .sheet-i:hover, .sheet-i:active { background: var(--surface); text-decoration: none; }
    .sheet-i .ico { color: var(--muted); }
    .sheet-f { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
    .sheet-f .sheet-i { color: var(--danger); }

    /* Viršuje atsijungimo mygtukas nebereikalingas — jis lape. */
    .top .link { display: none; }
}

/* =====================================================================
   Telefone lentelės virsta kortelėmis
   Horizontalus slinkimas siaurame ekrane nenaudojamas — dalis stulpelių
   tiesiog dingsta iš akių.
   ===================================================================== */

@media (max-width: 640px) {

    /* Kortelėmis paverčiamos lentelės konteinerio neslenka.
       Skaitinės ataskaitos lieka slenkamos — jų į korteles nesudėsi. */
    .lentele-slink:has(table.kort) { overflow: visible; margin: 0; padding: 0; }

    .lentele-slink {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -14px;
        padding: 0 14px 4px;
        -webkit-mask-image: linear-gradient(to right,
            #000 0, #000 calc(100% - 24px), transparent 100%);
        mask-image: linear-gradient(to right,
            #000 0, #000 calc(100% - 24px), transparent 100%);
    }
    .lentele-slink:has(table.kort) {
        -webkit-mask-image: none;
        mask-image: none;
    }
    .lentele-slink::-webkit-scrollbar { display: none; }
    /* Pakankamai plati, kad stulpeliai nesispaustų — vietoj to slenkasi. */
    .lentele-slink table { min-width: 700px; }
    .lentele-slink:has(table.kort) table { min-width: 0; }

    /* Skaitiniai stulpeliai neturi lūžti per kelias eilutes. */
    .lentele-slink th,
    .lentele-slink td.small,
    .lentele-slink td.mono,
    .lentele-slink td.muted { white-space: nowrap; }
    .lentele-slink:has(table.kort) th,
    .lentele-slink:has(table.kort) td { white-space: normal; }

    table.kort, table.kort thead { display: block; }
    table.kort thead { display: none; }
    table.kort tbody { display: block; }

    table.kort tbody tr {
        display: block;
        border: 1px solid var(--line);
        border-radius: var(--r-lg);
        padding: 12px 14px;
        margin-bottom: 10px;
        background: var(--bg);
        box-shadow: var(--shadow);
    }
    table.kort tbody tr:hover { background: var(--bg); }

    table.kort td {
        display: block;
        border: 0;
        padding: 2px 0;
        font-size: 14px;
    }

    /* Pirmas stulpelis — numeris, stambiau ir su tarpu. */
    table.kort td:first-child {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 2px;
    }

    /* Etiketė iš antraštės, kad be stulpelių būtų aišku, kas yra kas. */
    table.kort td[data-l]:not([data-l=""])::before {
        content: attr(data-l) ": ";
        color: var(--faint);
        font-size: 12px;
    }

    /* Tuščių langelių nerodom — kitaip kortelė pilna brūkšnelių. */
    table.kort td:empty { display: none; }

    /* Didesni taikiniai: viskas paspaudžiama bent 44 px. */
    table.list td a,
    .card a.small,
    td.small a { display: inline-block; padding: 6px 0; min-height: 24px; }
}

@media (max-width: 640px) {
    /* Rankenėlė kartu ir uždarymo mygtukas — didesnis taikinys nei linija. */
    button.sheet-r {
        display: block;
        width: 100%;
        height: 26px;
        border: 0;
        background: none;
        padding: 0;
        margin: 0 0 6px;
        cursor: pointer;
        position: relative;
    }
    button.sheet-r::after {
        content: "";
        position: absolute;
        left: 50%; top: 11px;
        transform: translateX(-50%);
        width: 38px; height: 4px;
        background: var(--line-2);
        border-radius: 2px;
    }
    button.sheet-r:active::after { background: var(--muted); }

    .sheet-i.on {
        background: var(--surface);
        font-weight: 500;
    }
    .sheet-i.on .ico { color: var(--teal); }
}

/* ---------- sulankstomas paaiškinimas ---------- */
.pa {
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal-bright);
    border-radius: 0 var(--r) var(--r) 0;
    background: var(--surface-2);
    margin-bottom: 18px;
}
.pa > summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.pa > summary::-webkit-details-marker { display: none; }
.pa > summary::after {
    content: "";
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg);
    margin-left: auto;
    margin-top: -3px;
    transition: transform .15s;
}
.pa[open] > summary::after { transform: rotate(-135deg); margin-top: 2px; }
.pa > summary:hover { background: var(--surface); }
.pa-t {
    padding: 0 14px 13px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-2);
}
.pa-t p + p { margin-top: 8px; }

/* Logotipas — nuoroda į suvestinę */
.brand-l { display: flex; align-items: baseline; gap: 5px; }
.brand-l:hover { text-decoration: none; }
.brand-l:hover .logo { opacity: .82; }

@media (max-width: 640px) {
    .daugiau-btn {
        display: block;
        width: 100%;
        margin-top: 4px;
        text-align: center;
    }
}

/* =====================================================================
   Mobilieji elementai darbastalyje — paslėpti negrįžtamai.
   Taisyklių eiliškumas ilgame faile lengvai pasislenka, todėl čia,
   pačioje pabaigoje, aiškiai užrakinama.
   ===================================================================== */

@media (min-width: 641px) {
    .tabbar,
    .sheet,
    .daugiau-btn { display: none !important; }
}

/* Slinkties juosta navigacijoje nereikalinga niekur — punktai arba telpa,
   arba (telefone) laužiami į kelias eilutes. */
.nav { scrollbar-width: none; -ms-overflow-style: none; }
.nav::-webkit-scrollbar { display: none; height: 0; }

/* Importo peržiūra: bloga eilutė pastebima iš karto */
tr.eil-bloga td { background: var(--danger-bg); }

input[type=file] {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
    background: var(--surface-2);
}
input[type=file]::file-selector-button {
    font: inherit;
    font-size: 13px;
    padding: 6px 12px;
    margin-right: 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--bg);
    cursor: pointer;
}

/* Veiksmai, kurie telefone neturi prasmės (pvz. CSV failo įkėlimas). */
@media (max-width: 640px) {
    .tik-desktop { display: none !important; }
}

/* =====================================================================
   Ataskaitų lentelės telefone — kortelės
   ===================================================================== */

@media (max-width: 640px) {

    /* Slinkimo šioms nereikia — jos virsta kortelėmis. */
    .lentele-slink:has(table.ats) {
        overflow: visible;
        margin: 0;
        padding: 0;
        -webkit-mask-image: none;
        mask-image: none;
    }
    .lentele-slink:has(table.ats) table { min-width: 0; }

    table.ats, table.ats tbody { display: block; }
    table.ats thead { display: none; }

    table.ats tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2px 12px;
        border: 1px solid var(--line);
        border-radius: var(--r-lg);
        padding: 13px 15px;
        margin-bottom: 10px;
        background: var(--bg);
        box-shadow: var(--shadow);
    }

    table.ats td {
        display: block;
        border: 0;
        padding: 3px 0;
        font-size: 13.5px;
        white-space: normal;
    }

    /* Pirmi du stulpeliai — kortelės antraštė per visą plotį. */
    table.ats td:first-child {
        grid-column: 1 / -1;
        font-size: 15px;
        font-weight: 600;
        padding-bottom: 0;
    }
    table.ats td:nth-child(2) {
        grid-column: 1 / -1;
        color: var(--muted);
        padding-bottom: 8px;
        border-bottom: 1px solid var(--line);
        margin-bottom: 6px;
    }

    /* Skaičiai su etiketėmis, po du stulpelius. */
    table.ats td[data-l]::before {
        content: attr(data-l);
        display: block;
        font-size: 10.5px;
        text-transform: uppercase;
        letter-spacing: .3px;
        color: var(--faint);
        margin-bottom: 1px;
    }

    table.ats td:empty { display: none; }
}

/* ---------- ataskaitų filtrai ---------- */
.fl {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.fl-s {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}
.fl-s select {
    width: auto;
    height: 34px;
    padding: 0 28px 0 10px;
    font-size: 13px;
    border-radius: 20px;
    background: var(--bg);
}
.fl-j {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    font-size: 13px;
    color: var(--muted);
    background: var(--bg);
}
.fl-j:hover { background: var(--surface); text-decoration: none; }
.fl-j.on {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.fl-v { font-size: 12px; }
.fl-x { font-size: 13px; margin-left: auto; }

@media (max-width: 640px) {
    .fl { gap: 8px; }
    .fl-s { flex: 1 1 100%; justify-content: space-between; }
    .fl-s select { flex: 1; margin-left: 8px; max-width: 60%; }
    .fl-x { margin-left: 0; }
}

/* ---------- siuntimai pas tiekėją ---------- */
.siunt {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--surface-2);
}
.siunt.veluoja {
    border-color: var(--warn-line);
    background: var(--warn-bg);
}
.siunt-h {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.siunt-f { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.siunt-f label { margin-top: 10px; }
.siunt-f .actions { margin-top: 12px; }
