:root {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --ink: #2b2723;
    --muted: #7a726a;
    --line: #e6e0d7;
    --accent: #8a6a4f;
    --accent-ink: #ffffff;
    --accent-soft: #f1e9e0;
    --ok: #3f7a52;
    --ok-soft: #e7f2ea;
    --err: #a3402f;
    --err-soft: #f8e7e3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(43, 39, 35, .06), 0 4px 16px rgba(43, 39, 35, .05);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.app { flex: 1; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* Išdėstymas */
.layout { display: flex; min-height: calc(100vh - 44px); }
.sidebar { width: 230px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
.brand { font-weight: 700; padding: .25rem .75rem 1rem; letter-spacing: -.01em; }
.nav a { display: block; padding: .55rem .75rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-group { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: .55rem .75rem; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.nav-group:hover { background: var(--bg); }
.nav-group.has-active { color: var(--accent); font-weight: 600; }
.nav-group .chevron { width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -.2rem .15rem 0 .5rem; transition: transform .15s; opacity: .7; }
.nav-group[aria-expanded="true"] .chevron { transform: rotate(-135deg); margin-top: .2rem; }
.nav-sub { margin: .1rem 0 .25rem .75rem; padding-left: .5rem; border-left: 1px solid var(--line); }
.nav-sub[hidden] { display: none; }
.nav-sub a { padding: .45rem .75rem; font-size: .95rem; }
.sidebar .me { margin-top: auto; padding: .75rem; border-top: 1px solid var(--line); font-size: .9rem; }
.content { flex: 1; padding: 2rem; max-width: 1100px; }

/* Kortelės ir formos */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.25rem; }
label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: .9rem; }
input, select { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { display: inline; width: auto; margin: 0 .5rem 0 0; }
.check { display: flex; align-items: center; font-weight: 400; margin-bottom: .5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.notice { padding: .75rem 1rem; border-radius: 8px; background: var(--accent-soft); margin-bottom: 1rem; }
.notice.success { background: var(--ok-soft); color: var(--ok); }
.notice.error { background: var(--err-soft); color: var(--err); }
.token { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px dashed var(--accent); padding: .75rem; border-radius: 8px; word-break: break-all; margin: .5rem 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.badge { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; }

/* Prisijungimas */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: .75rem; border-top: 1px solid var(--line); background: var(--surface); }

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; }
    .brand { padding: .25rem .5rem; }
    .sidebar .me { margin: 0 0 0 auto; border: 0; padding: .25rem .5rem; }
    .nav { flex-basis: 100%; order: 3; }
    .content { padding: 1rem; }
    .grid2 { grid-template-columns: 1fr; }
    table { font-size: .9rem; }
}

/* Autentifikatoriaus QR kodas */
.badge.warn { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Mygtukas, laukiantis patvirtinimo (antras paspaudimas atlieka veiksmą) */
.btn.armed { background: var(--err); border-color: var(--err); color: #fff; }

/* Darbas be interneto: juosta viršuje */
.net-banner { position: sticky; top: 0; z-index: 10; display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap;
    padding: .5rem 1rem; background: #fbf1dc; color: #6b4e14; border-bottom: 1px solid #ecd9ae; font-size: .9rem; text-align: center; }
.net-banner.update { background: var(--accent-soft); color: var(--accent); border-bottom-color: var(--line); }
.net-banner[hidden] { display: none; }

/* Teksto puslapiai (privatumo politika) */
.content.doc { max-width: 760px; margin: 0 auto; }
.doc h2 { margin-top: 1.5rem; font-size: 1.1rem; }
.doc li { margin-bottom: .35rem; }
