:root {
  --brand-green-dark: #1f3d2b;
  --brand-green: #2e6b3e;
  --brand-green-light: #e8f2ea;
  --brand-gold: #a68b3f;
  --brand-text: #2b2b2b;
  --brand-muted: #6c757d;
  --sidebar-width: 250px;
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--brand-text);
  background-color: #f4f6f5;
}

/* ---------- Admin shell layout ---------- */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--brand-green-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 3px;
}

.admin-sidebar-brand span {
  font-weight: 600;
  font-size: 1.05rem;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background-color 0.15s ease;
}

.admin-nav-link i.bi {
  font-size: 0.5rem;
  opacity: 0.7;
}

.admin-nav-link:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-nav-link.active {
  background-color: var(--brand-green);
  color: #fff;
  font-weight: 600;
}

.admin-nav-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-sidebar-backdrop {
  display: none;
}

.admin-menu-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  background: none;
  border-radius: 0.4rem;
  color: var(--brand-green-dark);
  cursor: pointer;
}

.admin-menu-toggle:hover { background: var(--brand-green-light); }
.admin-menu-toggle svg { width: 1.4rem; height: 1.4rem; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.admin-topbar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-green-dark);
}

.admin-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-user-name {
  font-size: 0.9rem;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border: none;
  border-radius: 999px;
  background: #f3f4f6;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.user-menu-trigger:hover,
.user-menu-trigger:focus-visible {
  background: #e9eaed;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.user-menu-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-text);
}

.user-menu-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--brand-muted);
}

.user-menu-panel {
  min-width: 260px;
  padding: 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(31, 61, 43, 0.14);
}

.user-menu-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.2rem 0.4rem 0.6rem;
}

.user-menu-header strong {
  font-size: 1rem;
  color: var(--brand-green-dark);
}

.user-menu-header span {
  font-size: 0.8rem;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.4rem;
  border: none;
  background: none;
  border-radius: 0.5rem;
  font-size: 0.88rem;
  color: var(--brand-text);
  text-align: left;
  cursor: pointer;
}

.user-menu-item svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--brand-green);
  flex-shrink: 0;
}

.user-menu-item:hover {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
}

.user-menu-item-danger,
.user-menu-item-danger svg {
  color: #b3261e;
}

.user-menu-item-danger:hover {
  background: #fdecea;
  color: #b3261e;
}

.admin-content {
  flex: 1;
  padding: 1.5rem;
}

.admin-footer {
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--brand-muted);
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* ---------- Stat cards ---------- */
.stat-card {
  position: relative;
  background: #fff;
  border-radius: 0.6rem;
  padding: 1.1rem 1.25rem 1.1rem 1.4rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  height: 100%;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0.65rem;
  width: 4px;
  border-radius: 4px;
  background: var(--brand-green);
}

.stat-card--gold::before { background: var(--brand-gold); }
.stat-card--warning::before { background: #d99a2b; }
.stat-card--danger::before { background: #c0392b; }
.stat-card--muted::before { background: #8a9a91; }

.stat-card-label {
  font-size: 0.78rem;
  color: var(--brand-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-green-dark);
  margin-top: 0.3rem;
  line-height: 1.1;
}

.stat-card-sub {
  font-size: 0.78rem;
  color: var(--brand-muted);
  margin-top: 0.35rem;
}

.stat-card--danger .stat-card-value,
.stat-card--warning .stat-card-value {
  color: #9a3412;
}

/* ---------- Dashboard sections ---------- */
.dashboard-section-title {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--brand-green-dark);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  padding: 1.25rem 1.5rem;
}

.demand-table {
  width: 100%;
  border-collapse: collapse;
}

.demand-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  font-weight: 600;
  padding: 0 0 0.6rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.demand-table td {
  padding: 0.65rem 0;
  border-bottom: 1px solid #f1f3f2;
  vertical-align: middle;
}

.demand-table tr:last-child td {
  border-bottom: none;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  font-weight: 700;
  font-size: 0.8rem;
}

.demand-bar-track {
  background: #eef1ef;
  border-radius: 999px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}

.demand-bar-fill {
  background: var(--brand-green);
  height: 100%;
  border-radius: 999px;
}

.empty-state {
  color: var(--brand-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
  text-align: center;
}

/* ---------- Data tables (shared across panels) ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  font-weight: 600;
  padding: 0 0.75rem 0.6rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f1f3f2;
  vertical-align: middle;
  font-size: 0.9rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: #fafbfa;
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-success { background: #e6f4ea; color: #1e7e34; }
.pill-danger { background: #fdecea; color: #b3261e; }
.pill-warning { background: #fdf3e0; color: #9a6b0a; }
.pill-info { background: #e8f0fe; color: #1a56c4; }
.pill-muted { background: #eef1ef; color: var(--brand-muted); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.filter-bar label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: block;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand-green);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.back-link:hover { color: var(--brand-green-dark); }

/* ---------- Order road map timeline ---------- */
.roadmap {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.roadmap-step {
  position: relative;
  padding: 0 0 1.25rem 2rem;
  border-left: 2px solid var(--brand-green-light);
}

.roadmap-step:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.roadmap-step::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-green);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--brand-green);
}

.roadmap-step-title {
  font-weight: 600;
  color: var(--brand-green-dark);
}

.roadmap-step-date {
  font-size: 0.8rem;
  color: var(--brand-muted);
}

.roadmap-step-notes {
  font-size: 0.85rem;
  color: var(--brand-muted);
  margin-top: 0.15rem;
}

/* ---------- Printable invoice ---------- */
@media print {
  .admin-sidebar, .admin-topbar, .admin-footer, .no-print {
    display: none !important;
  }
  .admin-content {
    padding: 0 !important;
  }
  body {
    background: #fff !important;
  }
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--brand-green-dark);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.invoice-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand-green-dark);
}

