:root {
  --bg: #f4f7ff;
  --surface: #ffffff;
  --surface-alt: #edf3ff;
  --sidebar: #0d1830;
  --sidebar-soft: rgba(255,255,255,0.08);
  --primary: #1f4ef5;
  --primary-soft: rgba(31,78,245,0.1);
  --secondary: #7b61ff;
  --success: #19b37e;
  --warning: #ffb648;
  --danger: #ff6d7d;
  --text: #18253f;
  --muted: #687a95;
  --border: rgba(24,37,63,0.08);
  --shadow: 0 20px 40px rgba(13,24,48,0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(180deg, #eef4ff 0%, #f7f9ff 100%);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

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

img {
  max-width: 100%;
  display: block;
}

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

.sidebar {
  background: linear-gradient(180deg, #0b1428 0%, #10213f 100%);
  color: rgba(255,255,255,0.9);
  padding: 28px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-wrap {
  padding: 8px 4px 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f65ff, #38d9be);
  color: #fff;
  box-shadow: 0 12px 25px rgba(47,101,255,0.35);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,0.76);
  font-weight: 600;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.side-card {
  margin-top: auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px 16px;
}

.muted {
  margin: 0 0 6px;
  color: rgba(255,255,255,0.68);
}

.small {
  font-size: 0.8rem;
}

.side-card strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  margin: 12px 0 8px;
}

.progress span {
  display: block;
  width: 92%;
  height: 100%;
  background: linear-gradient(90deg, #2f65ff, #47d5c3);
  border-radius: inherit;
}

.main-panel {
  padding: 28px 28px 36px;
}

.dashboard-status {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.dashboard-status.error {
  background: rgba(255, 109, 125, 0.12);
  color: #b92c42;
  border-color: rgba(255, 109, 125, 0.3);
}

.dashboard-status.success {
  background: rgba(25, 179, 126, 0.12);
  color: #0d8a5f;
  border-color: rgba(25, 179, 126, 0.3);
}

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

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.06em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  cursor: pointer;
}

.logout-btn {
  border: none;
  background: rgba(255, 109, 125, 0.12);
  color: #b92c42;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
}

.user-badge img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
}

.user-badge strong,
.user-badge small {
  display: block;
}

.user-badge small {
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.stat-card {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}

.stat-card.primary {
  background: linear-gradient(135deg, #1f4ef5, #3b6af8);
  color: #fff;
}

.stat-card.primary p,
.stat-card.primary .stat-head span {
  color: rgba(255,255,255,0.8);
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: var(--muted);
}

.stat-card.primary .stat-head {
  color: rgba(255,255,255,0.8);
}

.stat-card h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 2vw, 2.5rem);
  letter-spacing: -0.06em;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.content-grid,
.lower-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 22px;
  margin-bottom: 22px;
}

.panel {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
}

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

.panel-header h3 {
  margin: 0;
  font-size: 1.4rem;
}

.text-btn,
.small-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.chart-area {
  height: 220px;
  display: flex;
  align-items: end;
  padding: 18px 10px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f5f8ff 0%, #eef3ff 100%);
}

.bars {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.bars span {
  flex: 1;
  display: block;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #8ea7ff 0%, #305ef7 100%);
  min-height: 20%;
}

.payment-form {
  display: grid;
  gap: 16px;
}

.payment-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.payment-form input,
.payment-form select,
.payment-form textarea {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fbff;
  color: var(--text);
}

.payment-form textarea {
  min-height: 110px;
  resize: vertical;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--primary), #3f72ff);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(31,78,245,0.22);
}

.block {
  width: 100%;
}

.list-table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 0.7fr;
  gap: 10px;
  align-items: center;
  padding: 12px 10px;
  border-radius: 12px;
  background: #f7faff;
  color: var(--text);
}

.table-row.head {
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.success,
.pending {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
}

.success {
  background: rgba(25,179,126,0.12);
  color: var(--success);
}

.pending {
  background: rgba(255,182,72,0.12);
  color: #d88b00;
}

.cards-stack {
  display: grid;
  gap: 18px;
}

.virtual-card {
  border-radius: 22px;
  padding: 18px 18px 14px;
  color: #fff;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.virtual-card.blue {
  background: linear-gradient(135deg, #1d3c72, #2c69ff);
}

.virtual-card.purple {
  background: linear-gradient(135deg, #4738a4, #7b61ff);
}

.chip {
  width: 44px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffe49a, #f6c96b);
}

.card-top,
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  opacity: 0.95;
}

.virtual-card strong {
  font-size: 1.7rem;
  letter-spacing: 0.14em;
}

.settings-panel {
  margin-top: 8px;
}

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

.setting-box {
  background: #f7faff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}

.setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #dfe8ff;
  border-radius: 999px;
  transition: 0.25s ease;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,25,48,0.18);
  transition: 0.25s ease;
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::before {
  transform: translateX(22px);
}

.small-btn {
  background: rgba(31,78,245,0.08);
  border-radius: 10px;
  padding: 9px 12px;
}

.check-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.check-inline input {
  width: auto;
  margin: 0;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-preview-wrap {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fbff;
  display: grid;
  gap: 10px;
}

.image-preview-wrap img {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: none;
}

.product-table {
  margin-top: 14px;
}

.product-head,
.product-row {
  grid-template-columns: 1.8fr 0.9fr 0.8fr 1.2fr 0.8fr 1.2fr;
}

.product-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.product-status.live {
  color: #0e8f62;
  background: rgba(25, 179, 126, 0.16);
}

.product-status.hidden {
  color: #a86a14;
  background: rgba(255, 182, 72, 0.2);
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.product-thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.product-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-code-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
}

.row-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
}

.row-btn.toggle.live {
  background: rgba(255, 182, 72, 0.2);
  color: #8f5a0d;
}

.row-btn.toggle.hidden {
  background: rgba(25, 179, 126, 0.16);
  color: #0d8a5f;
}

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

  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    padding-bottom: 14px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .main-panel {
    padding: 18px 16px 24px;
  }

  .stats-grid,
  .settings-grid,
  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .table-row {
    grid-template-columns: 1fr 1fr;
  }

  .product-row {
    grid-template-columns: 1fr;
  }

  .table-row.head {
    display: none;
  }

  .user-badge {
    padding: 6px 10px 6px 6px;
  }
}
