/* ================================================
   ADMIN PANEL — admin.css
   Professional. Mobile-first. Touch-optimized.
   Tokens live in :root — edit once, applies everywhere.
================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --accent:        #4f46e5;
  --accent-hover:  #4338ca;
  --accent-light:  #eef2ff;
  --accent-soft:   rgba(79,70,229,.14);
  --accent-2:      #6366f1;

  /* Neutrals */
  --sidebar-bg:      #0f172a;
  --sidebar-bg-2:    #16213a;
  --sidebar-text:    #94a3b8;
  --sidebar-hover:   #1e293b;
  --sidebar-active:  var(--accent);

  --page-bg:       #f4f6f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e6e9ef;
  --border-strong: #d8dde6;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;

  /* Status */
  --red:      #dc2626;
  --red-bg:   #fef2f2;
  --red-line: #fecaca;
  --green:      #16a34a;
  --green-bg:   #f0fdf4;
  --green-line: #bbf7d0;
  --amber:      #d97706;
  --amber-bg:   #fffbeb;
  --amber-line: #fde68a;

  /* Layout */
  --sidebar-w:     232px;
  --topbar-h:      58px;
  --bottom-nav-h:  62px;
  --radius:        12px;
  --radius-sm:     9px;
  --radius-lg:     18px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 6px 16px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.06);
  --shadow-lg: 0 16px 40px rgba(15,23,42,.16), 0 4px 12px rgba(15,23,42,.08);
  --shadow-fab: 0 8px 20px rgba(79,70,229,.35), 0 2px 6px rgba(79,70,229,.25);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --ease: .18s cubic-bezier(.4,0,.2,1);
  --ease-spring: .28s cubic-bezier(.34,1.56,.64,1);

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a    { text-decoration: none; color: inherit; }
img  { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
button { -webkit-appearance: none; appearance: none; background: none; border: none; }
::selection { background: var(--accent-soft); }

/* Utility visibility (JS-free, pure CSS breakpoint control) */
.show-desktop { display: none; }
.show-mobile  { display: initial; }


/* ================================================
   LOGIN PAGE
================================================ */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(circle at 20% 10%, #eef2ff 0%, var(--page-bg) 45%);
}

.login-card {
  width: 100%;
  max-width: 388px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 38px 30px 32px;
  box-shadow: var(--shadow-lg);
  animation: cardIn .4s var(--ease-spring);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.login-brand-icon,
.sidebar-brand-icon,
.topbar-logo-icon {
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: 0 3px 10px rgba(79,70,229,.35);
}

.login-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand span {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}

.login-card h1 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: -.4px;
}

.login-card .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none;
}

.field input::placeholder { color: var(--text-faint); }

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-pw-wrap { position: relative; }
.field-pw-wrap input { padding-right: 42px; }

.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--ease);
}
.pw-toggle:active { color: var(--accent); }
.pw-toggle svg { width: 18px; height: 18px; }

.btn-login {
  width: 100%;
  padding: 13px;
  margin-top: 8px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease), opacity var(--ease);
  box-shadow: 0 6px 16px rgba(79,70,229,.3);
}

.btn-login:active { transform: scale(.98); opacity: .93; }

.alert-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  animation: shake .35s var(--ease);
}
.alert-error svg { flex-shrink: 0; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}


/* ================================================
   SHELL — mobile base (bottom nav)
================================================ */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 10px;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.topbar-logo-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.topbar-logo span {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}

.topbar-page {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Bottom tab bar — mobile nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,.9);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  transition: color var(--ease);
  position: relative;
}

.bottom-nav a.active { color: var(--accent); }

.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: 2px;
  width: 26px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--accent);
}

.bottom-nav a svg {
  width: 21px; height: 21px;
  transition: transform var(--ease-spring);
}

.bottom-nav a:active svg { transform: scale(.85); }

/* Sidebar — hidden on mobile */
.sidebar { display: none; }

/* Main content */
.main {
  padding-top: calc(var(--topbar-h) + var(--safe-top) + 16px);
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 84px);
  padding-left: 14px;
  padding-right: 14px;
  max-width: 1400px;
}


/* ================================================
   PAGE HEADER
================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.page-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}


/* ================================================
   STAT STRIP
================================================ */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 17px; height: 17px; }

