:root {
  color-scheme: light;
  --bg: #090909;
  --panel: #151515;
  --panel-2: #1e1e1e;
  --card: #ffffff;
  --ink: #f7f7f7;
  --ink-dark: #1e1e1e;
  --muted: #a9a9a9;
  --muted-dark: #66605a;
  --line: #303030;
  --line-light: #ded8cf;
  --orange: #f05a24;
  --orange-dark: #bf3f13;
  --soft: #21140f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(240, 90, 36, 0.18), transparent 34rem),
    linear-gradient(180deg, #050505 0%, var(--bg) 42%, #111 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 16px;
  max-width: 1480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.86);
  padding: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-lockup img {
  width: 144px;
  height: 76px;
  border-radius: 6px;
  object-fit: cover;
  object-position: center;
  background: #000;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
  color: #fff;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  color: var(--ink);
}

.import-button,
.primary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.import-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  background: var(--orange);
  color: #fff;
  overflow: hidden;
}

.import-button:hover,
.primary-button:hover {
  background: var(--orange-dark);
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.status-strip {
  margin: 0 auto 16px;
  max-width: 1480px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 10px 14px;
  color: #f0d4c7;
  font-size: 14px;
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin: 0 auto 16px;
  max-width: 1480px;
}

.tab-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111;
  color: #d8d8d8;
  cursor: pointer;
  padding: 8px 14px;
  font-weight: 800;
}

.tab-button.active {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
}

.app-view {
  display: none;
}

.app-view.active {
  display: grid;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 380px;
  gap: 16px;
  margin: 0 auto;
  max-width: 1480px;
}

.price-book {
  gap: 16px;
  margin: 0 auto;
  max-width: 1480px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 16px;
}

.app-view:not(.active) {
  display: none;
}

.price-book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.primary-button.narrow {
  width: auto;
  padding: 0 16px;
}

.price-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 160px 140px;
  gap: 12px;
}

.price-controls .field {
  margin-bottom: 0;
}

.price-count {
  color: #d7d7d7;
  font-size: 13px;
  font-weight: 800;
}

.price-table-wrap {
  max-height: calc(100vh - 300px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
  background: #111;
  color: #e9e9e9;
}

.price-table th,
.price-table td {
  border-bottom: 1px solid #2a2a2a;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.price-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1d1d1d;
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.price-table tbody tr:hover {
  background: #181818;
}

.price-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty-price-row {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

.controls-panel,
.catalog-panel,
.order-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.controls-panel,
.order-panel {
  padding: 16px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: #d8d8d8;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="number"],
input[type="search"],
input[type="text"],
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0f0f0f;
  color: var(--ink);
  padding: 8px 10px;
}

.visual-heading {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.visual-catalog {
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding: 14px;
}

.visual-section {
  display: grid;
  gap: 10px;
}

.visual-section h3 {
  margin: 0;
  border-left: 4px solid var(--orange);
  padding-left: 10px;
  font-size: 18px;
  color: #fff;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.module-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--card);
  color: var(--ink-dark);
}

.module-card h4 {
  margin-bottom: 0;
  font-size: 16px;
}

.module-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border: 1px solid #e8e0d1;
  border-radius: 5px;
  background: #fff;
}

.module-image img {
  max-width: 100%;
  max-height: 132px;
  object-fit: contain;
}

.module-meta {
  color: var(--muted-dark);
  font-size: 13px;
  line-height: 1.5;
}

.module-actions {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 8px;
}

.module-actions select {
  min-width: 0;
}

.module-add-row {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 8px;
}

.qty-input {
  min-height: 38px;
}

.add-button {
  border: 1px solid var(--orange);
  border-radius: 5px;
  background: #fff;
  color: var(--orange-dark);
  cursor: pointer;
  font-weight: 800;
  min-height: 38px;
}

.add-button:hover {
  background: #fff0e8;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.icon-button {
  min-height: 36px;
  border-color: var(--line);
  background: #0f0f0f;
  color: var(--muted);
  padding: 6px 10px;
}

.order-lines {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 400px);
  min-height: 180px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.empty-state {
  align-self: center;
  color: var(--muted);
  text-align: center;
}

.order-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #101010;
}

.order-line strong {
  display: block;
  font-size: 14px;
}

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

.line-controls {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.line-controls input {
  width: 64px;
  min-height: 34px;
}

.remove-line {
  border: 0;
  background: transparent;
  color: var(--orange);
  cursor: pointer;
  font-weight: 800;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.totals strong {
  color: var(--ink);
}

.grand-total {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 20px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  background: var(--orange);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 18px;
}

.modal-backdrop[hidden] {
  display: none;
}

.email-modal {
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.email-modal-header,
.email-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.email-modal-header {
  margin-bottom: 14px;
}

.email-actions {
  align-items: stretch;
}

.email-intro {
  display: grid;
  gap: 6px;
  margin: 4px 0 14px;
  color: #ececec;
}

.email-intro p {
  margin: 0;
}

.email-products-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
}

.email-products {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  color: #f2f2f2;
}

.email-products th,
.email-products td {
  border-bottom: 1px solid #2c2c2c;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.email-products th {
  background: #1d1d1d;
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.email-products td {
  font-size: 13px;
}

.email-products td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.email-summary {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
}

.email-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.email-summary strong {
  color: var(--ink);
}

.email-grand-total {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 18px;
  font-weight: 800;
}

.email-actions .primary-button,
.secondary-button {
  flex: 1;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--orange);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.secondary-button:hover {
  background: #1d130f;
}

.copy-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: #f0d4c7;
  font-size: 14px;
  font-weight: 700;
}

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

  .price-book-header,
  .price-controls {
    grid-template-columns: 1fr;
  }

  .price-book-header {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button.narrow {
    width: 100%;
  }

  .visual-catalog,
  .order-lines {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .brand-lockup,
  .visual-heading,
  .email-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .brand-lockup img {
    width: 132px;
  }
}