/* ---------- Notification bell ---------- */
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.4rem 0.5rem;
  border-radius: 0.4rem;
  color: var(--brand-green-dark);
}

.notif-bell-btn:hover {
  background: var(--brand-green-light);
}

.notif-badge {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  background: #c0392b;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 1.1rem;
  height: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}

.notif-dropdown {
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  padding: 0;
}

.notif-dropdown-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand-green-dark);
  border-bottom: 1px solid #e5e7eb;
}

.notif-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1f3f2;
}

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand-text);
}

.notif-item-message {
  font-size: 0.8rem;
  color: var(--brand-muted);
  margin-top: 0.1rem;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--brand-muted);
  margin-top: 0.2rem;
}

.notif-item-dismiss {
  background: none;
  border: none;
  color: var(--brand-muted);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}

.notif-item-dismiss:hover { color: var(--brand-green-dark); }

.notif-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--brand-muted);
  font-size: 0.85rem;
}

/* ---------- Login page ---------- */
.login-body {
  background: linear-gradient(135deg, var(--brand-green-dark), var(--brand-green));
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.login-card-brand {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.login-card-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand-green-dark);
  margin-bottom: 0.15rem;
}

.login-card-subtitle {
  text-align: center;
  color: var(--brand-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.btn-brand {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover {
  background-color: var(--brand-green-dark);
  border-color: var(--brand-green-dark);
  color: #fff;
}



.password-wrapper {
    position: relative;
}

.password-input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #718071;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    z-index: 5;
}

    .password-toggle:hover {
        color: #2f7d3b;
    }

    .password-toggle:focus {
        outline: none;
        box-shadow: none;
    }

.record-dialog-icon svg {
    width: 1.3rem;
    height: 1.3rem;
}

/* ---------- Sectioned forms (Products, and any future multi-section form) ---------- */
.form-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.7rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #eef1ef;
  background: linear-gradient(180deg, #fbfcfb, #ffffff);
}

.form-section-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.6rem;
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-section-icon svg { width: 1.2rem; height: 1.2rem; }

.form-section-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--brand-green-dark);
  margin: 0;
}

.form-section-subtitle {
  font-size: 0.82rem;
  color: var(--brand-muted);
  margin: 0.1rem 0 0 0;
}

.form-section-body {
  padding: 1.4rem;
}

.required-label::after {
  content: " *";
  color: #c0392b;
}

.form-help-text {
  font-size: 0.78rem;
  color: var(--brand-muted);
  margin-top: 0.35rem;
}

.optional-tag {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--brand-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Product form action bar (sticky Save/Cancel) ---------- */
.product-form-actionbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.7rem;
  box-shadow: 0 2px 8px rgba(31, 61, 43, 0.08);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

.product-form-actionbar-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.product-form-actionbar-hint {
  font-size: 0.82rem;
  color: var(--brand-muted);
}

.product-form-actionbar-buttons {
  display: flex;
  gap: 0.6rem;
}

.product-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1.25rem;
  margin-top: 0.25rem;
}

@media (max-width: 575.98px) {
  .product-form-actionbar {
    position: static;
  }
  .product-form-actionbar-buttons {
    width: 100%;
  }
  .product-form-actionbar-buttons .btn {
    flex: 1 1 0;
  }
}

