/* Design tokens */
:root {
  --bg: #efe9dd;
  --surface: #fff;
  --dark: #241f16;
  --gold: #c9a227;
  --gold-gradient: linear-gradient(150deg, #d9b64a, #a9801d);
  --border: #e7dfce;
  --border-light: #e2d9c6;
  --text-muted: #8a7f66;
  --text-secondary: #5a5241;
  --sidebar-bg: #241f16;
  --sidebar-text: #b8af99;
  --sidebar-active: #3a3324;
  --page-pad-y: 26px;
  --page-pad-x: 30px;
  --header-h: 41px;
}

/* Reset (moved from base inline) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
::selection { background: #e9d9a8; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; outline: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8cfbc; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }

@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tup { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes mfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mpop { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* App shell */
.app-root {
  min-height: 100vh;
  background: var(--bg);
  font-family: Onest, system-ui, sans-serif;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-root {
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-header {
    flex-shrink: 0;
  }

  .app-shell {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .app-main {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

body.sidebar-open {
  overflow: hidden;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  background: var(--sidebar-bg);
  color: var(--bg);
  border-bottom: 1px solid #000;
}

@media (min-width: 768px) {
  .app-header { gap: 16px; padding: 9px 22px; }
}

.header-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px 0 -6px -6px;
  border-radius: 10px;
  font-size: 20px;
  color: var(--bg);
  flex-shrink: 0;
}

.header-menu-btn:hover {
  background: #3a3324;
}

@media (min-width: 1024px) {
  .header-menu-btn { display: none; }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: #4a4335;
  flex-shrink: 0;
}

.header-lang {
  display: flex;
  gap: 4px;
  background: #161208;
  padding: 4px;
  border-radius: 11px;
  flex-shrink: 0;
}

.header-lang-btn {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

@media (max-width: 639px) {
  .header-lang-btn { padding: 7px 10px; font-size: 12px; }
}

.header-lang-btn--active {
  background: var(--gold);
  color: var(--dark);
}

.header-lang-btn--inactive {
  color: #b8af99;
}

.header-market {
  margin-left: auto;
  font-size: 11px;
  color: #9a917d;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-market-address {
  display: none;
}

@media (min-width: 768px) {
  .header-market-address { display: inline; }
}

/* Sidebar drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, .45);
}

.sidebar-backdrop--visible {
  display: block;
}

@media (min-width: 1024px) {
  .sidebar-backdrop { display: none !important; }
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #cfc7b4;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

@media (min-width: 1024px) {
  .sidebar {
    align-self: stretch;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
  }

  .sidebar--open {
    transform: translateX(0);
  }
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  width: 100%;
  min-height: 44px;
}

.sidebar-nav-preview-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-nav-link--preview {
  color: #7a7260;
  background: transparent;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.sidebar-cta-preview {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(217, 182, 74, .22), rgba(169, 128, 29, .18));
  border: 1px solid rgba(169, 128, 29, .22);
  color: #8f866f;
  font-weight: 600;
  font-size: 13.5px;
  width: 100%;
  min-height: 44px;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.sidebar-cta-preview__icon {
  font-size: 16px;
  line-height: 1;
  opacity: .75;
}

/* Page layout */
.page {
  padding: var(--page-pad-y) var(--page-pad-x) 40px;
}

@media (max-width: 639px) {
  .page { padding: 16px 16px 32px; }
  :root { --page-pad-x: 16px; --page-pad-y: 16px; }
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header--start {
  align-items: flex-start;
}

.page-title {
  font-family: Lora, serif;
  font-size: 26px;
  font-weight: 600;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-search {
  position: relative;
  min-width: 0;
  width: 100%;
  max-width: 360px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .page-search { min-width: 280px; }
}

.page-search--wide {
  max-width: 400px;
}

@media (max-width: 639px) {
  .page-header .page-search,
  .page-header .page-search--wide {
    max-width: none;
    width: 100%;
    margin-left: 0 !important;
  }
}

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

.chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 18px;
  align-items: start;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  align-items: start;
}

.grid-master-detail {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}

.grid-profile {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}

.grid-stats-3 {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.grid-stats-3 > * {
  flex: 1;
}

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

.grid-sklad-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  align-items: start;
}

.grid-cell-map {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
}

.grid-form-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-form-3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 1023px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-kanban { grid-template-columns: 1fr; }
  .grid-master-detail { grid-template-columns: 1fr; }
  .grid-sklad-layout { grid-template-columns: 1fr; }
  .grid-cell-map { grid-template-columns: repeat(7, 1fr); }
  .grid-stats-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-kpi { grid-template-columns: 1fr; }
  .grid-profile { grid-template-columns: 1fr; }
  .grid-stats-3 { flex-direction: column; }
  .grid-stats-4 { grid-template-columns: 1fr; }
  .grid-cell-map { grid-template-columns: repeat(5, 1fr); }
  .grid-form-2,
  .grid-form-3 { grid-template-columns: 1fr; }
}

/* Sticky panels — disable on mobile */
.sticky-panel {
  position: sticky;
  top: 14px;
  align-self: start;
}

@media (max-width: 1023px) {
  .sticky-panel {
    position: static;
    max-height: none !important;
    overflow-y: visible !important;
  }
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 11px;
  background: var(--gold-gradient);
  color: var(--dark);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 4px 14px rgba(169, 128, 29, .28);
  min-height: 44px;
  text-decoration: none;
}

.btn-primary--full {
  width: 100%;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  min-height: 44px;
}

@media (max-width: 639px) {
  .page-header .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* Data tables — hybrid card/table */
.data-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(36, 31, 22, .04);
}

.data-table__head {
  display: grid;
  gap: 14px;
  padding: 11px 20px;
  background: #faf6ec;
  border-bottom: 1px solid #eee3d0;
  font-size: 11px;
  font-weight: 600;
  color: #9a9078;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.data-table__row {
  display: grid;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid #f2ecdd;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  width: 100%;
  text-align: left;
}

.data-table__row[type="button"] {
  text-align: left;
  cursor: pointer;
}

  border-bottom: none;
}

.data-table__row:hover {
  background: #faf6ec;
}

.data-table--orders .data-table__head,
.data-table--orders .data-table__row {
  grid-template-columns: 88px 1.4fr 1.4fr 1.5fr 90px 158px;
}

.data-table--clients .data-table__head,
.data-table--clients .data-table__row {
  grid-template-columns: 1.6fr 1.2fr 110px 120px 120px;
}

.data-table--catalog .data-table__head,
.data-table--catalog .data-table__row {
  grid-template-columns: 1.8fr 1fr 100px 90px 90px;
}

.data-table--completed .data-table__head,
.data-table--completed .data-table__row {
  grid-template-columns: 80px 1.2fr 1.3fr 1.3fr 120px 80px 130px;
}

.data-table--works .data-table__head,
.data-table--works .data-table__row {
  grid-template-columns: 80px 1.2fr 1.4fr 1.4fr 100px 130px;
}

.data-table__cell-label {
  display: none;
  font-size: 10px;
  font-weight: 600;
  color: #9a9078;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 2px;
}

@media (max-width: 639px) {
  .data-table__head {
    display: none;
  }

  .data-table__row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 16px;
  }

  .data-table__cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .data-table__cell-label {
    display: block;
  }

  .data-table__cell--hide-mobile {
    display: none;
  }
}

/* Workflow cards */
.workflow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 1px 2px rgba(36, 31, 22, .04);
  flex-wrap: wrap;
}

.workflow-card__actions {
  display: flex;
  gap: 9px;
}

@media (max-width: 639px) {
  .workflow-card {
    flex-direction: column;
    align-items: stretch;
  }

  .workflow-card__actions {
    flex-direction: column;
    width: 100%;
  }

  .workflow-card__actions form,
  .workflow-card__actions button {
    width: 100%;
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(36, 31, 22, .45);
  overflow: hidden;
  animation: mfade .2s ease;
}

@media (max-width: 639px) {
  .modal-overlay { padding: 12px; align-items: flex-start; }
}

.modal-panel {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(36, 31, 22, .18);
  animation: mpop .25s ease;
}

.modal-panel--sm { max-width: 420px; padding: 24px; }
.modal-panel--md { max-width: 560px; padding: 24px; }
.modal-panel--lg { max-width: 960px; padding: 0; }

.modal-panel--split {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.modal-panel--split .modal-panel__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-panel--split .modal-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.modal-open {
  overflow: hidden;
}

@media (min-width: 1024px) {
  body.modal-open .app-main {
    overflow: hidden;
  }
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  justify-content: flex-end;
}

.catalog-chips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.draft-item-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-footer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #efe9dd;
  border-top: 1px solid #e2d9c6;
}

.modal-footer-bar__actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

@media (max-width: 639px) {
  .modal-panel--sm,
  .modal-panel--md { padding: 20px 16px; }

  .catalog-chips-grid,
  .draft-item-grid { grid-template-columns: 1fr; }

  .modal-actions,
  .modal-footer-bar,
  .modal-footer-bar__actions {
    flex-direction: column;
    width: 100%;
  }

  .modal-footer-bar__actions {
    margin-left: 0;
  }

  .modal-actions button,
  .modal-footer-bar__actions button {
    width: 100%;
    min-height: 44px;
  }

  .order-create-cells-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .order-create-cells-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

/* Auth */
.auth-root {
  min-height: 100vh;
  background: var(--bg);
  font-family: Onest, system-ui, sans-serif;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(36, 31, 22, .08);
}

.auth-title {
  font-family: Lora, serif;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
}

.form-field {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 16px;
  color: var(--dark);
  background: var(--surface);
  min-height: 44px;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .15);
}

.form-error {
  font-size: 12px;
  color: #b3402e;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-success { background: #e6f4ec; color: #2f7d54; }
.alert-error { background: #fbe9e6; color: #b3402e; }
.alert-warning { background: #fbf3da; color: #8a6d1a; }
.alert-info { background: #f0f0f0; color: var(--text-secondary); }

/* Order create modal grid */
.order-create-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 639px) {
  .order-create-grid > * {
    grid-column: 1 / -1 !important;
  }
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.max-w-centered {
  max-width: 960px;
  margin: 0 auto;
}

.max-w-narrow {
  max-width: 560px;
  margin: 0 auto;
}

.grid-stats-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

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

.staff-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e7dfce;
  border-radius: 16px;
  padding: 16px 20px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(36, 31, 22, .04);
  flex-wrap: wrap;
}

.staff-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 1023px) {
  .grid-stats-3col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
  .grid-stats-3col { grid-template-columns: 1fr; }
  .grid-form-profile { grid-template-columns: 1fr; }

  .staff-row {
    flex-direction: column;
    align-items: stretch;
  }

  .staff-row__actions {
    flex-direction: column;
    width: 100%;
    justify-content: stretch;
  }

  .staff-row__actions button,
  .staff-row__actions a {
    width: 100%;
    text-align: center;
    min-height: 44px;
  }
}

.market-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #faf6ec;
}

.market-user-row__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 639px) {
  .market-user-row {
    flex-direction: column;
    align-items: stretch;
  }

  .market-user-row__actions {
    flex-direction: column;
    width: 100%;
  }

  .market-user-row__actions button {
    width: 100%;
    min-height: 44px;
  }
}

/* Market settings tabs */
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.settings-back:hover {
  color: var(--text-secondary);
  background: #faf6ec;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-tab {
  flex-shrink: 0;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease;
}

.settings-tab:hover {
  color: var(--text-secondary);
}

.settings-tab--active {
  color: var(--dark);
  border-bottom-color: var(--gold);
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
}

.settings-card + .settings-card {
  margin-top: 18px;
}

.grid-2 .settings-card + .settings-card {
  margin-top: 0;
}

.settings-card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.settings-card__desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  max-width: 640px;
}

.settings-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.settings-market-name {
  font-family: Lora, serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.settings-market-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.settings-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.settings-help-btn:hover {
  background: #faf6ec;
  color: var(--text-secondary);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.setup-step__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.setup-step__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dark);
  color: #e6dcc4;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.setup-step__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.setup-step__text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.setup-step__num--active {
  background: linear-gradient(150deg, #d9b64a, #a9801d);
  color: var(--dark);
}

.setup-step__num--muted {
  background: #e7dfce;
  color: #8a7f66;
}

/* Onboarding (new market) */
.onboarding-hero {
  margin-bottom: 22px;
}

.onboarding-hero__subtitle {
  max-width: 640px;
  line-height: 1.55;
  margin-top: 8px;
}

.onboarding-main {
  margin-bottom: 18px;
}

.market-create-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-error-banner {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdecea;
  color: #9b2c2c;
  font-size: 13px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 5px;
}

.form-input--textarea {
  resize: vertical;
  min-height: 96px;
}

.onboarding-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.onboarding-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}

.onboarding-feature-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.onboarding-feature-card__icon--orders {
  background: #f0e8d4;
  color: #8a6d1a;
}

.onboarding-feature-card__icon--clients {
  background: #e8f0e4;
  color: #4a6b42;
}

.onboarding-feature-card__icon--catalog {
  background: #ebe4f4;
  color: #5c4a7a;
}

.onboarding-feature-card__icon--sklad {
  background: #e4edf4;
  color: #3d5a73;
}

.onboarding-feature-card__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

.onboarding-feature-card__text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.onboarding-after {
  margin-bottom: 18px;
}

.onboarding-checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-checklist li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.onboarding-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 1px;
  color: #8a6d1a;
  font-weight: 700;
  font-size: 12px;
}

.onboarding-faq__list {
  margin: 0;
}

.onboarding-faq__item + .onboarding-faq__item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.onboarding-faq__item dt {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 5px;
}

.onboarding-faq__item dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

@media (max-width: 768px) {
  .onboarding-feature-grid {
    grid-template-columns: 1fr;
  }
}

.setup-os-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.setup-info-box {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f6ecd3;
  border: 1px solid #e8d9a8;
  font-size: 12.5px;
  color: #7a5f16;
  line-height: 1.55;
}

.setup-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #faf6ec;
  border: 1px solid var(--border-light);
}

