:root {
  --bg: #fdfbf7;
  --surface: #ffffff;
  --stage: #f5f1e8;
  --orange: #f97316;
  --orange-deep: #ea580c;
  --yellow: #facc15;
  --accent-grad: linear-gradient(135deg, #facc15 0%, #f97316 100%);
  --accent-soft: #fff7ed;
  --nav-dark: #171412;
  --text: #1c1917;
  --muted: #78716c;
  --border: #ebe5d9;
  --danger: #b42318;
  --shadow-sm: 0 6px 20px rgba(23, 20, 18, 0.05);
  --font-display: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="dark"] {
  --bg: #110f0d;
  --surface: #1b1815;
  --stage: #24201c;
  --accent-soft: #2c1d11;
  --nav-dark: #0a0908;
  --text: #f5efe6;
  --muted: #a89f95;
  --border: #2e2924;
  --shadow-sm: 0 6px 22px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Branded Splash & Login Loader */
.admin-splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at 30% 20%, #2a1f14 0%, #14110f 65%, #0c0a09 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.admin-splash.hide {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.admin-splash-emblem {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 0 46px rgba(249, 115, 22, 0.28);
}

.admin-splash-emblem::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 30px;
  border: 2px solid transparent;
  border-top-color: var(--yellow);
  border-right-color: var(--orange);
  animation: adminSpin 1.3s linear infinite;
}

@keyframes adminSpin {
  to { transform: rotate(360deg); }
}

.splash-brand-text {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-sub-text {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d6cfc7;
}

/* Container & Sticky Topbar */
.admin-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 14px 64px;
  overflow-x: clip;
}

@media (min-width: 768px) {
  .admin-shell {
    padding: 0 28px 72px;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 -14px 18px;
  padding: 12px 14px;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .topbar {
  background: rgba(17, 15, 13, 0.92);
}

@media (min-width: 768px) {
  .topbar {
    margin: 0 -28px 22px;
    padding: 14px 28px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

@media (max-width: 440px) {
  .brand-sub {
    display: none;
  }
  .brand-title {
    font-size: 0.96rem;
  }
  .topbar-actions .btn-sm {
    padding: 6px 10px;
    font-size: 0.72rem;
  }
}

.icon-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Cards & Forms */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.login-wrap {
  max-width: 430px;
  margin: 40px auto;
  padding: 0;
  overflow: hidden;
}

.login-hero {
  position: relative;
  height: 160px;
  background: #171412;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  color: #fff;
}

.login-hero img.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.58;
}

.login-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 13, 10, 0.22) 0%, rgba(16, 13, 10, 0.92) 100%);
}

.login-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-body {
  padding: 22px;
}

label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.94rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.field {
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-grad);
  color: #171412;
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.25);
}

.btn-secondary {
  background: var(--stage);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
}

/* Hero Stats Banner */
.admin-hero {
  position: relative;
  border-radius: 22px;
  padding: 18px;
  color: #fff;
  background: #171412;
  overflow: hidden;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 768px) {
  .admin-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
  }
}

.admin-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.38;
}

.admin-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, rgba(16, 13, 10, 0.92) 0%, rgba(28, 20, 12, 0.72) 60%, rgba(234, 88, 12, 0.35) 100%);
}

.admin-hero-content {
  position: relative;
  z-index: 2;
}

.admin-hero-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 14px;
  padding: 10px 12px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--yellow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-lbl {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.82);
}

/* Segmented Tabs + Action Bar */
.toolbar-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 560px) {
  .toolbar-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 100%;
}

@media (min-width: 560px) {
  .tabs {
    width: auto;
  }
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--nav-dark);
  color: var(--yellow);
}

/* Inventory List Cards */
.inventory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 760px) {
  .inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  min-width: 0;
}

@media (min-width: 480px) {
  .list-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.list-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.list-item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--stage);
  flex-shrink: 0;
}

/* 80% Screen Focused Editor Sheet */
.editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 13, 10, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.editor-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 720px;
  height: 82dvh;
  max-height: 86dvh;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  animation: sheetUp 0.22s ease both;
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.editor-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.editor-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.editor-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.editor-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: var(--surface);
}

.cat-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  max-height: 180px;
  overflow-y: auto;
}

.cat-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.cat-check input {
  width: auto;
  accent-color: var(--orange-deep);
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.upload-drop {
  border: 1.5px dashed var(--orange);
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  overflow: hidden;
}

.upload-drop input[type="file"] {
  max-width: 100%;
}

.img-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.img-preview-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.upload-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.upload-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--stage);
  overflow: hidden;
}

.upload-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-grad);
  transition: width 0.15s ease;
}

.error-msg {
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 600;
  margin-top: 8px;
}

.status-msg {
  color: var(--orange-deep);
  font-size: 0.84rem;
  font-weight: 600;
  margin-top: 8px;
}

/* On-page Toast Notification */
.admin-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 120;
  background: var(--nav-dark);
  color: var(--yellow);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
