:root {
  --bg-deep: #152d2a;
  --bg-surface: #1d413d;
  --brand: #1b4741;
  --brand-dark: #102724;
  --accent: #d68643;
  --accent-soft: rgba(214, 134, 67, 0.18);
  --surface: var(--bg-surface);
  --surface-muted: #173632;
  --surface-alt: #24514b;
  --line: rgba(229, 239, 235, 0.15);
  --line-strong: rgba(229, 239, 235, 0.34);
  --text: #d5d5d5;
  --text-muted: rgba(242, 248, 245, 0.66);
  --danger: #ff8a7f;
  --danger-soft: rgba(255, 138, 127, 0.14);
  --ok: #8ee0aa;
  --warning: #f2bd72;
  --shadow: 0 20px 52px rgba(0, 0, 0, 0.24);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

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

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

button {
  cursor: pointer;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.tool-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: calc(var(--header-height, 68px) + 24px) 0 72px;
}

.hero-panel,
.setup-panel,
.tabs-panel,
.tool-card,
.metric-card {
  border: 1px solid rgba(27, 71, 65, 0.12);
  background: var(--bg-surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.7rem, 3.2vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.storage-panel {
  min-width: 190px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #162d2a;
}

.storage-label {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.storage-panel strong {
  margin-top: 8px;
  font-size: 1.35rem;
}

.setup-panel,
.tabs-panel {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius-lg);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading h3,
.tool-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.flat-heading {
  margin-bottom: 18px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #14312e;
  color: var(--text);
  min-height: 42px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 134, 67, 0.18);
}

.stepper {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 6px;
}

.stepper button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 900;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tab-button,
.category-button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 800;
  min-height: 40px;
  padding: 9px 15px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab-button:hover,
.category-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-button.is-active,
.category-button.is-active {
  background: var(--accent);
  color: #162d2a;
  border-color: var(--accent);
}

.tab-panel {
  padding-top: 24px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

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

.metric-card,
.tool-card {
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.metric-card {
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--text-muted);
  line-height: 1.45;
}

.highlight-card,
.result-card {
  background: linear-gradient(135deg, #24514b 0%, #14312e 100%);
  color: #fff;
}

.highlight-card .metric-label,
.highlight-card small,
.result-card .metric-label,
.result-card small {
  color: rgba(255, 255, 255, 0.76);
}

.highlight-card strong,
.result-card strong {
  color: #fff;
}

.equipment-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
}

.equipment-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.category-button {
  justify-content: flex-start;
  text-align: left;
  border-radius: var(--radius-sm);
}

.library-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 52px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: #14312e;
}

.item-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.88rem;
  font-weight: 800;
}

.item-pill.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #162d2a;
}

.empty-state {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

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

.dynamic-fields .field-wide {
  grid-column: 1 / -1;
}

.form-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.form-actions {
  margin-top: 18px;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 900;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--accent);
  color: #162d2a;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #14312e;
  color: var(--text);
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-button {
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
}

.result-list {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
}

.result-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.result-list div:last-child {
  border-bottom: 0;
}

.result-list dt {
  color: var(--text-muted);
  font-weight: 700;
}

.result-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.mini-form {
  margin-top: 18px;
  max-width: 240px;
}

.single-card {
  max-width: none;
}

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

.comparison-results {
  margin-top: 18px;
}

.comparison-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.comparison-table th,
.comparison-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
}

.comparison-table th {
  color: var(--text);
  background: var(--surface-alt);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-ok,
.result-list dd.status-ok,
.comparison-table td.status-ok {
  color: var(--ok);
}

.status-warning,
.result-list dd.status-warning,
.comparison-table td.status-warning {
  color: var(--warning);
}

.status-danger,
.result-list dd.status-danger,
.comparison-table td.status-danger {
  color: var(--danger);
}

@media (max-width: 1180px) {
  .setup-grid,
  .calculator-grid,
  .cards-grid,
  .two-col,
  .dynamic-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .equipment-sidebar {
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .tool-shell {
    width: min(100% - 28px, 1440px);
    padding-bottom: 48px;
  }

  .hero-panel,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .storage-panel {
    min-width: 0;
  }

  .setup-grid,
  .calculator-grid,
  .cards-grid,
  .two-col,
  .dynamic-fields,
  .narrow-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 14px;
  }

  .tab-button {
    white-space: nowrap;
  }

  .button-row,
  .form-actions {
    align-items: stretch;
  }

  .button-row > *,
  .form-actions > * {
    flex: 1 1 auto;
  }
}


/* Dark dashboard tuning */
.hero-panel,
.setup-panel,
.tabs-panel,
.tool-card,
.metric-card {
  background: var(--bg-surface);
  border-color: var(--line);
}

.hero-panel h2,
.section-heading h3,
.tool-card h3,
.metric-card strong,
.result-list dd,
.comparison-table th {
  color: var(--text);
}

input,
select,
textarea,
.library-list {
  background: #14312e;
  color: var(--text);
}

select option {
  background: #14312e;
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: rgba(242, 248, 245, 0.42);
}

.ghost-button,
.stepper button,
.item-pill,
.tab-button,
.category-button {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--line);
}

.primary-button,
.tab-button.is-active,
.category-button.is-active,
.item-pill.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #162d2a;
}

.primary-button:hover {
  background: #e09a5a;
}

.storage-panel {
  background: #14312e;
  border: 1px solid var(--line);
}

.comparison-table th {
  background: var(--surface-alt);
}

.comparison-table td,
.comparison-table th,
.result-list div {
  border-color: var(--line);
}
