:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #60708a;
  --line: #d8e2ee;
  --green: #07a64b;
  --green-dark: #087a3b;
  --blue: #1d6fb8;
  --amber: #bb7a10;
  --red: #b63b3b;
  --shadow: 0 18px 40px rgba(22, 38, 60, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: 88px;
}

button, input, select, textarea { font: inherit; }

.hidden {
  display: none !important;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: #fff;
  transition: opacity .45s ease, visibility .45s ease;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-screen img {
  width: min(100vw, 420px);
  height: min(100vh, 918px);
  object-fit: contain;
  display: block;
}

.splash-loader {
  position: absolute;
  left: 50%;
  bottom: clamp(174px, 22vh, 236px);
  width: min(260px, 62vw);
  height: 8px;
  transform: translateX(-50%);
  background: #e8f1f8;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 48, 96, .12);
}

.splash-loader span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #07c56b, #0087e8);
  border-radius: inherit;
  transition: width .18s linear;
}

.splash-screen p {
  position: absolute;
  left: 50%;
  bottom: clamp(146px, 18vh, 206px);
  transform: translateX(-50%);
  margin: 0;
  color: #09284e;
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 24px;
  min-width: min(700px, 100%);
  white-space: nowrap;
}

.brand-logo {
  object-fit: contain;
  object-position: left center;
  display: block;
  background: transparent;
  mix-blend-mode: multiply;
  filter: contrast(1.04) saturate(1.04);
}

.brand-logo-main {
  width: clamp(230px, 25vw, 350px);
  height: 66px;
}

.brand-logo-product {
  width: clamp(260px, 30vw, 410px);
  height: 66px;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.step-pill {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}

.step-pill.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.install-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: min(1040px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 14px;
  border: 1px solid #bfe8d0;
  border-radius: 8px;
  background: #f0fbf5;
  box-shadow: 0 12px 30px rgba(7, 166, 75, .12);
}

.install-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #07c56b, #0087e8);
  color: #fff;
  font-weight: 800;
}

.install-card strong {
  display: block;
  margin-bottom: 3px;
}

.install-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.install-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto 84px;
}

.app-shell.summary-hidden {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
}

.app-shell.summary-hidden .summary-panel {
  display: none;
}

.summary-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  min-height: 540px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 92px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.12; margin-bottom: 10px; }
h2 { font-size: 30px; line-height: 1.16; margin-bottom: 10px; }
h3 { font-size: 20px; margin-bottom: 16px; }
p { color: var(--muted); line-height: 1.5; }

.progress-block {
  margin: 28px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.progress-track {
  height: 12px;
  background: #e9eff6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width .2s ease;
}

.meta-list {
  display: grid;
  gap: 16px;
  margin: 0;
}

.meta-list div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.meta-list dt {
  color: var(--muted);
  font-size: 13px;
}

.meta-list dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 28px 42px;
  box-shadow: var(--shadow);
}

.screen { display: none; }
.screen.active { display: block; }

.screen-head {
  margin-bottom: 24px;
  max-width: 860px;
}

.main-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.main-menu-card {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 24px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(22, 38, 60, 0.06);
}

.main-menu-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.main-menu-card span:last-child {
  color: var(--muted);
  line-height: 1.4;
}

.primary-menu-card {
  border-color: rgba(7, 166, 75, .4);
  box-shadow: 0 0 0 3px rgba(7, 166, 75, .08), 0 12px 28px rgba(22, 38, 60, 0.06);
}

.menu-icon {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #eef8f2;
  color: var(--green-dark);
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  position: relative;
  isolation: isolate;
}

.icon-svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sector-card .menu-icon {
  color: var(--green-dark);
}

.row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  max-width: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 111, 184, 0.14);
}

.sector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.sector-card {
  min-height: 176px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: grid;
  align-content: start;
  gap: 10px;
}

.sector-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.sector-card span {
  color: var(--muted);
  line-height: 1.35;
}

.sector-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 166, 75, 0.12);
}

.conditional-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toggle-row, .check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.toggle-row input, .check-row input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  accent-color: var(--green);
}

.photo-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.photo-guide span {
  background: #eef8f2;
  color: var(--green-dark);
  border: 1px solid #ccebd8;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.photo-item, .risk-card, .action-card, .status-box, .counter-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.photo-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 14px;
}

