:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9e0e7;
  --accent: #0b6bcb;
  --accent-soft: #e8f2ff;
  --good: #047857;
  --warn: #b45309;
  --shadow: 0 12px 32px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.2;
}

.page-header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.ghost-button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-size: 15px;
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel,
.results-panel {
  padding: 18px;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.field-grid:first-of-type {
  border-top: 0;
  padding-top: 0;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b8c2cc;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  font-size: 17px;
  font-weight: 700;
  text-align: right;
}

input:focus {
  outline: 3px solid rgba(11, 107, 203, 0.15);
  border-color: var(--accent);
}

small {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.result-card {
  padding: 16px;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  background: var(--accent-soft);
}

.result-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.result-card strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.15;
}

.detail-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-box h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.detail-row {
  margin: 8px 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.55;
}

.detail-row strong {
  color: var(--text);
}

.price-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f8fbff;
}

.profit-positive {
  color: var(--good);
}

.profit-negative {
  color: #c2410c;
}

.warning {
  color: var(--warn);
}

@media (max-width: 900px) {
  .app {
    padding: 16px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app {
    padding: 12px;
  }

  .input-panel,
  .results-panel {
    padding: 14px;
  }

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

  input {
    font-size: 16px;
  }
}
