:root {
  --bg-base: #070707;
  --text: #f2f2f2;
  --muted: #a7a7a7;
  --green: #8ef5a8;
  --danger: #ff7b8b;
  --line-1: #2a2a2a;
  --line-2: #333333;
  --surface-1: #0f0f0f;
  --surface-2: #111111;
  --surface-3: #161616;
  --accent-1: #f0c94b;
  --accent-2: #d8b23c;
}

* {
  box-sizing: border-box;
  scrollbar-color: #2a2a2a #0d0d0d;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #0d0d0d;
}

*::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border: none;
  border-radius: 999px;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: var(--bg-base);
  padding: 0;
  overflow: hidden;
}

.ambient {
  display: none;
}

.app-frame {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--bg-base);
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid #1e1e1e;
  background: #0b0b0b;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0.25rem;
}

.brand-title,
.brand-sub {
  margin: 0;
}

.brand-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-sub {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
}

.history-panel {
  flex: 1;
  min-height: 0;
  border-radius: 0;
  background: var(--bg-base);
  border: none;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.history-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #c8c8c8;
  text-transform: uppercase;
}

.history-clear {
  border: none;
  border-radius: 8px;
  background: #1c1c1c;
  color: #e0e0e0;
  font-family: "Sora", sans-serif;
  font-size: 0.7rem;
  padding: 0.28rem 0.48rem;
  cursor: pointer;
}

.history-clear:focus,
.danger-btn:focus,
.submit-btn:focus,
.row-remove:focus,
.result-item:focus {
  outline: none;
}

.history-list {
  overflow-y: auto;
  display: grid;
  gap: 0.45rem;
  padding-right: 0.15rem;
}

.history-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.history-item {
  border-radius: 9px;
  padding: 0.45rem;
  background: #141414;
  border: none;
  display: grid;
  gap: 0.2rem;
}

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.45rem;
}

.history-when {
  color: #b3b3b3;
  font-size: 0.7rem;
}

.history-total {
  color: var(--green);
  font-family: "Manrope", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
}

.history-meta {
  color: #d0d0d0;
  font-size: 0.76rem;
}