/* ---------- Validation summary ---------- */
.form-validation-alert {
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid #f1c1bb;
}

.form-validation-alert::before {
  content: "!";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #c0392b;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.form-validation-alert ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* ---------- Image upload zone ---------- */
.image-upload-zone {
  position: relative;
  border: 2px dashed #cfd8d2;
  border-radius: 0.7rem;
  background: #fafbfa;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  overflow: hidden;
}

.image-upload-zone:hover,
.image-upload-zone.is-dragover {
  border-color: var(--brand-green);
  background: var(--brand-green-light);
}

.image-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-upload-placeholder {
  text-align: center;
  color: var(--brand-muted);
  padding: 1.5rem;
  pointer-events: none;
}

.image-upload-placeholder svg {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--brand-green);
  margin-bottom: 0.5rem;
}

.image-upload-placeholder strong {
  display: block;
  color: var(--brand-text);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.image-upload-placeholder span {
  font-size: 0.78rem;
}

.image-upload-preview {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 220px;
}

.image-upload-preview img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.image-upload-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: none;
  background: rgba(27, 36, 32, 0.65);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.image-upload-remove:hover { background: #c0392b; }

/* ---------- Deferred product media and 4:5 photo editor ---------- */
.media-guidance {
  padding: 0.8rem 1rem;
  border: 1px solid #dce9df;
  border-radius: 0.55rem;
  background: #f5faf6;
  color: #506057;
  font-size: 0.85rem;
}

.product-media-card,
.product-video-card {
  height: 100%;
  padding: 0.85rem;
  border: 1px solid #dfe7e1;
  border-radius: 0.65rem;
  background: #fff;
}

.product-media-card-label {
  margin-bottom: 0.55rem;
  color: var(--brand-text);
  font-size: 0.84rem;
  font-weight: 700;
}

.product-image-preview-wrap {
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid #e2e8e4;
  border-radius: 0.55rem;
  background: #f3f6f4;
}

.product-image-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.product-media-card.is-empty .product-image-preview {
  padding: 22%;
  object-fit: contain;
  opacity: 0.58;
}

.product-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.product-media-status {
  min-height: 1.1rem;
  margin-top: 0.5rem;
  color: var(--brand-muted);
  font-size: 0.73rem;
}

.product-video-card {
  max-width: 720px;
}

.product-video-preview-wrap {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid #e2e8e4;
  border-radius: 0.55rem;
  background: #18211c;
}

.product-video-preview {
  display: block;
  width: 100%;
  max-height: 400px;
  min-height: 220px;
  background: #18211c;
}

.product-video-placeholder {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.6rem;
  color: var(--brand-muted);
  background: #f4f7f5;
}

.product-video-placeholder svg {
  width: 3rem;
  height: 3rem;
  color: var(--brand-green);
}

.product-video-card.is-empty .product-video-preview,
.product-video-card.has-preview-error .product-video-preview {
  visibility: hidden;
}

.product-video-card.is-empty .product-video-placeholder,
.product-video-card.has-preview-error .product-video-placeholder {
  display: flex;
}

.photo-editor-modal {
  overflow: hidden;
}

.photo-editor-hint {
  margin-top: 0.15rem;
  color: var(--brand-muted);
  font-size: 0.8rem;
}

.photo-editor-stage {
  display: flex;
  justify-content: center;
  padding: 1rem;
  border-radius: 0.6rem;
  background: repeating-conic-gradient(#dce2de 0 25%, #edf1ee 0 50%) 50% / 20px 20px;
}

#productCropCanvas {
  display: block;
  width: min(400px, 100%);
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: 0.2rem;
  box-shadow: 0 6px 24px rgba(13, 31, 20, 0.22);
  cursor: grab;
  touch-action: none;
}

#productCropCanvas.is-dragging {
  cursor: grabbing;
}

.photo-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.photo-output-size {
  margin-right: auto;
  color: var(--brand-muted);
  font-size: 0.8rem;
}

.product-list-thumbnail {
  width: 3rem;
  height: 3.75rem;
  object-fit: cover;
  border: 1px solid #e1e7e3;
  border-radius: 0.4rem;
  background: #f4f7f5;
}

.category-media-card {
  max-width: 280px;
}

.required-field-missing:not(.product-media-card) {
  border-color: #c93f3f !important;
  box-shadow: 0 0 0 0.2rem rgba(201, 63, 63, 0.14) !important;
}

.product-media-card.required-field-missing {
  border-color: #c93f3f;
  box-shadow: 0 0 0 0.22rem rgba(201, 63, 63, 0.14);
}

.record-dialog {
  overflow: hidden;
  border: 0;
  border-radius: 0.85rem;
  box-shadow: 0 18px 55px rgba(20, 38, 27, 0.2);
}

.record-dialog-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 800;
}

