/* SDG dokumentai – tema pagal sdg.lt stilių */
:root {
  --red: #C73834;
  --red-dark: #A82D2A;
  --red-soft: #FBEFEE;
  --ink: #231F20;
  --ink-soft: #5d5758;
  --muted: #8a8485;
  --line: #e6e2e1;
  --line-soft: #efecec;
  --bg: #ffffff;
  --bg-soft: #faf8f8;
  --green: #2e7d32;
  --green-soft: #e8f3e9;
  --amber: #9a6c00;
  --amber-soft: #fdf3d7;
  --shadow: 0 1px 2px rgba(35,31,32,.05), 0 4px 16px rgba(35,31,32,.06);
  --radius: 10px;
  --font-head: 'Montserrat', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg-soft);
}
h1, h2, h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.25; }
h1 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 12px; }
a { color: var(--red); }
code { font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.ic { vertical-align: -3px; }

/* ---------- viršutinė juosta ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 60px; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--ink); }
.topnav { display: flex; gap: 4px; }
.topnav-link {
  display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 8px;
  text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: 14.5px;
}
.topnav-link:hover { background: var(--red-soft); color: var(--red); }
.topbar-right { margin-left: auto; }
.usermenu { position: relative; }
.usermenu-btn {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line);
  background: var(--bg); border-radius: 999px; padding: 5px 14px 5px 5px;
  cursor: pointer; font-family: var(--font-body); font-size: 13.5px; color: var(--ink-soft);
}
.usermenu-btn:hover { border-color: #d4cfce; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-family: var(--font-head); font-size: 14px;
}
.usermenu-drop {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 60;
}
.usermenu.open .usermenu-drop { display: block; }
.usermenu-drop a, .usermenu-drop button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border: 0; background: none; border-radius: 8px;
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink); text-decoration: none; cursor: pointer;
}
.usermenu-drop a:hover, .usermenu-drop button:hover { background: var(--bg-soft); color: var(--red); }
.usermenu-drop form { margin: 0; }

/* ---------- konteineriai ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 22px 60px; }
.container-narrow { max-width: 780px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px;
}

/* ---------- mygtukai ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-head); font-weight: 700; font-size: 14.5px;
  border-radius: 8px; padding: 10px 18px; cursor: pointer; text-decoration: none;
  border: 1.5px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline { background: var(--bg); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-ghost { background: none; color: var(--ink-soft); }
.btn-ghost:hover { color: var(--red); background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-row { margin: 14px 0; }
.btn-link {
  background: none; border: 0; color: var(--red); cursor: pointer; padding: 0;
  font-family: inherit; font-size: inherit; text-decoration: underline;
}
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: none;
  color: var(--ink-soft); cursor: pointer; text-decoration: none;
}
.btn-icon:hover { background: var(--red-soft); color: var(--red); }
.btn-icon-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-mini {
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  border-radius: 7px; padding: 4px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-mini:hover { border-color: var(--red); color: var(--red); }
.btn-mini-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* ---------- formų elementai ---------- */
.inp {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(199,56,52,.12); }
.inp:disabled { background: var(--bg-soft); color: var(--muted); }
.inp-narrow { max-width: 260px; }
.inp-sm { font-size: 13.5px; padding: 6px 9px; }
.inp-plain { border-color: transparent; background: transparent; }
.inp-plain:hover { border-color: var(--line); background: var(--bg); }
textarea.inp { resize: vertical; min-height: 42px; }
select.inp { appearance: auto; }
.inp-code {
  font-size: 24px; letter-spacing: 8px; text-align: center; font-weight: 700;
  font-family: var(--font-head); text-transform: uppercase;
}
.f-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.f-group { margin-bottom: 14px; min-width: 200px; flex: 1; }
.f-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; margin-top: 12px; }
.form-inline-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.form-inline-row .btn { margin-bottom: 14px; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--red); width: 17px; height: 17px; }
.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; }
.switch-row input { margin-top: 4px; }

