#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Header ── */
.header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 50px; flex-shrink: 0;
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  box-shadow: var(--shadow);
  position: relative; z-index: 200;
}
.header-logo  { display: flex; align-items: center; flex-shrink: 0; }
.header-logo-img { height: 36px; width: auto; display: block; }
.header-search { flex: 0 1 300px; min-width: 140px; }
.header-search input { height: 32px; }

/* Price type buttons */
.price-type-bar { display: flex; gap: 3px; flex-shrink: 0; }
.pt-btn         { padding: 4px 9px; font-size: 12px; font-weight: 600; border-radius: 4px; }
.pt-btn.active  { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); }

/* Client search */
.client-search-wrap { position: relative; flex: 0 1 200px; min-width: 120px; }
.client-search-wrap input { height: 32px; padding-right: 28px; }
.client-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: none; padding: 0; font-size: 13px;
  color: var(--clr-muted); cursor: pointer; line-height: 1;
}
.client-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 200px; overflow-y: auto; z-index: 300; font-size: 13px;
}
.client-suggest-item { padding: 6px 10px; cursor: pointer; }
.client-suggest-item:hover { background: var(--clr-bg); }

.header-right    { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-user-name { font-size: 13px; color: var(--clr-muted); white-space: nowrap; }
.btn-cart         { font-weight: 600; }
.cart-badge {
  display: inline-block; background: var(--clr-primary); color: #fff;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  padding: 0 6px; margin-left: 4px; min-width: 18px; text-align: center;
}

/* ── Top navigation ── */
.top-nav {
  display: flex; align-items: stretch; height: 42px; flex-shrink: 0;
  background: var(--clr-surface); border-bottom: 1px solid var(--clr-border);
  overflow: hidden; position: relative; z-index: 100;
}
.top-nav-list { display: flex; align-items: stretch; overflow: hidden; flex: 1; }

.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px; font-size: 13px; font-weight: 500;
  color: var(--clr-text); text-decoration: none; white-space: nowrap;
  flex-shrink: 0; border-bottom: 2px solid transparent;
  transition: color .15s, background .1s, border-color .15s;
}
.nav-tab:hover { background: var(--clr-bg); text-decoration: none; }
.nav-tab-active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); font-weight: 600; }
.nav-tab-draft  { color: var(--clr-muted); }
.nav-tab-draft:hover { color: var(--clr-text); }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { }

.nav-more-btn {
  padding: 0 12px; border: none; background: none;
  font-size: 18px; color: var(--clr-muted); cursor: pointer; flex-shrink: 0;
}
.nav-more-btn:hover { background: var(--clr-bg); color: var(--clr-text); }

.nav-overflow-menu {
  position: fixed; background: var(--clr-surface);
  border: 1px solid var(--clr-border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 500; min-width: 200px;
}
.nav-overflow-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--clr-text); text-decoration: none; font-size: 13px;
}
.nav-overflow-item:hover { background: var(--clr-bg); text-decoration: none; }
.nav-overflow-item.nav-overflow-draft { color: var(--clr-muted); }
.nav-overflow-item.nav-overflow-active { color: var(--clr-primary); font-weight: 600; }
.nav-overflow-item .nav-icon { color: inherit; }

/* goods-only header controls: hidden outside goods section */
body:not(.sect-goods) .goods-only { display: none !important; }

/* Narrow: hide text labels, keep icons */
@media (max-width: 860px) { .nav-label { display: none; } .nav-tab { padding: 0 10px; } }

/* ── Section panes ── */
.section-pane { display: none; flex: 1; min-height: 0; overflow: hidden; }
.section-pane.section-active { display: flex; }
#section-goods.section-active { flex-direction: row; }

/* Stub sections center their content */
.section-pane.section-stub.section-active {
  justify-content: center; align-items: center; background: var(--clr-bg);
}

/* ── Main layout (inside #section-goods) ── */

.sidebar {
  width: 210px; min-width: 160px; flex-shrink: 0;
  background: var(--clr-surface); border-right: 1px solid var(--clr-border);
  overflow-y: auto; padding: 10px 6px;
}

.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Filter bar ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-bottom: 1px solid var(--clr-border);
  background: var(--clr-surface); flex-shrink: 0;
}
.filter-select { height: 30px; font-size: 13px; width: auto; padding: 0 8px; }
.filter-chip-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap;
}
.filter-chip-group { display: flex; gap: 3px; }
.filter-chip {
  padding: 3px 10px; font-size: 12px; border-radius: 14px;
  border: 1px solid var(--clr-border); background: var(--clr-surface);
  cursor: pointer; white-space: nowrap;
}
.filter-chip:hover  { background: var(--clr-bg); }
.filter-chip.active { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); }
.result-count { margin-left: auto; font-size: 12px; color: var(--clr-muted); white-space: nowrap; }

/* ── Three-zone container ── */
.zones-container {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; overflow: hidden;
}

.zone {
  overflow-y: auto; flex-shrink: 0;
  min-height: 60px;
}

.zone-header {
  padding: 4px 12px; font-size: 12px; font-weight: 700;
  background: var(--clr-bg); border-bottom: 1px solid var(--clr-border);
  color: var(--clr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0;
}

.zone-body { height: 100%; overflow-y: auto; }
#zone2 { display: flex; flex-direction: column; }
#zone2 .zone-body { flex: 1; min-height: 0; overflow-y: auto; }

.zone-splitter {
  height: 5px; flex-shrink: 0;
  background: var(--clr-border); cursor: row-resize;
  transition: background .1s;
}
.zone-splitter:hover, .zone-splitter.dragging { background: var(--clr-primary); }

/* ── Group tree ── */
.group-tree { margin-top: 4px; }
.group-tree .group-node {
  display: flex; align-items: center; gap: 2px;
  padding: 3px 4px; border-radius: 4px; user-select: none;
  font-size: 13px; cursor: pointer;
}
.group-tree .group-node:hover  { background: var(--clr-bg); }
.group-tree .group-node.active { background: #e8f0fe; color: var(--clr-primary); font-weight: 600; }
.group-tree .group-arrow       { width: 14px; flex-shrink: 0; text-align: center; font-size: 10px; color: var(--clr-muted); }
.group-tree .group-arrow:hover { color: var(--clr-text); }
.group-tree .group-arrow-empty { width: 14px; flex-shrink: 0; }
.group-tree .group-label       { flex: 1; }
.group-tree .group-children    { padding-left: 14px; }

/* ── Cart popup ── */
.cart-popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.2); z-index: 400;
}
.cart-popup {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(520px, 98vw);
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
  z-index: 500; padding: 16px 20px 20px;
}

/* ── Cart drawer ── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 400;
}
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px;
  background: var(--clr-surface); border-left: 1px solid var(--clr-border);
  box-shadow: -4px 0 16px rgba(0,0,0,.12);
  z-index: 500; overflow-y: auto; padding: 12px 14px;
}

/* ── Login screen ── */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--clr-bg);
}
.login-form {
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px 28px; width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-form h2 { text-align: center; font-size: 20px; }
.login-form button[type="submit"] { width: 100%; padding: 8px; }
