﻿:root {
  --bg-0: #e6e9ef;
  --bg-1: #dfe4ec;
  --shell: #d8dde6;
  --shell-edge: #c6ceda;
  --card-top: #f3f5f9;
  --card-bottom: #eef2f7;
  --line: #c9d1dd;
  --line-strong: #a7b3c5;
  --ink-900: #131d30;
  --ink-700: #24324a;
  --ink-500: #4a5972;
  --text-1: #1b2435;
  --text-2: #43516b;
  --sun-500: #f5c61f;
  --sun-600: #e2b317;
  --shadow-card: 0 14px 30px rgba(28, 40, 61, 0.08);
  --shadow-soft: 0 8px 20px rgba(28, 40, 61, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Manrope", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text-1);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(145deg, var(--bg-0) 0%, var(--bg-1) 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0) 8%, rgba(255, 255, 255, 0.3) 8.5%, rgba(255, 255, 255, 0) 15%),
    linear-gradient(135deg, rgba(255, 255, 255, 0) 26%, rgba(255, 255, 255, 0.33) 26.5%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(152deg, rgba(255, 255, 255, 0) 43%, rgba(255, 255, 255, 0.35) 43.7%, rgba(255, 255, 255, 0) 50%);
  opacity: 0.7;
}

body::after {
  background:
    linear-gradient(160deg, rgba(255, 205, 45, 0.36) 0%, rgba(255, 205, 45, 0) 36%),
    linear-gradient(20deg, rgba(255, 205, 45, 0.22) 4%, rgba(255, 205, 45, 0) 24%);
  clip-path: polygon(0 100%, 0 54%, 26% 71%, 58% 56%, 100% 76%, 100% 100%);
}

.shell {
  width: min(1480px, 95.5vw);
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 40;
  margin-top: 18px;
  margin-bottom: 14px;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #f5f7fb 0%, #edf2f8 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 28px rgba(18, 28, 45, 0.14);
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(90deg, #39465a 0%, #495871 40%, #4f5f79 100%);
}

.title-group {
  padding-top: 6px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background:
    linear-gradient(142deg, #0f223c 0%, #274168 38%, #edbc1e 39%, #f4cb2d 66%, #cf4f5f 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.title-group h1 {
  margin: 0;
  font-size: clamp(28px, 2vw, 36px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.topbar-actions {
  margin-top: 2px;
  margin-right: -16px;
  margin-bottom: -12px;
  padding: 16px 16px 14px 22px;
  border-top-left-radius: 18px;
  background: linear-gradient(180deg, #f9cf2d 0%, #f2c31f 100%);
  display: flex;
  gap: 10px;
  align-items: center;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--shell-edge);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 247, 251, 0.96) 0%, rgba(234, 239, 247, 0.95) 100%);
  box-shadow: var(--shadow-soft);
}

.layout::before {
  content: "";
  position: absolute;
  top: 26px;
  left: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #79879d;
  border: 2px solid #eef1f5;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.card-save {
  grid-column: span 7;
  min-height: 212px;
}

.card-equipment {
  grid-column: span 5;
  min-height: 212px;
}

.card-inputs {
  grid-column: span 7;
}

.card-results {
  grid-column: span 5;
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

h3 {
  margin: 12px 0 8px;
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink-900);
}

.hint {
  margin: 6px 0 10px;
  font-size: 15px;
  color: var(--text-2);
}

.section-gap {
  margin-top: 10px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}

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

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

.compact-grid {
  gap: 9px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text-1);
  background: linear-gradient(180deg, #f7f9fc 0%, #edf1f7 100%);
}

input::placeholder {
  color: #6d7a8f;
}

input:focus,
select:focus,
button:focus,
summary:focus {
  outline: 3px solid rgba(57, 98, 179, 0.3);
  outline-offset: 1px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
  color: var(--text-1);
}

.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #f7f9fc 0%, #edf1f7 100%);
  color: var(--text-1);
}

.checkbox-row input {
  width: 20px;
  min-height: 20px;
}

.btn {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #f7f9fc 0%, #e9edf4 100%);
  border-radius: 12px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(19, 33, 56, 0.16);
  filter: saturate(1.04);
}

.btn-primary {
  border-color: #d2a913;
  background: linear-gradient(180deg, #f8d342 0%, var(--sun-500) 52%, var(--sun-600) 100%);
  color: #111b2a;
}

.btn-ink {
  border-color: #1b2638;
  background: linear-gradient(180deg, #3e4f68 0%, #26364f 56%, #16253c 100%);
  color: #f1f5fb;
}

.btn-muted {
  border-color: #b3becf;
  background: linear-gradient(180deg, #eff2f7 0%, #d9dfeb 100%);
  color: #27354d;
}

.save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.saved-list {
  margin-top: 8px;
  max-height: 170px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.saved-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: linear-gradient(180deg, #f8fafd 0%, #edf2f8 100%);
}

.saved-actions {
  display: flex;
  gap: 6px;
}

.status {
  min-height: 18px;
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

.equipment-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.detail-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f7fb 0%, #e9eef6 100%);
  overflow: hidden;
}

.detail-card summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-900);
}

.detail-card summary::-webkit-details-marker {
  display: none;
}

.detail-card summary::after {
  content: "+";
  float: right;
  color: var(--ink-500);
}

.detail-card[open] summary::after {
  content: "-";
}

.detail-content {
  padding: 0 12px 12px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th,
.table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.table th {
  background: linear-gradient(180deg, #edf1f7 0%, #dfe5ee 100%);
  color: var(--ink-900);
  font-weight: 700;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #eff3f8 0%, #e3e8f1 100%);
  font-size: 16px;
}

.result-box strong {
  display: block;
  margin-bottom: 3px;
}

.report-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reveal {
  animation: card-fade 260ms ease both;
}

.reveal:nth-child(2) {
  animation-delay: 40ms;
}

.reveal:nth-child(3) {
  animation-delay: 80ms;
}

.reveal:nth-child(4) {
  animation-delay: 120ms;
}

@keyframes card-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1199px) {
  .topbar {
    top: 8px;
  }

  .title-group h1 {
    font-size: clamp(24px, 3.6vw, 40px);
  }

  .topbar-actions {
    margin-right: 0;
    margin-bottom: 0;
    border-radius: 12px;
    padding: 8px;
  }

  .layout {
    padding: 12px;
  }

  .card-save,
  .card-equipment {
    grid-column: span 6;
  }

  .card-inputs,
  .card-results {
    grid-column: span 12;
  }

  h2 {
    font-size: clamp(22px, 3vw, 28px);
  }

  h3 {
    font-size: clamp(18px, 2.6vw, 24px);
  }

  .hint,
  .status,
  label,
  .table,
  .result-box,
  .btn,
  input,
  select,
  .detail-card summary {
    font-size: clamp(14px, 1.9vw, 16px);
  }

  input,
  select,
  .btn,
  .checkbox-row {
    min-height: 40px;
  }
}

@media (max-width: 767px) {
  .shell {
    width: min(96vw, 760px);
  }

  body::after {
    clip-path: polygon(0 100%, 0 70%, 48% 78%, 100% 66%, 100% 100%);
  }

  .topbar {
    position: static;
    margin-top: 10px;
    padding: 10px;
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar::before {
    height: 10px;
  }

  .topbar-actions {
    width: 100%;
    margin: 0;
    border-radius: 10px;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .layout::before {
    display: none;
  }

  .card-save,
  .card-equipment,
  .card-inputs,
  .card-results {
    grid-column: auto;
  }

  .grid-2,
  .grid-3,
  .save-row,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .saved-item {
    grid-template-columns: 1fr;
  }

  .saved-actions {
    flex-wrap: wrap;
  }
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  body::after {
    display: none;
  }

  .topbar,
  .card-save,
  .card-equipment,
  .report-actions,
  #exportHtml,
  #printReport,
  #saveButton,
  #refreshSaved,
  #printButton {
    display: none !important;
  }

  .layout,
  .shell {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .card {
    border: 0;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }

  .card-inputs {
    display: none;
  }

  .card-results {
    display: block;
  }
}
