/* 32grybai.lt — one stylesheet, no framework, no build step.
   System fonts on purpose: nothing to download, nothing to keep updated. */

:root {
    --paper:  #F6F7F1;
    --panel:  #FFFFFF;
    --ink:    #1B1D14;
    --muted:  #5F6450;
    --line:   #DFE2D3;
    --line-soft: #EBEDE2;
    --brand:  #176333;
    --brand-ink: #FFFFFF;
    --accent: #FFED00;
    --data:   #2a78d6;   /* the one colour the charts use */
    --good:   #37704A;
    --warn:   #8A5F12;
    --warn-bg:#F8F1DF;
    --bad:    #993125;
    --bad-bg: #F9E8E5;
    --radius: 6px;

    /* Two spacing steps, so nothing drifts to 4px here and 5px there. */
    --gap-pair:  6px;    /* a label and the thing it labels */
    --gap-block: 16px;   /* between blocks that stand on their own */
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:  #14160F;
        --panel:  #1C1F16;
        --ink:    #E9EBDF;
        --muted:  #9BA189;
        --line:   #2E3226;
        --line-soft: #242820;
        --brand:  #247A45;
        --brand-ink: #FFFFFF;
        --accent: #FFED00;
        --data:   #3987e5;
        --good:   #7FBE95;
        --warn:   #D5A751;
        --warn-bg:#2A2415;
        --bad:    #E28A7C;
        --bad-bg: #2E1D1A;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- top bar ---------- */

/* A darker shade of the bar itself, not the flag yellow — saturated yellow on
   saturated green vibrates along the edge. */
.topbar { background: var(--brand); color: var(--brand-ink);
          border-bottom: 1px solid color-mix(in srgb, black 25%, var(--brand)); }
.bar {
    max-width: 960px; margin: 0 auto; padding: 20px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px;
}
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-name { font-size: 17.5px; font-weight: 650; letter-spacing: .01em; }
.topbar nav { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
/* Scoped to .topbar so these outrank `button[type=submit]` below: the logout
   control is a submit button and would otherwise take the big green style. */
.topbar nav a, .topbar .linkish {
    color: inherit; text-decoration: none;
    font-size: 14.5px; line-height: 1.55; font-weight: 400;
    padding: 0 0 2px; background: none; align-self: auto;
    border: 0; border-radius: 0; border-bottom: 2px solid transparent;
}
.topbar nav a:hover { border-bottom-color: currentColor; }
.topbar nav a.on { border-bottom-color: currentColor; }
.inline { display: flex; margin: 0; }
/* Logging out is not a page, so it never takes the underline; it keeps the
   transparent border only so it lines up with the links. */
.topbar .linkish { cursor: pointer; font-family: inherit; }
.topbar .linkish:hover { opacity: .8; }

/* ---------- page ---------- */

main { max-width: 960px; margin: 0 auto; padding: 28px 20px 64px; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 var(--gap-pair); }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 60ch; }
.eyebrow { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--gap-pair); }
.unit, h2 .unit { font-size: 13px; font-weight: 400; color: var(--muted); }
a { color: var(--brand); }
.muted { color: var(--muted); }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.narrow { max-width: 400px; }

.login-shell {
    display: grid; grid-template-columns: minmax(300px, 400px) minmax(340px, 1fr);
    align-items: center; gap: 30px;
    /* Fill what is left of the viewport (main's 28px + 64px padding) so the
       card sits in the middle of the page, not under a header that is gone. */
    min-height: calc(100vh - 92px);
    min-height: calc(100dvh - 92px);
}
/* One rhythm in the card: 16px between blocks, tighter only inside a pair. */
.login-card .lead, .login-card .error { margin: 0 0 var(--gap-block); }

/* The reading form gets the same house next to it, without the full-height
   centring the login splash needs. */
.form-shell {
    display: grid; grid-template-columns: minmax(300px, 440px) minmax(280px, 1fr);
    align-items: center; gap: 30px;
}
.building-art { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
    .building-art { mix-blend-mode: normal; border-radius: var(--radius); }
}
@media (max-width: 760px) {
    .login-shell { grid-template-columns: 1fr; min-height: 0; }
    .login-shell .building-art { grid-row: 1; max-height: 260px; object-fit: contain; }
    .login-card { justify-self: stretch; max-width: none; }
    /* On a phone the form comes first; the house would only push it down. */
    .form-shell { grid-template-columns: 1fr; }
    .form-shell .building-art { display: none; }
}

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } }

/* ---------- forms ---------- */

