:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #d97706;
  --neutral: #64748b;
  --radius-xl: 16px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  padding: 20px;
}

button,
input,
select,
summary {
  font: inherit;
}

button {
  border: 0;
}

.app-shell,
.container {
  max-width: 1100px;
  margin: 0 auto;
}

.tool-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.tool-topbar-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tool-topbar-link {
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.tool-topbar-text {
  color: var(--muted);
  font-size: 0.86rem;
}

.tool-topbar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.page-header {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  text-align: center;
}

.page-header h1,
.panel-title-row h2,
.form-section-head h3,
.detail-card-head h3 {
  margin: 0;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--primary);
}

.page-header p {
  max-width: 760px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.75;
}

.hero-meta,
.save-status,
.risk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}

.hero-meta,
.save-status {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.hero-meta {
  margin-top: 16px;
}

.page-alert {
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 55%, #ffffff 100%);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.12);
}

.page-alert-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.page-alert-title {
  margin-top: 12px;
  font-size: 1.08rem;
  font-weight: 800;
  color: #9a3412;
}

.page-alert-text {
  margin-top: 10px;
  color: #7c2d12;
  font-size: 0.95rem;
  line-height: 1.75;
}

.page-alert-tip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  color: #b45309;
  font-size: 0.88rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel,
.card {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.panel-title-row,
.form-section-head,
.detail-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-title-row {
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: 0;
}

.panel-heading {
  display: grid;
  gap: 10px;
}

.panel-kicker {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.panel-heading-copy {
  display: grid;
  gap: 8px;
}

.panel-title-row h2 {
  display: flex;
  align-items: center;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.panel-heading-copy p {
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-section,
.detail-card,
.chart-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.highlight-section {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: #dbeafe;
}

.form-section-head,
.detail-card-head {
  align-items: flex-start;
}

.section-head-copy {
  display: grid;
  gap: 6px;
}

.section-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.section-note,
.detail-card-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-section-head h3,
.detail-card-head h3 {
  font-size: 17px;
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

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

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

label {
  display: grid;
  gap: 8px;
}

label span,
.metric-card p,
.mini-stats span,
.detail-card-head span,
.helper-text,
.metric-card span,
.cost-row-top {
  color: var(--muted);
}

label span {
  font-size: 0.875rem;
  font-weight: 500;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

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

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  padding-right: 40px;
}

.input-with-suffix em {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-style: normal;
  color: var(--muted);
}

.field-toggle {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.field-toggle summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

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

.field-toggle summary::after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.field-toggle[open] summary::after {
  content: "−";
}

.toggle-grid {
  margin-top: 0;
  padding: 0 14px 14px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost-button:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

.metrics-grid,
.detail-grid {
  display: grid;
  gap: 14px;
}

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

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
}

.metric-card.accent {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  border-color: transparent;
  color: #fff;
}

.metric-card.accent p,
.metric-card.accent span {
  color: rgba(255, 255, 255, 0.72);
}

.metric-card p {
  margin: 0;
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.04em;
}

.metric-card strong,
.mini-stats strong,
.cost-row-top strong,
.cost-row-top span {
  overflow-wrap: anywhere;
}

.insight-summary {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
}

.insight-summary p {
  margin: 0;
  line-height: 1.65;
}

.risk-chip {
  width: fit-content;
  color: #fff;
}

.risk-neutral {
  background: linear-gradient(135deg, #64748b, #94a3b8);
}

.risk-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.risk-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.risk-good {
  background: linear-gradient(135deg, #059669, #0ea5a4);
}

.detail-grid {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.mini-stats span {
  display: block;
  font-size: 12px;
}

.mini-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.helper-text {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.cost-bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.cost-row {
  display: grid;
  gap: 8px;
}

.cost-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.cost-track {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.cost-fill {
  height: 100%;
  border-radius: inherit;
}

.empty-block {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--panel-soft);
  color: var(--muted);
}

.recommendation-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 18px;
}

.recommendation-list li {
  line-height: 1.65;
}

.status-positive {
  color: var(--success);
}

.status-negative {
  color: var(--danger);
}

.status-neutral {
  color: var(--neutral);
}

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

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .app-shell,
  .container {
    max-width: 100%;
  }

  .tool-topbar,
  .tool-topbar-main,
  .panel-title-row,
  .detail-card-head,
  .cost-row-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-heading,
  .section-head-copy {
    width: 100%;
  }

  .tool-topbar {
    gap: 10px;
  }

  .tool-topbar-main {
    gap: 8px;
  }

  .tool-topbar-badge {
    width: 100%;
    justify-content: center;
  }

  .page-header {
    margin-bottom: 20px;
    padding: 18px 16px;
    gap: 10px;
  }

  .page-header h1 {
    font-size: 1.55rem;
  }

  .page-header p {
    font-size: 0.92rem;
  }

  .panel,
  .card {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 14px;
  }

  .page-alert {
    padding: 16px;
    border-radius: 14px;
  }

  .columns-2,
  .metrics-grid,
  .detail-grid,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .panel-title-row h2 {
    font-size: 1.05rem;
  }

  .panel-heading-copy p,
  .page-alert-text,
  .helper-text,
  .metric-card span {
    line-height: 1.6;
  }

  .form-section,
  .detail-card,
  .metric-card {
    padding: 16px;
  }

  .ghost-button,
  .hero-meta,
  .save-status {
    min-height: 40px;
  }

  .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .field-toggle summary {
    min-height: 48px;
    padding: 14px;
  }

  .metric-card strong {
    font-size: clamp(22px, 8vw, 28px);
  }

  .cost-row-top {
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .tool-topbar-link,
  .tool-topbar-text {
    font-size: 0.84rem;
  }

  .page-header h1 {
    font-size: 1.45rem;
  }

  .page-header {
    padding: 16px 14px;
  }

  .page-alert-title {
    font-size: 1rem;
  }

  .panel-title-row h2 {
    font-size: 1rem;
  }

  .panel-heading-copy p {
    font-size: 12px;
    padding-left: 16px;
  }

  .form-section-head h3,
  .detail-card-head h3 {
    font-size: 16px;
  }

  .section-note,
  .detail-card-head span {
    font-size: 11px;
  }

  .mini-stats div,
  .metric-card {
    padding: 14px;
  }

  .mini-stats strong {
    font-size: 18px;
  }
}
