/* Inventario e entrada: hierarquia operacional compacta. */
@media (min-width: 901px) {
  body.disk-inventory-page .admin-layout-stack {
    gap: 12px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child {
    padding: 12px 16px !important;
    border-radius: 16px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero {
    align-items: center !important;
    gap: 12px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-section-title {
    font-size: 23px !important;
    line-height: 1 !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero-note {
    max-width: 680px !important;
    margin-top: 4px !important;
    font-size: 10px !important;
    line-height: 1.3 !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero > div:last-child {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero button,
  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero summary {
    white-space: nowrap !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 11px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child input[type="file"] {
    display: none !important;
  }

  body.disk-inventory-page .inventory-create-menu-source,
  body.disk-inventory-page .inventory-action-bulk,
  body.disk-inventory-page .inventory-action-delete {
    display: none !important;
  }

  body.disk-inventory-page .inventory-action-create {
    color: #032017 !important;
    background: linear-gradient(135deg, #00c96b, #00e676) !important;
    border: 0 !important;
    box-shadow: 0 9px 20px rgba(0, 184, 100, 0.24) !important;
  }

  body.disk-inventory-page .inventory-action-import {
    color: #1f3553 !important;
    background: #fff !important;
    border: 1px solid #d6e0eb !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:nth-of-type(2) {
    padding: 10px !important;
    border-radius: 16px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:nth-of-type(2) > div:first-child {
    margin-bottom: 8px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:nth-of-type(2) input,
  body.disk-inventory-page .admin-layout-stack > .admin-section:nth-of-type(2) select,
  body.disk-inventory-page .admin-layout-stack > .admin-section:nth-of-type(2) button {
    min-height: 34px !important;
    font-size: 11px !important;
  }

  body.disk-inventory-page .stock-brand-grid {
    display: flex !important;
    gap: 8px !important;
    padding: 2px 1px 8px !important;
    overflow-x: auto !important;
    scroll-snap-type: x proximity;
  }

  body.disk-inventory-page .stock-brand-grid::-webkit-scrollbar {
    height: 5px;
  }

  body.disk-inventory-page .stock-brand-card {
    flex: 0 0 190px !important;
    scroll-snap-align: start;
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
    grid-template-rows: 1fr auto !important;
    gap: 3px 8px !important;
    min-height: 72px !important;
    padding: 8px !important;
    border-radius: 13px !important;
  }

  body.disk-inventory-page .stock-brand-logo {
    grid-row: 1 / 3 !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 11px !important;
  }

  body.disk-inventory-page .stock-brand-card > span:nth-child(2) strong {
    font-size: 12px !important;
    line-height: 1.1 !important;
  }

  body.disk-inventory-page .stock-brand-card > span:nth-child(2) span {
    font-size: 8px !important;
    line-height: 1.2 !important;
  }

  body.disk-inventory-page .stock-brand-stats b {
    font-size: 15px !important;
  }

  body.disk-inventory-page .stock-brand-card > em {
    grid-column: 2 / 4 !important;
    justify-self: start !important;
    min-height: 18px !important;
    padding: 0 7px !important;
    font-size: 8px !important;
  }

  .stock-model-section {
    margin-top: 8px !important;
    padding: 12px !important;
    border-radius: 16px !important;
  }

  .stock-model-section-head {
    align-items: center !important;
    margin-bottom: 12px !important;
  }

  .stock-model-section-head > div:first-child > span {
    display: none !important;
  }

  .stock-model-section-head h2 {
    margin-top: 0 !important;
    font-size: 18px !important;
    line-height: 1.1 !important;
  }

  .stock-model-summary strong {
    font-size: 22px !important;
    line-height: 1 !important;
  }

  .stock-model-summary span {
    margin-top: 3px !important;
    font-size: 9px !important;
  }

  /* Inventario: deixa de usar uma linha inteira por modelo. */
  .stock-model-section:not(.entry-model-section) .stock-model-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 8px !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-card {
    border-radius: 15px !important;
    min-width: 0 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06) !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-main {
    grid-template-columns: 58px minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    gap: 5px 10px !important;
    min-height: 90px !important;
    padding: 8px !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-image {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    width: 58px !important;
    height: 64px !important;
    border-radius: 11px !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-info {
    grid-column: 2 !important;
    grid-row: 1 / 3 !important;
    align-self: center !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-info h3 {
    margin: 2px 0 3px !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-info p {
    font-size: 9px !important;
    line-height: 1.3 !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-badges {
    gap: 4px !important;
    margin-top: 6px !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-money {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: end !important;
    text-align: right !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-money strong {
    font-size: 12px !important;
    line-height: 1.1 !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-money span,
  .stock-model-section:not(.entry-model-section) .stock-model-money small {
    font-size: 9px !important;
    line-height: 1.2 !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-model-actions {
    grid-column: 3 !important;
    grid-row: 2 !important;
    align-self: start !important;
    justify-self: end !important;
  }

  .stock-model-section:not(.entry-model-section) .stock-expand-btn {
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 9px !important;
  }

  /* Entrada: mais modelos por linha, mantendo os numeros legiveis. */
  .entry-model-grid {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)) !important;
    gap: 10px !important;
  }

  .entry-model-card {
    grid-template-columns: 60px minmax(0, 1fr) 62px auto !important;
    gap: 7px !important;
    min-height: 98px !important;
    padding: 9px !important;
    border-radius: 15px !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06) !important;
  }

  .entry-model-image {
    width: 60px !important;
    height: 60px !important;
    border-radius: 12px !important;
  }

  .entry-model-info h3 {
    font-size: 14px !important;
    line-height: 1.12 !important;
  }

  .entry-model-info p {
    margin-top: 3px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  .entry-model-info .stock-model-badges {
    gap: 4px !important;
    margin-top: 5px !important;
  }

  .entry-model-numbers strong {
    font-size: 15px !important;
  }

  .entry-model-numbers span {
    font-size: 8px !important;
  }

  .entry-open-drawer {
    min-height: 32px !important;
    padding: 0 11px !important;
    font-size: 10px !important;
  }
}

/* Desktop amplo: tabela operacional, como um inventario SaaS. */
@media (min-width: 1181px) {
  body.disk-inventory-page .inventory-desktop-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }

  body.disk-inventory-page .inventory-kpi {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 78px;
    padding: 12px;
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  }

  body.disk-inventory-page .inventory-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(145deg, #e7f4ff, #d9edff);
  }

  body.disk-inventory-page .inventory-kpi:nth-child(2) .inventory-kpi-icon {
    background: linear-gradient(145deg, #fff0ed, #ffe0dc);
  }

  body.disk-inventory-page .inventory-kpi:nth-child(3) .inventory-kpi-icon {
    background: linear-gradient(145deg, #f0efff, #e4e1ff);
  }

  body.disk-inventory-page .inventory-kpi:nth-child(n+4) .inventory-kpi-icon {
    background: linear-gradient(145deg, #e8fbf4, #d6f7eb);
  }

  body.disk-inventory-page .inventory-kpi small,
  body.disk-inventory-page .inventory-kpi strong,
  body.disk-inventory-page .inventory-kpi em {
    display: block;
    font-style: normal;
  }

  body.disk-inventory-page .inventory-kpi small {
    color: #64748b;
    font-size: 9px;
    font-weight: 850;
  }

  body.disk-inventory-page .inventory-kpi strong {
    color: #071437;
    margin-top: 1px;
    font-size: 17px;
    line-height: 1.1;
    font-weight: 950;
  }

  body.disk-inventory-page .inventory-kpi em {
    color: #64748b;
    margin-top: 2px;
    font-size: 8px;
    font-weight: 750;
  }

  body.disk-inventory-page .stock-model-section-head {
    display: none !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) {
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid #dbe4ef !important;
    background: #fff !important;
  }

  body.disk-inventory-page .inventory-table-header,
  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-main {
    display: grid !important;
    grid-template-columns: minmax(270px, 2fr) 72px 96px 125px 135px 100px 138px !important;
    align-items: center !important;
    column-gap: 12px !important;
  }

  body.disk-inventory-page .inventory-table-header {
    min-height: 36px;
    padding: 0 14px;
    color: #52627a;
    background: #f7f9fc;
    border-bottom: 1px solid #dbe4ef;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
  }

  body.disk-inventory-page .inventory-table-header span:first-child {
    grid-column: 1;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-grid {
    display: block !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-card {
    border: 0 !important;
    border-bottom: 1px solid #e3e9f1 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-card:last-child {
    border-bottom: 0 !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-card:hover {
    background: #f8fbff !important;
    transform: none !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-main {
    min-height: 74px !important;
    padding: 8px 14px !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-image {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    width: 68px !important;
    height: 56px !important;
    margin-right: 0 !important;
  }

  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-info {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    min-width: 0 !important;
    padding-left: 82px !important;
  }

  body.disk-inventory-page .stock-model-info > p,
  body.disk-inventory-page .stock-model-info > .stock-model-badges,
  body.disk-inventory-page .stock-model-money {
    display: none !important;
  }

  body.disk-inventory-page .stock-model-info > span {
    font-size: 8px !important;
  }

  body.disk-inventory-page .stock-model-info h3 {
    font-size: 13px !important;
  }

  body.disk-inventory-page .inventory-row-cells {
    display: contents !important;
  }

  body.disk-inventory-page .inventory-row-cells > span {
    color: #071437;
    font-size: 11px;
    font-weight: 800;
  }

  body.disk-inventory-page .inventory-row-cells > span:nth-child(1) { grid-column: 2; }
  body.disk-inventory-page .inventory-row-cells > span:nth-child(2) { grid-column: 3; }
  body.disk-inventory-page .inventory-row-cells > span:nth-child(3) { grid-column: 4; }
  body.disk-inventory-page .inventory-row-cells > span:nth-child(4) { grid-column: 5; }
  body.disk-inventory-page .inventory-row-cells > span:nth-child(5) { grid-column: 6; }

  body.disk-inventory-page .inventory-row-cells .stock-status {
    min-height: 22px !important;
    padding: 0 8px !important;
    font-size: 8px !important;
  }

  body.disk-inventory-page .stock-model-actions {
    display: flex !important;
    grid-column: 7 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  body.disk-inventory-page .stock-expand-btn {
    color: #1f3553 !important;
    background: #fff !important;
    border: 1px solid #d6e0eb !important;
    box-shadow: none !important;
  }

  body.disk-inventory-page .inventory-table-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 14px;
    color: #64748b;
    background: #fafcff;
    border-top: 1px solid #e3e9f1;
    font-size: 9px;
    font-weight: 800;
  }

  body.disk-inventory-page .inventory-table-footer nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  body.disk-inventory-page .inventory-table-footer button {
    min-width: 30px;
    min-height: 30px;
    padding: 0 8px;
    color: #52627a;
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 900;
  }

  body.disk-inventory-page .inventory-table-footer button.active {
    color: #042016;
    background: #00e676;
    border-color: #00d86f;
  }

  body.disk-inventory-page .inventory-table-footer button:disabled {
    opacity: 0.4;
  }

  body.disk-inventory-page .inventory-table-footer select {
    justify-self: end;
    min-height: 32px;
    padding: 0 28px 0 10px;
    color: #334155;
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 800;
  }

  body.disk-inventory-page .stock-drawer-sheet {
    width: 420px !important;
    max-width: 94vw !important;
  }
}

@media (min-width: 1181px) and (max-width: 1380px) {
  body.disk-inventory-page .inventory-desktop-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.disk-inventory-page .inventory-table-header,
  body.disk-inventory-page .stock-model-section:not(.entry-model-section) .stock-model-main {
    grid-template-columns: minmax(230px, 2fr) 62px 82px 110px 115px 90px 122px !important;
    column-gap: 8px !important;
  }
}

@media (max-width: 900px) {
  body.disk-inventory-page {
    overflow-x: hidden !important;
  }

  body.disk-inventory-page .admin-layout-stack {
    gap: 10px !important;
    padding-bottom: 84px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child {
    padding: 12px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero {
    display: block !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-section-title {
    font-size: 22px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero-note {
    margin-top: 4px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero .inventory-action-create {
    grid-column: 1 / -1 !important;
    order: -1;
    width: 100% !important;
    min-height: 44px !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child .admin-hero > div:last-child > button {
    width: 100% !important;
    min-height: 42px !important;
  }

  body.disk-inventory-page .inventory-action-categories,
  body.disk-inventory-page .inventory-action-bulk,
  body.disk-inventory-page .inventory-action-delete {
    display: none !important;
  }

  body.disk-inventory-page .admin-layout-stack > .admin-section:first-child > .mt-4 {
    display: none !important;
  }

  body.disk-inventory-page .inventory-desktop-kpis {
    display: flex !important;
    gap: 8px;
    width: 100%;
    padding: 2px 2px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  body.disk-inventory-page .inventory-desktop-kpis::-webkit-scrollbar {
    display: none;
  }

  body.disk-inventory-page .inventory-kpi {
    flex: 0 0 132px;
    scroll-snap-align: start;
    min-height: 88px;
    padding: 11px;
    background: #fff;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
  }

  body.disk-inventory-page .inventory-kpi-icon {
    display: block;
    width: 30px;
    height: 30px;
    margin-bottom: 7px;
    background: #e5f8f0;
    border-radius: 9px;
  }

  body.disk-inventory-page .inventory-kpi small,
  body.disk-inventory-page .inventory-kpi strong,
  body.disk-inventory-page .inventory-kpi em {
    display: block;
    font-style: normal;
  }

  body.disk-inventory-page .inventory-kpi small {
    color: #64748b;
    font-size: 9px;
    font-weight: 800;
  }

  body.disk-inventory-page .inventory-kpi strong {
    color: #071437;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 950;
  }

  body.disk-inventory-page .inventory-kpi em {
    color: #64748b;
    font-size: 8px;
    font-weight: 750;
  }

  body.disk-inventory-page .inventory-mobile-filter-button {
    display: block;
    width: 100%;
    min-height: 42px;
    margin-bottom: 8px;
    color: #17314f;
    background: #fff;
    border: 1px solid #d6e0eb;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 900;
  }

  body.disk-inventory-page .inventory-mobile-filters {
    z-index: 160;
    display: none !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100%;
    max-height: 80vh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    background: #fff;
    border-radius: 22px 22px 0 0;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    box-shadow: 0 -22px 60px rgba(15, 23, 42, 0.22);
  }

  body.disk-inventory-page.inventory-filters-open::before {
    content: '';
    z-index: 150;
    background: rgba(15, 23, 42, 0.52);
    position: fixed;
    inset: 0;
  }

  body.disk-inventory-page.inventory-filters-open .inventory-mobile-filters {
    display: grid !important;
  }

  body.disk-inventory-page .inventory-filter-apply {
    min-height: 46px;
    color: #032017;
    background: #00e676;
    border: 0;
    border-radius: 13px;
    font-size: 12px;
    font-weight: 950;
  }

  body.disk-inventory-page .stock-brand-grid {
    display: flex !important;
    gap: 7px !important;
    width: 100%;
    padding-bottom: 6px;
    overflow-x: auto !important;
    scrollbar-width: none;
  }

  body.disk-inventory-page .stock-brand-grid::-webkit-scrollbar {
    display: none;
  }

  body.disk-inventory-page .stock-brand-card {
    flex: 0 0 150px !important;
    min-height: 68px !important;
  }

  body.disk-inventory-page .inventory-table-header,
  body.disk-inventory-page .inventory-row-cells,
  body.disk-inventory-page .inventory-table-footer {
    display: none !important;
  }

  body.disk-inventory-page .stock-model-section {
    padding: 8px !important;
  }

  body.disk-inventory-page .stock-model-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  body.disk-inventory-page .stock-model-card {
    border-radius: 14px !important;
  }

  body.disk-inventory-page .inventory-mobile-fab {
    z-index: 90;
    display: block;
    min-height: 44px;
    padding: 0 16px;
    color: #032017;
    background: #00e676;
    border: 0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 950;
    position: fixed;
    right: 14px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    box-shadow: 0 12px 28px rgba(0, 184, 100, 0.32);
  }

  body.disk-inventory-page .stock-drawer-backdrop {
    z-index: 180 !important;
    padding: 0 !important;
  }

  body.disk-inventory-page .stock-drawer-sheet {
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
  }
}

@media (min-width: 901px) {
  .inventory-mobile-filter-button,
  .inventory-filter-apply,
  .inventory-mobile-fab {
    display: none !important;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .stock-model-section:not(.entry-model-section) .stock-model-grid,
  .entry-model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1500px) {
  .entry-model-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