/* ---------- ženkleliai, pranešimai ---------- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 800; font-family: var(--font-head);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray { background: var(--line-soft); color: var(--ink-soft); }
.badge-red { background: var(--red-soft); color: var(--red); }

.alert { border-radius: 8px; padding: 11px 14px; font-size: 14.5px; margin-bottom: 14px; }
.alert-err { background: var(--red-soft); color: var(--red-dark); border: 1px solid #f2d2d0; }
.alert-ok { background: var(--green-soft); color: var(--green); border: 1px solid #cfe6d1; }
.alert-dev { background: var(--amber-soft); color: var(--amber); border: 1px dashed #eadfc0; }

.flash {
  position: fixed; top: 74px; right: 22px; z-index: 100; max-width: 420px;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 13px 40px 13px 16px;
  font-size: 14.5px; box-shadow: var(--shadow); animation: flash-in .25s ease;
}
.flash-err { background: var(--red-dark); }
.flash-x {
  position: absolute; right: 8px; top: 8px; background: none; border: 0; color: #fff;
  font-size: 18px; cursor: pointer; opacity: .7;
}
.flash-x:hover { opacity: 1; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- prisijungimas ---------- */
.login-body { background: linear-gradient(160deg, #fdf7f6 0%, var(--bg-soft) 60%); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 34px 34px 28px;
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.login-logo { height: 42px; width: auto; }
.login-title { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.login-form .inp { margin-bottom: 14px; }
.login-email-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 14px; font-size: 14.5px;
}
.login-email { font-weight: 700; }
.login-remember { margin: 2px 0 14px; font-size: 14px; }
.login-hint { text-align: center; font-size: 13.5px; color: var(--muted); margin: 14px 0 0; }
.login-foot { color: var(--muted); font-size: 13px; margin-top: 18px; }

/* ---------- pradžios kortelės ---------- */
.home-hero { margin-bottom: 24px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; max-width: 900px; }
.home-card {
  position: relative; display: block; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 26px; text-decoration: none;
  color: var(--ink); transition: border-color .15s, transform .15s;
}
.home-card:hover { border-color: var(--red); transform: translateY(-2px); }
.home-card-ic {
  width: 58px; height: 58px; border-radius: 14px; background: var(--red-soft); color: var(--red);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.home-card h2 { margin-bottom: 8px; }
.home-card p { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 16px; }
.home-card-meta { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.home-card-go { font-family: var(--font-head); font-weight: 800; color: var(--red); font-size: 14.5px; }

/* ---------- lentelės ---------- */
.tbl-wrap { overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dtable { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.dtable th {
  text-align: left; font-family: var(--font-head); font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg);
  white-space: nowrap;
}
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tr:hover td { background: var(--bg-soft); }
.tbl-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.tbl-link:hover { color: var(--red); }
.row-inactive td { opacity: .55; }
.row-actions { white-space: nowrap; text-align: right; }
.th-actions { width: 1%; }
.progress { width: 90px; height: 7px; border-radius: 99px; background: var(--line-soft); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--red); transition: width .3s; }
.empty {
  text-align: center; color: var(--muted); background: var(--bg); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 48px 20px;
}
.empty p { margin: 10px 0 0; }
.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager-item {
  min-width: 34px; text-align: center; padding: 6px 8px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--line); background: var(--bg); text-decoration: none; color: var(--ink-soft);
}
.pager-item.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; margin: 18px 0 22px; flex-wrap: wrap; }
.admin-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  font-family: var(--font-head); font-weight: 700; font-size: 14px; text-decoration: none;
}
.admin-tab:hover { border-color: var(--red); color: var(--red); }
.admin-tab.active { background: var(--red); border-color: var(--red); color: #fff; }
.filter-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-row .inp { width: auto; min-width: 180px; }
.mail-body summary { cursor: pointer; color: var(--red); font-size: 13.5px; font-weight: 700; }
.mail-body pre {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 13px; white-space: pre-wrap; max-width: 480px; margin: 8px 0 0;
}
.action-code { background: var(--bg-soft); border-radius: 5px; padding: 2px 7px; font-size: 12px; }
.details-cell { max-width: 380px; overflow-wrap: break-word; }
.rename-form { margin: 0; }

/* ---------- anketos pildymo išdėstymas ---------- */
.form-layout { display: flex; align-items: flex-start; gap: 26px; max-width: 1280px; margin: 0 auto; padding: 26px 22px 80px; }
.form-side {
  width: 290px; flex-shrink: 0; position: sticky; top: 80px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px; max-height: calc(100vh - 104px);
  display: flex; flex-direction: column;
}
.side-back {
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px;
  text-decoration: none; margin-bottom: 12px;
}
.side-back:hover { color: var(--red); }
.side-company { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.side-company-name { font-family: var(--font-head); font-weight: 800; font-size: 15.5px; overflow-wrap: anywhere; }
.side-progress { margin-bottom: 14px; }
.side-progress .progress { width: 100%; margin: 0 0 4px; }
.side-nav { overflow-y: auto; flex: 1; margin: 0 -8px; padding: 0 8px; }
.side-nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer;
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink-soft); line-height: 1.3;
}
.side-nav-item:hover { background: var(--bg-soft); }
.side-nav-item.active { background: var(--red-soft); color: var(--red); font-weight: 700; }
.side-nav-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 12px; background: var(--bg);
}
.side-nav-item.active .side-nav-num { border-color: var(--red); background: var(--red); color: #fff; }
.side-nav-item.done .side-nav-num { border-color: var(--green); color: var(--green); }
.side-nav-title { flex: 1; }
.side-nav-state { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.side-actions { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 10px; display: grid; gap: 8px; }
.save-state { font-size: 12.5px; color: var(--muted); min-height: 17px; }
.save-state.saving { color: var(--amber); }
.save-state.saved { color: var(--green); }
.save-state.error { color: var(--red); font-weight: 700; }

.form-main { flex: 1; min-width: 0; }
.form-intro { margin-bottom: 18px; }
.form-intro h1 { font-size: 21px; }
.form-locked-note { display: flex; align-items: center; gap: 8px; }

.fsec { display: none; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 26px; }
.fsec-active { display: block; animation: sec-in .2s ease; }
@keyframes sec-in { from { opacity: 0; transform: translateY(6px); } }
.fsec-title { display: flex; align-items: center; gap: 12px; font-size: 18px; margin-bottom: 20px; }
.fsec-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.fsec-nav { display: flex; justify-content: space-between; margin-top: 26px; gap: 10px; }

/* klausimai */
.q { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.q:last-of-type { border-bottom: 0; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.q-num { font-family: var(--font-head); font-weight: 800; font-size: 13px; color: var(--red); flex-shrink: 0; }
.q-label { font-weight: 700; font-size: 15.5px; }
.q-hint { color: var(--muted); font-size: 13.5px; margin: 2px 0 8px 0; }
.q-cond {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--amber);
  background: var(--amber-soft); border-radius: 6px; padding: 3px 9px; margin: 2px 0 6px;
}
.q-body { margin-top: 8px; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill input { position: absolute; opacity: 0; }
.pill span {
  display: inline-block; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 22px; font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: all .12s; background: var(--bg);
}
.pill input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(199,56,52,.2); }
.pill:hover span { border-color: var(--red); }
.pills-sm .pill span { padding: 5px 14px; font-size: 13px; }

.opts { display: grid; gap: 7px; }
.opt { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 15px; }
.opt input { margin-top: 3px; flex-shrink: 0; }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.oi-wrap { display: inline-flex; align-items: center; gap: 8px; margin-left: 27px; }
.oi-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.inp-oi { width: 220px; }
.inp-other { max-width: 340px; margin-left: 27px; margin-top: 4px; }

/* kartotuvai (nuomininkai, pastatai) */
.rep-items { display: grid; gap: 12px; margin-bottom: 12px; }
.rep-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--bg-soft); }
.rep-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rep-item-title { font-family: var(--font-head); font-weight: 800; font-size: 13.5px; color: var(--ink-soft); }
.rep-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; }
.rf-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }

/* anketos lentelės */
.q .tbl-wrap { box-shadow: none; margin-bottom: 10px; }
.ftable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ftable th {
  background: var(--bg-soft); font-size: 12px; font-weight: 700; color: var(--ink-soft);
  text-align: left; padding: 8px 9px; border: 1px solid var(--line);
}
.ftable td { border: 1px solid var(--line-soft); padding: 6px 7px; vertical-align: top; }
.ftable .ft-name { min-width: 190px; font-size: 13.5px; }
.ftable .ft-name .chk { align-items: flex-start; }
.ftable .ft-name .chk input { margin-top: 2px; }
.ftable tr.row-off td { background: var(--bg-soft); }
.ftable tr.row-off .ft-name { color: var(--muted); }
.ftable .row-actions { width: 1%; }
.inp-cell { border-color: transparent; background: transparent; width: 100%; min-height: 34px; }
.inp-cell:hover { border-color: var(--line); }
.inp-cell:focus { background: var(--bg); }
.grp td {
  background: var(--line-soft) !important; font-family: var(--font-head); font-weight: 700; font-size: 12.5px;
}
.grp td span { margin-right: 12px; }
.grp-add { float: right; }
.srow-name { font-weight: 600; }
.srow-note { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 3px; }

/* komentarų režimas */
.cbox {
  margin-top: 12px; border: 1px solid #e9d9a8; background: #fdfaf1; border-radius: 10px;
  padding: 10px 12px;
}
.cbox-head {
  display: flex; align-items: center; gap: 7px; font-family: var(--font-head);
  font-weight: 700; font-size: 12.5px; color: var(--amber); margin-bottom: 6px;
}
.cbox-inp {
  width: 100%; border: 1px solid #eadfc0; border-radius: 7px; background: #fff;
  font-family: var(--font-body); font-size: 14px; padding: 8px 10px; resize: vertical;
}
.cbox-inp:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(154,108,0,.1); }
.cbox-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.cbox-state.saving { color: var(--amber); }
.cbox-state.saved { color: var(--green); }
.cbox-state.error { color: var(--red); }
.comment-mode .q { border-bottom: 0; border-top: 1px solid var(--line-soft); }

/* ---------- responsyvumas ---------- */
@media (max-width: 960px) {
  .form-layout { flex-direction: column; }
  .form-side { position: static; width: 100%; max-height: none; }
  .side-nav { max-height: 300px; }
  .topnav-link span { display: none; }
  .usermenu-email { display: none; }
}
@media (max-width: 640px) {
  .container { padding: 18px 14px 40px; }
  .fsec { padding: 18px 14px; }
  .form-layout { padding: 16px 12px 60px; }
  h1 { font-size: 22px; }
}