form.card, .stack { display: flex; flex-direction: column; gap: var(--gap-block); }
.card.form { max-width: 440px; }
.field, .stack label { display: flex; flex-direction: column; gap: var(--gap-pair); }
.field-label { font-weight: 550; font-size: 14.5px; display: flex; gap: 7px; align-items: baseline; }
.field-label em { font-style: normal; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.stack label > span { font-weight: 550; font-size: 14.5px; }

input, select {
    font: inherit; color: inherit;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 9px 11px;
    width: 100%;
}
/* The native arrow sits on the edge and ignores padding-right, which makes the
   box look lopsided. Our own chevron keeps both sides even. */
select {
    appearance: none; -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" fill="none" stroke="%235F6450" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M1 1.5 6 6.5 11 1.5"/></svg>');
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 32px;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) select {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" fill="none" stroke="%239BA189" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M1 1.5 6 6.5 11 1.5"/></svg>');
    }
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--brand); outline-offset: 2px;
}
.field-msg { font-size: 12.5px; color: var(--muted); }
.field-error input { border-color: var(--bad); }
.field-msg.error, p.error { color: var(--bad); }
.field-caution input { border-color: var(--warn); }
.field-msg.caution { color: var(--warn); }
.confirm { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
input[type=checkbox] { width: auto; margin: 0; }
p.error { background: var(--bad-bg); padding: 9px 12px; border-radius: 4px; margin: 0; font-size: 14.5px; }

button[type=submit], .button {
    align-self: flex-start;
    font: inherit; font-weight: 550;
    background: var(--brand); color: var(--brand-ink);
    border: 0; border-radius: 4px;
    padding: 10px 20px; cursor: pointer;
    text-decoration: none; display: inline-block;
}
.hint { font-size: 13px; color: var(--muted); margin: 0; }
/* A hint after a form is a separate note, not a caption for the last field. */
form + .hint { margin-top: var(--gap-block); }

.history-heading {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 12px 24px; margin-bottom: 22px;
}
.history-heading .lead { margin-bottom: 0; }
.view-picker label { display: flex; flex-direction: column; gap: var(--gap-pair); }
.view-picker span { color: var(--muted); font-size: 12px; font-weight: 550; }
.view-picker select { width: auto; min-width: 230px; padding: 7px 32px 7px 10px; }

.flash {
    background: var(--panel); border: 1px solid var(--line);
    border-left: 3px solid var(--good);
    padding: 11px 14px; border-radius: 4px; margin: 0 0 22px; font-size: 14.5px;
}
.warn {
    background: var(--warn-bg); color: var(--warn);
    padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; font-size: 14.5px;
}

/* ---------- tables ---------- */

table { border-collapse: collapse; width: 100%; font-size: 14px; }
.card > table { margin-top: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
th {
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line);
}
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.wide { min-width: 460px; max-width: 760px; }
.apt { font-variant-numeric: tabular-nums; font-weight: 600; }
.card:has(.wide) { overflow-x: auto; }
tr.row-first td { border-top: 1px solid var(--line); }
tbody tr.row-first:first-child td { border-top: 0; }
/* Three levels: nothing between the meters of one submission, a hairline above
   the next submission, a wider darker rule and more air above the next flat. */
.wide tbody td { border-bottom: 0; }
.wide tbody tr.sub-first td { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.wide tbody tr.row-first td {
    border-top: 2px solid color-mix(in srgb, var(--line) 55%, var(--muted));
    padding-top: 18px;
}
/* Air at both ends, so a flat with one row is not pinned to the bottom of it. */
.wide tbody tr.row-last td { padding-bottom: 18px; }
.wide tbody tr:not(.row-first):not(.sub-first) td { padding-top: 2px; }

/* ---------- manager summary ---------- */

/* Top-aligned: a stat is shorter than a date field, and bottom-aligning them
   put the two rows of labels on different lines. */
.summary {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 26px;
    margin: 0 0 20px;
}
.stat { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.stat-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value.good { color: var(--good); }
.stat-value.bad  { color: var(--bad); }
.range { display: flex; align-items: flex-end; gap: 10px; margin: 0; }
/* One height for all three, or a select renders shorter than a date input and
   drags its label down with it. */
.range input, .range select { height: 38px; padding: 0 9px; width: auto; min-width: 0; }
.range select { padding-right: 32px; }
.summary .button, .range button { align-self: flex-end; height: 38px; padding: 0 16px; font-size: 14.5px; }
.flag { color: var(--warn); cursor: help; margin-right: 4px; }

/* ---------- informacija ---------- */

.info { max-width: 680px; }
.info + .info { margin-top: var(--gap-block); }
.info p { margin: 0 0 var(--gap-block); }
.info p:last-of-type { margin-bottom: 0; }
.info .button { margin-top: var(--gap-block); }

/* ---------- contacts ---------- */

.contact-name { font-weight: 600; margin: 0 0 var(--gap-pair); }
/* Contact cards only — as `.card p` this silently flattened every card's paragraphs. */
.grid .card p { margin: 0 0 4px; }

/* ---------- chart ---------- */

.chart { width: 100%; max-width: 440px; height: auto; display: block; }
.chart .grid       { stroke: var(--line); stroke-width: 1; }
.chart .grid-faint { stroke: var(--line-soft); stroke-dasharray: 3 3; }
.chart .series     { fill: none; stroke: var(--data); stroke-width: 2;
                     stroke-linejoin: round; stroke-linecap: round; }
.chart .dot        { fill: var(--data); }
.chart .dot-last   { stroke: var(--panel); stroke-width: 2; }
.chart .dot-hit    { fill: transparent; pointer-events: all; }
.chart-point { outline: none; cursor: help; }
.chart-point:focus .dot { stroke: var(--accent); stroke-width: 3; }
.chart .axis       { fill: var(--muted); font-size: 9px;
                     font-family: system-ui, sans-serif; }
.chart-empty       { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }

