:root {
  --bg: #fff8fb;
  --surface: #ffffff;
  --surface-soft: #fff1f6;
  --rose: #f7bfd1;
  --rose-strong: #df6e98;
  --gold: #b9913b;
  --gold-soft: #fff4d8;
  --ink: #2f2530;
  --muted: #756a73;
  --line: #f0d9e2;
  --shadow: 0 18px 44px rgba(91, 46, 68, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #fff 0%, #fff3f7 100%);
  border-right: 1px solid var(--line);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--rose-strong), var(--gold));
  border-radius: 8px;
  color: #fff;
  display: flex;
  font-size: 24px;
  font-weight: 800;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.panel p,
.sidebar-card small,
.stat-card span,
.mini-summary span,
.price-summary span {
  color: var(--muted);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  display: flex;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  text-align: left;
}

.nav-tab:hover,
.nav-tab.active {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(91, 46, 68, 0.08);
}

.icon {
  align-items: center;
  background: var(--surface-soft);
  border-radius: 8px;
  color: var(--rose-strong);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.sidebar-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  bottom: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  left: 24px;
  padding: 16px;
  position: absolute;
  right: 24px;
}

.sidebar-card strong {
  color: var(--gold);
  font-size: 24px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  margin-bottom: 0;
}

h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

h3 {
  font-size: 16px;
  margin-bottom: 0;
}

.global-search,
.filters-row,
.panel-head,
.form-actions,
.section-line {
  align-items: center;
  display: flex;
  gap: 12px;
}

.global-search {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(91, 46, 68, 0.06);
  max-width: 420px;
  padding: 0 14px;
  width: 100%;
}

.global-search input,
.filters-row input,
.filters-row select,
.panel-head input,
label input,
label select,
label textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 46px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

.global-search input {
  border: 0;
  padding-left: 0;
}

textarea {
  padding-top: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose-strong);
  box-shadow: 0 0 0 3px rgba(223, 110, 152, 0.13);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 18px;
}

.stat-card strong {
  color: var(--rose-strong);
  font-size: 32px;
}

.panel {
  padding: 20px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head p {
  margin-bottom: 0;
}

.dashboard-layout,
.two-column,
.labor-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.pricing-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.accent-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fff5df 100%);
}

.mini-summary,
.price-summary {
  display: grid;
  gap: 12px;
}

.mini-summary div,
.price-summary div,
.live-result {
  align-items: center;
  background: #fffafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 12px;
}

.price-summary .suggested {
  background: var(--gold-soft);
  border-color: #ead28a;
}

.price-summary .suggested strong {
  color: var(--gold);
  font-size: 24px;
}

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

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

label {
  color: var(--ink);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 800;
  min-height: 44px;
  padding: 0 16px;
}

.primary-button {
  background: var(--rose-strong);
  color: #fff;
}

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

.secondary-button,
.ghost-button,
.icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button:hover,
.secondary-button:hover,
.icon-button:hover {
  background: var(--surface-soft);
}

.filters-row {
  margin-bottom: 14px;
}

.supply-list,
.product-list,
.materials-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.item-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 14px;
}

.item-top {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.item-top h3 {
  margin-bottom: 4px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  background: var(--surface-soft);
  border-radius: 999px;
  color: var(--rose-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  min-width: 42px;
  padding: 0 12px;
}

.section-line {
  justify-content: space-between;
  margin-top: 4px;
}

.material-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(160px, 1fr) 120px 120px 44px;
}

.material-cost {
  background: #fffafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 46px;
  padding: 12px;
}

.summary-panel {
  position: sticky;
  top: 24px;
}

.history-panel {
  margin-top: 18px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0 0;
}

.toast {
  background: var(--ink);
  border-radius: var(--radius);
  bottom: 18px;
  color: #fff;
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 16px);
  transition: 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    height: auto;
    padding: 14px;
    position: sticky;
    z-index: 10;
  }

  .brand,
  .sidebar-card {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-tab {
    justify-content: center;
  }

  .dashboard-layout,
  .two-column,
  .labor-layout,
  .pricing-layout {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .workspace {
    min-height: 100dvh;
    padding: 16px 16px 78px;
  }

  .sidebar {
    bottom: 0;
    height: auto;
    left: 0;
    padding: 8px 10px;
    position: fixed;
    right: 0;
    top: auto;
    z-index: 30;
    border-right: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 28px rgba(91, 46, 68, 0.12);
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  .nav-tab {
    flex-direction: column;
    gap: 2px;
    min-height: 54px;
    min-width: 0;
    padding: 4px;
  }

  .nav-tab span:last-child {
    display: block;
    font-size: 10px;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar,
  .panel-head,
  .filters-row,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .nav-tabs {
    gap: 6px;
    overflow: visible;
  }

  .nav-tab {
    min-width: 0;
    padding: 4px;
  }

  .nav-tab span:last-child {
    display: block;
  }

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