.history-items {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.content {
  padding: 1.1rem 1.2rem;
  background: var(--bg-base);
  overflow-y: auto;
}

.tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.tab-btn {
  border: none;
  border-radius: 9px;
  padding: 0.5rem 0.75rem;
  background: #121212;
  color: #d3d3d3;
  font-family: "Sora", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.tab-btn.active {
  background: linear-gradient(145deg, var(--accent-1), var(--accent-2));
  color: #1a1a1a;
}

.tab-btn:focus {
  outline: none;
}

.view-panel {
  display: block;
}

.panel {
  background: var(--bg-base);
  border-radius: 0;
  padding: 0.9rem;
  border: none;
}

.dossier-panel {
  display: grid;
  gap: 1rem;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.7rem;
}

.panel-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.section-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.period {
  margin: 0.32rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi-main {
  min-width: 138px;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: var(--bg-base);
  border: none;
  text-align: right;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.amount {
  display: block;
  margin-top: 0.08rem;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  line-height: 1;
}

.kpi-sub {
  display: inline-block;
  margin-top: 0.2rem;
  color: #b7b7b7;
  font-size: 0.72rem;
}

.client-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.35rem;
}

label {
  display: grid;
  gap: 0.33rem;
  color: #d4d4d4;
  font-size: 0.84rem;
}

input[type="text"],
input[type="tel"],
input[type="number"] {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.58rem 0.66rem;
  background: #0d0d0d;
  color: #efefef;
  font-family: "Sora", sans-serif;
}

input:focus {
  outline: none;
}

.paste-zone {
  border-radius: 11px;
  padding: 0.82rem;
  text-align: center;
  cursor: pointer;
  background: #0d0d0d;
  border: none;
  margin-top: 0.2rem;
}

.paste-zone p {
  margin: 0;
  font-size: 0.9rem;
}

.paste-zone small {
  display: block;
  margin-top: 0.38rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.paste-zone:focus {
  outline: none;
}

kbd {
  background: #232323;
  border-radius: 5px;
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
}

.preview-wrap {
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}

.preview-wrap img {
  width: min(420px, 100%);
  height: 96px;
  object-fit: contain;
  background: #0d0d0d;
  border-radius: 10px;
  border: none;
}

.danger-btn {
  justify-self: start;
  border: none;
  border-radius: 8px;
  padding: 0.38rem 0.62rem;
  color: #ffdbe2;
  background: #2c1b1b;
  font-family: "Sora", sans-serif;
  font-size: 0.76rem;
  cursor: pointer;
}

.hidden {
  display: none;
}

.submit-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.68rem 0.82rem;
  color: #1d1d1d;
  background: linear-gradient(145deg, var(--accent-1), var(--accent-2));
  font-family: "Sora", sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.submit-btn:disabled {
  filter: saturate(0.5);
}

.status {
  margin: 0;
  min-height: 1.05rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.status.ok {
  color: var(--green);
}

.status.error {
  color: var(--danger);
}

.catalog-panel {
  margin-top: 0.82rem;
  display: grid;
  gap: 0.68rem;
}

.catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}

.catalog-head h2 {
  margin: 0;
  font-size: 1rem;
}

.catalog-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.search-block {
  position: relative;
}

.search-input {
  width: 100%;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #111111;
  border: none;
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 9;
}

.result-item {
  width: 100%;
  border: none;
  padding: 0.58rem 0.7rem;
  text-align: left;
  color: #e9e9e9;
  background: transparent;
  font-family: "Sora", sans-serif;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.result-item:hover {
  background: #1b1b1b;
}

.result-meta {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 0.07rem;
}

.result-price {
  color: var(--green);
  font-family: "Manrope", sans-serif;
  font-weight: 700;
}

.selected-items {
  display: grid;
  gap: 0.52rem;
}

.seller-section {
  display: grid;
  justify-items: start;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

.seller-field {
  width: min(420px, 100%);
}

.submit-section {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.selected-empty {
  margin: 0;
  padding: 0.68rem;
  border-radius: 10px;
  color: var(--muted);
  background: #0f0f0f;
  border: none;
}

.selected-row {
  display: grid;
  grid-template-columns: 1.6fr auto 84px auto;
  align-items: center;
  gap: 0.52rem;
  padding: 0.54rem 0.6rem;
  border-radius: 10px;
  background: #121212;
  border: none;
}

.selected-name {
  font-size: 0.86rem;
}

.selected-price {
  color: var(--green);
  font-family: "Manrope", sans-serif;
  font-weight: 700;
}

.qty-input {
  text-align: center;
}

.row-remove {
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  background: #2c1b1b;
  color: #ffdbe2;
  font-family: "Sora", sans-serif;
  font-size: 0.76rem;
  cursor: pointer;
}

.price-editor {
  display: grid;
  gap: 0.85rem;
}

.price-category {
  border: none;
  border-radius: 10px;
  background: #090909;
  padding: 0.7rem;
}

.price-category-title {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.price-items {
  display: grid;
  gap: 0.45rem;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  align-items: center;
  gap: 0.6rem;
}

.price-row-name {
  font-size: 0.86rem;
  color: #e5e5e5;
}

.price-input {
  text-align: right;
  font-weight: 600;
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid #1e1e1e;
    max-height: 38vh;
  }

  .content {
    min-height: 0;
  }

  .client-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 0.78rem;
  }

  .tabs-bar {
    flex-wrap: wrap;
  }

  .panel-top {
    display: grid;
  }

  .kpi-main {
    justify-self: start;
  }

  .selected-row {
    grid-template-columns: 1fr auto 74px;
  }

  .row-remove {
    grid-column: 1 / -1;
    justify-self: end;
  }

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