.setup-copy-row__value {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  word-break: break-all;
}

.setup-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.setup-copy-btn:hover {
  background: #fff;
  color: var(--text-secondary);
}

.modal-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.modal-panel__close:hover {
  background: #faf6ec;
  color: var(--text-secondary);
}

/* Printer table */
.printer-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: visible;
}

.printer-table__grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr 64px;
  gap: 14px;
  align-items: center;
}

.printer-key-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  max-width: 100%;
  min-width: 0;
}

.printer-key-row__label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #a39a83;
}

.printer-key-row__value {
  min-width: 0;
  font-size: 12px;
  color: #7a715d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.printer-key-row__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.printer-key-row__copy:hover {
  background: #faf6ec;
  color: #8a6d1a;
}

.printer-key-row__copy--copied {
  color: #3aa06b;
  border-color: #b8dfc8;
  background: #eef8f1;
}

.row-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.row-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 16px;
}

.row-menu__trigger:hover,
.row-menu--open .row-menu__trigger {
  background: #faf6ec;
  color: var(--text-secondary);
}

.row-menu__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  padding: 6px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(36, 31, 22, .14);
}

.row-menu--open .row-menu__panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.printer-table > .printer-table__grid:last-of-type .row-menu__panel {
  top: auto;
  bottom: calc(100% + 6px);
}

.row-menu__action {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #8a6d1a;
}

.row-menu__action:hover {
  background: #faf6ec;
}

.row-menu__action--danger {
  color: #b3402e;
}

@media (max-width: 767px) {
  .printer-table__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .row-menu__panel {
    right: auto;
    left: 0;
  }
}

.jewel-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 11px;
  background: #241f16;
  color: #f4efe3;
  padding: 13px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(36, 31, 22, .35);
  animation: tup .28s ease;
  font-size: 13.5px;
  font-weight: 500;
  max-width: min(92vw, 520px);
}

.jewel-toast__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3aa06b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.jewel-toast--error .jewel-toast__icon {
  background: #b3402e;
}
