/* V5 Admin — stilius pagal v5.21pixels.lt: #121212, auksas #D6A21E, Barlow / Barlow Condensed, be apvalinimų */
:root {
  --ink: #121212;
  --panel: #1A1A19;
  --panel-2: #222220;
  --line: #2B2B2A;
  --text: #F1EFE9;
  --muted: #A9A59B;
  --gold: #D6A21E;
  --gold-deep: #3A2F10;
  --ok: #7DBE8A;   --ok-bg: #18291C;
  --warn: #E3B341; --warn-bg: #33290F;
  --bad: #EE7A62;  --bad-bg: #3A1A14;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: square; }

/* ---------- Karkasas ---------- */
.shell { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top { position: sticky; top: 0; z-index: 20; background: rgba(18,18,18,.94); backdrop-filter: blur(10px); padding-top: var(--safe-t); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 8px; min-height: 64px; }
.title { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 34px; line-height: 1; letter-spacing: .5px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title.sm { font-size: 24px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text); text-decoration: none; }
.icon-btn:active { background: var(--panel); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #161615; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a { height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; position: relative; }
.nav a[aria-current="page"] { color: var(--gold); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--gold); }
.nav .badge { position: absolute; top: 9px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; background: var(--gold); color: #111; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.nav .brand { display: none; }

@media (min-width: 900px) {
  .nav { position: sticky; top: 0; left: auto; bottom: auto; height: 100dvh; width: 220px; flex: none; display: flex; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 20px 0; }
  .nav a { flex-direction: row; justify-content: flex-start; height: 52px; padding: 0 24px; gap: 12px; font-size: 15px; }
  .nav a[aria-current="page"]::before { top: 10px; bottom: 10px; left: 0; right: auto; width: 3px; height: auto; }
  .nav .badge { position: static; margin-left: auto; }
  .nav .brand { display: block; font-family: var(--cond); font-weight: 800; font-size: 30px; text-transform: uppercase; padding: 0 24px 20px; color: var(--text); line-height: .95; }
  .nav .brand span { color: var(--gold); }
  .main { padding-bottom: 40px; }
  .fab { bottom: 32px !important; right: 40px !important; }
}

/* ---------- Valdikliai ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 48px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; margin: 16px 0 12px; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 16px; }
.search svg { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 14px; border: 1px solid var(--line); background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #111; }
.chip .n { opacity: .7; margin-left: 4px; }

.btn { height: 48px; padding: 0 18px; border: 1px solid var(--text); background: transparent; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #111; }
.btn.ghost { border-color: var(--line); }
.btn.danger { border-color: #5a2a22; color: var(--bad); }
.btn.sm { height: 44px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.row-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 16px 0; }

.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25; width: 58px; height: 58px; background: var(--gold); color: #111; border: 0; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 28px rgba(0,0,0,.5); text-decoration: none; }
.fab svg.i { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- Sąrašai ---------- */
.list { border-top: 1px solid var(--line); }
.item { display: flex; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 72px; }
a.item:active, button.item:active { background: var(--panel); }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 600; font-size: 17px; }
.item .sub { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.av { width: 42px; height: 42px; flex: none; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-weight: 700; font-size: 18px; }

.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; background: currentColor; }
.t-new, .t-debt, .t-none { background: var(--bad-bg); color: var(--bad); }
.t-contacted, .t-active { background: var(--ok-bg); color: var(--ok); }
.t-expiring { background: var(--warn-bg); color: var(--warn); }
.t-member { background: var(--gold-deep); color: var(--gold); }

.empty { padding: 48px 8px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Suvestinė ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); margin: 16px 0 8px; }
.stats button { background: transparent; border: 0; border-right: 1px solid var(--line); padding: 12px 12px 10px; text-align: left; color: inherit; }
.stats button:last-child { border-right: 0; }
.stats button[aria-pressed="true"] { background: var(--panel); }
.stats b { display: block; font-family: var(--cond); font-size: 34px; line-height: 1; font-weight: 700; }
.stats span { font-size: 13px; color: var(--muted); }

.hero-num { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 0 14px; border-bottom: 1px solid var(--line); }
.hero-num b { font-family: var(--cond); font-size: 56px; line-height: .9; font-weight: 800; color: var(--gold); }
.hero-num span { color: var(--muted); font-size: 14px; text-align: right; }
.section-h { font-family: var(--cond); font-weight: 700; font-size: 22px; text-transform: uppercase; margin: 28px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.section-h small { font-family: var(--body); text-transform: none; font-size: 14px; color: var(--muted); font-weight: 500; }

/* ---------- Kortelė (narys / registracija) ---------- */
.head { padding: 20px 0 8px; }
.head h2 { font-family: var(--cond); font-weight: 800; font-size: 44px; line-height: .95; text-transform: uppercase; margin: 0 0 8px; word-break: break-word; }
.head p { margin: 0; color: var(--muted); }
.state { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; margin: 16px 0 0; border: 1px solid var(--line); }
.state.s-active { background: var(--ok-bg); border-color: #2b4a33; }
.state.s-expiring { background: var(--warn-bg); border-color: #57461a; }
.state.s-debt, .state.s-none { background: var(--bad-bg); border-color: #5a2a22; }
.state .k { font-family: var(--cond); font-size: 26px; font-weight: 800; text-transform: uppercase; line-height: 1; }
.s-active .k { color: var(--ok); } .s-expiring .k { color: var(--warn); } .s-debt .k, .s-none .k { color: var(--bad); }
.state .v { color: var(--text); font-size: 14px; margin-top: 4px; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; white-space: pre-line; }
.pay { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit; min-height: 64px; }
.pay .amt { font-family: var(--cond); font-weight: 700; font-size: 22px; }
.pay.void { opacity: .5; }
.pay.void .amt { text-decoration: line-through; }

.ev { padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.ev .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.ev .meta .who { color: var(--gold); font-weight: 600; }
.ev details { margin-top: 6px; font-size: 13px; color: var(--muted); }
.ev summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.ev table { border-collapse: collapse; width: 100%; }
.ev td { padding: 4px 6px 4px 0; vertical-align: top; border-top: 1px solid var(--line); }
.ev td del { color: var(--bad); text-decoration: none; }
.ev td ins { color: var(--ok); text-decoration: none; }
.day { font-family: var(--cond); font-weight: 700; font-size: 16px; text-transform: uppercase; color: var(--muted); padding: 18px 4px 6px; border-bottom: 1px solid var(--line); }

/* ---------- Formos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; color: #D8D5CD; }
.field input, .field select, .field textarea { min-height: 50px; background: var(--ink); border: 1px solid var(--line); padding: 12px 14px; font-size: 16px; outline: none; width: 100%; border-radius: 0; -webkit-appearance: none; appearance: none; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field .hint { font-size: 13px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); margin-bottom: 14px; }
.switch input { width: 52px; height: 30px; -webkit-appearance: none; appearance: none; background: #3A3A38; position: relative; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: var(--text); transition: transform .15s; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(22px); background: #111; }
.err { color: var(--bad); font-size: 14px; margin: 0 0 12px; }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--panel); border-top: 3px solid var(--gold); padding: 8px 20px calc(20px + var(--safe-b)); animation: up .2s cubic-bezier(.2,.8,.2,1); }
.sheet h3 { font-family: var(--cond); font-weight: 800; font-size: 28px; text-transform: uppercase; margin: 8px 0 16px; display: flex; justify-content: space-between; align-items: center; }
.sheet .field input, .sheet .field select, .sheet .field textarea { background: var(--ink); }
@media (min-width: 700px) { .scrim { align-items: center; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 20px); transform: translateX(-50%) translateY(20px); z-index: 60; background: var(--text); color: #111; padding: 0 6px 0 16px; min-height: 48px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s; width: max-content; max-width: min(520px, calc(100% - 32px)); line-height: 1.3; }
#toast span { padding: 10px 0; }
#toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast.err { background: var(--bad); }
#toast button { background: transparent; border: 0; font-weight: 800; color: #111; text-decoration: underline; min-height: 44px; padding: 0 10px; }

/* ---------- Prisijungimas ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(40px + var(--safe-t)) 24px 40px; max-width: 440px; margin: 0 auto; }
.login .mark { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 88px; line-height: .82; margin: 0 0 6px; letter-spacing: -1px; }
.login .mark span { color: var(--gold); display: block; font-size: 40px; letter-spacing: 1px; margin-top: 8px; }
.login p { color: var(--muted); margin: 14px 0 32px; }
.login .note { font-size: 13px; color: var(--muted); margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.more { margin: 16px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
