/* Phase 21m: Stock pages mobile/desktop polish */

body.p21m-stock-page {
  background: #f8fafc !important;
}

body.p21m-stock-page .card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .055) !important;
  overflow: hidden;
}

body.p21m-stock-page h1,
body.p21m-stock-page h2 {
  color: #0f172a !important;
  font-weight: 950 !important;
  letter-spacing: -.03em;
}

body.p21m-stock-page .text-muted {
  color: #64748b !important;
}

body.p21m-stock-page .table-responsive {
  border: 1px solid #e2e8f0 !important;
  border-radius: 15px !important;
  overflow-x: auto !important;
}

body.p21m-stock-page table {
  margin-bottom: 0 !important;
}

body.p21m-stock-page table thead th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: .72rem !important;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.p21m-stock-page .badge,
body.p21m-stock-page .stock-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .18rem .4rem;
  font-size: .62rem;
  line-height: 1;
  font-weight: 900;
  margin: .08rem;
}

body.p21m-stock-page .stock-badge.ok {
  background: #dcfce7;
  color: #166534;
}

body.p21m-stock-page .stock-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

body.p21m-stock-page .stock-badge.muted {
  background: #e2e8f0;
  color: #475569;
}

body.p21m-stock-page .btn {
  border-radius: 12px !important;
  font-weight: 850 !important;
}

body.p21m-stock-page .form-control,
body.p21m-stock-page .form-select {
  border-radius: 12px !important;
  border-color: #cbd5e1 !important;
}

body.p21m-stock-page .stock-mobile-list {
  display: none;
}

/* Desktop */
@media (min-width: 768px) {
  body.p21m-stock-page .card-body {
    padding: 1rem !important;
  }

  body.p21m-stock-page .stock-add-card {
    position: sticky;
    top: 1rem;
  }

  body.p21m-stock-page .stock-adjust-form {
    min-width: 220px;
  }

  body.p21m-stock-page .stock-adjust-form .btn {
    min-height: 34px;
  }
}

/* Mobile */
@media (max-width: 767.98px) {
  body.p21m-stock-page .container-fluid,
  body.p21m-stock-page main {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: 92px !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.p21m-stock-page .container-fluid.py-4 {
    padding-top: .65rem !important;
  }

  body.p21m-stock-page .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    row-gap: .65rem !important;
  }

  body.p21m-stock-page [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.p21m-stock-page .card {
    border-radius: 15px !important;
    margin-bottom: .65rem !important;
  }

  body.p21m-stock-page .card-body {
    padding: .68rem !important;
  }

  body.p21m-stock-page h1 {
    font-size: 1.18rem !important;
    margin-bottom: .15rem !important;
  }

  body.p21m-stock-page h2 {
    font-size: 1rem !important;
  }

  body.p21m-stock-page .text-muted {
    font-size: .72rem !important;
    line-height: 1.18 !important;
  }

  body.p21m-stock-page .table-responsive {
    display: none !important;
  }

  body.p21m-stock-page .stock-mobile-list {
    display: grid !important;
    gap: .52rem;
  }

  body.p21m-stock-page .stock-mobile-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 15px;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .055);
    padding: .62rem;
    overflow: hidden;
  }

  body.p21m-stock-page .stock-mobile-card.is-archived {
    opacity: .78;
    background: #f8fafc;
  }

  body.p21m-stock-page .stock-mobile-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .55rem;
    padding-bottom: .45rem;
    border-bottom: 1px solid #eef2f7;
  }

  body.p21m-stock-page .stock-mobile-top strong {
    display: block;
    color: #0f172a;
    font-size: .92rem;
    line-height: 1.08;
    font-weight: 950;
    overflow-wrap: anywhere;
  }

  body.p21m-stock-page .stock-mobile-top small {
    display: block;
    color: #64748b;
    font-size: .68rem;
    line-height: 1.15;
    font-weight: 750;
    margin-top: .12rem;
  }

  body.p21m-stock-page .stock-mobile-badges {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .2rem;
    max-width: 38%;
  }

  body.p21m-stock-page .stock-badge {
    font-size: .52rem;
    padding: .15rem .32rem;
    margin: 0;
  }

  body.p21m-stock-page .stock-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .34rem;
    margin-top: .48rem;
  }

  body.p21m-stock-page .stock-mini {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: .4rem .32rem;
    min-width: 0;
    text-align: center;
  }

  body.p21m-stock-page .stock-mini span {
    display: block;
    color: #64748b;
    font-size: .5rem;
    line-height: 1;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  body.p21m-stock-page .stock-mini strong {
    display: block;
    margin-top: .18rem;
    color: #0f172a;
    font-size: .72rem;
    line-height: 1.05;
    font-weight: 950;
    overflow-wrap: anywhere;
  }

  body.p21m-stock-page .stock-mobile-desc {
    margin-top: .45rem;
    color: #64748b;
    font-size: .68rem;
    line-height: 1.18;
  }

  body.p21m-stock-page .stock-mobile-adjust {
    display: grid;
    grid-template-columns: .8fr 1.2fr auto;
    gap: .34rem;
    margin-top: .5rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 13px;
    padding: .45rem;
  }

  body.p21m-stock-page .stock-mobile-adjust .form-control {
    min-height: 34px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    padding: .28rem .42rem !important;
  }

  body.p21m-stock-page .stock-mobile-adjust .btn {
    min-height: 34px !important;
    font-size: .68rem !important;
    padding: .25rem .42rem !important;
    white-space: nowrap;
  }

  body.p21m-stock-page .stock-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .38rem;
    margin-top: .45rem;
  }

  body.p21m-stock-page .stock-mobile-actions .btn,
  body.p21m-stock-page .stock-mobile-actions form button {
    width: 100%;
    min-height: 36px;
    font-size: .72rem;
    font-weight: 900;
  }

  body.p21m-stock-page .stock-mobile-actions form {
    margin: 0;
  }

  body.p21m-stock-page .stock-empty {
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    padding: .8rem;
    text-align: center;
    font-weight: 800;
  }

  /* Add forms */
  body.p21m-stock-page .stock-add-card {
    position: static !important;
  }

  body.p21m-stock-page .stock-add-card form.row,
  body.p21m-stock-page form[action*="/accessories/add"].row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .45rem !important;
    margin: 0 !important;
  }

  body.p21m-stock-page .stock-add-card form.row > div,
  body.p21m-stock-page form[action*="/accessories/add"].row > div {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.p21m-stock-page .stock-add-card form.row > div:has(textarea),
  body.p21m-stock-page .stock-add-card form.row > div:has(button),
  body.p21m-stock-page form[action*="/accessories/add"].row > div:has(button) {
    grid-column: 1 / -1 !important;
  }

  body.p21m-stock-page .stock-add-card .form-control,
  body.p21m-stock-page .stock-add-card .form-select,
  body.p21m-stock-page form[action*="/accessories/add"] .form-control {
    min-height: 40px !important;
    font-size: 16px !important;
    border-radius: 11px !important;
  }

  body.p21m-stock-page .stock-add-card button,
  body.p21m-stock-page form[action*="/accessories/add"] button {
    min-height: 42px !important;
    font-weight: 950 !important;
  }
}
