:root {
  --bg: #f4f6f9; --panel: #fff; --text: #1d2433; --muted: #667085; --line: #e3e7ee; --line2: #eef1f5;
  --brand: #1f3b63; --brand2: #2c5aa0; --accent: #2563eb; --accent-soft: #e8efff;
  --green: #12805c; --green-soft: #e3f5ed; --red: #c0362c; --red-soft: #fdecea; --amber: #a15c07; --amber-soft: #fff4e0;
  --blue: #1d4ed8; --blue-soft: #e6eeff; --grey-soft: #eef0f3;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar: 240px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; margin-bottom: 12px; }
h3 { font-size: 15px; margin-bottom: 8px; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- administratoriaus išdėstymas ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--brand); color: #dbe4f3; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar .brand:hover { text-decoration: none; }
.sidebar nav { padding: 4px 10px 12px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dbe4f3; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar nav a.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8fa6c8; padding: 14px 10px 4px; }
.sidebar-foot { padding: 12px 18px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; display: grid; gap: 8px; }
.sidebar-foot a { color: #dbe4f3; display: flex; gap: 8px; align-items: center; }
.sidebar-foot .me { display: flex; gap: 8px; align-items: center; color: #fff; }
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(244,246,249,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 20px 24px 48px; width: 100%; max-width: 1500px; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 16px 16px 40px; }
}

/* ---------- korteles, lentelės ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2, .card.flush > .card-head { padding: 16px 18px 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; flex: 1; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fafcff; }
table.t tfoot td { font-weight: 700; background: #fafbfc; border-top: 1px solid var(--line); }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t .act { white-space: nowrap; text-align: right; }
table.t tr.off td { color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- mygtukai ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: #f6f8fb; }
.btn.danger { background: var(--panel); color: var(--red); border-color: #f1c5c0; }
.btn.green { background: var(--green); border-color: var(--green); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 14px 18px; font-size: 17px; width: 100%; justify-content: center; border-radius: 12px; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: inherit; display: inline-flex; }
.icon-btn:hover { background: rgba(0,0,0,.05); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* ---------- formos ---------- */
form.stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field .lbl { font-size: 13px; font-weight: 600; color: #344054; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=search], input[type=color], input[type=month], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd6e0; border-radius: 8px; font: inherit; font-size: 15px; background: #fff; color: var(--text); min-height: 40px;
}
input[type=color] { padding: 3px; height: 40px; }
textarea { resize: vertical; }
select[multiple] { min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db8f5; outline-offset: 0; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; padding: 4px 0; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1 1 160px; max-width: 260px; }
.filters .field.grow { max-width: none; flex: 2 1 220px; }

/* ---------- ženkliukai, statistika ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grey-soft); color: #475467; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.grey { background: var(--grey-soft); color: #667085; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; display: block; }
a.stat:hover { text-decoration: none; border-color: #b9c8e6; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--green-soft); color: #0b5e43; border: 1px solid #b7e2cf; }
.flash-error { background: var(--red-soft); color: #8f241b; border: 1px solid #f3c1bb; }
.flash-info { background: var(--blue-soft); color: #1c3d99; border: 1px solid #c4d4fb; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.pager span.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.kv { display: grid; grid-template-columns: minmax(110px, min(35%, 220px)) 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photos a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #eef1f5; position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eef1f5; display: block; }
.bulkbar { display: none; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--accent-soft); border-bottom: 1px solid #c9d8fb; }
.bulkbar.show { display: flex; }

/* ---------- kalendorius ---------- */
.cal { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.cal th, .cal td { border: 1px solid var(--line); padding: 4px; text-align: center; min-width: 34px; }
.cal th { background: #fafbfc; font-weight: 600; position: sticky; top: 0; }
.cal td.name, .cal th.name { text-align: left; white-space: nowrap; min-width: 160px; position: sticky; left: 0; background: #fff; z-index: 1; }
.cal .we { background: #f6f7f9; }
.cal .today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .h { background: #e6eeff; color: #1d3f9e; font-weight: 600; }
.cal .abs-sickness { background: #fdecea; color: #a12c22; }
.cal .abs-holiday, .cal .abs-unpaid, .cal .abs-day_off { background: #e3f5ed; color: #0d6b4c; }
.cal .abs-business_trip { background: #fff4e0; color: #8a4f06; }
.cal .abs-idle, .cal .abs-absence, .cal .abs-other { background: #eef0f3; color: #475467; }
.cal td a { color: inherit; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

/* ---------- prisijungimas, vieši puslapiai ---------- */
body.plain { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; background: linear-gradient(180deg, #1f3b63 0, #1f3b63 220px, var(--bg) 220px); }
.plain-box { width: 100%; max-width: 420px; }
.plain-box.wide { max-width: 900px; }
.plain-box .card { padding: 24px; }
.login-brand { color: #fff; text-align: center; margin-bottom: 18px; }
.login-brand img { display: block; margin: 0 auto 8px; }
.login-brand h1 { font-size: 22px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #eef1f5; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.seg a { text-align: center; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg a.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }
.sig-pad { width: 100%; height: 200px; border: 1px dashed #98a6bd; border-radius: 8px; background: #fff; touch-action: none; }

/* ---------- darbuotojo (telefono) vaizdas ---------- */
body.worker { padding-bottom: calc(70px + env(safe-area-inset-bottom)); background: var(--bg); }
.w-top { background: var(--brand); color: #fff; padding: 14px 16px 12px; padding-top: calc(14px + env(safe-area-inset-top)); }
.w-company { font-size: 12px; opacity: .75; text-transform: uppercase; letter-spacing: .05em; }
.w-name { font-weight: 700; font-size: 17px; }
.w-content { padding: 16px; max-width: 640px; margin: 0 auto; }
.w-title { font-size: 20px; margin: 4px 0 14px; }
.w-tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.w-tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11px; color: var(--muted); font-weight: 600; }
.w-tabs a.on { color: var(--accent); }
.w-tabs a:hover { text-decoration: none; }
body.worker input, body.worker select, body.worker textarea { font-size: 16px; min-height: 46px; }
body.worker input[type=checkbox], body.worker input[type=radio] { min-height: 0; width: 22px; height: 22px; }
.w-card { background: #fff; border-radius: 14px; border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.w-list { display: grid; gap: 10px; }
.w-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; color: inherit; }
.w-item:hover { text-decoration: none; }
.w-item .main-col { flex: 1; min-width: 0; }
.w-item .t1 { font-weight: 600; }
.w-item .t2 { font-size: 13px; color: var(--muted); }
.w-item .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.w-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.w-sum div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.w-sum b { display: block; font-size: 22px; }
.w-sum span { font-size: 12px; color: var(--muted); }
.time-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.chip.on, .chip:active { background: var(--accent-soft); border-color: #a9c0f7; color: var(--blue); }
.photo-input { display: grid; gap: 8px; }
.photo-prev { display: flex; gap: 8px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; justify-content: center; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; min-height: 0; }
.photo-prev img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.lang-switch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* ---------- spausdinimas ---------- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .w-tabs, .w-top, .bulkbar, .pager, .flash { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body, html { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block; }
  table.t { font-size: 11px; }
  table.t th, table.t td { padding: 4px 6px; }
  a { color: inherit; }
  @page { margin: 12mm; }
}
