:root {
  --topbar-h: 64px;
  --menubar-h: 44px;
  --sidebar-gap: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --sidebar-offset: calc(var(--topbar-h) + var(--menubar-h) + var(--sidebar-gap));
  --page-offset-with-filters: 132px;
  --page-offset-no-filters: 56px;

  --bg-main: #000000;
  --bg-elevated: #1c1c1e;
  --bg-panel: #2c2c2e;
  --bg-sector: #3a3a3c;

  --text-main: rgba(245, 245, 247, 0.95);
  --text-muted: rgba(161, 161, 170, 0.85);
  --border-soft: rgba(255, 255, 255, 0.08);
  --accent: #0a84ff;
}

* {
  box-sizing: border-box;
}

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

body.app-body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: #1c1c1e;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* layout */

.layout {
  flex: 1;
  display: flex;
  min-height: 100vh;
  padding-top: calc(var(--topbar-h) + var(--safe-top) + var(--page-offset-with-filters));
  background: #1c1c1e;
}

body.filters-hidden .layout {
  padding-top: calc(var(--topbar-h) + var(--safe-top) + var(--page-offset-no-filters));
}

/* workspace */

.workspace {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
  min-height: 0;
}

.cashback-workspace {
  min-height: 1px;
}

/* controls / filters */

.controls {
  margin: 0;
  padding: 10px 12px 12px;
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.controls-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.controls-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.controls-field {
  width: 150px;
  max-width: 150px;
  min-width: 150px;
  flex: 0 0 150px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: flex-start;
  min-width: 0;
}

.field-input {
  width: 100%;
}

.field-input {
  padding: 6px 10px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.055);
  color: rgba(245,245,247,0.95);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out;
}

/* responsive */

@media (max-width: 900px) {
  .controls {
    flex-direction: column;
    padding: 10px 12px 12px;
  }

  .controls-col {
    width: 100%;
  }

  .controls-field {
    width: 136px;
    max-width: 136px;
    min-width: 136px;
    flex: 0 0 136px;
  }

  .filters-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .filters-row::-webkit-scrollbar {
    display: none;
  }

  .filters-actions-row {
    padding-top: 0;
  }
}

body:not(.products-reorder-mode):not(.products-glue-mode) .layout,
body:not(.products-reorder-mode):not(.products-glue-mode) .workspace {
  overflow-y: visible !important;
}
