/* Final UI quality layer: readable type, collision-safe controls and compact actions. */
:root {
  --ui-label-size: 12px;
  --ui-note-size: 11px;
  --ui-action-gap: 7px;
}

html,
body { overflow-x: hidden; }

.main,
.view-root,
.view-root > *,
.panel,
.card,
.content-grid > *,
.topbar > * { min-width: 0; }

.view-root button,
.view-root input,
.view-root select,
.view-root textarea { font-size: var(--ui-label-size); }

.view-root .small-button {
  min-height: 32px;
  padding: 6px 11px;
  font-size: var(--ui-note-size);
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-actions,
.row-actions,
.filter-actions,
.toolbar-actions,
.panel-actions { gap: var(--ui-action-gap); }

.erp-master-table,
.store-directory-table,
.table-wrap,
.strategy-table-wrap,
.purchase-details-table-wrap,
.purchase-receive-table-wrap,
.manual-restock-table {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

/* Company work plan: readable desktop ledger with a deliberate action hierarchy. */
.office-execution-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
}

.office-os-hero {
  overflow: hidden;
}

.office-plan-ledger {
  min-width: 0;
  overflow: visible;
}

.office-ledger-columns,
.office-plan-row {
  grid-template-columns:
    minmax(300px, 1.65fr)
    minmax(118px, .58fr)
    minmax(104px, .5fr)
    minmax(112px, .55fr)
    minmax(116px, .56fr)
    minmax(178px, .78fr);
  gap: 12px;
  min-width: 0;
}

.office-ledger-columns {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 650;
}

.office-plan-row { padding: 14px 16px; }
.office-plan-index { font-size: 10px; }
.office-plan-tags { flex-wrap: wrap; }

.office-plan-tags b,
.office-plan-tags em {
  max-width: 160px;
  font-size: 10px;
  line-height: 1.35;
}

.office-plan-copy > strong {
  font-size: 14px;
  line-height: 1.45;
}

.office-plan-copy > small,
.office-plan-owner small,
.office-plan-due small,
.office-plan-health > small,
.office-plan-progress > small {
  font-size: 10px;
  line-height: 1.4;
}

.office-plan-owner strong,
.office-plan-due strong {
  font-size: 12px;
  line-height: 1.4;
}

.office-plan-health > span { font-size: 10px; }

.office-plan-actions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 7px;
}

.office-plan-actions .small-button,
.office-plan-more > summary {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.office-plan-more { position: relative; }

.office-plan-more > summary {
  display: grid;
  place-items: center;
  color: #45536d;
  border: 1px solid #ccd6e6;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.office-plan-more > summary::-webkit-details-marker { display: none; }

.office-plan-more[open] > summary {
  color: #4057c8;
  border-color: #aebcf2;
  background: #f2f5ff;
}

.office-plan-more-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 142px;
  gap: 6px;
  padding: 8px;
  border: 1px solid #d8deea;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(32, 48, 82, .16);
}

.office-plan-more-menu .small-button { justify-content: center; }

.office-edit-action {
  color: #45536d;
  border-color: #d5dce8 !important;
  background: #f8fafc !important;
}

/* Keep the inventory total inside the fixed table heading without shrinking it
   into unreadable text or pushing the neighbouring columns away. */
.view-root[data-view="catalog"] .store-product-ledger .stock-value-total-head {
  display: grid;
  justify-items: center;
  gap: 2px;
  white-space: normal;
  line-height: 1.15;
}

.view-root[data-view="catalog"] .store-product-ledger .stock-value-total-head em {
  font-size: 10px;
  line-height: 1.2;
}

.office-advice-panel > header > small,
.office-advice-panel footer,
.office-ledger-header > small {
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 1500px) {
  .office-execution-layout { grid-template-columns: 1fr; }
  .office-advice-panel { position: static; }
}

@media (max-width: 1180px) {
  .office-ledger-columns { display: none; }
  .office-plan-row {
    grid-template-columns: minmax(0, 1fr) minmax(150px, .4fr);
    gap: 12px 16px;
  }
  .office-plan-main { grid-column: 1 / -1; }
  .office-plan-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
  }
}

@media (max-width: 720px) {
  .office-plan-row { grid-template-columns: 1fr; }
  .office-plan-owner,
  .office-plan-due,
  .office-plan-progress,
  .office-plan-health,
  .office-plan-actions { grid-column: 1; }
}
