/* ─────────── Bazė ─────────── */
:root {
  --raudona:      #B10116;
  --raudona-sv:   #D81B2E;
  --fonas:        #F2F2F7;
  --kortele:      #FFFFFF;
  --tekstas:      #000000;
  --pilka:        #8A8A8E;
  --pilka-sv:     #C6C6C8;
  --skirtukas:    #E5E5EA;
  --mėlyna:       #007AFF;
  --sauga-virsus: env(safe-area-inset-top, 0px);
  --sauga-apacia: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--fonas);
  color: var(--tekstas);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
.pilka  { color: var(--pilka); }
.raudona{ color: var(--raudona); }

/* ─────────── Prisijungimas ─────────── */
#ekranas-login {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--sauga-virsus));
}
.login-vidus { width: 100%; max-width: 340px; text-align: center; }
.login-ikona { width: 92px; height: 92px; border-radius: 21px; box-shadow: 0 8px 24px rgba(177,1,22,.22); }
.login-title { font-size: 30px; font-weight: 700; margin: 18px 0 4px; letter-spacing: -.4px; }
.login-sub   { color: var(--pilka); font-size: 15px; margin: 0 0 32px; }

.ivestis {
  width: 100%; padding: 14px 16px; font-size: 17px;
  border: none; border-radius: 12px; background: var(--kortele);
  margin-bottom: 12px; font-family: inherit;
}
.ivestis:focus { outline: 2px solid var(--raudona); outline-offset: -2px; }

.btn {
  width: 100%; padding: 15px; font-size: 17px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { opacity: .7; }
.btn-primary     { background: var(--raudona); color: #fff; margin-bottom: 18px; }
.btn-sekundarinis{ background: var(--kortele); color: var(--raudona); }
.vienintelis .btn-sekundarinis { background: var(--raudona); color: #fff; }
.btn-trinti      { background: var(--kortele); color: var(--raudona); margin-top: 24px; }
.btn:disabled    { opacity: .45; }

.klaida { color: var(--raudona); font-size: 14px; min-height: 20px; margin: 14px 0 0; }

/* ─────────── Antraštė ─────────── */
.antraste {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--sauga-virsus)) 16px 10px;
  background: rgba(242,242,247,.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--pilka-sv);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 20px; font-weight: 700; letter-spacing: -.3px;
}
.antraste-mygtukas {
  background: none; border: none; color: var(--raudona);
  font-size: 30px; line-height: 1; font-weight: 300;
  padding: 0 4px; cursor: pointer; font-family: inherit;
}
.antraste-mygtukas:active { opacity: .5; }

/* ─────────── Turinys ─────────── */
#ekranas-app { display: flex; flex-direction: column; min-height: 100%; }
.turinys {
  flex: 1;
  padding: 14px 12px calc(74px + var(--sauga-apacia));
  -webkit-overflow-scrolling: touch;
}

.kortele {
  background: var(--kortele);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* ─────────── Lentelė ─────────── */
.lentele { width: 100%; }
.eil {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: .5px solid var(--skirtukas);
}
.eil:last-child { border-bottom: none; }
.eil-antraste {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .3px; color: var(--pilka);
  padding: 9px 14px; background: #FAFAFC;
}
.eil-duomenys { cursor: pointer; }
.eil-duomenys:active { background: var(--skirtukas); }
.st { text-align: right; }
.st-data { text-align: left; }

.reiksme { font-variant-numeric: tabular-nums; text-align: right; }
.reiksme.nera { color: var(--pilka-sv); }
.data-langelis { font-variant-numeric: tabular-nums; font-weight: 500; }

.pastaba {
  grid-column: 1 / -1;
  font-size: 13px; color: var(--pilka);
  margin-top: 4px; text-align: left;
  white-space: pre-wrap; word-break: break-word;
}

.tuscia { text-align: center; color: var(--pilka); font-size: 15px; padding: 34px 20px; margin: 0; }

/* ─────────── Nustatymai ─────────── */
.grupes-antraste {
  font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--pilka); margin: 24px 0 7px 16px; font-weight: 500;
}
.grupes-antraste:first-child { margin-top: 6px; }
.grupes-paaiskinimas {
  font-size: 13px; color: var(--pilka); margin: 0 16px 4px; line-height: 1.4;
}
.grupes-paaiskinimas code { font-size: 12px; background: var(--skirtukas); padding: 1px 4px; border-radius: 4px; }

.nust-eil {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; width: 100%;
  padding: 13px 16px; min-height: 48px;
  border-bottom: .5px solid var(--skirtukas);
  background: none; border-left: none; border-right: none; border-top: none;
  font-size: 17px; font-family: inherit; color: var(--tekstas);
  text-align: left;
}
.nust-eil:last-child { border-bottom: none; }
.nust-mygtukas { cursor: pointer; }
.nust-mygtukas:active { background: var(--skirtukas); }
.rodykle { color: var(--pilka-sv); font-size: 20px; font-weight: 300; }

.jungiklis {
  appearance: none; -webkit-appearance: none;
  width: 51px; height: 31px; border-radius: 16px;
  background: var(--pilka-sv); position: relative; cursor: pointer;
  transition: background .2s; flex: none; margin: 0;
}
.jungiklis::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s;
}
.jungiklis:checked { background: #34C759; }
.jungiklis:checked::after { transform: translateX(20px); }
.jungiklis:disabled { opacity: .45; cursor: default; }

.pasirinkimas {
  border: none; background: none; color: var(--pilka);
  font-size: 17px; font-family: inherit; text-align: right;
  padding: 0; cursor: pointer;
}

.versija { text-align: center; color: var(--pilka-sv); font-size: 13px; margin: 28px 0 8px; }

/* ─────────── Skirtukų juosta ─────────── */
.juosta {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: rgba(249,249,249,.94);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--pilka-sv);
  padding-bottom: var(--sauga-apacia);
}
.juostos-mygtukas {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: 7px 0 6px; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--pilka);
}
.juostos-mygtukas.aktyvus { color: var(--raudona); }
.j-ikona { width: 25px; height: 25px; display: block; }
.btn-ikona { width: 21px; height: 21px; display: block; flex: none; }
.j-tekstas { font-size: 10.5px; font-weight: 500; }

