* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-size: 13px;
  line-height: 1.3;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.back-link {
  color: #2c5530;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.back-link:hover {
  background: #e8f5e9;
}

.header {
  text-align: center;
  margin-bottom: 12px;
}

.header h1 {
  color: #2c5530;
  margin-bottom: 4px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.header p {
  color: #666;
  font-size: 0.82rem;
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.35;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

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

.panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  padding: 12px 14px;
}

.panel h2 {
  color: #2c5530;
  font-size: 0.95rem;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8f5e9;
}

.field-group {
  margin-bottom: 8px;
}

.field-group label {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 3px;
  color: #444;
  line-height: 1.25;
}

.field-group label code {
  font-size: 0.68rem;
  font-weight: 500;
  color: #888;
}

.field-group .hint {
  display: block;
  font-size: 0.7rem;
  color: #888;
  margin-top: 2px;
  line-height: 1.25;
}

.field-group input,
.field-group select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #d0d7de;
  border-radius: 5px;
  font-size: 0.82rem;
  background: #fff;
  line-height: 1.3;
}

.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: #2c5530;
  box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.1);
}

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

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.derived-grid {
  display: grid;
  gap: 4px;
}

.derived-grid--compact {
  gap: 3px;
}

.derived-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #f8faf8;
  border-radius: 4px;
  border: 1px solid #edf2ed;
  min-height: 24px;
}

.derived-item .label {
  font-size: 0.74rem;
  color: #555;
  line-height: 1.2;
}

.derived-item .label code {
  font-size: 0.65rem;
  color: #888;
  background: #eef2ee;
  padding: 0 3px;
  border-radius: 3px;
}

.derived-item .value {
  font-weight: 700;
  font-size: 0.76rem;
  color: #2c5530;
  white-space: nowrap;
}

.derived-item.total {
  background: #e8f5e9;
  border-color: #c8e6c9;
  padding: 5px 8px;
}

.derived-item.total .value {
  font-size: 0.88rem;
}

.flag-yes {
  color: #2e7d32;
}

.flag-no {
  color: #757575;
}

.alert {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 0.76rem;
  line-height: 1.3;
}

.alert-warning {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #6d4c00;
}

.alert-info {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
}

.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #888;
  margin: 8px 0 4px;
}

.section-title:first-of-type {
  margin-top: 4px;
}

.footer-note {
  margin-top: 10px;
  text-align: center;
  color: #777;
  font-size: 0.7rem;
  line-height: 1.35;
}

.calc-list {
  display: grid;
  gap: 3px;
}

.calc-block--input {
  margin-bottom: 4px;
}

.calc-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.calc-input-row label {
  font-weight: 600;
  font-size: 0.78rem;
  color: #444;
  line-height: 1.2;
}

.calc-input-row label code {
  font-size: 0.68rem;
  font-weight: 500;
  color: #888;
}

.calc-input-row input {
  width: 118px;
  padding: 4px 6px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 0.78rem;
  text-align: right;
}

.calc-details {
  border: 2px solid #9eb5a0;
  border-radius: 5px;
  background: #f8faf8;
  overflow: hidden;
}

.calc-details--total {
  background: #e8f5e9;
  border-color: #7daa80;
}

.calc-details--total > .calc-summary .calc-summary-value {
  font-size: 0.88rem;
}

.calc-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  min-height: 24px;
  cursor: pointer;
  list-style: none;
}

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

.calc-summary::before {
  content: '▸';
  font-size: 0.62rem;
  color: #888;
  flex-shrink: 0;
  width: 10px;
}

.calc-details[open] > .calc-summary::before {
  content: '▾';
}

.calc-summary-label {
  font-size: 0.74rem;
  color: #555;
  line-height: 1.2;
  flex: 1;
}

.calc-summary-label code {
  font-size: 0.65rem;
  color: #888;
  background: #eef2ee;
  padding: 0 3px;
  border-radius: 3px;
}

.calc-summary-value {
  font-weight: 700;
  font-size: 0.76rem;
  color: #2c5530;
  white-space: nowrap;
}

.calc-breakdown {
  padding: 5px 8px 6px 22px;
  border-top: 1px solid #e8ede8;
  background: #fff;
}

.calc-formula {
  font-size: 0.68rem;
  color: #666;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f0f3f0;
}

.calc-steps {
  list-style: none;
  display: grid;
  border: 1px solid #eef2ee;
  border-radius: 3px;
  overflow: hidden;
  background: #fcfdfc;
}

.calc-step {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  line-height: 1.25;
  padding: 3px 6px;
  border-bottom: 1px solid #f3f6f3;
}

.calc-step:last-child {
  border-bottom: none;
}

.calc-step-label {
  color: #666;
}

.calc-step-value {
  color: #2c5530;
  font-weight: 600;
  white-space: nowrap;
}