* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #0a0e16 0%, #0f1424 50%, #0a1220 100%);
  color: #e8ecf1;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  background: linear-gradient(180deg, #0d1522 0%, #0a0f1a 100%);
  padding: 24px 18px;
  border-right: 2px solid rgba(0, 230, 118, 0.08);
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.currency-switcher {
  margin-bottom: 22px;
}

.currency-switcher label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.currency-switcher select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e8ecf1;
  font-size: 14px;
}

.currency-switcher select:focus {
  outline: none;
  border-color: rgba(0, 230, 118, 0.28);
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.12);
}

.sidebar h3 {
  color: #00e676;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 28px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar button {
  width: 100%;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 230, 118, 0.12);
  padding: 14px 16px;
  color: #c8cfd8;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 200ms ease;
  text-align: left;
}

.sidebar button:hover {
  background: rgba(0, 230, 118, 0.08);
  border-color: rgba(0, 230, 118, 0.24);
  color: #00e676;
  transform: translateX(4px);
}

/* CONTENT */
.content {
  margin-left: 260px;
  padding: 32px 40px;
  background-image: 
    radial-gradient(ellipse at 20% 10%, rgba(0, 230, 118, 0.03) 0px, transparent 150px),
    radial-gradient(ellipse at 80% 90%, rgba(0, 150, 255, 0.02) 0px, transparent 180px);
}

h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 32px 0;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 230, 118, 0.1);
}

h3 {
  font-size: 16px;
  font-weight: 700;
  color: #00e676;
  margin: 0 0 12px 0;
}

/* PAGES */
.page { display: none; }
.active { display: block; animation: fadeInPage 300ms ease; }

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CARDS */
.card {
  background: linear-gradient(135deg, rgba(18, 28, 44, 0.6) 0%, rgba(15, 24, 40, 0.4) 100%);
  border: 1px solid rgba(0, 230, 118, 0.08);
  padding: 20px;
  margin: 14px 0;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 300ms ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 230, 118, 0.2), transparent);
}

.card:hover {
  border-color: rgba(0, 230, 118, 0.16);
  box-shadow: 0 12px 40px rgba(0, 230, 118, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

input {
  padding: 12px 16px;
  margin: 6px;
  width: 240px;
  border-radius: 12px;
  border: 1px solid rgba(0, 230, 118, 0.12);
  background: rgba(12, 18, 32, 0.8);
  color: #e8ecf1;
  font-size: 14px;
  font-weight: 500;
  transition: all 160ms ease;
}

input::placeholder {
  color: rgba(200, 207, 216, 0.5);
}

input:focus {
  outline: none;
  border-color: rgba(0, 230, 118, 0.28);
  background: rgba(12, 18, 32, 1);
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.12);
}

button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #00c853 0%, #00e676 100%);
  border: none;
  color: #0a0e16;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 200ms ease;
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.24);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 230, 118, 0.32);
}

button:active {
  transform: translateY(0);
}

.store-card {
  padding: 18px;
  background: rgba(5, 12, 24, 0.8);
}

.store-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.store-meta {
  min-width: 200px;
}

.store-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.store-details {
  font-size: 13px;
  color: #b0b8c3;
}

.store-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quantity-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(12, 18, 32, 0.9);
  border: 1px solid rgba(0, 230, 118, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
}

.quantity-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 230, 118, 0.12);
  color: #c8cfd8;
  font-size: 18px;
  border: 1px solid rgba(0, 230, 118, 0.16);
}

.quantity-controls span {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  color: #e8ecf1;
}

.store-toggle-btn {
  background: linear-gradient(135deg, #00e676 0%, #12ff9d 100%);
  color: #081012;
  min-width: 84px;
}

.store-toggle-btn:hover {
  background: linear-gradient(135deg, #00ff7a 0%, #18ffb0 100%);
}

.store-remove-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8f9fb;
  min-width: 84px;
}

.store-remove-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* INSIGHT / STATUS INDICATORS */
.insight {
  font-size: 14px;
  line-height: 1.8;
  position: relative;
  padding: 18px 18px 24px 18px;
  border-left: 4px solid rgba(0, 230, 118, 0.24);
}

.insight::before {
  content: "🏋️";
  position: absolute;
  right: 12px;
  top: -12px;
  font-size: 120px;
  opacity: 0.05;
  transform: rotate(-15deg);
  pointer-events: none;
}

.insight > div:first-child,
.insight > div:nth-child(2) {
  font-size: 15px;
  color: #a8adb7;
  margin-bottom: 8px;
  font-weight: 500;
}

.insight > div:first-child strong,
.insight > div:nth-child(2) strong {
  color: #00e676;
  font-weight: 700;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 230, 118, 0.4); }
  50% { transform: scale(1.2); box-shadow: 0 0 20px rgba(0, 230, 118, 0.6); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 230, 118, 0.4); }
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.status {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: all 220ms ease;
  min-width: 140px;
  color: #a8adb7;
  opacity: 0.5;
  border: 1px solid rgba(0, 230, 118, 0.06);
}

