:root {
  --bg: #070708;
  --bg-soft: #0d0d10;
  --panel: rgba(18, 18, 21, 0.92);
  --panel-light: rgba(255, 255, 255, 0.04);
  --line: rgba(212, 175, 55, 0.18);
  --gold: #d4af37;
  --gold-soft: #f0d895;
  --text: #f6f2e8;
  --muted: #b6ae97;
  --danger: #ff8d8d;
  --success: #9bdfb0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --transition: 220ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: clip;
}

body.sidebar-open,
body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.admin-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 12%, rgba(212, 175, 55, 0.09), transparent 18%),
    radial-gradient(circle at 82% 8%, rgba(212, 175, 55, 0.07), transparent 16%),
    linear-gradient(180deg, #0a0a0b 0%, #070708 45%, #0d0d10 100%);
}

.brand-mark,
.store-pill,
.icon-btn,
.btn,
.panel-card,
.stat-card,
.login-card,
.modal-card {
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(244, 213, 122, 0.25), rgba(244, 213, 122, 0.06));
  border: 1px solid rgba(244, 213, 122, 0.22);
  color: var(--gold-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
}

.sidebar-kicker {
  display: inline-block;
  color: var(--gold-soft);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.btn,
.icon-btn {
  border: 1px solid rgba(212, 175, 55, 0.16);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 213, 122, 0.35);
}

.btn {
  padding: 13px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, #f0d895, #d4af37);
  color: #1c1303;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  color: var(--gold-soft);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(560px, 100%);
  padding: clamp(28px, 5vw, 42px);
  border-radius: 32px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.login-brand strong,
.login-card h1,
.sidebar-head h2,
.panel-head h3,
.store-pill {
  font-family: Georgia, "Times New Roman", serif;
}

.login-brand strong {
  font-size: 1.35rem;
  color: var(--gold-soft);
}

.login-brand small {
  display: block;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 24px 0 12px;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 1;
}

.login-card p,
.toast-inline,
.field span,
.preview-card p,
.store-summary p {
  color: var(--muted);
}

.login-card p {
  margin: 0 0 26px;
  line-height: 1.8;
}

.login-form,
.settings-form,
.product-form {
  display: grid;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(13, 13, 16, 0.96);
  color: var(--text);
  outline: 0;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(244, 213, 122, 0.42);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.login-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.login-hint span {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.12);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(212, 175, 55, 0.1);
  background: rgba(10, 10, 12, 0.92);
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.sidebar-head h2 {
  margin: 0;
  font-size: 2rem;
}

.sidebar-close {
  display: none;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}

.nav-link {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
}

.nav-link.active,
.nav-link:hover {
  border-color: rgba(244, 213, 122, 0.22);
  background: rgba(244, 213, 122, 0.08);
  color: var(--gold-soft);
}

.external-link {
  display: inline-flex;
  align-items: center;
}

.sidebar-credit {
  position: absolute;
  bottom: 22px;
  left: 22px;
  right: 22px;
  color: var(--muted);
}

.admin-main-shell {
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  backdrop-filter: blur(12px);
  background: rgba(7, 7, 8, 0.82);
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-left h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.store-pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gold-soft);
}

.admin-content {
  padding: 24px;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.stats-grid,
.overview-grid,
.settings-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.overview-grid {
  margin-top: 18px;
  grid-template-columns: 1.1fr 0.9fr;
}

.settings-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.stat-card,
.panel-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--gold-soft);
}

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

.panel-head h3 {
  margin: 0;
  font-size: 1.7rem;
}

.recent-orders,
.store-summary,
.preview-card {
  display: grid;
  gap: 14px;
}

.recent-order-item,
.summary-line {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.1);
}

.recent-order-item strong,
.preview-card strong {
  display: block;
  margin-bottom: 4px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.summary-line strong {
  color: var(--text);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
}

.table-product {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: center;
}

.table-product img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 14px;
}

.table-product strong {
  display: block;
  margin-bottom: 4px;
}

.table-product span,
.muted-text,
.status-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.badge-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pill {
  background: rgba(244, 213, 122, 0.1);
  color: var(--gold-soft);
  border: 1px solid rgba(244, 213, 122, 0.2);
}

.status-pill.active {
  background: rgba(127, 215, 150, 0.1);
  color: var(--success);
}

.status-pill.inactive,
.status-pill.cancelled {
  background: rgba(255, 141, 141, 0.12);
  color: var(--danger);
}

.status-pill.pending {
  background: rgba(244, 213, 122, 0.1);
  color: var(--gold-soft);
}

.status-pill.confirmed,
.status-pill.delivered {
  background: rgba(127, 215, 150, 0.1);
  color: var(--success);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-actions button,
.table-actions select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.danger-btn {
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: span 2;
}

.checkbox-field {
  justify-content: end;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.toggle-line input {
  accent-color: var(--gold);
}

.image-preview {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 22px;
  border: 1px dashed rgba(212, 175, 55, 0.22);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.image-preview img {
  max-height: 260px;
  border-radius: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.preview-card,
.order-detail-grid {
  padding-top: 6px;
}

.preview-card a {
  color: var(--gold-soft);
}

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(4, 4, 5, 0.66);
  backdrop-filter: blur(4px);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 12px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 5, 0.76);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1000px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.98);
}

.order-products-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.order-product-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.order-product-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
}

.toast,
.toast-inline {
  font-size: 0.94rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 32;
  transform: translate(-50%, 22px);
  opacity: 0;
  pointer-events: none;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid rgba(244, 213, 122, 0.2);
  background: rgba(10, 10, 12, 0.96);
  transition: opacity var(--transition), transform var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, calc(100% - 48px));
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 24;
  }

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

  .sidebar-close {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .admin-content,
  .admin-topbar {
    padding-inline: 16px;
  }

  .topbar-right {
    gap: 10px;
  }

  .store-pill {
    display: none;
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .modal-card {
    padding: 18px;
    border-radius: 24px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
}

/* Final mobile polish for admin screens */
@media (max-width: 560px) {
  .login-shell {
    padding: 16px;
  }

  .admin-content,
  .admin-topbar {
    padding-inline: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .stat-card,
  .panel-card {
    padding: 16px;
    border-radius: 20px;
  }

  .table-product {
    grid-template-columns: 50px 1fr;
  }

  .table-product img {
    width: 50px;
    height: 50px;
  }

  .order-product-item {
    grid-template-columns: 54px 1fr;
  }

  .order-product-item img {
    width: 54px;
    height: 54px;
  }

  .order-product-item strong:last-child {
    grid-column: 2;
  }
}
