/* Kattoklinikka CRM – ulkoasu mukailee kattoklinikka.fi-sivustoa. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --brand: #16a4d6;
  --brand-dark: #1b8db4;
  --navy: #0d2137;
  --ink: #040404;
  --muted: #5b6673;
  --bg: #f9f9f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --footer: #313131;
  --ok: #1f8a4c;
  --ok-bg: #e4f5ea;
  --warn: #9a6200;
  --warn-bg: #fff2a8;
  --bad: #c0281b;
  --bad-bg: #fde8e6;
  --info-bg: #e3f4fb;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 900; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .75rem; }

/* Yläpalkki */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.logo img { height: 38px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  color: #fff; text-decoration: none; font-weight: 700; font-size: 15px;
  padding: 8px 12px; border-radius: 999px;
}
.nav a:hover, .nav a.on { color: var(--brand); }
.nav a.on { background: rgba(22, 164, 214, .14); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who a { color: #fff; font-weight: 600; }
.who form { margin: 0; }
.company-bar {
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  padding: 6px 16px; text-align: center;
}
.company-bar a { color: #fff; }

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
main.narrow { max-width: 760px; }
footer { background: var(--footer); color: #d6d6d6; font-size: 13px; text-align: center; padding: 14px 16px; }

.pagehead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.sub { color: var(--muted); font-size: 14px; }
.eyebrow { color: var(--brand-dark); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

/* Painikkeet: pillerit kuten sivustolla */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: 2px solid var(--brand);
  border-radius: 999px; padding: 12px 22px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 600; text-transform: uppercase;
  text-decoration: none; line-height: 1.2; text-align: center;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.outline { background: transparent; color: var(--brand-dark); }
.btn.outline:hover { background: var(--info-bg); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.topbar .btn.outline { color: #fff; }
.topbar .btn.outline:hover { background: rgba(255, 255, 255, .1); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(22, 164, 214, .45); outline-offset: 2px;
}

/* Kortit ja taulukot */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card > h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

/* Tilamerkit */
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; background: var(--info-bg); color: #0b5f7e; white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.grey { background: #eef1f4; color: var(--muted); }

/* Työmaajono */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.column { background: #eef2f6; border-radius: 14px; padding: 12px; }
.column > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; }
.jobcard {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-top: 10px; color: inherit; text-decoration: none;
}
.jobcard:hover { border-color: var(--brand); }
.jobcard strong { display: block; font-weight: 700; overflow-wrap: anywhere; }
.jobcard .meta { color: var(--muted); font-size: 13px; }
.jobcard .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Lomakkeet */
form.stack > .field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid #c7d0da; border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }
.field ul, .field > div > div { list-style: none; margin: 0; padding: 0; }
.field li label, .field > div > div label { font-weight: 400; display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.field.check > label { display: flex; gap: 8px; align-items: center; }
.help { color: var(--muted); font-size: 13px; margin-top: 4px; }
.errorlist { color: var(--bad); font-size: 14px; list-style: none; padding: 0; margin: 4px 0 0; font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.inline select, .inline input[type=text] { width: auto; flex: 1; min-width: 120px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 11px 14px; border-radius: 10px; margin-bottom: 8px; font-weight: 600; background: var(--info-bg); color: #0b5f7e; }
.messages li.success { background: var(--ok-bg); color: var(--ok); }
.messages li.error { background: var(--bad-bg); color: var(--bad); }
.note { background: var(--warn-bg); color: #5c3b00; border-radius: 10px; padding: 11px 14px; font-weight: 600; margin-bottom: 16px; white-space: pre-line; }

/* Kuvat */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13px; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #dfe5ea; }
.photo .cap { padding: 8px; display: grid; gap: 6px; }
.photo .cap input[type=text], .photo .cap select { padding: 6px 8px; font-size: 13px; }
.upload { border: 2px dashed #b9c6d2; border-radius: 14px; padding: 16px; background: #fff; display: grid; gap: 10px; margin-bottom: 16px; }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li { border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps button {
  all: unset; cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 0; width: 100%; font-size: 16px;
}
.steps .box {
  flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid #9aa9b6;
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px;
}
.steps .done .box { background: var(--brand); border-color: var(--brand); }
.steps .done .txt { color: var(--muted); text-decoration: line-through; }

.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #dfe5ea; display: block; }
.avatar.none { display: grid; place-items: center; font-weight: 900; font-size: 30px; color: var(--muted); }
.cardimg { max-width: 320px; width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }

.listlink {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 10px; color: inherit; text-decoration: none;
}
.listlink:hover { border-color: var(--brand); }
.listlink strong { display: block; overflow-wrap: anywhere; }

/* Kirjautuminen */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.login img { height: 46px; margin: 0 auto 20px; display: block; }

@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
  .topbar-inner { gap: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  .who { margin-left: auto; }
  .who .name { display: none; }
}

/* Raportin muokkaus */
.report-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.reportpage { margin: 0 0 16px; min-width: 0; }
.reportpage legend { font-weight: 800; font-size: 16px; padding: 0 8px; }
.reportpage legend label { display: flex; gap: 8px; align-items: center; }
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.slot { display: grid; gap: 6px; }
.slot img, .slot .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #dfe5ea; }
.slot .noimg { display: grid; place-items: center; color: var(--muted); font-size: 14px; border: 2px dashed #b9c6d2; }
.slot [hidden] { display: none; }
.slot select, .slot textarea { font-size: 14px; padding: 7px 9px; }
.sticky { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -6px 18px rgba(13, 33, 55, .08); }
img.preview { width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; display: block; }
.photos.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.photos.small img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
@media (max-width: 1000px) { .report-layout { grid-template-columns: 1fr; } }

/* Kuntokartoitukset */
.subnav { display: flex; gap: 6px; margin-top: 8px; }
.subnav a, .tabs a {
  text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px;
  padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
}
.subnav a.on, .tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.survey-row { justify-content: flex-start; }
.survey-row img, .survey-row .nocover { width: 112px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #dfe5ea; flex: none; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.formgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.formgrid .field, .card .field { margin-bottom: 14px; }
.fixrow { display: grid; grid-template-columns: minmax(0, 1fr) 150px 110px; gap: 8px; margin-bottom: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.thumbs.big { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.thumb { position: relative; margin: 0; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: #dfe5ea; }
.thumb > button {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: var(--navy); color: #fff; font-size: 17px; line-height: 1; cursor: pointer;
}
.thumb-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.pick label { position: relative; display: block; cursor: pointer; }
.pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; border: 3px solid transparent; }
.pick input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; }
.pick input:checked + img { border-color: var(--brand); }
details.obs > summary { display: flex; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
details.obs > summary::-webkit-details-marker { display: none; }
.dot {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--muted); color: #fff; font-weight: 800; font-size: 13px; border: 2px solid #fff; padding: 0;
}
.dot.nyt { background: #c0392b; } .dot.myohemmin { background: #c98a0c; } .dot.ok { background: #2e7d4f; }
.pill.nyt { background: var(--bad-bg); color: var(--bad); } .pill.myohemmin { background: var(--warn-bg); color: var(--warn); }
.mapwrap { position: relative; line-height: 0; border-radius: 10px; overflow: hidden; cursor: crosshair; }
.mapwrap img { width: 100%; display: block; }
.mapwrap .dot { position: absolute; transform: translate(-50%, -50%); cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.mapwrap .dot.on { outline: 4px solid rgba(255, 255, 255, .85); transform: translate(-50%, -50%) scale(1.25); z-index: 2; }
.mapwrap .dot[hidden] { display: none; }
.pointlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; margin: 14px 0; }
.pointlist button {
  display: flex; gap: 8px; align-items: center; text-align: left; font: inherit; font-size: 14px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.pointlist button.on { border-color: var(--brand); background: var(--info-bg); }
.pointlist button.missing { border-style: dashed; }
table.checklist td { padding: 8px 10px; }
table.checklist textarea { font-size: 14px; padding: 6px 8px; min-width: 180px; }
td.kep { white-space: nowrap; }
td.kep label { display: inline-flex; gap: 3px; align-items: center; margin-right: 8px; font-weight: 700; }

/* Asiakkaan linkkinäkymä */
.pub-head { background: var(--navy); color: #fff; }
.pub-inner { max-width: 1280px; margin: 0 auto; padding: 22px 16px 18px; }
.pub-logo { height: 34px; margin-bottom: 18px; display: block; }
.pub-head h1 { color: #8fd6f2; font-size: 34px; text-transform: none; margin: 4px 0 6px; }
.pub-head .eyebrow { color: #fff; }
.pub-meta { color: #d5dee8; font-size: 14px; margin: 0 0 14px; }
.pub-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.pub-stats div { background: rgba(255, 255, 255, .07); border-left: 4px solid #8fd6f2; border-radius: 8px; padding: 8px 14px; min-width: 130px; }
.pub-stats .nyt { border-color: #e2574c; } .pub-stats .myohemmin { border-color: #e0a526; } .pub-stats .ok { border-color: #49b675; }
.pub-stats b { display: block; font-size: 22px; font-weight: 900; }
.pub-stats span { font-size: 12px; color: #d5dee8; }
.pub-cover { width: 100%; max-height: 60vh; object-fit: cover; display: block; }
.pub-map { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.pub-photo { width: 100%; border-radius: 10px; margin-bottom: 8px; display: block; }
#havainto h3 { display: flex; gap: 8px; align-items: center; margin: 8px 0 2px; }
#havainto article[hidden] { display: none; }
.legend { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin: 10px 0 0; flex-wrap: wrap; line-height: 1; }
.legend .dot { width: 12px; height: 12px; border: 0; margin-left: 8px; }
#taulukko tbody tr { cursor: pointer; }
#taulukko tbody tr.on { background: var(--info-bg); }
@media (max-width: 900px) {
  .formgrid, .formgrid.three, .pub-map { grid-template-columns: 1fr; }
  .fixrow { grid-template-columns: 1fr 1fr; }
  .fixrow input:first-child { grid-column: 1 / -1; }
  .pub-head h1 { font-size: 26px; }
}

.pub-head .btn.outline { color: #fff; }
.pub-head .btn.outline:hover { background: rgba(255, 255, 255, .1); }

td.links a { display: block; white-space: nowrap; }