.stat-icon.blue   { background: var(--accent-light); color: var(--accent); }
.stat-icon.green  { background: var(--green-bg); color: var(--green); }
.stat-icon.amber  { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red    { background: var(--red-bg); color: var(--red); }

.stat-text { min-width: 0; }

.stat-item .num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -.3px;
}

.stat-item .label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ================================================
   SEARCH
================================================ */

.search-row {
  position: relative;
  margin-bottom: 16px;
}

.search-row svg.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  width: 17px; height: 17px;
}

.search-row input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--ease), box-shadow var(--ease);
  -webkit-appearance: none;
}

.search-row input::placeholder { color: var(--text-faint); }

.search-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: 50%;
  cursor: pointer;
}
.search-clear.show { display: flex; }
.search-clear:active { background: var(--surface-2); }
.search-clear svg { width: 15px; height: 15px; }

.search-no-results {
  display: none;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.search-no-results.show { display: block; }


/* ================================================
   PRODUCT LIST — mobile cards
================================================ */

.product-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.product-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  cursor: pointer;
  position: relative;
}

.product-row:active {
  transform: scale(.985);
  background: var(--surface-2);
}

.product-thumb {
  position: relative;
  flex-shrink: 0;
}

.product-row img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.stock-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.stock-dot.in    { background: var(--green); }
.stock-dot.low   { background: var(--amber); }
.stock-dot.out   { background: var(--red); }

.product-meta {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  letter-spacing: -.1px;
}

.product-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.product-price {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
}

.product-price-old {
  font-size: 11.5px;
  color: var(--text-faint);
  text-decoration: line-through;
  font-weight: 500;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Desktop table — hidden on mobile */
.table-wrap { display: none; }


/* ================================================
   BADGES
================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-red    { background: var(--red-bg);   color: var(--red); }
.badge-amber  { background: var(--amber-bg); color: var(--amber); }
.badge-accent { background: var(--accent-light); color: var(--accent); }


/* ================================================
   BUTTONS
================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  transition: background var(--ease), opacity var(--ease), transform var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(.97); opacity: .92; }

.btn-primary { background: var(--accent); box-shadow: 0 4px 10px rgba(79,70,229,.25); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger  { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn .spinner { display: none; }
.btn.loading .btn-label { opacity: 0; }
.btn.loading .spinner {
  display: block;
  position: absolute;
}
.btn.loading { position: relative; pointer-events: none; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* icon-only */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  line-height: 0;
  box-shadow: none;
}

.btn-icon.edit {
  background: var(--accent-light);
  color: var(--accent);
}
.btn-icon.edit:hover { background: #e0e7ff; }

.btn-icon.del {
  background: var(--red-bg);
  color: var(--red);
}
.btn-icon.del:hover { background: #fee2e2; }


/* ================================================
   FAB — mobile quick-add
================================================ */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 90;
  transition: transform var(--ease-spring);
}
.fab:active { transform: scale(.9); }
.fab svg { width: 24px; height: 24px; }


/* ================================================
   TOASTS
================================================ */

.toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(94vw, 380px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease-spring);
}

.toast.hide { animation: toastOut .25s var(--ease) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(.95); }
}