/* ─────────── Modalas ─────────── */
.modalo-fonas {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.35);
  display: flex; align-items: flex-end; justify-content: center;
}
.modalas {
  width: 100%; max-width: 520px;
  background: var(--fonas);
  border-radius: 14px 14px 0 0;
  max-height: 92vh; overflow-y: auto;
  padding-bottom: var(--sauga-apacia);
  animation: kilti .25s cubic-bezier(.32,.72,0,1);
}
@keyframes kilti { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modalo-antraste {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px 16px;
  background: var(--fonas);
  border-bottom: .5px solid var(--pilka-sv);
  font-size: 16px; font-weight: 600;
}
.modalo-antraste > span { text-align: center; white-space: nowrap; }
.modalo-veiksmas {
  background: none; border: none; color: var(--raudona);
  font-size: 16px; font-family: inherit; cursor: pointer; padding: 0;
  text-align: left;
}
.modalo-issaugoti { font-weight: 600; text-align: right; }
.modalo-veiksmas:active { opacity: .5; }

.modalo-turinys { padding: 16px; }
.laukas {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--kortele); padding: 12px 16px;
  border-bottom: .5px solid var(--skirtukas);
}
.laukas:first-of-type { border-radius: 12px 12px 0 0; }
.laukas-vardas { font-size: 17px; flex: none; }
.laukas input, .laukas textarea {
  border: none; background: none; font-size: 17px; font-family: inherit;
  text-align: right; flex: 1; min-width: 0; color: var(--tekstas);
  padding: 0;
}
.laukas input:focus, .laukas textarea:focus { outline: none; }
.laukas input[type=date] { text-align: right; font-variant-numeric: tabular-nums; }
.laukas-pastabos {
  flex-direction: column; align-items: stretch; gap: 6px;
  border-radius: 0 0 12px 12px; border-bottom: none;
}
.laukas-pastabos .laukas-vardas { font-size: 13px; color: var(--pilka); }
.laukas-pastabos textarea { text-align: left; resize: none; line-height: 1.4; }

.modalo-klaida { color: var(--raudona); font-size: 14px; min-height: 20px; margin: 12px 4px 0; }

/* ─────────── Pranešimas (toast) ─────────── */
.pranesimas {
  position: fixed; left: 50%; bottom: calc(84px + var(--sauga-apacia));
  transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff;
  padding: 11px 18px; border-radius: 22px;
  font-size: 15px; z-index: 90; max-width: 88vw; text-align: center;
  animation: irodyti .2s ease;
}
@keyframes irodyti { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (min-width: 620px) {
  .turinys { max-width: 620px; margin: 0 auto; width: 100%; }
  .antraste { max-width: 620px; margin: 0 auto; width: 100%; }
}
