.material-hub {
  font-size: 18px;
}

.material-hub button,
.material-hub input,
.material-hub select,
.material-hub textarea,
.material-hub a.button-like {
  font-size: max(18px, var(--ui-min-font-size)) !important;
}

.material-hub :where(.page-subtitle, .panel, .stat, .sheet, .material-mobile-list, .material-list-state, .material-stocktake-inline) :where(p, span, td, th, label, strong, em, small, dt, dd) {
  font-size: max(18px, var(--ui-min-font-size)) !important;
}

.material-hub-head {
  align-items: center;
  gap: 16px;
}

.material-hub-head-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.material-hub-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
}

.material-hub-toolbar .material-hub-tabs {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  margin: 0;
}

.material-hub-head h2 {
  margin: 2px 0 4px;
  font-size: clamp(28px, 3vw, 38px);
}

.material-hub-auth {
  flex: 0 0 auto;
  min-height: 48px;
  padding-inline: 18px;
}

.material-hub-auth.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.material-hub-quick-search {
  display: flex;
  gap: 8px;
  width: 360px;
  min-height: 48px;
  grid-column: 2;
  grid-row: 1;
}

.material-hub-quick-search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
}

.material-hub-quick-search button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 48px;
  padding-inline: 14px;
}

.material-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.material-hub-tabs a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  font-weight: 800;
  text-decoration: none;
}

.material-hub-tabs a.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.material-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.material-hub-actions > a,
.material-hub-actions > button {
  min-width: 190px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  text-align: center;
  text-decoration: none;
}

.material-hub-actions > [hidden] {
  display: none !important;
}

.material-hub-actions .material-hub-primary {
  min-width: 240px;
  min-height: 60px;
  font-weight: 900;
}

.material-hub .tx-entry-toolbar .tx-type-btn {
  min-width: 180px;
  min-height: 60px;
  font-weight: 900 !important;
}

.material-hub .material-summary-collapsible {
  display: grid;
}

.material-new-inline {
  margin-bottom: 18px;
}

.material-new-inline .material-new-inline-panel {
  width: min(1080px, 100%);
  height: auto;
  min-height: 0;
  max-height: none;
  display: block;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 20px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.material-new-inline .material-entry-form {
  overflow: visible;
  padding-right: 0;
}

.material-new-inline [hidden] {
  display: none !important;
}

.material-new-login-help {
  margin: 14px 0 0;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 800;
}

#materialsTable.material-hub-low-table {
  min-width: 980px;
  width: 100%;
  table-layout: fixed;
}

.material-hub .sheet--materials .col-transactions {
  width: 150px;
}

.material-hub-low-table td {
  vertical-align: middle;
}

.material-low-ignore-filter {
  align-self: auto;
}

.material-low-ignore-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.material-low-ignore-control input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.material-low-ignored,
.material-low-card--ignored {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.material-low-ignored .material-low-status,
.material-low-card--ignored .material-low-status {
  color: #64748b;
}

.material-low-status {
  color: #b42318;
  font-weight: 900;
}

.material-low-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.material-low-actions a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.material-low-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #f2b8b5;
  border-radius: 14px;
  background: #fff8f7;
}

.material-low-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin: 0;
}

.material-low-card dt { color: #64748b; }
.material-low-card dd { margin: 0; font-weight: 700; }

@media (max-width: 900px) {
  .material-new-inline .material-new-inline-panel {
    width: 100%;
    height: auto;
    max-height: none;
    display: block;
    padding: 16px;
    overflow: visible;
  }

  .material-new-inline .material-entry-form {
    display: grid;
    flex: none;
    min-height: auto;
    overflow: visible;
    padding-bottom: 0;
  }

  .material-new-inline .material-entry-footer {
    position: static;
  }

  .material-new-inline .material-form-head-actions .secondary {
    min-width: 72px;
    min-height: 48px;
    white-space: nowrap;
  }
}

.material-stocktake-inline {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.material-stocktake-inline .material-stocktake-dialog {
  width: 100%;
  height: auto;
  max-height: none;
  box-shadow: none;
}

.material-hub-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.material-hub-output-card {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 24px;
}

.material-hub-output-card h3,
.material-hub-output-card p { margin: 0; }
.material-hub-output-card > a,
.material-hub-output-card > button { min-height: 52px; }

@media (max-width: 900px) {
  .material-hub-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .material-hub-toolbar .material-hub-quick-search,
  .material-hub-toolbar .material-hub-tabs {
    width: 100%;
  }

  .material-hub-toolbar .material-hub-quick-search { order: 1; }
  .material-hub-toolbar .material-hub-tabs { order: 2; }

  .material-hub-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-hub-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-hub-actions > a,
  .material-hub-actions > button,
  .material-hub-actions .material-hub-primary {
    width: 100%;
    min-width: 0;
  }

  .material-hub-output-grid { grid-template-columns: 1fr; }

  .material-hub .material-tag-batch-dialog {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    padding: 12px;
  }

  .material-hub #openMaterialTagBatchBtn:not([hidden]) {
    display: inline-flex !important;
  }

  .material-hub #materialTagBatchModal:not([hidden]) {
    display: grid !important;
  }

  .material-hub .material-tag-batch-workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .material-hub .material-tag-batch-picker,
  .material-hub .material-tag-batch-preview-panel {
    min-height: 420px;
  }

  .material-hub .material-tag-batch-table-head { display: none; }

  .material-hub .material-tag-batch-option {
    grid-template-columns: 42px minmax(76px, auto) minmax(0, 1fr);
    grid-template-rows: repeat(3, auto);
    min-height: 0;
    flex: 0 0 auto;
    align-items: start;
    padding-block: 12px;
  }

  .material-hub .material-tag-batch-option > input,
  .material-hub .material-tag-batch-option > .material-tag-batch-number {
    grid-row: 1 / 4;
  }

  .material-hub .material-tag-batch-option > strong {
    grid-column: 3;
    grid-row: 1;
  }

  .material-hub .material-tag-batch-option > strong + span {
    grid-column: 3;
    grid-row: 2;
  }

  .material-hub .material-tag-batch-option > span:last-child {
    grid-column: 3;
    grid-row: 3;
  }

  .material-hub .material-tag-batch-option > strong,
  .material-hub .material-tag-batch-option > strong + span,
  .material-hub .material-tag-batch-option > span:last-child {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .material-hub .material-tag-batch-footer {
    grid-template-columns: 1fr 1fr;
  }

  .material-hub .material-tag-batch-status { grid-column: 1 / -1; }

  .material-hub .material-tag-batch-footer button {
    min-height: 48px !important;
  }
}

@media (max-width: 520px) {
  .material-hub-actions { grid-template-columns: 1fr; }
  .material-hub-head { align-items: stretch; }
  .material-hub-head-side,
  .material-hub-auth { width: 100%; }
}
