:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: #172026;
  --muted: #66737c;
  --line: #dbe3e8;
  --accent: #0f766e;
  --accent-2: #cf3f32;
  --accent-soft: #dff4f1;
  --warning: #8a5b11;
  --shadow: 0 12px 32px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand,
.top-actions,
.pdf-header,
.field-row,
.metrics,
.line-item,
.tabs {
  display: flex;
}

.brand {
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
}

.brand-subtitle,
.muted,
.revision,
.date,
small {
  color: var(--muted);
}

.brand-subtitle,
.revision,
.date,
small {
  font-size: 13px;
}

.top-actions {
  align-items: center;
  gap: 8px;
}

.icon-button,
.primary-button,
.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 700;
}

.icon-button svg,
.primary-button svg {
  width: 18px;
  height: 18px;
}

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

.workspace {
  min-width: 0;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 1;
}

.section-head p {
  margin-top: 8px;
  color: var(--muted);
}

.tabs {
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  width: fit-content;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(23, 32, 38, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.panel {
  padding: 18px;
}

.panel h2,
.summary-card h2 {
  margin-bottom: 14px;
  font-size: 17px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #34434c;
  font-size: 13px;
  font-weight: 700;
}

.field-row {
  gap: 12px;
}

.field-row label {
  flex: 1;
  min-width: 0;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.scenario {
  display: none;
}

.scenario.active {
  display: block;
}

.summary {
  position: sticky;
  top: 88px;
  align-self: start;
}

.summary-card {
  padding: 20px;
}

.pdf-header {
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.total-block {
  margin: 18px 0;
  padding: 18px;
  border-radius: 8px;
  background: var(--accent-soft);
}

.total-block span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.total-block strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
}

.metrics {
  gap: 10px;
  margin-bottom: 18px;
}

.metrics div {
  flex: 1;
  min-width: 0;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.line-items {
  display: grid;
  gap: 8px;
}

.line-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.line-item:last-child {
  border-bottom: 0;
}

.line-title {
  font-weight: 700;
}

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

.line-price {
  white-space: nowrap;
  font-weight: 800;
}

.disclaimer {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #ead9a5;
  border-radius: 8px;
  background: #fff8df;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.45;
}

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

  .summary {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-head,
  .field-row,
  .metrics {
    flex-direction: column;
    align-items: stretch;
  }

  .layout {
    padding: 16px;
  }

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

  .tabs {
    width: 100%;
  }

  h1 {
    font-size: 30px;
  }

  .tab {
    flex: 1;
    padding: 0 8px;
  }
}
