:root {
  --ink: #1c2b24;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --line: #d7d2c4;
  --accent: #2f6f4e;
  --accent-soft: #e6efe8;
  --muted: #6b6d63;
  --error-bg: #fbeaea;
  --error-border: #c0392b;
  --error-text: #7a2418;
  --hairline: rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ebe8;
    --paper: #131a16;
    --surface: #1b2521;
    --line: #35443c;
    --accent: #4fb384;
    --accent-soft: #1e3229;
    --muted: #93998f;
    --error-bg: #3a1f1c;
    --error-border: #e0574a;
    --error-text: #f0a89e;
    --hairline: rgba(255, 255, 255, 0.08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  padding: 48px 20px;
}

.wrap {
  width: 100%;
  max-width: 480px;
}

h1 {
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
  line-height: 1.5;
}

form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}

.field {
  margin-bottom: 18px;
}

.field:last-of-type {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  color-scheme: light dark;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

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

button {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { opacity: 0.92; }

.result {
  margin-top: 20px;
  padding: 18px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  display: none;
}

.result.show { display: block; }

.result.error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}

.result-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

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

.result-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.breakdown {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--ink);
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.breakdown span:last-child {
  font-variant-numeric: tabular-nums;
}

.note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 20px;
  line-height: 1.5;
}
