/* Form / app chrome — not printed */

body.app-body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: #e8eef1;
  color: #1a1a1a;
  min-height: 100vh;
}

.app-topbar {
  background: #008fb5;
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-topbar h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.3px;
}

.app-topbar .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 4px;
  font-family: inherit;
}

.btn-print {
  background: #d7193f;
  color: #fff;
}

.btn-print:hover { background: #b81435; }

.btn-secondary {
  background: #fff;
  color: #008fb5;
}

.btn-secondary:hover { background: #f0f7fa; }

.btn-dark {
  background: #222831;
  color: #fff;
}

.btn-add {
  background: #008fb5;
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  background: #be283a;
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  padding: 18px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.panel h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #008fb5;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e4eef1;
}

.panel h2 + .field-grid,
.section-block + .section-block {
  margin-top: 4px;
}

.section-block {
  margin-bottom: 16px;
}

.section-block:last-child {
  margin-bottom: 0;
}

.bill-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.bill-type-tabs label {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border: 2px solid #cfd8dc;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  background: #f7fafb;
}

.bill-type-tabs input {
  display: none;
}

.bill-type-tabs label.active,
.bill-type-tabs input:checked + span,
.bill-type-tabs label:has(input:checked) {
  border-color: #008fb5;
  background: #e6f5f9;
  color: #006d8a;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  margin-bottom: 4px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #c5d0d5;
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid #008fb5;
  border-color: #008fb5;
}

.field textarea {
  resize: vertical;
  min-height: 52px;
}

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

.items-table th {
  background: #222831;
  color: #fff;
  padding: 6px 4px;
  font-size: 10px;
  text-align: left;
}

.items-table td {
  padding: 4px 2px;
  vertical-align: middle;
  border-bottom: 1px solid #e8e8e8;
}

.items-table input {
  width: 100%;
  border: 1px solid #d0d7db;
  border-radius: 3px;
  padding: 5px 4px;
  font-size: 12px;
}

.items-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.items-head h2 {
  margin: 0;
  border: none;
  padding: 0;
}

.solar-only { display: none; }
body[data-bill-type="solar"] .solar-only { display: block; }
body[data-bill-type="solar"] .solar-only-cell { display: table-cell; }
body[data-bill-type="normal"] .solar-only-cell { display: none; }

.preview-wrap {
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 10px;
  background: #c5d0d6;
  border-radius: 8px;
  min-height: calc(100vh - 100px);
}

.preview-scale {
  transform-origin: top center;
}

.preview-wrap .bill-page {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.hint {
  font-size: 11px;
  color: #666;
  margin-top: 8px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .preview-wrap {
    min-height: auto;
  }
}

@media print {
  .no-print {
    display: none !important;
  }

  body.app-body {
    background: #fff;
  }

  .app-layout {
    display: block;
    padding: 0;
    margin: 0;
  }

  .preview-wrap {
    background: transparent;
    padding: 0;
    border-radius: 0;
    overflow: visible;
    min-height: 0;
  }

  .preview-scale {
    transform: none !important;
  }

  .bill-page {
    box-shadow: none !important;
  }
}
