/* Riebus Pienas portalas — dizaino žetonai ir komponentai */
:root {
  --brand: #329dd0;        /* logotipo mėlyna (PDF „spalvų variantai“) */
  --brand-ink: #08232f;    /* tekstas ant brand fono (kontrastas > 6:1) */
  --brand-strong: #17678f; /* nuorodos / tekstas ant balto (kontrastas > 5:1) */
  --brand-tint: #e7f4fa;
  --ink: #111417;
  --ink-2: #4a545c;
  --line: #e6e9ec;
  --bg: #f6f7f8;
  --card: #ffffff;
  --side: #0b0d0f;
  --side-ink: #c9d1d6;
  --side-line: #23282d;
  --ok: #0e7a4e;
  --ok-bg: #e2f5ec;
  --warn: #7a4b00;
  --warn-bg: #fdf1d6;
  --bad: #9b1c1c;
  --bad-bg: #fde7e7;
  --radius: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bitter", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; font: 400 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--brand-strong); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { width: 20px; height: 20px; flex: none; }
.num, td.num, .stat-value { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 2px; border-radius: 6px; }
.side :focus-visible { outline-color: #fff; }
.skip { position: absolute; left: 8px; top: -60px; background: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }

/* ---------- Kevalas ---------- */
.app { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--side); color: var(--side-ink); width: 268px; padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; transition: width .2s ease; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; border-bottom: 1px solid var(--side-line); margin-bottom: 18px; }
.brand img { width: 46px; height: 46px; background: #fff; border-radius: 13px; padding: 2px; flex: none; }
.brand .name { font: 700 1.1rem/1.1 var(--font-display); color: #fff; }
.brand .role { display: block; font: 600 .72rem/1.2 var(--font); color: var(--brand); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.collapse { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; background: #1b2024; border: 0; color: #fff; border-radius: 9px; }
.collapse .ic { transition: transform .2s; }
.nav { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.nav a, .navbtn { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; color: var(--side-ink); text-decoration: none; font-weight: 600; background: none; border: 0; width: 100%; text-align: left; min-height: 46px; transition: background .15s, color .15s; }
.nav a:hover, .navbtn:hover { background: #181c20; color: #fff; }
.nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.nav .badge-n { margin-left: auto; background: var(--brand); color: var(--brand-ink); font-size: .72rem; font-weight: 800; border-radius: 99px; padding: 1px 8px; }
.nav a[aria-current="page"] .badge-n { background: var(--brand-ink); color: #fff; }
.side-foot { padding-top: 14px; border-top: 1px solid var(--side-line); }
.app.collapsed .side { width: 84px; }
.app.collapsed .lbl, .app.collapsed .brand .name-wrap, .app.collapsed .badge-n { display: none; }
.app.collapsed .brand { flex-direction: column; padding-bottom: 14px; }
.app.collapsed .collapse { margin: 0; }
.app.collapsed .collapse .ic { transform: rotate(180deg); }
.app.collapsed .nav a, .app.collapsed .navbtn { justify-content: center; padding: 12px 0; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); min-height: 72px; padding: 0 28px; display: flex; align-items: center; gap: 14px; }
.top h1 { font-size: 1.35rem; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.icon-btn:hover { background: #eceff1; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #d92d2d; color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.menu-btn { display: none; }
.user { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-strong); display: grid; place-items: center; font-weight: 800; }
.user b { display: block; font-size: .9rem; line-height: 1.2; }
.user small { color: var(--ink-2); font-size: .8rem; }
main { padding: 28px; outline: none; }
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 54px; width: min(360px, 88vw); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(10, 20, 30, .18); padding: 8px; z-index: 40; max-height: 70vh; overflow: auto; }
.pop h3 { padding: 10px 12px 6px; font-size: 1rem; }
.pop .item { padding: 10px 12px; border-radius: 10px; font-size: .93rem; }
.pop .item.unread { background: var(--brand-tint); }
.pop .item small { display: block; color: var(--ink-2); }

/* ---------- Komponentai ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stack { display: grid; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 22px 0; margin: 0 0 12px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--ink-2); font-weight: 600; }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 8px; }
.stat-value { font: 800 2rem/1.1 var(--font); letter-spacing: -.01em; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .9rem; margin-top: 8px; }
.delta.up { color: var(--ok); } .delta.down { color: #c0262d; }
.delta small { font-weight: 500; color: var(--ink-2); }
.delta .ic { width: 16px; height: 16px; }
.spark { width: 130px; height: 56px; flex: none; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1 1 220px; }
.field { display: grid; gap: 6px; }
.field label, .lbl-t { font-weight: 700; font-size: .92rem; }
.field .hint { color: var(--ink-2); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; background: #fff; border: 1px solid #ccd2d7; border-radius: 12px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-strong); outline-offset: 1px; border-color: var(--brand-strong); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.err { color: var(--bad); font-weight: 600; font-size: .9rem; }
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid #ccd2d7; background: #fff; font-weight: 700; text-decoration: none; color: var(--ink); transition: background .15s, box-shadow .15s; }
.btn:hover { background: #f1f3f5; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #2a8fbf; }
.btn-danger { color: var(--bad); border-color: #efc3c3; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--brand-strong); font-weight: 700; padding: 6px 4px; text-decoration: underline; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .9rem; background: #f3f4f6; padding: 14px 18px; white-space: nowrap; }
td { padding: 16px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
td small { display: block; color: var(--ink-2); }
td.num, th.num { text-align: right; }
td .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
tbody tr:hover { background: #fafbfc; }
.empty { padding: 40px 22px; text-align: center; color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 99px; font-size: .82rem; font-weight: 700; white-space: nowrap; background: #eceff1; color: #3b454c; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.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.info { background: var(--brand-tint); color: var(--brand-strong); }
.pill-select { min-height: 36px; padding: 4px 30px 4px 10px; border-radius: 10px; font-weight: 600; width: auto; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.pcard { display: flex; flex-direction: column; gap: 10px; }
.pcard .farm { color: var(--ink-2); font-size: .88rem; }
.pcard .price { font: 800 1.4rem/1 var(--font); }
.pcard .price small { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.pcard .buy { display: flex; gap: 8px; margin-top: auto; }
.pcard .buy input { width: 84px; }
.pcard .buy .btn { flex: 1; padding: 0 12px; }
.qty { width: 86px !important; min-height: 38px !important; }

.cols { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 24px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; font-size: .8rem; color: var(--ink-2); }
.col .bar { width: 100%; max-width: 56px; background: var(--brand); border-radius: 8px 8px 0 0; min-height: 3px; }
.col b { color: var(--ink); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbars { display: grid; gap: 14px; }
.hbar .top-row { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; margin-bottom: 4px; }
.hbar .track { height: 10px; background: #edf0f2; border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 99px; }

.dropzone { border: 2px dashed #b9c4cb; border-radius: 16px; padding: 34px 20px; text-align: center; background: #fafcfd; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--brand-tint); border-color: var(--brand-strong); }
.dropzone .ic { width: 34px; height: 34px; color: var(--brand-strong); margin-bottom: 8px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; counter-reset: s; padding: 0; margin: 0 0 16px; list-style: none; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e3e8ec; font-size: .85rem; }
.steps li.on { color: var(--ink); } .steps li.on::before { background: var(--brand); color: var(--brand-ink); }
.notice { display: flex; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--brand-tint); color: #0d4a68; font-size: .93rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 600; }

dialog { border: 0; border-radius: 20px; padding: 0; width: min(640px, 94vw); box-shadow: 0 30px 80px rgba(8, 20, 30, .35); }
dialog::backdrop { background: rgba(8, 14, 18, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.dlg-body { padding: 8px 24px 8px; max-height: 68vh; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; flex-wrap: wrap; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 200; }
.toast { background: #111417; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: tin .25s ease; max-width: 340px; }
.toast.ok { border-left: 5px solid var(--brand); } .toast.bad { border-left: 5px solid #f26b6b; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Prisijungimo / vartų puslapiai ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, #d7ebf6 0, transparent 60%), radial-gradient(900px 500px at 100% 110%, #d9e9df 0, transparent 55%), #eef3f5; }
.gate-card { width: min(440px, 100%); background: #fff; border-radius: 26px; padding: 36px 32px; box-shadow: 0 30px 70px rgba(20, 50, 70, .14); display: grid; gap: 18px; text-align: center; }
.gate-card img.logo { width: 132px; height: 132px; margin: 0 auto; }
.gate-card form { display: grid; gap: 14px; text-align: left; }
.gate-card .code { text-align: center; font: 700 1.2rem var(--font); letter-spacing: .12em; text-transform: uppercase; }
.gate-foot { color: var(--ink-2); font-size: .85rem; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s ease; width: 280px !important; }
  .app.nav-open .side { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 25; }
  .app.collapsed .lbl, .app.collapsed .brand .name-wrap { display: initial; }
  .collapse { display: none; }
  .menu-btn { display: grid; }
  .top { padding: 0 16px; }
  main { padding: 18px 16px; }
  .user div { display: none; }
  .user { padding-left: 0; border: 0; }
  .top h1 { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media print {
  body > *:not(dialog) { display: none !important; }
  dialog { position: static !important; box-shadow: none; width: 100%; }
  dialog::backdrop { display: none; }
  .dlg-foot, .dlg-head button { display: none !important; }
}