.toast-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.toast.success .toast-icon { background: rgba(22,163,74,.25); color: #4ade80; }
.toast.error   .toast-icon { background: rgba(220,38,38,.25); color: #f87171; }
.toast-icon svg { width: 12px; height: 12px; }


/* ================================================
   MODAL / BOTTOM SHEET (delete confirmation)
================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 400;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; animation: overlayIn .2s var(--ease); }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheetIn .3s var(--ease-spring);
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px; height: 4px;
  border-radius: 4px;
  background: var(--border-strong);
  margin: 0 auto 18px;
}

.modal-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--red-bg);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.modal-icon svg { width: 22px; height: 22px; }

.modal-sheet h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}

.modal-sheet p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.modal-sheet p strong { color: var(--text); font-weight: 700; }

.modal-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.modal-actions .btn {
  width: 100%;
  padding: 13px;
  font-size: 14.5px;
}


/* ================================================
   FORMS
================================================ */

.form-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.section-title {
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-title svg { width: 14px; height: 14px; color: var(--accent); }

.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -10px;
  margin-bottom: 16px;
}

.form-group { margin-bottom: 15px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.req { color: var(--red); margin-left: 2px; }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Prefix input (₹ symbol) ── */
.input-prefix-wrap { position: relative; }

.input-prefix {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
}

.input-prefix-wrap input { padding-left: 28px; }

/* ── Image upload grid ── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upload-box {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px dashed var(--border-strong);
  background: var(--surface-2);
  transition: border-color var(--ease), background var(--ease);
}

.upload-box.has-file { border-style: solid; border-color: var(--accent); }

.upload-box:has(.upload-input:focus-visible) {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 3;
}

.upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  position: relative;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 12px;
  pointer-events: none;
  transition: opacity var(--ease);
}

.upload-placeholder svg { opacity: .45; }
.upload-placeholder em { font-style: normal; color: var(--accent); }

.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.upload-preview.has-image { display: block; }
.upload-preview.has-image + .upload-placeholder { display: none; }

.upload-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px; height: 24px;
  background: rgba(15,23,42,.65);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4;
}
.upload-box.has-file .upload-remove { display: flex; }
.upload-remove svg { width: 13px; height: 13px; }

.upload-badge-main {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 3px 6px;
  border-radius: 5px;
  z-index: 4;
}

.upload-box:hover { border-color: var(--accent); }

/* ── Bottom action bar ── */
.form-actions-bar {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.btn-submit {
  flex: 1;
  padding: 14px;
  font-size: 15px;
}

.form-actions-bar .btn-ghost {
  padding: 14px 20px;
  font-size: 15px;
}


/* ================================================
   EMPTY STATE
================================================ */

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 13.5px;
  margin-bottom: 18px;
}


/* ================================================
   DESKTOP ≥ 800px
   Sidebar replaces bottom nav + topbar brand
================================================ */

@media (min-width: 800px) {

  .show-desktop { display: initial; }
  .show-mobile  { display: none !important; }

  .bottom-nav { display: none; }
  .fab { display: none; }
  .topbar-logo { display: none; }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
    z-index: 200;
    overflow-y: auto;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    margin-bottom: 10px;
  }

  .sidebar-brand-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  .sidebar-brand span {
    font-size: 15.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.2px;
  }

  .sidebar-nav { flex: 1; padding: 4px 12px; }

  .sidebar-nav-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #64748b;
    padding: 12px 12px 8px;
  }

  .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    transition: background var(--ease), color var(--ease);
  }

  .sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }

  .sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }

  .sidebar-nav a.active {
    background: linear-gradient(145deg, var(--accent-2), var(--accent));
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.35);
  }

  .sidebar-footer {
    padding: 12px 12px 22px;
    border-top: 1px solid rgba(255,255,255,.06);
  }

  .sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
    transition: background var(--ease), color var(--ease);
  }
  .sidebar-footer a:hover { background: #7f1d1d33; color: #fca5a5; }
  .sidebar-footer a svg { width: 17px; height: 17px; }

  .topbar {
    left: var(--sidebar-w);
    padding-top: 0;
    height: var(--topbar-h);
  }

  .main {
    margin-left: var(--sidebar-w);
    padding: calc(var(--topbar-h) + 26px) 32px 40px;
    padding-bottom: 40px;
  }

  .toast-container { top: calc(var(--topbar-h) + 14px); left: auto; right: 28px; transform: none; }

  .modal-overlay { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius-lg);
    padding: 26px 26px 22px;
  }
  .modal-handle { display: none; }
  .modal-actions { flex-direction: row-reverse; }

  .stat-strip { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .stat-item { padding: 18px 20px; }
  .stat-icon { width: 40px; height: 40px; }

  .page-title { font-size: 24px; }

  /* Show table, hide card list */
  .table-wrap  { display: block; }
  .product-list { display: none; }

  .table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-xs);
  }

  table { width: 100%; border-collapse: collapse; min-width: 640px; }

  thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }

  tbody td {
    padding: 12px 18px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }

  tbody tr:last-child td { border-bottom: none; }
  tbody tr { transition: background var(--ease); }
  tbody tr:hover { background: var(--surface-2); }

  .table-name { font-weight: 700; color: var(--text); }
  .table-brand { font-size: 12px; color: var(--text-muted); }

  td img {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
  }

  .td-actions { display: flex; gap: 8px; align-items: center; }
  .td-actions .btn { padding: 8px 13px; font-size: 12.5px; }

  .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

  .upload-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .btn-submit { flex: 0 1 auto; min-width: 170px; }

  .form-surface { padding: 24px; margin-bottom: 16px; }
}

@media (min-width: 1100px) {
  .main { padding-left: 40px; padding-right: 40px; }
}


/* ================================================
   REDUCED MOTION
================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
