:root {
  --brand-yellow: #f9dc3b;
  --brand-yellow-soft: #fff5b8;
  --brand-black: #15120d;
  --brand-ink: #27241f;
  --brand-muted: #726d63;
  --brand-line: #dedede;
  --brand-canvas: #f4f5f7;
  --brand-surface: #ffffff;
  --brand-danger: #e05a47;
  --brand-success: #5e9d38;
  --brand-sidebar: 64px;
  --brand-sidebar-open: 232px;
  --brand-topbar: 64px;
}

.dish-analytics-controls {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(180px, 1.35fr) minmax(130px, .8fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.dish-analytics-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted, #776d5d);
  font-size: 12px;
  font-weight: 700;
}

.dish-analytics-controls input,
.dish-analytics-controls select {
  min-height: 40px;
  border: 1px solid #ded8ca;
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
  color: #17130d;
}

.dish-analytics-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dish-analytics-summary > div {
  min-width: 0;
  border: 1px solid #e6e0d2;
  border-top: 3px solid #f4cf19;
  border-radius: 8px;
  background: #fffdfa;
  padding: 11px 12px;
}

.dish-analytics-summary span,
.dish-analytics-summary strong {
  display: block;
}

.dish-analytics-summary span {
  color: #776d5d;
  font-size: 11px;
}

.dish-analytics-summary strong {
  margin-top: 4px;
  font-size: 18px;
}

.dish-analytics-recommendations,
.dish-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dish-analytics-recommendations section,
.dish-matrix section {
  border: 1px solid #e4ded1;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.dish-analytics-recommendations h4,
.dish-matrix h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.dish-recommendation-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-top: 1px solid #eee9df;
  font-size: 12px;
}

.dish-recommendation-list > div:first-child {
  border-top: 0;
}

.dish-recommendation-list span {
  color: #776d5d;
  text-align: right;
}

.dish-matrix {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dish-matrix h4 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dish-matrix h4 span {
  border-radius: 999px;
  background: #f7dd45;
  padding: 2px 7px;
  font-size: 11px;
}

.dish-matrix p {
  margin: 0;
  color: #776d5d;
  font-size: 12px;
  line-height: 1.45;
}

.dish-analytics-table-wrap {
  max-height: 520px;
}

.dish-analytics-table-wrap td:first-child {
  min-width: 230px;
}

.dish-analytics-table-wrap details {
  margin-top: 5px;
  color: #776d5d;
}

.dish-analytics-table-wrap details small {
  display: block;
  max-width: 420px;
  padding-top: 5px;
  line-height: 1.45;
}

.dish-analytics-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 10px;
  color: #776d5d;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .dish-analytics-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dish-analytics-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dish-matrix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .dish-analytics-controls,
  .dish-analytics-summary,
  .dish-analytics-recommendations,
  .dish-matrix {
    grid-template-columns: 1fr;
  }
}

html {
  background: var(--brand-canvas);
}

body {
  color: var(--brand-ink);
  background: var(--brand-canvas);
}

body,
button,
input,
select,
textarea {
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
}

.topbar {
  min-height: var(--brand-topbar);
  padding: 8px 20px 8px calc(var(--brand-sidebar) + 20px);
  border-bottom: 1px solid var(--brand-line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: none;
}

.topbar .brand-lockup {
  display: flex;
}

.topbar-actions {
  margin-left: auto;
}

.account-menu-button {
  min-height: 42px;
  border: 1px solid var(--brand-line);
  background: #fff;
}

.order-pack-editor {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(72px, 0.7fr) minmax(112px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 360px;
}

.order-pack-editor input,
.order-pack-editor select,
.order-pack-editor button {
  min-height: 34px;
  margin: 0;
}

.order-pack-editor button {
  padding: 7px 10px;
}

.assortment-table-wrap table {
  min-width: 840px;
  table-layout: auto;
}

.assortment-table-wrap th:nth-child(1),
.assortment-table-wrap td:nth-child(1) {
  width: 24%;
}

.assortment-table-wrap th:nth-child(2),
.assortment-table-wrap td:nth-child(2) {
  width: 24%;
}

.assortment-table-wrap th:nth-child(3),
.assortment-table-wrap td:nth-child(3) {
  width: 40%;
}

.assortment-table-wrap th:nth-child(4),
.assortment-table-wrap td:nth-child(4) {
  width: 12%;
  min-width: 132px;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.account-section {
  border: 1px solid var(--line, #dedbd2);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.account-section-head,
.account-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-section-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.account-section-head h4 {
  margin: 0;
}

.info-icon {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  font-weight: 800;
}

.account-access-summary {
  display: grid;
  gap: 8px;
}

.account-access-summary > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #dedbd2);
}

.account-access-summary > div:last-child {
  border-bottom: 0;
}

@media (max-width: 920px) {
  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .order-pack-editor {
    min-width: 300px;
  }
}

.layout,
.layout.filters-hidden {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 20px 80px calc(var(--brand-sidebar) + 20px);
}

.workspace-toolbar {
  box-sizing: border-box;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--brand-sidebar);
  min-width: var(--brand-sidebar);
  max-width: var(--brand-sidebar);
  height: 100vh;
  margin: 0;
  padding: calc(var(--brand-topbar) + 16px) 12px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: var(--brand-black);
  box-shadow: none;
  transition: width 180ms ease, box-shadow 180ms ease;
}

.workspace-toolbar:hover {
  width: var(--brand-sidebar-open);
  min-width: var(--brand-sidebar-open);
  max-width: var(--brand-sidebar-open);
  box-shadow: 12px 0 28px rgba(21, 18, 13, 0.2);
}

@media (min-width: 901px) {
  .workspace-toolbar:not(:hover) .view-filter,
  .workspace-toolbar:not(:hover) .view-filter-dropdown,
  .workspace-toolbar:not(:hover) .view-filter-dropdown.hidden,
  .workspace-toolbar:not(:hover) .tabs,
  .workspace-toolbar:not(:hover) .tab {
    width: 40px !important;
    min-width: 0 !important;
    max-width: 40px !important;
  }

  .workspace-toolbar:hover .view-filter,
  .workspace-toolbar:hover .view-filter-dropdown,
  .workspace-toolbar:hover .view-filter-dropdown.hidden,
  .workspace-toolbar:hover .tabs,
  .workspace-toolbar:hover .tab {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}

.side-brand {
  display: none;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  margin: 0 4px 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.side-brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 4px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  color: var(--brand-black);
  background: var(--brand-yellow);
  font-size: 17px;
  font-weight: 900;
}

.side-brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.side-brand-copy strong {
  color: #fff;
  font-size: 17px;
}

.side-brand-copy small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.workspace-toolbar .view-filter,
.workspace-toolbar .view-filter-dropdown,
.workspace-toolbar .view-filter-dropdown.hidden {
  display: block !important;
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-toolbar .view-filter-button,
.workspace-toolbar .block-filter-head,
.workspace-toolbar .stage-badge {
  display: none;
}

.workspace-toolbar .tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.workspace-toolbar .tab {
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  font-size: 0;
  font-weight: 750;
  text-align: left;
  white-space: nowrap;
}

.workspace-toolbar .tab::before {
  content: attr(data-short);
  min-width: 28px;
  color: inherit;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}

.workspace-toolbar:hover .tab {
  justify-content: flex-start;
  font-size: 13px;
}

.workspace-toolbar:hover .tab::before {
  content: attr(data-index);
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
}

.workspace-toolbar:hover .tab.active::before {
  color: rgba(21, 18, 13, 0.64);
}

.workspace-toolbar .tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.workspace-toolbar .tab.active {
  color: var(--brand-black);
  background: var(--brand-yellow);
}

.sidebar {
  position: sticky;
  top: calc(var(--brand-topbar) + 8px);
  z-index: 25;
  width: 100%;
  margin-bottom: 14px;
  padding: 0;
}

.dashboard-filter-panel {
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(21, 18, 13, 0.06);
}

.dashboard-filter-body {
  grid-template-columns: minmax(220px, 1.2fr) minmax(520px, 3fr) minmax(130px, 0.5fr);
  gap: 10px;
  padding: 10px;
}

.sidebar-filter-grid {
  grid-template-columns: repeat(5, minmax(112px, 1fr));
}

.content {
  width: 100%;
  max-width: 1660px;
  margin: 0 auto;
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  margin: 0 0 10px;
  padding: 0 2px;
}

.workspace-heading .eyebrow {
  display: none;
}

.workspace-heading h2 {
  margin: 0;
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.1;
}

.workspace-heading p:last-child {
  display: none;
}

.report-view-actions {
  display: flex;
  justify-content: flex-end;
  margin: -40px 0 12px;
  position: relative;
  z-index: 2;
}

#comparisonHint:empty,
.operational-source-note:empty,
.result-box:empty {
  display: none;
}

.report-export-button,
.request-download-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--brand-black);
  border-radius: 6px;
  color: #fff;
  background: var(--brand-black);
  box-shadow: none;
  font-weight: 800;
}

.report-export-button:hover:not(:disabled),
.request-download-button:hover:not(:disabled) {
  color: var(--brand-black);
  background: var(--brand-yellow);
}

.report-export-button:disabled,
.request-download-button:disabled {
  border-color: #d6d6d6;
  color: #8b8b8b;
  background: #ececec;
  cursor: not-allowed;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi,
.panel,
.comparison-chart-card,
.comparison-ratio-grid article,
.admin-card {
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: var(--brand-surface);
  box-shadow: 0 6px 18px rgba(21, 18, 13, 0.055);
}

.kpi {
  min-height: 112px;
  padding: 16px;
}

.kpi::before {
  height: 3px;
  background: var(--brand-yellow);
}

.dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.panel {
  grid-column: span 6;
  padding: 17px;
}

.panel.wide,
#appShell[data-view="operational"] [data-block="operational"],
#appShell[data-view="requests"] [data-block="requests"],
#appShell[data-view="feedback"] [data-block="feedback"],
#appShell[data-view="admin"] [data-views~="admin"] {
  grid-column: 1 / -1;
}

.panel-head {
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  font-size: 17px;
}

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.badge,
.status-chip,
.quality-status,
.status-pill {
  border-radius: 5px;
  box-shadow: none;
}

.request-download-button:not(:disabled) {
  border-color: #d2b700;
  color: var(--brand-black);
  background: var(--brand-yellow);
}

.request-toolbar {
  grid-template-columns: repeat(2, minmax(220px, 1fr)) minmax(190px, auto);
  align-items: end;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: #f8f8f8;
}

.request-toolbar button {
  min-height: 42px;
}

.result-box {
  border: 1px solid #e4ce43;
  border-radius: 8px;
  background: var(--brand-yellow-soft);
}

.table-wrap,
.operational-table-wrap,
.warehouse-table-wrap {
  max-width: 100%;
  max-height: min(66vh, 720px);
  border: 1px solid var(--brand-line);
  border-radius: 7px;
  background: #fff;
}

table {
  font-size: 12px;
}

thead th {
  color: var(--brand-black);
  background: #fff2a5;
}

tbody tr:hover td {
  background: #fffbea;
}

input,
select,
textarea,
.multi-select-dropdown > summary,
.checkbox-dropdown > summary {
  border-radius: 6px;
  box-shadow: none;
}

.warehouse-layout,
.inventory-alert-grid,
.comparison-charts,
.admin-grid {
  gap: 14px;
}

.admin-card {
  padding: 15px;
}

.chat-layout {
  min-height: 560px;
}

@media (min-width: 1680px) {
  :root {
    --brand-sidebar-open: 248px;
  }

  .content {
    max-width: 1780px;
  }

  .kpi-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .panel {
    padding: 19px;
  }
}

@media (max-width: 1240px) {
  :root {
    --brand-sidebar-open: 210px;
  }

  .dashboard-filter-panel > summary {
    display: flex;
  }

  .dashboard-filter-body {
    grid-template-columns: minmax(210px, 1fr) minmax(0, 2fr) 132px;
  }

  .sidebar-filter-grid {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    position: static;
    min-height: 64px;
    padding: 8px 12px;
  }

  .topbar .brand-lockup {
    display: flex;
  }

  .layout,
  .layout.filters-hidden {
    box-sizing: border-box;
    width: min(100% - 20px, 1760px);
    margin: 0 auto;
    padding: 10px 0 60px;
  }

  .workspace-toolbar {
    position: sticky;
    inset: auto;
    top: 8px;
    z-index: 30;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    margin: 0 0 10px;
    padding: 7px;
    overflow: visible;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    color: var(--brand-ink);
    background: #fff;
    transition: none;
  }

  .workspace-toolbar:hover {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-shadow: none;
  }

  .side-brand {
    display: none;
  }

  .workspace-toolbar .view-filter-button {
    display: inline-flex;
  }

  .workspace-toolbar .view-filter-dropdown.hidden {
    display: none !important;
  }

  .workspace-toolbar .view-filter-dropdown {
    margin-top: 7px;
    padding: 7px;
    border: 1px solid var(--brand-line);
    border-radius: 6px;
    background: #fff;
  }

  .workspace-toolbar .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-toolbar .tab {
    justify-content: flex-start;
    color: var(--brand-muted);
    font-size: 13px;
  }

  .workspace-toolbar .tab::before,
  .workspace-toolbar:hover .tab::before {
    display: none;
  }

  .workspace-toolbar .tab:hover {
    color: var(--brand-black);
    background: #f4f4f4;
  }

  .sidebar {
    top: 62px;
  }

  .dashboard-filter-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-filter-body > *,
  .sidebar-filter-grid,
  .sidebar-filter-grid > * {
    min-width: 0;
    max-width: 100%;
  }

  .workspace-heading {
    min-height: 0;
  }

  .report-view-actions {
    justify-content: flex-start;
    margin: 0 0 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .panel.wide {
    grid-column: auto;
  }

  .request-toolbar,
  .admin-grid,
  .comparison-controls,
  .comparison-charts,
  .warehouse-layout,
  .inventory-alert-grid,
  .chat-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .workspace-toolbar .tabs,
  .kpi-grid,
  .sidebar-filter-grid {
    grid-template-columns: 1fr;
  }

  .workspace-heading h2 {
    font-size: 25px;
  }

  .panel {
    padding: 12px;
  }

  .panel-head,
  .panel-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .report-export-button,
  .request-download-button {
    width: 100%;
  }
}