.record-dialog-icon-warning {
  color: #9b3b25;
  background: #fff0e9;
}

.record-dialog-icon-confirm {
  color: var(--brand-green);
  background: #e8f3ea;
}

.required-fields-list {
  margin: 0;
  padding-left: 1.25rem;
  color: #9b3b25;
  font-weight: 600;
}

/* ---------- Client-side product data table ---------- */
.product-table-panel {
  padding: 0;
  overflow: hidden;
}

.product-table-summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #ebe1ce;
  background: #fffcf7;
}

.product-global-search {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.product-global-search label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--brand-green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.product-search-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.product-global-search .form-control {
  width: min(100%, 420px);
  min-height: 46px;
}

.product-global-search .form-control:focus,
.product-page-jump .form-control:focus,
.product-table-controls .form-select:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 0.2rem rgba(166, 139, 63, 0.18);
}

.product-total-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-dark));
  box-shadow: 0 5px 14px rgba(31, 61, 43, 0.16);
  white-space: nowrap;
}

.product-total-icon {
  color: #efd27d;
  font-size: 1.15rem;
}

.product-table-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eef0ee;
}

.product-client-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.product-client-filters label:not(.product-low-stock-filter),
.product-page-size span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--brand-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.product-low-stock-filter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  margin: 0;
  font-size: 0.86rem;
}

.product-low-stock-filter .form-check-input:checked {
  border-color: var(--brand-green);
  background-color: var(--brand-green);
}

.product-reset-button,
.product-edit-button {
  border: 1px solid #91ad98;
  color: var(--brand-green-dark);
  background: #fff;
  font-weight: 600;
}

.product-reset-button:hover,
.product-edit-button:hover {
  border-color: var(--brand-green);
  color: var(--brand-green-dark);
  background: var(--brand-green-light);
}

.product-add-button,
.product-go-button {
  box-shadow: 0 3px 9px rgba(46, 107, 62, 0.16);
}

.product-page-size {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
  white-space: nowrap;
}

.product-page-size span {
  margin: 0;
  color: var(--brand-text);
  text-transform: none;
  font-weight: 400;
}

.product-page-size .form-select {
  width: 76px;
}

.product-table-scroll {
  overflow-x: auto;
  padding: 1rem 1rem 0;
}

.product-table-description {
  overflow: hidden;
  max-width: 320px;
  margin-top: 0.2rem;
  color: var(--brand-muted);
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-mrp {
  margin-right: 0.35rem;
  font-size: 0.82rem;
  text-decoration: line-through;
}

.product-row-actions {
  white-space: nowrap;
}

.product-filter-empty {
  padding: 2.5rem 1rem;
}

.product-table-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.15rem 1.5rem 1.35rem;
  border-top: 1px solid #eef0ee;
  background: #fffcf7;
}

.product-result-info {
  align-self: flex-start;
  color: var(--brand-muted);
  font-size: 0.82rem;
}

.product-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.product-page-button {
  min-width: 40px;
  height: 40px;
  padding: 0 0.8rem;
  border: 1px solid #e2e3e5;
  border-radius: 999px;
  color: var(--brand-green-dark);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.product-page-button:hover:not(:disabled):not(.is-active) {
  border-color: var(--brand-gold);
  color: var(--brand-green-dark);
  background: #fbf7e9;
}

.product-page-button.is-active {
  border-color: var(--brand-gold);
  color: #fff;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-dark));
  box-shadow: 0 0 0 2px rgba(166, 139, 63, 0.2);
}

.product-page-button:disabled {
  color: #a4aea7;
  background: #f2f4f2;
  cursor: not-allowed;
}

.product-page-ellipsis {
  padding: 0 0.3rem;
  color: var(--brand-gold);
}

.product-page-jump {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--brand-green-dark);
}

.product-page-jump label {
  margin: 0;
}

.product-page-jump .form-control {
  width: 64px;
}

@media (max-width: 767.98px) {
  .product-table-summary,
  .product-global-search {
    align-items: stretch;
    flex-direction: column;
  }
  .product-total-card { align-self: stretch; justify-content: center; }
  .product-page-size { margin-left: 0; }
  .product-result-info { align-self: center; text-align: center; }
}

