/* Tehnohoolduse platvorm – kujundus
   Värvid tulevad Eesti Halduse logost: sügav sinine #034286 ja lehtroheline #83C557.
   Font: Manrope (tabelinumbrid ühelaiused, et veerud jookseksid sirgelt). */

@font-face { font-family: "Manrope"; src: url(fonts/Manrope.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --navy: #034286; --navy-2: #0A56A8; --navy-soft: #EAF1FA; --ink: #0F1B2D; --muted: #66748A;
  --leaf: #83C557; --leaf-soft: #EEF7E6;
  --bg: #F3F5F8; --paper: #FFFFFF; --line: #E2E7EE; --line-2: #EEF1F5;
  --ok: #2E8540; --ok-bg: #E8F5EA; --bad: #C8372D; --bad-bg: #FCECEA; --warn: #B26A00; --warn-bg: #FFF4E0;
  --r: 12px; --r-sm: 8px; --side: 248px; --top: 0px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 4px 16px rgba(15, 27, 45, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-2); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.85rem; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; margin: .1em 0 .7em; }
h2 { font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; margin: 1.8em 0 .7em; }
h3 { font-size: 1rem; font-weight: 750; margin: 1.2em 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { font-size: .9em; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Külgmenüü (arvuti) ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 40; overflow-y: auto; }
.side .brand { display: block; padding: 4px 10px 22px; }
.brand img { max-height: 44px; max-width: 170px; width: auto; display: block; }
.brand-name { font-weight: 800; font-size: 1.05rem; color: var(--navy); letter-spacing: -.01em; }
.nav-sect { font-size: .75rem; font-weight: 700; color: #9AA6B8; padding: 16px 12px 6px; }
nav.main a, .side-user a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 0; border-radius: var(--r-sm);
  color: #334155; text-decoration: none; font-weight: 600; font-size: .94rem; position: relative; }
nav.main a:hover, .side-user a:hover { background: var(--bg); color: var(--ink); }
nav.main a.on, .side-user a.on { background: var(--navy-soft); color: var(--navy); }
nav.main a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--leaf); }
.ic { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-user { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.side-user small { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; line-height: 1.2; }
.topbar, .scrim { display: none; }
body.has-nav .wrap, body.has-nav .foot { margin-left: var(--side); }

.wrap { max-width: 1240px; padding: 32px 36px 64px; margin: 0 auto; }
body.has-nav .wrap { margin-left: var(--side); margin-right: auto; }
@media (min-width: 1500px) { body.has-nav .wrap { margin-left: calc(var(--side) + (100vw - var(--side) - 1240px) / 2); } }

/* ---------- Mobiil: ülariba + sahtelmenüü ---------- */
@media (max-width: 1000px) {
  :root { --top: 60px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; height: calc(var(--top) + env(safe-area-inset-top, 0)); align-items: center;
    justify-content: space-between; padding: env(safe-area-inset-top, 0) 16px 0; background: rgba(255,255,255,.92);
    backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
  .topbar .brand img { max-height: 34px; }
  .menu-btn { background: none; border: 0; padding: 8px; margin-right: -8px; color: var(--ink); cursor: pointer; }
  .menu-btn .ic { width: 24px; height: 24px; }
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(15,27,45,.18); width: 280px; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,27,45,.35); z-index: 35; }
  body.has-nav .wrap, body.has-nav .foot { margin-left: auto; }
  .wrap { padding: 20px 16px 48px; }
  h1 { font-size: 1.5rem; }
}

/* ---------- Teated ---------- */
.flash { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 16px; background: var(--ok-bg); color: #1D5C2B; font-weight: 600; border: 1px solid #CFE8D4; }
.flash-err { background: var(--bad-bg); color: #8E2019; border-color: #F5CFCB; }

/* ---------- Plokid ja tabelid ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tbl-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.t th { text-align: left; font-weight: 700; color: var(--muted); font-size: .78rem; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.tbl-wrap table.t tr:hover td { background: #FAFCFE; }
.panel table.t th { background: transparent; padding-left: 0; }
.panel table.t td { padding-left: 0; }
table.t tr.grp td { background: var(--navy-soft); color: var(--navy); font-weight: 750; font-size: .88rem; }
td.num, th.num { text-align: right; }
table.t a { font-weight: 650; text-decoration: none; }
table.t a:hover { text-decoration: underline; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--line-2); color: #475569; white-space: nowrap; line-height: 1.4; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
a.pill { text-decoration: none; }

/* ---------- Vahelehed ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--navy); }
table.matrix th { white-space: normal; vertical-align: bottom; min-width: 70px; max-width: 104px; }
table.matrix .gname { font-weight: 500; font-size: .7rem; color: #94A0B2; display: block; line-height: 1.25; }
table.matrix td:first-child { min-width: 150px; }
table.matrix th, table.matrix td { padding-left: 10px; padding-right: 10px; }
table.matrix td { vertical-align: middle; }

/* ---------- Näitajad ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow);
  color: var(--muted); font-size: .88rem; font-weight: 600; display: block; text-decoration: none; transition: border-color .15s; }
a.kpi:hover { border-color: #C9D3E0; }
.kpi b { display: block; font-size: 2.1rem; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; color: var(--ink); margin-bottom: 6px; }
.kpi.bad b { color: var(--bad); } .kpi.warn b { color: var(--warn); } .kpi.ok b { color: var(--ok); }

/* ---------- Vormid ---------- */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: .83rem; font-weight: 650; color: #475569; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #CDD5E0; border-radius: var(--r-sm); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(10, 86, 168, .14); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy); vertical-align: -3px; margin-right: 6px; }
textarea { min-height: 84px; resize: vertical; }
.row2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; padding: 10px 18px;
  border-radius: var(--r-sm); border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.3;
  transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--navy-2); box-shadow: 0 4px 12px rgba(3, 66, 134, .18); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.sec { background: #fff; color: var(--navy); border-color: #CDD5E0; }
.btn.sec:hover { background: var(--navy-soft); border-color: var(--navy-soft); box-shadow: none; }
.btn.danger { background: #fff; color: var(--bad); border-color: #F0C5C1; }
.btn.danger:hover { background: var(--bad-bg); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: .86rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px; }
.filters label.f { margin: 0; min-width: 180px; }

/* ---------- Graafikud ---------- */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(120px, 36%) 1fr 44px; gap: 12px; align-items: center; font-size: .88rem; }
.bar i { display: block; height: 10px; background: linear-gradient(90deg, #E56B5F, var(--bad)); border-radius: 99px; min-width: 3px; }
.bar b { text-align: right; }
svg.trend { width: 100%; height: auto; }

/* ============ Tehniku vaade ============ */
.tech { max-width: 720px; margin: 0 auto; }
.netbar { font-size: .86rem; font-weight: 600; padding: 9px 14px; border-radius: var(--r-sm); margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.netbar.on { background: var(--ok-bg); color: #1D5C2B; } .netbar.off { background: var(--warn-bg); color: #7A4A00; }
.netbar .muted { font-weight: 500; }
.obj-list { display: grid; gap: 10px; }
.obj { display: block; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; font: inherit; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.obj:active { transform: scale(.99); }
.obj:hover { border-color: #C9D3E0; }
.obj strong { font-size: 1.08rem; font-weight: 750; display: block; letter-spacing: -.01em; }
.obj .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.search { margin-bottom: 14px; }

.group-h { position: sticky; top: var(--top); z-index: 5; background: rgba(243,245,248,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--navy); font-weight: 800; padding: 12px 2px 8px; margin: 18px 0 6px; display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.group-h::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--leaf); }
.item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow);
  border-left: 4px solid var(--line); }
.item.ans-ok { border-left-color: var(--ok); }
.item.ans-bad { border-left-color: var(--bad); }
.item.ans-skip { border-left-color: var(--warn); }
.item.missing { box-shadow: 0 0 0 2px var(--bad); }
.item .q { font-weight: 700; line-height: 1.4; }
.item .sub { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.item.notdue .q { font-weight: 550; }
.seg { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.seg button { flex: 1 1 0; min-width: 90px; min-height: 48px; font: inherit; font-weight: 700; border-radius: 10px; border: 1.5px solid #D5DCE6;
  background: #fff; color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.seg button:active { transform: scale(.98); }
.seg button.sel-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg button.sel-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.seg button.sel-skip { background: var(--warn); border-color: var(--warn); color: #fff; }
.seg button.skip { flex: 0 0 auto; min-width: 0; padding: 0 14px; font-weight: 600; color: var(--muted); border-style: dashed; }
.seg button.skip.sel-skip { color: #fff; font-weight: 700; border-style: solid; }
.extra { margin-top: 12px; display: grid; gap: 10px; }
.extra textarea { min-height: 66px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.photos img { width: 74px; height: 74px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.photo-btn { display: inline-flex; align-items: center; min-height: 46px; padding: 0 16px; border: 1.5px dashed #BAC5D3; border-radius: 10px;
  cursor: pointer; background: #FAFBFC; font-weight: 650; color: #475569; }
.photo-btn input { display: none; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.params label span { font-size: .8rem; color: var(--muted); display: block; font-weight: 600; margin-bottom: 3px; }
.req { color: var(--bad); font-size: .83rem; font-weight: 700; margin-top: 8px; }
.submit-bar { position: sticky; bottom: 0; z-index: 10; background: linear-gradient(rgba(243,245,248,0), var(--bg) 28%);
  padding: 22px 0 calc(14px + env(safe-area-inset-bottom, 0)); margin-top: 20px; }
.submit-bar .btn { width: 100%; min-height: 54px; font-size: 1.05rem; border-radius: var(--r); box-shadow: 0 8px 24px rgba(3, 66, 134, .25); }
.progress { font-size: .86rem; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
details.later { margin-top: 22px; }
details.later summary { cursor: pointer; font-weight: 750; padding: 10px 0; color: var(--navy); }

/* ---------- Sisselogimine ---------- */
body.no-nav { background: radial-gradient(1200px 600px at 10% -10%, #E3EEFA 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #EAF5E1 0%, transparent 55%), var(--bg); min-height: 100vh; }
.login { max-width: 400px; margin: 10vh auto 0; padding: 32px; }
.login .login-logo { display: block; max-height: 56px; max-width: 220px; margin: 0 0 24px; }

/* ---------- Jalus ---------- */
.foot { text-align: center; color: #94A0B2; font-size: .8rem; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0)); }

@media print { .side, .topbar, .actions, .filters, .foot { display: none !important; } body.has-nav .wrap { margin: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
