/* Compact product controls and responsive mobile workspace. */
.product-row {
  grid-template-columns: minmax(210px, 1.45fr) minmax(105px, .75fr) minmax(125px, .9fr) minmax(290px, 1.8fr);
  align-items: center;
}
.product-header {
  grid-template-columns: minmax(210px, 1.45fr) minmax(105px, .75fr) minmax(125px, .9fr) minmax(290px, 1.8fr);
}
.product-more { display: grid; grid-column: 4; grid-template-columns: repeat(3, minmax(70px, 1fr)); align-items: center; gap: 10px; }
.product-more > summary { display: none; }
.product-more .more-fields { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(70px, 1fr)); align-items: center; gap: 10px; }
.product-name { grid-column: 1; }
.product-row > .regular-price { grid-column: 2; }
.product-row > .stock-wrap { grid-column: 3; }
.product-thumb { overflow: hidden; }
.product-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-thumb.has-image { background: #f2f4f8; }
.sidebar-bottom { color: inherit; text-decoration: none; }
.sidebar-bottom:hover .backend-label strong { color: var(--purple); }
.drawer-overview, .drawer-close, .sidebar-backdrop, .menu-toggle, .mobile-secure { display: none; }
.save-floating[hidden] { display: none !important; }
.save-floating {
  position: fixed;
  z-index: 35;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  box-shadow: 0 10px 30px #4333ba45;
  font: 700 14px 'DM Sans', sans-serif;
  cursor: pointer;
}
.save-floating b { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #ffffff2b; }
#changes-dialog { width: min(540px, calc(100% - 28px)); max-height: min(82dvh, 720px); overflow: auto; }
.changes-summary { display: grid; gap: 9px; max-height: 48dvh; overflow: auto; }
.change-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.change-item > strong, .change-item > small { display: block; }
.change-item > small { margin: 3px 0 8px; color: var(--muted); }
.change-item > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid #f0f2f6; font-size: 12px; }
.change-item > div span { color: var(--muted); }
.change-item > div b { text-align: right; }
.change-item > div i { color: var(--purple); font-style: normal; padding: 0 4px; }

@media (min-width: 761px) {
  .product-header { font-size: 14px; }
  .product-copy strong, .product-copy small, .price-input, .stock-select,
  .product-more .publish-toggle, .product-more .shop-tag { font-size: 14px; }
  .price-caption, .stock-caption, .product-more .promo-price { display: none !important; }
  .product-more { grid-template-columns: repeat(2, minmax(80px, 1fr)); }
  .product-more .more-fields { grid-template-columns: repeat(2, minmax(80px, 1fr)); }
  .product-more .publish-toggle, .product-more .shop-tag {
    grid-column: auto;
    grid-row: auto;
    width: max-content;
    max-width: 100%;
    padding-bottom: 0;
  }
}

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .main { margin-left: 0; min-height: 100dvh; }
  .sidebar {
    z-index: 51;
    width: min(310px, 86vw);
    padding: max(20px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform .24s ease;
    box-shadow: 14px 0 42px #14203324;
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    padding: 0;
    border: 0;
    background: #10182766;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  body.drawer-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .brand { margin: 2px 0 34px; }
  .brand > span:last-child { display: inline; font-size: 20px; }
  .side-label { display: block; font-size: 10px; padding: 0 10px; }
  .nav-item { justify-content: flex-start; height: 44px; padding: 0 11px; font-size: 13px; }
  .nav-count { display: inline; margin-left: auto; }
  .drawer-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 22px;
  }
  .drawer-overview { display: block; margin-top: 24px; padding: 17px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fafbfe; }
  .drawer-overview-title { margin: 0 0 11px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  .drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .drawer-stats span { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
  .drawer-stats strong { color: var(--ink); font: 700 17px Manrope, sans-serif; }
  .drawer-overview .button { width: 100%; height: 38px; justify-content: center; margin-top: 11px; font-size: 12px; }
  .sidebar-bottom { justify-content: flex-start; margin-top: auto; padding: 15px 2px 0; }
  .sidebar-bottom > div:not(.avatar) { display: block; }
  .backend-label { display: grid !important; gap: 3px; }
  .backend-label strong, .backend-label small { font-size: 11px; }
  .topbar { position: sticky; top: 0; z-index: 20; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 13px 0; background: #ffffffed; backdrop-filter: blur(12px); }
  .breadcrumbs { gap: 6px; font-size: 14px; }
  .desktop-crumb, .top-actions > span { display: none !important; }
  .mobile-secure { display: inline-flex; align-items: center; gap: 5px; margin-left: 7px; color: var(--muted); font-size: 10px; font-weight: 500; }
  .mobile-secure i { width: 7px; height: 7px; border-radius: 50%; background: #2eb67d; }
  .top-actions { margin-left: auto; }
  .top-actions #settings-open { display: none; }
  .menu-toggle { display: flex; width: 40px; height: 40px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
  .menu-toggle span { width: 17px; height: 2px; border-radius: 2px; background: var(--ink); }
  .content { padding: 8px 10px calc(112px + env(safe-area-inset-bottom)); }
  .heading-row, .stats-row { display: none !important; }
  .panel { overflow: visible; border-radius: 14px; }
  .filterbar { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 12; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 38px; gap: 7px; padding: 9px; border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; background: #fff; }
  .search { grid-column: 1 / -1; width: 100%; max-width: none; height: 39px; }
  .search input { min-width: 0; font-size: 13px; }
  .filter-select { display: flex; min-width: 0; height: 37px; justify-content: space-between; gap: 5px; padding: 0 8px; font-size: 10px; }
  .filter-select select { min-width: 0; max-width: 100px; height: 30px; font-size: 11px; }
  .status-filter { display: flex !important; }
  .filter-button { width: 38px; height: 37px; justify-content: center; padding: 0; }
  .filter-button span { display: none; }
  .table-meta { min-height: 38px; padding: 0 10px; font-size: 10px; }
  .auto-save-hint { display: none; }
  .product-header { display: none !important; }
  .product-list { overflow: visible; padding: 8px 7px 90px; }
  .product-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(92px, .82fr) 36px;
    grid-template-rows: auto auto;
    gap: 8px;
    min-height: 0;
    margin: 0 0 8px;
    padding: 11px 9px 10px;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px #17203308;
  }
  .product-row.has-changes { border-color: #cfc8ff; box-shadow: 0 0 0 1px #eeeaff; }
  .product-name { grid-column: 1 / -1; grid-row: 1; display: flex; min-width: 0; align-items: center; gap: 12px; margin: 0; }
  .product-thumb { flex: 0 0 58px; width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 12px; font-size: 22px; }
  .product-copy { min-width: 0; }
  .product-copy strong { overflow: hidden; font-size: 15px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .product-copy small { overflow: hidden; max-width: 100%; margin-top: 4px; color: #67748a; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
  .product-row > .regular-price { grid-column: 1; grid-row: 2; min-width: 0; }
  .price-caption, .stock-caption { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 11px; }
  .price-input { width: 100%; height: 40px; padding: 0 10px; border: 1px solid #e9edf3; border-radius: 8px; background: #f8f9fc; font-size: 14px; }
  .product-row > .stock-wrap { grid-column: 2; grid-row: 2; min-width: 0; }
  .stock-select { width: 100%; height: 40px; padding: 0 6px; border-radius: 8px; font-size: 12px; }
  .product-more { position: relative; display: block; grid-column: 3; grid-row: 2; align-self: end; min-width: 0; }
  .product-more > summary { display: grid; place-items: center; width: 36px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #697587; list-style: none; cursor: pointer; }
  .product-more > summary::-webkit-details-marker { display: none; }
  .product-more > summary span { transform: translateY(-3px); font-size: 20px; font-weight: 700; letter-spacing: 1px; }
  .product-more .more-fields { display: none; }
  .product-more[open] .more-fields { position: absolute; top: calc(100% + 7px); right: 0; z-index: 24; display: grid; width: min(245px, calc(100vw - 42px)); gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 34px #18223024; }
  .product-more .more-fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .product-more .promo-price { display: block; grid-column: auto; }
  .product-more .publish-toggle { display: flex; min-height: 30px; align-items: center; gap: 8px; font-size: 11px; }
  .product-more .more-fields .price-caption { font-size: 11px; }
  .product-more .more-fields .price-input { min-height: 40px; font-size: 14px; }
  .product-more .shop-tag { display: inline-flex; grid-column: auto; width: max-content; font-size: 10px; }
  .product-row .shop-column { display: inline-flex; }
  .pagination { margin-top: 0; padding: 0 8px; }
  .page-button { min-width: 38px; height: 34px; }
  .page-button span { display: none; }
  .page-number { width: 26px; height: 26px; }
  .content footer { padding: 16px 0; font-size: 9px; }
  .save-floating { right: 13px; bottom: calc(14px + env(safe-area-inset-bottom)); min-height: 48px; padding: 0 14px; font-size: 13px; }
  #changes-dialog { width: calc(100% - 20px); max-height: calc(86dvh - env(safe-area-inset-top)); padding: 18px 14px; border-radius: 16px; }
  #changes-dialog .dialog-title h2 { max-width: 250px; font-size: 18px; }
  .changes-summary { max-height: 48dvh; }
  .change-item { padding: 10px; }
  #changes-dialog .dialog-actions { position: sticky; bottom: -18px; display: grid; grid-template-columns: 1fr; padding: 12px 0 0; background: #fff; }
  #changes-dialog .dialog-actions button { min-height: 42px; justify-content: center; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.drawer-open { overflow: hidden; }
}

@media (max-width: 370px) {
  .content { padding-left: 7px; padding-right: 7px; }
  .product-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 6px; padding-right: 7px; padding-left: 7px; }
  .product-row > .regular-price { grid-column: 1; }
  .product-row > .stock-wrap { grid-column: 2; }
  .product-more { grid-column: 3; }
  .product-more > summary { width: 34px; }
  .filterbar { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) 34px; gap: 5px; padding: 7px; }
  .filter-button { width: 34px; }
  .filter-select { padding: 0 5px; }
}
