:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #69716c;
  --line: #e2e5df;
  --accent: #1f5f4a;      /* tamsiai žalia */
  --accent-2: #e8a317;    /* kelio ženklų geltona */
  --hi: #1f7a4f;
  --mid: #b7791f;
  --lo: #a0a7a2;
  --err: #b42318;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--ink); color: #fff; padding: .6rem 1.4rem;
  position: sticky; top: 0; z-index: 10;
}
.brand { color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; }
.logo {
  display: inline-block; background: var(--accent-2); color: var(--ink);
  font-weight: 800; padding: .05rem .35rem; border-radius: 4px; margin-right: .2rem;
}
.topbar nav { display: flex; gap: .2rem; align-items: center; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #cfd6d2; text-decoration: none; padding: .4rem .7rem; border-radius: 6px; }
.topbar nav a:hover { background: #2c3430; color: #fff; }
.topbar nav a.on { background: #36413c; color: #fff; }
.topbar .soon { color: #7d8781; font-size: .78rem; margin-left: .8rem; }
.me { display: flex; gap: .6rem; align-items: baseline; font-size: .9rem; white-space: nowrap; }
.me small { color: #9aa49f; }
.me a { color: var(--accent-2); }

main.wrap { max-width: 1100px; margin: 1.5rem auto; padding: 0 1.2rem; }
main.wide { max-width: 1500px; margin: 1.5rem auto; padding: 0 1.2rem; }
main.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.card.narrow { width: min(420px, 100%); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + .sticky-save { margin-top: 1rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.pagehead p { margin: .2rem 0 0; max-width: 75ch; }

label { display: block; margin-bottom: .7rem; font-size: .9rem; color: #3b433f; }
label.inline { display: inline-flex; gap: .35rem; align-items: center; margin: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem;
  border: 1px solid #cdd2cc; border-radius: 7px; font: inherit; background: #fff; color: var(--ink);
}
input[type=checkbox] { display: inline; width: auto; margin: 0; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
label.inline input[type=number] { width: 5rem; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc5b5; border-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: #f3f4f1; }

.btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 7px; border: 1px solid #c4cbc5;
  background: #fff; color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #174a39; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: #e4f1ea; border: 1px solid #b8d9c7; }
.flash.err { background: #fdecea; border-color: #f2c0bb; color: var(--err); }
.errtxt { color: var(--err); }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.filters input[name=q] { flex: 1 1 260px; width: auto; margin: 0; }
.filters select { width: auto; margin: 0; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbf9; padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
table.grid td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: #fafbf8; }
table.grid.compact td, table.grid.compact th { padding: .4rem .55rem; }
table.users input:not([type=checkbox]) { margin: 0; min-width: 8rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c { text-align: center; }
.tcell a { font-weight: 600; text-decoration: none; color: var(--ink); }
.tcell a:hover { color: var(--accent); text-decoration: underline; }
.sub { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
tr.expired { opacity: .5; }
tr.st-atmestas { opacity: .45; }

.score { display: inline-block; min-width: 2.6rem; text-align: center; font-weight: 700; padding: .25rem .4rem; border-radius: 6px; color: #fff; cursor: help; }
.score.hi { background: var(--hi); }
.score.mid { background: var(--mid); }
.score.lo { background: var(--lo); }
.score.big { font-size: 1.3rem; min-width: 3.4rem; }

.tag { font-size: .8rem; padding: .15rem .5rem; border-radius: 99px; background: #eef0ec; white-space: nowrap; }
.tag.wt-asfaltavimas { background: #2a2f2c; color: #fff; }
.tag.wt-keliai { background: #fbecc8; color: #6b4a07; }
.tag.wt-inzinerija { background: #dfeaf5; color: #234b70; }
.pill { font-size: .8rem; padding: .15rem .5rem; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.pill.p-domina { background: #fff6dc; border-color: #f1d58a; }
.pill.p-dalyvaujame { background: #e1f2e8; border-color: #9fd0b4; }
.pill.p-atmestas { color: var(--muted); }

.breakdown { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.breakdown th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: .3rem 0; }
.breakdown td { padding: .4rem 0; border-top: 1px solid var(--line); }
.bar { display: inline-block; width: 70px; height: 7px; background: #eceee9; border-radius: 4px; margin-right: .5rem; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

dl.kv { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: .45rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.pre { white-space: pre-wrap; }
details { margin: .6rem 0 1rem; }
summary { cursor: pointer; color: var(--accent); margin-bottom: .6rem; }

.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.row > label { flex: 1 1 200px; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: .9rem; flex: 1 1 100%; }

.weights { display: grid; gap: .5rem; }
.weights .w { display: grid; grid-template-columns: 240px 1fr 2.5rem 3.5rem; gap: 1rem; align-items: center; margin: 0; }
.weights output { font-weight: 700; text-align: right; }
.weights em { color: var(--muted); font-style: normal; text-align: right; }
.sticky-save { position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--bg) 35%); text-align: right; }

.empty { text-align: center; padding: 2.5rem; }

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; }
  .topbar .soon { display: none; }
  .weights .w { grid-template-columns: 1fr 3rem; }
  .weights .w input { grid-column: 1 / -1; }
  .tcell { min-width: 240px; }
  .pagehead { flex-direction: column; }
}
.tablewrap { overflow-x: auto; border-radius: var(--radius); }

/* ---------- 4–5 moduliai ---------- */
.topbar nav .sep { width: 1px; height: 1.2rem; background: #3d4742; margin: 0 .4rem; }
.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btnrow form { margin: 0; }
.flash.warn { background: #fff6dc; border-color: #f1d58a; color: #6b4a07; }
.warntxt { color: #9a5b00; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
tr.stale td { background: #fffbef; }
.kind { font-size: .78rem; padding: .1rem .45rem; border-radius: 4px; white-space: nowrap; }
.kind.k-medziaga { background: #e7efe9; color: #1f5f4a; }
.kind.k-darbas { background: #e6eef8; color: #234b70; }
.kind.k-mechanizmas { background: #f3e9dc; color: #7a4a12; }
.bigprice { text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; min-width: 200px; }
.bigprice b { font-size: 1.5rem; margin-right: .25rem; }
.bigprice small { color: var(--muted); }
.bigprice > small:first-child { display: block; }
.bigprice.stale { border-color: #f1d58a; background: #fffbef; }
.plainlist { margin: 0; padding-left: 1.1rem; line-height: 1.7; }
input.numin { width: 7rem; margin: 0; text-align: right; display: inline-block; }

.status { font-size: .8rem; padding: .2rem .55rem; border-radius: 99px; white-space: nowrap; background: #eef0ec; }
.status.s-perziurai { background: #e6eef8; color: #234b70; }
.status.s-tvirtinimui { background: #fff1cf; color: #6b4a07; }
.status.s-patvirtinta { background: #dff1e6; color: #1f5f4a; font-weight: 600; }

.chain { display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: st; }
.chain li { position: relative; padding: .6rem .8rem .6rem 2.6rem; border-top: 4px solid var(--line); color: var(--muted); }
.chain li::before { counter-increment: st; content: counter(st); position: absolute; left: .6rem; top: .55rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--line); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.chain li b { display: block; color: inherit; }
.chain li span { font-size: .82rem; }
.chain li.done { border-color: var(--accent); color: var(--ink); }
.chain li.done::before { background: var(--accent); content: "✓"; }
.chain li.now { border-color: var(--accent-2); color: var(--ink); }
.chain li.now::before { background: var(--accent-2); color: var(--ink); }
.chain li.final { border-color: var(--hi); }
.actions textarea { margin-bottom: .6rem; }
.blocked { display: inline-flex; flex-direction: column; padding: .45rem .8rem; border: 1px dashed #d8b7b3; border-radius: 7px; color: var(--err); background: #fdf3f2; }
.blocked small { color: #8c4a44; max-width: 40ch; }

dl.sums { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: .4rem 0 0; }
dl.sums dt { color: var(--muted); }
dl.sums dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
dl.sums .strong { color: var(--ink); font-weight: 700; border-top: 1px solid var(--line); padding-top: .35rem; }
dl.sums .big { font-size: 1.25rem; }

.titleform { display: flex; gap: .5rem; align-items: center; }
.titleform input { font-size: 1.35rem; font-weight: 700; margin: 0; border-color: transparent; background: transparent; padding-left: 0; }
.titleform input:hover, .titleform input:focus { border-color: #cdd2cc; background: #fff; padding-left: .6rem; }

table.lines tr.flag td { background: #fffdf5; }
table.lines tr.suggested td { background: #fff6dc; }
table.lines tr.hl td { outline: 2px solid #9cc5b5; }
table.lines tr.editrow td { background: #f6f8f5; }
table.lines tfoot td { border-top: 2px solid var(--line); background: #fafbf9; }
.addline { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.history .comment { margin: .2rem 0 0 1rem; color: #3b433f; font-style: italic; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs a { padding: .4rem .8rem; border-radius: 7px; background: #e8ebe6; text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--accent); color: #fff; }
table.preview td, table.preview th { white-space: pre-line; max-width: 380px; overflow: hidden; vertical-align: top; }
table.preview .mapped { background: #e1f2e8 !important; }
table.preview th .maplabel { color: var(--accent); text-transform: none; letter-spacing: 0; }
table.preview tr.skip td { opacity: .35; }
@media (max-width: 800px) { .chain { grid-template-columns: 1fr 1fr; } }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.bell { position: relative; text-decoration: none; font-size: 1.05rem; padding: .15rem .35rem; border-radius: 6px; filter: grayscale(1) brightness(1.6); }
.bell.has { filter: none; }
.bell b { position: absolute; top: -.35rem; right: -.45rem; background: #d64535; color: #fff; font-size: .68rem; border-radius: 99px; padding: 0 .35rem; line-height: 1.1rem; }
.bell b:empty { display: none; }
.folderpath { background: #f3f5f1; border-radius: 7px; padding: .45rem .7rem; font-size: .85rem; overflow-wrap: anywhere; }
.folderpath code { font-family: Consolas, monospace; }
ul.notes { list-style: none; margin: 0 0 .6rem; padding: 0; }
ul.notes li { padding: .45rem .6rem; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); }
ul.notes li.unread { border-left-color: var(--accent-2); background: #fffaf0; }
ul.notes.big li { padding: .7rem .8rem; }
ul.notes .ico { margin-right: .35rem; }
.tag.obj { background: #e6eef8; color: #234b70; }
.goodtxt { color: var(--hi); }
tr.grouprow td { background: #f3f5f1; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.subst td { background: #f2f7ff; }
.substform { display: flex; gap: .35rem; align-items: center; margin: 0; }
.substform select { margin: 0; max-width: 320px; padding: .3rem .4rem; }
input.numin.small { width: 4.5rem; padding: .3rem .4rem; }
.dropcard { border: 2px dashed #b9cfc4; background: #f8fbf9; }
label.drop { border: 1px solid #cdd2cc; border-radius: 8px; background: #fff; padding: .5rem .7rem; }
label.drop span { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
input.missing { border-color: #e2b13c; background: #fffaf0; }
.vatbox { margin-top: .4rem; padding: .5rem .7rem; background: #f3f5f1; border-radius: 7px; }
table.review input { margin: 0; padding: .3rem .4rem; }
table.review input.wide { min-width: 300px; }
table.review input.tiny { width: 4.5rem; }
table.review select { margin: 0; padding: .3rem .4rem; max-width: 340px; }
table.review tr.ok td { background: #f2faf5; }
table.review tr.new td { background: #f2f6ff; }
table.review tr.off td { opacity: .4; }
.legend { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: middle; margin: 0 .2rem 0 .6rem; }
.legend.ok { background: #cfeedd; } .legend.new { background: #d6e3fb; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: .4rem 1rem; }
section.pick { padding: .8rem 1rem; }
.pickhead { display: flex; justify-content: space-between; gap: 1rem; }
table.cands { width: 100%; border-collapse: collapse; margin-top: .4rem; }
table.cands td { padding: .3rem .4rem; border-top: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
table.cands tr.chosen td { background: #eef8f2; }
table.cands tr.detailrow td { background: #f7faf8; border-top: 0; }
.sc { display: inline-block; min-width: 2.6rem; text-align: center; border-radius: 5px; padding: .05rem .3rem; font-size: .8rem; font-weight: 700; color: #fff; }
.sc.hi { background: var(--hi); } .sc.mid { background: var(--mid); } .sc.lo { background: var(--lo); }
.artrow { margin-top: .35rem; }
.artrow select { display: inline-block; width: auto; max-width: 520px; margin: 0 0 0 .3rem; padding: .2rem .4rem; }
.searchrow { display: flex; gap: .4rem; margin-top: .5rem; }
.statsbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.conf { font-size: .78rem; padding: .1rem .5rem; border-radius: 99px; margin-left: .4rem; white-space: nowrap; }
.conf.c-hi { background: #dff1e6; color: #1f5f4a; }
.conf.c-mid { background: #fff1cf; color: #6b4a07; }
.conf.c-none { background: #eef0ec; color: var(--muted); }
label.extra { display: flex; margin-top: .35rem; }
.searchrow input { margin: 0; padding: .3rem .5rem; font-size: .85rem; }
ul.files { list-style: none; margin: 0; padding: 0; columns: 2 380px; }
ul.files li { padding: .25rem 0; break-inside: avoid; }

/* ---------- Telefono vaizdas ---------- */
.menubtn, .bell-m { display: none; }
@media (max-width: 800px) {
  .topbar { gap: .6rem; padding: .5rem .8rem; }
  .bell-m { display: inline-block; margin-left: auto; text-decoration: none; font-size: 1.2rem; }
  .menubtn { display: inline-block; background: none; border: 1px solid #3d4742; color: #fff; font-size: 1.3rem; line-height: 1; padding: .35rem .6rem; border-radius: 7px; cursor: pointer; }
  .topbar nav, .topbar .me { display: none; }
  .topbar.open nav { display: flex; flex-direction: column; align-items: stretch; flex: 1 1 100%; gap: 0; }
  .topbar.open nav a { padding: .7rem .6rem; font-size: 1.05rem; }
  .topbar.open nav .sep { width: 100%; height: 1px; margin: .3rem 0; }
  .topbar.open .me { display: flex; flex-wrap: wrap; flex: 1 1 100%; white-space: normal; gap: .4rem .8rem; padding: .5rem .6rem .3rem; border-top: 1px solid #3d4742; }
  .topbar.open .me .bell { display: none; }
  main.wrap, main.wide { margin: 1rem auto; padding: 0 .7rem; }
  h1 { font-size: 1.3rem; }
  .card { padding: .9rem .9rem; }
  /* platesnės lentelės slenka į šoną, puslapis nebeišsiplečia */
  table.grid, table.lines, table.preview, table.review { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .filters > * { flex: 1 1 100%; }
  .filters select, .filters input { width: 100%; }
  .filters label.inline { flex: 1 1 auto; }
  .filters input[type=checkbox] { width: auto; }
  .btn { padding: .6rem 1rem; }
  .btn.small { padding: .45rem .7rem; }
  input, select, textarea { font-size: 16px; } /* kad iPhone nedidintų lauko */
  dl.kv { grid-template-columns: 1fr; gap: .1rem; }
  dl.kv dd { margin-bottom: .5rem; }
  .cols { grid-template-columns: 1fr; }
  .cols > * { min-width: 0; }
  .titleform { flex-wrap: wrap; }
  .titleform input { flex: 1 1 100%; font-size: 1.05rem !important; }
  code, .card a, .card p { overflow-wrap: anywhere; }
  table.review input.wide { min-width: 220px; }
}

/* ---------- Programėlės diegimas ---------- */
.install { max-width: 620px; }
main.auth .install { width: min(620px, 100%); }
.install-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.install-head img { border-radius: 14px; flex: none; }
.install-head p { margin: .2rem 0 0; }
.install h2 { margin-top: 1.2rem; }
.install > h2:first-child { margin-top: 0; }
.install ol { padding-left: 1.3rem; margin: 0; }
.install ol li { margin-bottom: .45rem; }
.btn.big { font-size: 1.1rem; padding: .8rem 1.4rem; width: 100%; margin: .4rem 0; }
.linkrow { display: flex; gap: .5rem; flex-wrap: wrap; }
.linkrow input { flex: 1 1 240px; width: auto; margin: 0; }

/* iPhone diegimo žingsniai */
.ios-ico { width: 1.25em; height: 1.25em; vertical-align: -.25em; color: #0a84ff; }
.ios-steps { list-style: none; padding: 0 !important; }
.ios-steps li { display: flex; gap: .7rem; align-items: flex-start; margin-bottom: .8rem !important; }
.ios-steps .n { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
img.mini { width: 1.4em; height: 1.4em; border-radius: 22%; vertical-align: -.35em; }
.warnbox { background: #fff6dc; border: 1px solid #f1d58a; border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; }
.warnbox h2 { margin-top: 0 !important; }
.ios-arrow { position: fixed; left: 50%; bottom: .6rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 10px; text-align: center; font-size: .95rem; line-height: 1.5; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.25); animation: vpbob 1.4s ease-in-out infinite; }
.ios-arrow .ios-ico { color: #7cc0ff; }
@keyframes vpbob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 6px); } }

[hidden] { display: none !important; }
