/* Grupės fondas — banko tipo sąsaja. Spalvos: tamsiai mėlyna + balta. */
:root {
  --navy-950: #0a1a33;
  --navy-900: #0e2240;
  --navy-800: #16305a;
  --navy-700: #234477;
  --accent:   #2d6be0;
  --ink:      #14213a;
  --muted:    #5b6b82;
  --line:     #dbe2eb;
  --line-soft:#edf1f6;
  --bg:       #f2f5f9;
  --surface:  #ffffff;
  --ok:       #127046;
  --ok-bg:    #e3f3ea;
  --warn:     #9a5b00;
  --warn-bg:  #fdf1dc;
  --bad:      #b42318;
  --bad-bg:   #fdeaea;
  --radius:   10px;
  --radius-sm:6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #8fb4ff; outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
p { margin: .4rem 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
code { background: var(--line-soft); padding: .1em .35em; border-radius: 4px; }
.num, .hero-amount, .stat strong, input.input-money { font-variant-numeric: tabular-nums; }

/* Viršutinė juosta */
.topbar { background: var(--navy-900); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: .6rem 1.2rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none !important; flex-shrink: 0; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: #fff; color: var(--navy-900); font-weight: 800; font-size: 1.05rem;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 1.7rem; border-radius: 14px; background: var(--navy-900); color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: #a9bbd8; font-size: .78rem; }
.mainnav { display: flex; align-items: center; gap: .15rem; flex: 1; flex-wrap: wrap; }
.mainnav > a { color: #cfdbef; padding: .45rem .7rem; border-radius: var(--radius-sm); font-size: .93rem; }
.mainnav > a:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.mainnav > a.active { background: var(--navy-700); color: #fff; font-weight: 600; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: .8rem; font-size: .88rem; }
.nav-user-name { color: #fff; font-weight: 600; }
.nav-user a, .nav-user .linklike { color: #a9bbd8; }
.nav-toggle { display: none; margin-left: auto; background: var(--navy-800); color: #fff; border: 1px solid var(--navy-700); border-radius: var(--radius-sm); padding: .45rem .8rem; font: inherit; cursor: pointer; }

/* Išdėstymas */
.container { max-width: 1200px; margin: 0 auto; padding: 1.4rem 1.2rem; }
.container.narrow { max-width: 560px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { font-size: .88rem; color: var(--muted); }
.back::before { content: "‹ "; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.grid-2.tight { gap: 1.5rem; margin: 0; }
.grid-2 > .card { margin-bottom: 0; }
.footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .82rem; padding-top: 0; }

/* Kortelės */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head a, .card-head span { font-size: .9rem; }

/* Likučio blokas — pagrindinis akcentas */
.hero {
  background: var(--navy-900); color: #fff; border-radius: 14px; padding: 1.6rem 1.8rem;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; border: 1px solid var(--navy-800);
}
.hero-main { display: flex; flex-direction: column; gap: .2rem; }
.hero-label { color: #a9bbd8; font-size: .92rem; }
.hero-amount { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.hero-amount.neg { color: #ffb4ab; }
.hero-date { color: #7f95b8; font-size: .82rem; }
.hero-equation { display: flex; align-items: flex-end; gap: .9rem; flex-wrap: wrap; }
.hero-equation div { display: flex; flex-direction: column; }
.hero-equation span { color: #a9bbd8; font-size: .8rem; }
.hero-equation strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hero-equation .op { color: #7f95b8; font-size: 1.3rem; padding-bottom: .05rem; }

/* Statistika */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.3rem; }
.quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }

/* Spalvos sumoms */
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.warn-text { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.empty { color: var(--muted); padding: .6rem 0; }

/* Lentelės */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.2rem; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .6rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafd; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.row-muted td { color: #8a97ab; }
.table tr.row-muted td a { color: #7d93bb; }
.summary-table td { font-size: 1rem; }
.summary-table tr.total td { font-weight: 700; border-top: 2px solid var(--navy-900); border-bottom: 0; }
.nowrap { white-space: nowrap; }
.details .kv { display: inline-block; margin-right: .6rem; font-size: .85rem; }

/* Būsenos žymos */
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: .12rem .5rem; border-radius: 99px; vertical-align: middle; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-neutral { background: #e8eef8; color: var(--navy-700); }
.badge-muted { background: #eef0f3; color: #6b7685; }

/* Progreso juostos */
.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list li { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; padding: .65rem 0; border-bottom: 1px solid var(--line-soft); }
.progress-list li:last-child { border-bottom: 0; }
.progress-list .bar { grid-column: 1 / -1; }
progress.bar { width: 100%; height: 6px; border: 0; border-radius: 99px; background: var(--line-soft); overflow: hidden; appearance: none; -webkit-appearance: none; }
progress.bar::-webkit-progress-bar { background: var(--line-soft); border-radius: 99px; }
progress.bar::-webkit-progress-value { background: var(--navy-700); border-radius: 99px; }
progress.bar::-moz-progress-bar { background: var(--navy-700); border-radius: 99px; }

/* Mygtukai */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--navy-900); color: #fff; border: 1px solid var(--navy-900);
  border-radius: var(--radius-sm); padding: .6rem 1.05rem; font: inherit; font-weight: 600; font-size: .93rem;
  cursor: pointer; text-decoration: none !important; min-height: 42px;
}
.btn:hover { background: var(--navy-800); }
.btn-secondary { background: #fff; color: var(--navy-900); border-color: #b9c6d8; }
.btn-secondary:hover { background: #f1f5fb; }
.btn-ghost { background: transparent; color: var(--navy-800); border-color: transparent; }
.btn-ghost:hover { background: #e8eef8; }
.btn-danger { background: #fff; color: var(--bad); border-color: #ecb3ad; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-small { padding: .35rem .7rem; font-size: .84rem; min-height: 34px; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--bad); }
form.inline { display: inline; }

/* Formos */
.form label, .filters label, .row-form, .inline-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; color: #33435c; margin-bottom: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=file], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid #c4cfdd; border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 42px; width: 100%;
}
input[type=file] { padding: .4rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid #bcd2ff; outline-offset: 0; }
.check { flex-direction: row !important; align-items: center; gap: .5rem !important; font-weight: 400 !important; }
.check input { width: 18px; height: 18px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.narrow-form { max-width: 520px; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.filters label { margin: 0; min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.inline-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: .8rem 0; }
.inline-form label { margin: 0; flex: 1 1 200px; }
.row-form { flex-direction: row !important; align-items: center; gap: .4rem !important; margin: 0 !important; justify-content: flex-end; flex-wrap: wrap; }
.input-money { width: 110px !important; text-align: right; min-height: 36px !important; padding: .35rem .5rem !important; }
.input-note { width: 150px !important; min-height: 36px !important; padding: .35rem .5rem !important; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem 1rem; margin: .4rem 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .2rem 1rem; }
.checks .check { margin-bottom: .3rem; }
.alloc .btn { margin-bottom: .6rem; }
.alloc-summary { margin-top: .8rem; }

/* Pranešimai */
.alert { border-radius: var(--radius-sm); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; font-size: .94rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--ok-bg); border-color: #b5dec6; color: #0d5534; }
.alert-error { background: var(--bad-bg); border-color: #f1b8b2; color: #8a1a12; }
.alert-info { background: #e9f0fc; border-color: #c3d4f3; color: #1b3a6b; }

/* Aprašų sąrašas */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; }
.receipt-img { max-width: 100%; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: block; margin-bottom: .6rem; }

.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; color: var(--muted); }

/* Prisijungimas */
body.guest { background: linear-gradient(180deg, var(--navy-900) 0, var(--navy-900) 260px, var(--bg) 260px); min-height: 100vh; }
.login-wrap { max-width: 400px; margin: 2rem auto 0; }
.login-brand { text-align: center; color: #fff; margin-bottom: 1.4rem; }
.login-brand .brand-mark.big { background: #fff; color: var(--navy-900); }
.login-brand h1 { margin-top: .8rem; }
.login-brand p { color: #a9bbd8; margin: 0; }
.login-card { padding: 1.6rem; box-shadow: 0 10px 30px rgba(14, 34, 64, .12); }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: 1rem; }
.error-card { margin-top: 3rem; }
body.guest .footer { display: none; }
body.guest .page-head h1 { color: #fff; }

/* Planšetės ir telefonai */
@media (max-width: 960px) {
  .nav-toggle { display: inline-block; }
  .topbar-inner { flex-wrap: wrap; gap: .6rem; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .4rem 0 .6rem; }
  body.nav-open .mainnav { display: flex; }
  .mainnav > a { padding: .7rem .8rem; font-size: 1rem; }
  .nav-user { margin: .5rem 0 0; padding: .8rem .8rem 0; border-top: 1px solid var(--navy-800); flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2.tight { gap: 1rem; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .container { padding: 1rem .8rem; }
  .card { padding: 1rem; }
  .hero { padding: 1.3rem 1.2rem; gap: 1.2rem; }
  .hero-equation { gap: .6rem; }
  .stat strong { font-size: 1.1rem; }
  .filters label { max-width: none; }
  .quick-actions .btn, .actions .btn { flex: 1 1 auto; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .5rem; }
  .table { font-size: .88rem; }
  .table td, .table th { padding: .5rem .45rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .topbar, .filters, .actions, .quick-actions, .btn, form { display: none !important; }
  body { background: #fff; }
  .card, .stat { border-color: #ccc; break-inside: avoid; }
  .hero { background: #fff; color: #000; border: 1px solid #000; }
  .hero-label, .hero-equation span, .hero-date { color: #333; }
}
