/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'League Spartan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  background-color: #eef1f6;
  color: #1a1a1a;
  padding: 16px;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(26,58,92,0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26,58,92,0.09) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, black 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 30%, black 20%, transparent 75%);
}

/* ── App Shell ── */
.app-container { max-width: 680px; margin: 0 auto; }

.app-header { text-align: center; padding: 24px 0 16px; }
.app-header h1 { font-size: 1.8rem; font-weight: 700; color: #1a3a5c; }
.app-subtitle { color: #666; font-size: 0.95rem; margin-top: 4px; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Fields ── */
.field-row { display: flex; flex-direction: column; margin-bottom: 12px; }
.field-row:last-child { margin-bottom: 0; }

.field-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 4px;
}

.field-row input[type="text"],
.field-row input[type="number"],
.field-row input[type="date"] {
  padding: 9px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fff;
  -webkit-appearance: none;
}

.field-row input:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

/* ── Services ── */
.service-block { border-bottom: 1px solid #f0f0f0; padding: 12px 0; }
.service-block:last-child { border-bottom: none; padding-bottom: 0; }
.service-block:first-child { padding-top: 0; }

.service-main-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.97rem;
  font-weight: 500;
  cursor: pointer;
}

.service-main-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a3a5c;
  flex-shrink: 0;
}

.service-sub {
  margin-top: 10px;
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-sub label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.service-sub input[type="radio"],
.service-sub input[type="checkbox"] {
  accent-color: #1a3a5c;
  flex-shrink: 0;
}

.sub-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 2px; }

.mold-auto-label { font-size: 0.9rem; color: #444; }
.mold-hint { font-size: 0.8rem; color: #888; }

/* ── Totals ── */
.totals-table { display: flex; flex-direction: column; gap: 8px; }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.total-label { font-size: 0.95rem; color: #444; }
.total-value { font-size: 0.95rem; font-weight: 600; color: #1a1a1a; }

.total-row--final { border-top: 2px solid #1a3a5c; border-bottom: 2px solid #1a3a5c; padding: 10px 0; margin: 4px 0; }
.total-row--final .total-label { font-size: 1.05rem; font-weight: 700; color: #1a3a5c; }
.total-row--final .total-value { font-size: 1.05rem; font-weight: 700; color: #1a3a5c; }

.adjustment-row { gap: 10px; }
.adjustment-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.9rem;
}
.adjustment-row input[type="number"] {
  width: 110px;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: right;
}

/* ── Button ── */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #0f2740; }
.btn-primary:active { background: #0a1d2e; }
.btn-primary:disabled { background: #7a9bbf; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: #1a3a5c;
  border: 2px solid #1a3a5c;
  border-radius: 6px;
  font-family: 'League Spartan', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: #1a3a5c; color: #fff; }

/* ── Status ── */
.status-message { text-align: center; font-size: 0.9rem; color: #555; margin-top: 10px; min-height: 20px; }
.status-message.error   { color: #c0392b; }
.status-message.success { color: #27ae60; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── PDF render target (off-screen) ── */
#pdf-template {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 816px;
  background: #fff;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  body { padding: 10px; }
  .card { padding: 16px; }
  .adjustment-row { flex-direction: column; }
  .adjustment-row input[type="number"] { width: 100%; }
}