.photo-preview {
  width: 120px;
  aspect-ratio: 4 / 3;
  border: 1px dashed #b9c7d8;
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
  font-weight: 700;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-content h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.photo-content p {
  font-size: 14px;
  margin-bottom: 12px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.file-button input { display: none; }

.counter-card {
  padding: 14px 18px;
  min-width: 96px;
  text-align: center;
}

.counter-card strong {
  display: block;
  font-size: 26px;
}

.counter-card span {
  color: var(--muted);
  font-size: 13px;
}

.checklist {
  display: grid;
  gap: 12px;
}

.check-row select {
  max-width: 170px;
}

.status-box {
  padding: 16px;
  margin-bottom: 18px;
  color: var(--muted);
  background: #f8fafc;
}

.status-box.ready {
  color: var(--green-dark);
  background: #eef8f2;
  border-color: #ccebd8;
}

.status-box.error {
  color: var(--red);
  background: #fff4f4;
  border-color: #f0c7c7;
}

.generation-panel {
  display: grid;
  gap: 18px;
  max-width: 620px;
}

.generate-button {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
}

.generation-progress {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.report-content {
  margin-top: 24px;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.risk-list, .action-list {
  display: grid;
  gap: 12px;
}

.risk-card, .action-card {
  padding: 16px;
}

.risk-card strong, .action-card strong {
  display: block;
  margin-bottom: 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f7;
  color: var(--muted);
}

.tag.high { background: #fff2dc; color: var(--amber); }
.tag.critical { background: #ffe7e7; color: var(--red); }
.tag.ok { background: #eaf8ef; color: var(--green-dark); }

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.evidence-section {
  margin-top: 24px;
}

.evidence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.evidence-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.evidence-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #eef2f7;
}

.evidence-card figcaption {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.evidence-card figcaption span,
.empty-evidence {
  color: var(--muted);
  line-height: 1.4;
}

.evidence-finding {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.evidence-finding b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.evidence-finding p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.history-panel {
  margin-top: 24px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  cursor: pointer;
}

.history-card strong,
.history-card span {
  display: block;
}

.history-card span {
  margin-top: 4px;
  color: var(--muted);
}

.history-status {
  display: inline-flex !important;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.history-status.ok {
  background: #eaf8ef;
  color: var(--green-dark);
}

.history-status.pending {
  background: #fff2dc;
  color: var(--amber);
}

.history-card dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.history-card dt {
  color: var(--muted);
  font-size: 12px;
}

.history-card dd {
  margin: 3px 0 0;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
}

.primary-button, .secondary-button {
  border: 0;
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.primary-button:disabled {
  background: #9ccbad;
  cursor: not-allowed;
}

.secondary-button {
  background: #eaf0f7;
  color: var(--ink);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    min-height: auto;
    position: static;
  }

  .sector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .row-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: center;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .app-shell, .workspace {
    padding: 16px;
  }

  .brand {
    min-width: 0;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .brand-logo-main {
    width: min(180px, 43vw);
    height: 48px;
  }

  .brand-logo-product {
    width: min(200px, 49vw);
    height: 48px;
  }

  .install-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: calc(100% - 24px);
    margin-top: 12px;
  }

  .install-card .primary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .form-grid, .conditional-panel, .photo-list, .report-grid, .evidence-list, .main-menu-grid {
    grid-template-columns: 1fr;
  }

  .history-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sector-grid {
    grid-template-columns: 1fr;
  }

  .photo-item {
    grid-template-columns: 96px 1fr;
  }

  .photo-preview {
    width: 96px;
  }

  h2 {
    font-size: 24px;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 10px 14px;
  }

  #resetButton {
    grid-column: 1 / -1;
  }
}

@media print {
  .splash-screen, .topbar, .bottom-nav, .summary-panel, .report-actions, .file-button, .step-pill, .generation-panel, .history-panel, .install-card {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .app-shell, .workspace {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .screen {
    display: none !important;
  }

  .screen[data-screen="4"], .report-content {
    display: block !important;
  }

  .report-grid, .evidence-list {
    grid-template-columns: 1fr 1fr;
  }

  .risk-card, .action-card, .evidence-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
