@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,500;0,9..40,700;1,9..40,300&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #f7f4ee;
  --dark: #1a1714;
  --mid: #3d3830;
  --muted: #8a8274;
  --accent: #d4622a;
  --accent-soft: #f0ddd4;
  --rail-blue: #2c5f8a;
  --rail-blue-soft: #d6e6f4;
  --green: #2e6b4a;
  --green-soft: #d4ebe0;
  --border: #ddd8d0;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

header {
  border-bottom: 1.5px solid var(--dark);
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.header-right {
  display: flex;
  gap: 16px;
}

.header-right a {
  color: var(--dark);
  text-decoration: none;
}

a.active {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--dark);
  border-radius: 4px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.logo-mark svg {
  width: 22px;
  height: 22px;
}

header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
header p {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
}

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - 73px);
}

/* ── SIDEBAR ── */
.sidebar {
  border-right: 1.5px solid var(--border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--mid);
}
.field .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 300;
}

.units-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}
.units-toggle button {
  padding: 6px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.units-toggle button.active {
  background: var(--dark);
  color: white;
}

.bench-mode-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}
.bench-mode-toggle button {
  flex: 1;
  padding: 10px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-right: 1.5px solid var(--border);
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
  transition: all 0.15s;
}
.bench-mode-toggle button:last-child {
  border-right: none;
}
.bench-mode-toggle button.active {
  background: var(--dark);
  color: white;
}

select,
input[type='number'] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: white;
  color: var(--dark);
  appearance: none;
  transition: border-color 0.15s;
}
select:focus,
input[type='number']:focus {
  outline: none;
  border-color: var(--accent);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8274' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.cabinet-count {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cabinet-count input[type='number'] {
  width: 80px;
}

.unit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 6px;
}
.unit-row .unit-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  min-width: 32px;
  flex-shrink: 0;
}
.unit-row select {
  border: none;
  padding: 0 24px 0 0;
  font-size: 13px;
  background-color: transparent;
  flex: 1;
}
.unit-row select:focus {
  border: none;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
}
.btn-primary:hover {
  opacity: 0.85;
}

/* ── MAIN ── */
.main {
  padding: 28px 32px;
  overflow-y: auto;
}

.placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}
.placeholder svg {
  opacity: 0.25;
}
.placeholder p {
  font-size: 14px;
  font-weight: 300;
  max-width: 260px;
}

/* ── RESULTS ── */
.results {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.result-header {
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.result-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.result-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header .icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}
.card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.measurement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
}
.measurement-row .m-label {
  font-size: 13px;
  color: var(--mid);
}
.measurement-row .m-value {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--dark);
}
.measurement-row.highlight {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.measurement-row.highlight .m-value {
  color: var(--accent);
}
.measurement-row.blue {
  background: var(--rail-blue-soft);
  border-color: var(--rail-blue);
}
.measurement-row.blue .m-value {
  color: var(--rail-blue);
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--green-soft);
  border: 1.5px solid var(--green);
  border-radius: 6px;
  font-size: 12.5px;
  color: #1e4d32;
  line-height: 1.5;
}
.note svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  background: #fef3e2;
  border: 1.5px solid #e8a020;
  border-radius: 6px;
  font-size: 12.5px;
  color: #7a4a00;
  line-height: 1.5;
}

/* ── DIAGRAM ── */
.diagram-wrap {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.diagram-wrap h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--mid);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px;
}

svg.diagram {
  width: 100%;
  height: auto;
  display: block;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.step-num {
  width: 22px;
  height: 22px;
  background: var(--dark);
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--mid);
}
.step-text strong {
  color: var(--dark);
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1.5px solid var(--border);
  }
}

@media (max-width: 600px) {
  header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: start;
    gap: 16px;
  }
  .sidebar {
    padding: 20px 16px;
  }
  .main {
    padding: 20px 16px;
  }
  select,
  input[type='number'] {
    font-size: 16px;
  }
  .measurement-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .measurement-row .m-value {
    font-size: 18px;
  }
  .result-header h2 {
    font-size: 17px;
  }
  .placeholder {
    min-height: 200px;
    padding: 40px 0;
  }
}