.status-item.active {
  opacity: 1;
  transform: translateY(-3px);
  background: rgba(0, 230, 118, 0.08);
  border-color: rgba(0, 230, 118, 0.2);
  box-shadow: 0 8px 24px rgba(0, 230, 118, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6b6f76;
  display: inline-block;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  flex: 0 0 auto;
  transition: all 160ms ease;
}

.status-dot.green {
  background: #00e676;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.4);
}

.status-dot.red {
  background: #ff5252;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.3);
}

.status-dot.inactive {
  filter: grayscale(1) opacity(0.4);
  box-shadow: none;
}

.status-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  color: inherit;
  opacity: 0.9;
  flex: 0 0 auto;
}

.status-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.status-label {
  color: #a8adb7;
  font-weight: 700;
  font-size: 13px;
  display: none;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-value {
  color: #00e676;
  font-weight: 700;
  font-size: 15px;
  display: none;
}

.status-item.active .status-label,
.status-item.active .status-value {
  display: inline-block;
}

.status-item.active .status-dot.green { animation: pulse 1.8s infinite ease-in-out; }
.status-item.active .status-dot.red { animation: heartbeat 1s infinite ease-in-out; }
.status-item .status-value { transition: opacity 180ms ease, transform 180ms ease; }
.status-item.active .status-value { animation: fadeInUp 240ms ease both; }

/* Forms, search, feedback */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.form-group input,
.search-box input {
  margin: 0;
}

.search-box {
  margin: 18px 0 8px;
}

.search-box input {
  width: min(100%, 420px);
}

.field-error {
  min-height: 20px;
  color: #ff8a8a;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 12px;
}

.empty-state {
  color: #a8adb7;
  padding: 18px 0;
  font-size: 14px;
}

.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.list-card strong {
  color: #fff;
  display: block;
  margin-bottom: 6px;
}

.list-card span {
  color: #a8adb7;
  display: inline-block;
  margin-right: 12px;
  font-size: 13px;
}

.list-card .member-id {
  color: #00e676;
  font-weight: 800;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-danger,
button.btn-danger {
  background: linear-gradient(135deg, #ff5252 0%, #ff7b7b 100%);
  color: #130708;
  box-shadow: 0 4px 16px rgba(255, 82, 82, 0.18);
}

.btn-secondary,
button.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8f9fb;
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

/* Toasts and dialogs */
#toast-container {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(16, 28, 44, 0.96);
  border: 1px solid rgba(0, 230, 118, 0.24);
  color: #e8ecf1;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  font-weight: 700;
  animation: fadeInUp 180ms ease both;
}

.toast-error {
  border-color: rgba(255, 82, 82, 0.4);
}

.toast-warning {
  border-color: rgba(255, 193, 7, 0.45);
}

.toast-fade {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 250ms ease, transform 250ms ease;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(480px, 100%);
  background: #101a2a;
  border: 1px solid rgba(0, 230, 118, 0.16);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.modal-content p {
  color: #c8cfd8;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.edit-field {
  display: block;
  margin-bottom: 12px;
}

.edit-field span {
  display: block;
  color: #a8adb7;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.edit-field input {
  width: 100%;
  margin: 0;
}

/* Dashboard stat cards */
.card:has(#mc),
.card:has(#rev),
.card:has(#active),
.card:has(#expiring),
.card:has(#sc),
.card:has(#eq) {
  font-size: 16px;
  font-weight: 600;
  color: #c8cfd8;
}

.card:has(span) span {
  color: #00e676;
  font-weight: 700;
  font-size: 18px;
}

@media (max-width: 820px) {
  body {
    background: #0a0e16;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(0, 230, 118, 0.12);
  }

  .sidebar h3,
  .currency-switcher {
    grid-column: 1 / -1;
    margin-bottom: 6px;
  }

  .sidebar button {
    margin-top: 0;
    text-align: center;
    padding: 12px 10px;
  }

  .sidebar button:hover {
    transform: none;
  }

  .content {
    margin-left: 0;
    padding: 22px 16px 36px;
  }

  h1 {
    font-size: 26px;
    margin-bottom: 20px;
  }

  input,
  .form-group input,
  .search-box input {
    width: 100%;
  }

  .form-group {
    align-items: stretch;
  }

  .form-group button,
  .modal-actions button {
    width: 100%;
  }

  .list-card,
  .store-row,
  .store-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions button,
  .store-actions button {
    flex: 1 1 auto;
  }

  .quantity-controls {
    justify-content: space-between;
    border-radius: 8px;
  }

  .status {
    align-items: stretch;
    flex-direction: column;
  }
}
