/* Gamybos dokumentacija. Layout: left navigation (a drawer on phones) + scrolling content area.
   Single light look by choice. Colours and fonts are the variables in :root. */
:root {
  --bg: #F3F7F8;
  --surface: #FFFFFF;
  --side: #E8F0F2;
  --ink: #1B2A32;
  --muted: #55676F;
  --line: #D9E4E8;
  --accent: #1D7488;
  --accent-ink: #0E4A59;
  --accent-soft: #D8EEF2;
  --ok: #2B7549;
  --ok-soft: #DEF2E5;
  --warn: #8A5F0E;
  --warn-soft: #FBEFD2;
  /* The computer's own typefaces: the program works without internet (Segoe UI on Windows). */
  --font-display: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.app { display: grid; grid-template-columns: 288px minmax(0, 1fr); height: 100%; }

/* ---------- Sidebar ---------- */
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding-block: 22px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; padding-inline: 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none;
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1.15; }
.brand-sub { font-size: 12.5px; color: var(--muted); }

.nav-list, .sub-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  width: 100%; border: 0; background: transparent; text-align: left;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  font-weight: 700; color: var(--ink);
  min-height: 44px;
}
.nav-item svg { flex: none; color: var(--muted); }
.nav-item .label { flex: 1; min-width: 0; }
.nav-item:hover { background: rgba(255,255,255,.65); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(20,60,75,.10), 0 0 0 1px var(--line); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.chev { transition: transform .18s ease; }
.nav-item[aria-expanded="true"] .chev { transform: rotate(90deg); }

.sub-wrap { margin: 4px 0 4px 22px; padding-left: 12px; border-left: 2px solid var(--line); }
.sub-item {
  width: 100%; border: 0; background: transparent; text-align: left;
  padding: 9px 12px; border-radius: 10px; font-weight: 600; color: var(--muted);
  min-height: 40px;
}
.sub-item:hover { background: rgba(255,255,255,.65); color: var(--ink); }
.sub-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }

/* ---------- Main ---------- */
.main {
  overflow-y: auto; min-width: 0;
  padding-block: 32px 48px;
  padding-left: max(32px, env(safe-area-inset-left, 0px));
  padding-right: max(32px, env(safe-area-inset-right, 0px));
}
.page { max-width: 1120px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); }
.crumbs button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; }
.crumbs button:hover { text-decoration: underline; }
h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0; }
.lede { color: var(--muted); font-size: 16px; max-width: 62ch; margin: 8px 0 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.tile:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(29,116,136,.12); transform: translateY(-1px); }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.tile-title { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.tile-text { color: var(--muted); font-size: 14px; }
.tile-meta { font-size: 13px; color: var(--accent-ink); font-weight: 700; margin-top: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; min-height: 38px; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 44px; padding: 10px 14px 10px 40px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; color: var(--ink);
}
.search input::placeholder { color: #7B8C94; }
.count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: #5E4108; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.notice svg { flex: none; margin-top: 2px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #EEF4F6; color: var(--muted); font-size: 13px; font-weight: 700; }
th.n, td.n { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F6FAFB; }
td.code { font-weight: 700; color: var(--accent-ink); }
td.changed-by { font-size: 13px; color: var(--muted); }
/* "Paskutinis pakeitimas" opens the row's comments in a small table under the row. */
.link-btn {
  min-height: 40px; padding: 4px 0; border: 0; background: none; font: inherit; color: var(--accent-ink);
  text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
tbody tr.history-row > td, tbody tr.history-row:hover > td { background: #F6FAFB; white-space: normal; padding: 10px 16px 16px; }
.history { display: flex; flex-direction: column; gap: 8px; }
.history-title { font-size: 14px; font-weight: 700; }
.history table { min-width: 0; width: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.history th, .history td { padding: 8px 12px; font-size: 14px; background: none; }
.history td.comment { white-space: normal; min-width: 220px; }
td.tags { white-space: normal; min-width: 140px; }
.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700; }

/* ---------- Table filters (one per choice column) and multiple choices in the row form ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); min-width: 0; }
.filter select {
  min-height: 44px; min-width: 180px; max-width: 100%; padding: 8px 12px; border: 1px solid #BCCCD2; border-radius: 12px;
  background: var(--surface); font: inherit; font-size: 15px; font-weight: 400; color: var(--ink);
}
.filter select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.choices { grid-column: 1 / -1; margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 12px; min-width: 0; }
.choices legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.choice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0 16px; }
.choice-list .check { min-height: 40px; }
td.audit-details { white-space: normal; min-width: 260px; font-size: 14px; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.empty-row { text-align: center; color: var(--muted); padding: 32px 16px; white-space: normal; }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.empty .tile-icon { width: 48px; height: 48px; }
.empty p { margin: 0; color: var(--muted); max-width: 56ch; }

/* ---------- Login, user box, forms ---------- */
.login {
  height: 100%; overflow-y: auto; display: grid; place-items: center;
  padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.login-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 10px 30px rgba(20,60,75,.08);
}
.login-card h1 { font-size: 26px; }
.login-card .lede { margin: 6px 0 0; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #BCCCD2; border-radius: 12px;
  background: var(--surface); font: inherit; color: var(--ink);
}
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.error { background: #FBE4E1; color: #8E2A20; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.btn {
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; color: var(--ink);
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.danger { color: #8E2A20; }
.btn.danger:hover { border-color: #8E2A20; background: #FBE4E1; color: #8E2A20; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.field-note { font-size: 13px; color: var(--muted); }

/* "Įkelti PDF iš kompiuterio" under a PDF name field */
.upload { display: flex; flex-direction: column; gap: 6px; }
.upload .row-actions { flex-wrap: wrap; }
.upload-status { font-size: 13px; color: var(--muted); }
.upload-status.upload-error { color: #8E2A20; font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Line: choosing operators ---------- */
.segmented { display: flex; gap: 8px; }
.seg {
  flex: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-weight: 700; color: var(--ink);
}
.seg:hover { border-color: var(--accent); }
.seg.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.operator-slot { margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.operator-slot legend { font-weight: 800; font-size: 14px; padding: 0 6px; }
.user-ops { font-size: 13px; color: var(--muted); }

/* ---------- Notices: PDF version ---------- */
.pdf-version { font-size: 13px; color: var(--muted); }
.signers li.old-pdf { background: var(--warn-soft); color: var(--warn); }
.signers li.old-pdf span { color: var(--warn); }

/* ---------- Notice form: who has to sign ---------- */
.audience { margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.audience legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.audience-options { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.audience .check { min-height: 40px; }
.recipients { display: flex; flex-direction: column; gap: 12px; }
.recipient-role { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.recipient-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.muted { color: var(--muted); }
.user { margin-top: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; flex: none; font-family: var(--font-display); }
.user-name { font-weight: 700; line-height: 1.2; }
.user-role { font-size: 13px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-actions { display: flex; gap: 8px; align-items: center; }
td.actions { width: 1%; }
.confirm-text { font-size: 14px; font-weight: 700; color: #8E2A20; }

/* ---------- Information blocks ---------- */
.blocks { display: flex; flex-direction: column; gap: 16px; }
.info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.info-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.info-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 13.5px; }
.info h2 { font-size: 19px; text-wrap: balance; }
.info-text { margin: 0; white-space: pre-line; max-width: 70ch; }
.pill.changed { background: var(--warn-soft); color: var(--warn); }
.pill.new { background: var(--accent-soft); color: var(--accent-ink); }
.pill.note { background: #E8EDEF; color: var(--muted); }
.sign { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.sign-title { font-weight: 700; font-size: 14px; }
.sign-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.sign-form .field { flex: 1 1 180px; max-width: 260px; }
.signers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.signers li { background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 700; }
.signers li span { font-weight: 400; color: #2F5F44; font-variant-numeric: tabular-nums; }
.pending { color: var(--muted); font-size: 14px; }
.ok-msg { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700; }
.field textarea {
  width: 100%; min-height: 110px; padding: 10px 14px; border: 1px solid #BCCCD2; border-radius: 12px;
  background: var(--surface); font: inherit; color: var(--ink); resize: vertical;
}
.field textarea.short { min-height: 64px; }
.field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form-grid .wide { grid-column: 1 / -1; }

.check { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.sig-details summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); min-height: 36px; display: flex; align-items: center; width: fit-content; }
.sig-inner { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

th.c, td.c { text-align: center; }
table.matrix { min-width: 560px; }
table.matrix td { white-space: normal; }
table.matrix input { width: 20px; height: 20px; accent-color: var(--accent); }
table.matrix input:disabled { opacity: .55; }

/* ---------- Added in the project version ---------- */
.min0 { min-width: 0; }
.loading { color: var(--muted); padding: 24px 0; }
.banner { background: #FBE4E1; color: #8E2A20; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.hint-title { font-weight: 800; }

/* ---------- Phone ---------- */
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--side); border-bottom: 1px solid var(--line);
    padding-block: 10px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .menu-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; display: grid; place-items: center; }
  .topbar-title { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
  .side {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0;
    width: min(300px, 86vw);
    padding-top: calc(22px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  .nav-open .side { transform: translateX(0); box-shadow: 0 0 40px rgba(20,50,60,.25); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(20,40,50,.35); }
  .main { padding-block: 22px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 25px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .side, .chev, .tile { transition: none; }
}
