:root {
    --bg: #fbf7f2;
    --surface: #ffffff;
    --ink: #2b2f36;
    --muted: #6b7280;
    --line: #eadfce;
    --sea: #2f7d86;
    --sea-dark: #235f66;
    --sun: #f28c4a;
    --danger: #b3261e;
    --ok: #2e7d4f;
    --radius: 14px;
    --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.has-nav { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

a { color: var(--sea); }
h1 { font-size: 1.5rem; margin: .25rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }

/* Antraste */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 16px;
    padding-top: calc(.6rem + env(safe-area-inset-top));
    background: rgba(251, 247, 242, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--sea-dark); text-decoration: none; letter-spacing: .01em; }
.userbox { display: flex; align-items: center; gap: .5rem; margin: 0; min-width: 0; }
.username { font-size: .9rem; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: transparent; color: var(--sea-dark); cursor: pointer;
}
.icon-btn:hover { background: var(--line); }

/* Turinys */
.page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; }
.flash-error { background: #fdecea; color: var(--danger); }
.flash-ok { background: #e8f5ee; color: var(--ok); }

/* Pradzios (login) puslapis */
.start { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding-top: .5rem; }
.start-img { width: 100%; max-width: 520px; height: auto; display: block; mix-blend-mode: multiply; }
.google-btn {
    display: inline-flex; align-items: center; gap: .75rem;
    padding: .75rem 1.4rem;
    background: #fff; color: #3c4043; text-decoration: none; font-weight: 500;
    border: 1px solid #dadce0; border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.google-btn:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

/* Formos */
.form { display: flex; flex-direction: column; gap: .75rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.form input[type=text], .form input[type=email] {
    font: inherit; color: var(--ink);
    padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff;
    width: 100%;
}
.form input:focus { outline: 2px solid var(--sea); outline-offset: 1px; }
.form .check { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); }
.form .check input { width: 20px; height: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

.btn {
    font: inherit; font-weight: 600; cursor: pointer;
    padding: .7rem 1.2rem; border: 0; border-radius: 10px;
    background: var(--sea); color: #fff;
}
.btn:hover { background: var(--sea-dark); }
.btn-small { padding: .45rem .9rem; font-size: .9rem; }

/* Admin sub-meniu */
.subtabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 14px; }
.subtabs a {
    padding: .45rem .9rem; border-radius: 999px; text-decoration: none; white-space: nowrap;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: .9rem;
}
.subtabs a.active { background: var(--sea); border-color: var(--sea); color: #fff; }

/* Lenteles */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

/* Footer */
.footer { text-align: center; font-size: .8rem; color: var(--muted); padding: 16px; }

/* Apatine tab juosta (mobile) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex; justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: .72rem;
}
.tabbar a.active { color: var(--sea-dark); font-weight: 600; }
.tabbar a.active svg { stroke: var(--sun); }

@media (min-width: 720px) {
    body.has-nav { padding-bottom: 0; }
    /* Desktop: meniu virsuje, po antraste */
    .tabbar {
        position: sticky; top: 53px; bottom: auto; height: auto; padding: 0;
        justify-content: center; gap: 1rem; border-top: 0; border-bottom: 1px solid var(--line);
        background: var(--bg);
    }
    .tabbar a { flex: 0 0 auto; flex-direction: row; gap: .4rem; padding: .6rem .8rem; font-size: .95rem; }
    .tabbar a.active { border-bottom: 2px solid var(--sea); }
    body { flex-direction: column; }
    .tabbar { order: 0; }
}