@media (max-width: 575.98px) {
  .photo-editor-stage { padding: 0.45rem; }
  .photo-editor-toolbar .btn { flex: 1 1 30%; }
  .photo-output-size { width: 100%; margin-bottom: 0.45rem; }
}

/* Product Variants */
#variantRowsContainer {
  counter-reset: variant-counter;
}

.variant-row {
  counter-increment: variant-counter;
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  padding: 2.1rem 1rem 1rem;
  margin-bottom: 0.9rem;
  background: #fafafa;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.variant-row:focus-within {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--brand-green-light);
}

.variant-row::before {
  content: "Variant " counter(variant-counter);
  position: absolute;
  top: 0.7rem;
  left: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-green-dark);
  background: var(--brand-green-light);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.variant-row-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
}

.variant-active-field,
.variant-remove-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.variant-remove-field {
  align-items: flex-start;
}

.variant-stock-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.47rem 0.75rem;
  border: 1px solid #dcdfe3;
  border-radius: 0.4rem;
  background: #f3f4f6;
  font-size: 0.9rem;
}

.variant-stock-readonly .btn-link {
  font-size: 0.82rem;
  text-decoration: none;
}

.variant-empty-state {
  border: 1px dashed #d7dade;
  border-radius: 0.6rem;
  margin-bottom: 0.9rem;
}

@media (max-width: 900px) {
  .variant-row-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =====================================================================
   Mobile responsiveness — applies across every Admin page. Each rule
   below only takes effect under its breakpoint, so desktop layout is
   unchanged and no page markup or functionality is altered.
   ===================================================================== */

/* ---------- Off-canvas sidebar (tablet and below) ---------- */
@media (max-width: 991.98px) {
  .admin-menu-toggle {
    display: inline-flex;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
    max-width: 82vw;
  }

  .admin-shell.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 18, 0.45);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .admin-shell.sidebar-open .admin-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* JS toggles this on <body> while the mobile sidebar is open, so the page behind the
   off-canvas drawer can't scroll (kept in JS rather than a :has() selector for broader
   browser support). */
body.admin-sidebar-locked {
  overflow: hidden;
}

@media (max-width: 420px) {
  .admin-sidebar {
    max-width: 88vw;
  }
}

/* ---------- General page chrome ---------- */
@media (max-width: 767.98px) {
  body {
    overflow-x: hidden;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-topbar {
    padding: 0.75rem 1rem;
  }

  .admin-footer {
    padding: 0.65rem 1rem;
  }

  .user-menu-name {
    display: none;
  }

  h2 {
    font-size: 1.35rem;
  }

  /* The common "title + action button" page header used across Index pages. */
  .d-flex.justify-content-between {
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }

  .form-section-header {
    padding: 0.9rem 1.1rem;
  }

  .form-section-body {
    padding: 1.1rem;
  }

  .panel-card {
    padding: 1rem;
  }

  .invoice-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .roadmap-step {
    padding-left: 1.6rem;
  }
}

/* ---------- Tables: allow horizontal scroll instead of overflow/cutoff ---------- */
@media (max-width: 767.98px) {
  .data-table,
  .demand-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Dropdowns: never let a fixed-width panel overflow the viewport ---------- */
@media (max-width: 575.98px) {
  .dropdown-menu {
    max-width: calc(100vw - 2rem);
  }

  .notif-dropdown {
    width: calc(100vw - 2rem);
    max-width: 340px;
  }

  .user-menu-panel {
    min-width: 0;
    width: calc(100vw - 2rem);
    max-width: 300px;
  }
}

/* ---------- Forms and variant rows ---------- */
@media (max-width: 575.98px) {
  .variant-row-grid {
    grid-template-columns: 1fr;
  }

  .variant-remove-field,
  .variant-active-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .product-media-card,
  .product-video-card {
    padding: 0.7rem;
  }

  .product-media-actions .btn {
    flex: 1 1 auto;
  }

  .product-form-actions {
    flex-wrap: wrap;
  }

  .product-form-actions .btn {
    flex: 1 1 0;
  }
}

/* ---------- Filter bars, table toolbars and pagination ---------- */
@media (max-width: 575.98px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar > * {
    width: 100%;
  }

  .product-table-summary {
    padding: 1rem;
  }

  .product-global-search .form-control {
    width: 100%;
  }

  .product-table-controls {
    padding: 0.85rem 1rem;
  }

  .product-client-filters {
    width: 100%;
  }

  .product-client-filters > * {
    flex: 1 1 45%;
  }

  .product-table-footer {
    padding: 1rem;
  }

  .product-page-jump {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ---------- Modals ---------- */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.6rem;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
  }
}
