:root {
  --ink: #102431;
  --muted: #5f7585;
  --line: #cbdbe7;
  --sea: #0b3a53;
  --sea-deep: #072b3d;
  --foam: #e9f4fb;
  --sun: #f2c77b;
  --paper: #ffffff;
  --sheet: #f7fbfe;
  --ok: #116536;
  --no: #932121;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(1100px 420px at -5% -10%, #d7eaf8 0%, transparent 55%),
    radial-gradient(800px 360px at 110% 0%, #f9ecd2 0%, transparent 50%),
    var(--sheet);
}

.container {
  width: min(980px, 100% - 1.2rem);
  margin: 1rem auto 2rem;
}

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--sea) 0%, var(--sea-deep) 100%);
  border-radius: calc(var(--radius) + 4px);
  color: #fff;
  padding: 1.15rem 1rem 1.25rem;
  box-shadow: 0 14px 30px rgb(9 43 62 / 24%);
}

.hero-logo {
  width: min(100%, 360px);
  display: block;
  margin: 0 0 0.4rem;
  border-radius: 12px;
}

.hero::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff66 0%, #ffffff11 45%, transparent 70%);
}

.kicker {
  margin: 0;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.72rem;
  color: #b7d9ee;
}

.hero h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 0.6rem 0 0;
  color: #d6ebf8;
  max-width: 54ch;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.54rem 0.84rem;
  border-radius: 10px;
  background: #ffffff1f;
  color: #fff;
  border: 1px solid #ffffff4f;
  text-decoration: none;
  font-weight: 700;
}

.hero-cta:hover {
  background: #ffffff33;
}

.back-to-form {
  position: fixed;
  right: max(0.8rem, env(safe-area-inset-right));
  bottom: max(0.8rem, env(safe-area-inset-bottom));
  z-index: 9000;
  border-radius: 999px;
  padding: 0.74rem 0.98rem;
  font-weight: 800;
  font-size: 0.93rem;
  border: 1px solid #81aac3;
  background: linear-gradient(135deg, #0d4f73 0%, #0b3a53 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgb(9 43 62 / 35%);
}

.back-to-form:hover {
  filter: brightness(1.08);
}

.info-card,
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgb(20 48 66 / 7%);
}

.info-card {
  margin-top: 0.9rem;
  padding: 0.95rem;
  background: linear-gradient(180deg, #f3fafe 0%, #ffffff 70%);
}

.info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.info-head h2 {
  margin: 0;
  color: var(--sea);
  font-size: 1rem;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.26rem 0.58rem;
  font-size: 0.74rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--sun) 30%, #fff);
  border: 1px solid #e4c58f;
  color: #664715;
}

.owner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.owner-grid div {
  border: 1px dashed #c7d9e8;
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  background: #fff;
}

.owner-grid span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.owner-grid strong {
  font-size: 0.9rem;
}

.card {
  margin-top: 0.9rem;
  padding: 1rem;
}

section {
  margin-bottom: 1.1rem;
}

h2 {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
  color: var(--sea);
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 0.94rem;
}

.subcard {
  padding: 0.75rem;
  border: 1px solid #d8e4ed;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--foam) 0%, #f8fcff 100%);
  margin-bottom: 0.75rem;
}

.subcard-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.66rem;
  align-items: end;
  margin-bottom: 0.66rem;
}

.grid {
  display: grid;
  gap: 0.66rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
}

label.full {
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  background: #fff;
}

input.readonly {
  background: #f2f7fb;
  color: #476273;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--sea);
  outline: 2px solid color-mix(in srgb, var(--sea) 30%, #fff);
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

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

.crew-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  background: #fff;
}

.crew-table th,
.crew-table td {
  border: 1px solid #d6e2ec;
  padding: 0.44rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.crew-table th {
  background: #eaf4fb;
  color: #0d3d58;
  font-weight: 700;
}

.actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

button {
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(135deg, var(--sea) 0%, #115a80 100%);
  padding: 0.77rem 1.08rem;
  box-shadow: 0 8px 18px rgb(11 58 83 / 24%);
}

.ghost-btn {
  background: #fff;
  color: var(--sea);
  border: 1px solid #bfd3e2;
  box-shadow: none;
  padding: 0.62rem 0.8rem;
}

.ghost-btn:hover {
  background: #eef6fb;
  filter: none;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  cursor: wait;
  opacity: 0.75;
}

#result {
  margin-top: 1rem;
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.pdf-actions .ghost-btn {
  text-decoration: none;
}

.pdf-helper {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(5 23 34 / 65%);
}

.pdf-modal-panel {
  position: absolute;
  inset: max(0.7rem, env(safe-area-inset-top)) max(0.7rem, env(safe-area-inset-right))
    max(0.7rem, env(safe-area-inset-bottom)) max(0.7rem, env(safe-area-inset-left));
  background: #fff;
  border-radius: 14px;
  border: 1px solid #bdd4e4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 45px rgb(0 0 0 / 30%);
}

.pdf-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  background: #f1f8fc;
  border-bottom: 1px solid #d0e2ef;
}

.pdf-modal-head strong {
  color: var(--sea);
}

.pdf-modal-close {
  padding: 0.5rem 0.7rem;
}

.pdf-modal-frame {
  width: 100%;
  flex: 1;
  border: 0;
  background: #f0f4f8;
}

body.modal-open {
  overflow: hidden;
}

.hidden {
  display: none;
}

.result-success {
  color: var(--ok);
}

.result-error {
  color: var(--no);
}

@media (max-width: 980px) {
  .container {
    width: min(980px, 100% - 1rem);
  }

  .hero-logo {
    width: min(100%, 320px);
  }
}

@media (max-width: 900px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

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

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .actions button {
    width: 100%;
  }

  .pdf-actions .ghost-btn {
    width: 100%;
    text-align: center;
  }

  .pdf-modal-panel {
    inset: max(0.4rem, env(safe-area-inset-top)) max(0.4rem, env(safe-area-inset-right))
      max(0.4rem, env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-left));
    border-radius: 12px;
  }
}

@media (min-width: 1200px) {
  .back-to-form {
    right: max(1.2rem, env(safe-area-inset-right));
    bottom: max(1.2rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  .owner-grid {
    grid-template-columns: 1fr;
  }

  .subcard-tools {
    grid-template-columns: 1fr;
  }

  .container {
    width: min(980px, 100% - 0.8rem);
  }

  .card,
  .info-card {
    padding: 0.85rem;
  }

  .actions {
    justify-content: stretch;
    flex-direction: column;
  }
}
