:root {
  --brand: #5a31e0;
  --brand-dark: #4321b8;
  --brand-soft: #efeafd;
  --ink: #1d1d22;
  --muted: #5d6170;
  --line: #dcdfe7;
  --bg: #f4f5f8;
  --card: #ffffff;
  --navy: #1f3864;
  --slate: #596a80;
  --tile: #eaf0f8;
  --we: #f0f1f4;
  --ok: #1d7a46;
  --ok-soft: #e5f4eb;
  --warn-soft: #fff4d6;
  --warn: #7a5600;
  --err: #b42318;
  --err-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 4px 16px rgba(20, 20, 40, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 .75rem; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.center { text-align: center; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- viršutinė juosta ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.bar-logo { height: 34px; width: auto; display: block; }
.bar-title { font-weight: 600; color: var(--muted); white-space: nowrap; }
.langs { margin-left: auto; display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; }
.langs button {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 8px;
  font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; min-width: 40px; min-height: 34px;
}
.langs button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.wrap.wide { max-width: 1500px; }

/* ---------- kortelės ir formos ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.login-card { max-width: 420px; margin: 32px auto; }
.login-card .hint { margin: 14px 0 0; }
label, .field { display: block; margin-bottom: 14px; }
label > span, .label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.login-card label { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; min-height: 46px; font-size: 1rem;
}
textarea { min-height: 0; resize: vertical; font-size: .92rem; line-height: 1.4; }
input:focus, select:focus, textarea:focus, button:focus-visible, .cell:focus-visible {
  outline: 3px solid rgba(90, 49, 224, .35); outline-offset: 1px; border-color: var(--brand);
}
.login-card input { font-size: 1.15rem; letter-spacing: .04em; margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: .95rem; }
label.check input { width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--muted); font-size: .85rem; }
label.inline input { width: auto; min-height: 38px; padding: 6px 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer;
  min-height: 44px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--err); border-color: #f1c4bf; }
.btn.danger:hover { background: var(--err-soft); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.08rem; }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: .85rem; margin-left: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 8px 0; min-height: 40px; }

.msg { padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.hint { color: var(--muted); font-size: .85rem; }

/* ---------- darbuotojo forma ---------- */
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px 10px; }
.hello h1 { margin: 0; }
.date-row { display: flex; gap: 8px; align-items: center; }
.date-row input { flex: 1; min-width: 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 14px; font-weight: 600; font-size: .92rem; cursor: pointer; min-height: 44px; white-space: nowrap;
}
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.chips { display: flex; gap: 8px; margin-top: 10px; }
.chips .chip { flex: 1; padding: 8px 0; font-size: 1.02rem; }
.hours { display: flex; align-items: center; gap: 10px; }
.hours input {
  flex: 1; min-width: 0; text-align: center; font-size: 2rem; font-weight: 700; min-height: 64px;
  font-variant-numeric: tabular-nums;
}
.hours .unit { position: absolute; left: -9999px; }
.step {
  width: 64px; height: 64px; flex: none; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); font-size: 2rem; font-weight: 600; cursor: pointer; line-height: 1;
}
.step:active { background: var(--brand-soft); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.actions .btn.big { flex: 1; }

/* ---------- kalendorius ---------- */
.month-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month-head h1, .month-head h2 { margin: 0; text-align: center; flex: 1; }
.nav {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.nav:disabled { opacity: .35; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); padding: 2px 0 4px; text-transform: capitalize; }
.day {
  aspect-ratio: 1 / 1.05; border: 1px solid transparent; border-radius: 10px; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; padding: 0; min-width: 0;
}
.day .n { font-size: .8rem; color: var(--muted); }
.day .hv { font-size: .95rem; font-weight: 700; min-height: 1.2em; }
.day.we { background: var(--we); }
.day.has { background: var(--brand-soft); }
.day.has .hv { color: var(--brand-dark); }
.day.today { border-color: var(--brand); }
.day.sel { background: var(--brand); border-color: var(--brand); }
.day.sel .n, .day.sel .hv { color: #fff; }
.day:disabled { opacity: .35; cursor: default; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.totals div { background: var(--tile); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.totals span { font-size: .8rem; color: var(--muted); }
.totals strong { font-size: 1.3rem; }
.list { list-style: none; padding: 0; margin: 10px 0 0; }
.list li button {
  width: 100%; display: grid; grid-template-columns: 4.5em 1fr auto; gap: 10px; align-items: center;
  border: 0; border-top: 1px solid var(--line); background: none; padding: 12px 2px; text-align: left; cursor: pointer;
}
.list .d { color: var(--muted); font-size: .9rem; }
.list .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.list li.empty { color: var(--muted); padding: 10px 2px; font-size: .92rem; }
.list.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 60; max-width: calc(100% - 32px); text-align: center;
}

/* ---------- administravimas ---------- */
.admin .bar { flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 40px;
}
.tabs button.on { background: var(--brand-soft); color: var(--brand-dark); }
.bar-out { margin-left: auto; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar h1 { margin: 0; }
.toolbar .month-head { margin: 0; min-width: 280px; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-right label.check { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--tile); border: 1px solid #bfc8d6; border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi strong { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.filters label { margin: 0; min-width: 220px; }
.filters label.check { min-width: 0; padding-bottom: 10px; }
.filters input, .filters select { min-height: 40px; padding: 7px 10px; font-size: .92rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.row-between h2 { margin: 0; }

.grid-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; max-height: 70vh; }
.grid-wrap.short { max-height: 420px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 3; background: var(--navy); color: #fff; font-weight: 600; font-size: .8rem; }
.table td { white-space: normal; }
.table tr.muted td { color: var(--muted); }
.grid th.d { text-align: center; padding: 4px 2px; min-width: 34px; line-height: 1.1; }
.grid th.d small { display: block; font-weight: 400; opacity: .8; font-size: .68rem; }
.grid th.we { background: var(--slate); }
.grid th.today { box-shadow: inset 0 -3px 0 #c9b8ff; }
.grid th.tot, .grid td.tot { text-align: right; font-weight: 700; background: #f2f2f2; position: sticky; right: 0; z-index: 2; }
.grid thead th.tot { background: var(--slate); color: #fff; z-index: 4; }
.grid .sticky { position: sticky; z-index: 2; background: var(--card); }
.grid thead .sticky { z-index: 5; background: var(--navy); }
.grid .c1 { left: 0; width: 56px; min-width: 56px; max-width: 56px; }
.grid .c2 { left: 56px; width: 190px; min-width: 190px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.grid .c3 { left: 246px; min-width: 92px; box-shadow: 1px 0 0 var(--line); }
.grid td.cell { text-align: center; padding: 6px 2px; cursor: pointer; font-variant-numeric: tabular-nums; border-left: 1px solid #eef0f4; }
.grid td.cell.we { background: var(--we); }
.grid td.cell.has { font-weight: 600; }
.grid td.cell.adm { background: #fff2cc; }
.grid td.cell:hover { background: var(--brand-soft); }
.grid tr.group td { border-top: 2px solid var(--navy); }
.grid tfoot td { font-weight: 700; background: #f2f2f2; position: sticky; bottom: 0; z-index: 2; border-top: 2px solid var(--navy); }
.grid tfoot .sticky { background: #f2f2f2; z-index: 3; }
.grid tfoot td.tot { z-index: 4; }
td.empty { text-align: center; color: var(--muted); padding: 24px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--err-soft); color: var(--err); border-radius: 999px; padding: 5px 12px; font-size: .85rem; }
.tags li.ok { background: var(--ok-soft); color: var(--ok); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols .card { margin-bottom: 0; }
.tab > .cols { margin-bottom: 16px; }

.modal {
  position: fixed; inset: 0; background: rgba(20, 20, 35, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: var(--card); border-radius: 14px; padding: 20px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.modal-box .actions { margin-top: 12px; }
.creds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.creds div { background: var(--tile); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.creds span { font-size: .8rem; color: var(--muted); }
.creds strong { font-size: 1.8rem; letter-spacing: .08em; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .cols .card { margin-bottom: 16px; }
  .tabs { margin-left: 0; order: 3; width: 100%; }
  .grid .c2 { width: 140px; min-width: 140px; max-width: 140px; }
  .grid .c3 { left: 196px; }
}
@media (max-width: 380px) {
  .chip { padding: 8px 10px; }
  .step { width: 56px; height: 56px; }
  .bar-logo { height: 28px; }
}

/* administravimo formų užrašai kaip darbuotojo puslapyje */
.admin form > label:not(.check) { font-size: .85rem; font-weight: 600; color: var(--muted); }
.admin form > label:not(.check) input { margin-top: 6px; color: var(--ink); font-weight: 400; font-size: 1rem; }

/* telefone prilipę lieka tik kodas, kad matytųsi dienos */
@media (max-width: 600px) {
  .grid .c2, .grid .c3, .grid th.tot, .grid td.tot { position: static; }
  .grid .c2 { width: auto; min-width: 120px; max-width: none; }
  .grid thead .c2, .grid thead .c3, .grid thead th.tot { position: sticky; top: 0; }
}

.checklist { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.checklist label.check { margin: 0; padding: 7px 0; border-bottom: 1px solid #eef0f4; font-size: .9rem; }
.checklist label.check:last-child { border-bottom: 0; }
.checklist .mono { font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.table td div + div { margin-top: 2px; }
