:root {
  --teal-primary: #014d4e;     /* Sidebar, headers, primary buttons */
  --amber-secondary: #ffbf00;  /* Hover, highlights, warning alerts */
  --emerald-accent: #046307;   /* Success states */
  --burgundy-alert: #800020;   /* Critical alerts */
  --black-text: #000000;       /* Text */
  --offwhite-canvas: #f8f8f5;  /* Background canvas */

  /* Aliases for legacy selectors */
  --emerald: var(--emerald-accent);
  --deep-emerald: var(--emerald-accent);
  --amber: var(--amber-secondary);
  --offwhite: var(--offwhite-canvas);
}

/* === Reset + Base === */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--offwhite);
  color: var(--black-text);
}

/* === Dashboard Layout (desktop) === */
.dashboard {
  display: grid;
  grid-template-columns: 220px 1fr; /* unified width */
  min-height: 100vh;
  background-color: var(--offwhite-canvas);
}
.dashboard-main {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}
.content {
  flex: 1;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* === Sidebar (desktop) === */
.sidebar {
  width: 220px;
  background-color: var(--teal-primary);
  color: var(--offwhite-canvas);
  min-height: 100vh;
  padding: 1rem;
  overflow-y: auto;
  border-left: 4px solid var(--emerald-accent); /* ceremonial sideline */
}
.logo {
  width: 140px;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.logo-block {
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.menu-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.3s ease;
}
.menu-item i { margin-right: 10px; font-size: 18px; color: inherit; }
.menu-item:hover,
.menu-item.active { color: #ffffff; font-weight: 600; }

/* === Header === */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--offwhite-canvas);
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.search-container { flex: 1; margin-right: 1rem; min-width: 0; }
.search-bar {
  width: 100%;
  max-width: 300px;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.2);
  background-color: #ffffff;
  color: var(--black-text);
}
.search-bar:focus { outline: none; border-color: var(--emerald-accent); }

/* === Wallet Button === */
.wallet-btn {
  flex-shrink: 0;
  background-color: var(--teal-primary);
  color: var(--offwhite-canvas);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.wallet-btn:hover,
.connect-btn:hover {
  background-color: #013c3d; /* darker teal */
  color: var(--offwhite-canvas);
}
}
/* === Storefronts === */
.storefronts h2 { color: var(--emerald-accent); margin-bottom: 1rem; }
.storefront-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.storefront-card {
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.storefront-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* === Auctions & Payable === */
.auctions h2,
.payable h2,
.transaction-history h3 {
  color: var(--emerald-accent);
  margin-bottom: 1rem;
}
.auction-grid,
.payable-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.auction-card,
.summary-box {
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.auction-card:hover,
.summary-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  color: #ffffff;
}
.status.live { background-color: var(--emerald-accent); }
.status.ends-soon { background-color: var(--amber-secondary); color: var(--black-text); }
.summary-box span {
  display: block;
  font-size: 18px;
  margin-top: 0.25rem;
  color: var(--emerald-accent);
}
.transaction-history li {
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 14px;
}

/* === Steward Profile === */
.steward-profile h2 { color: var(--emerald-accent); margin-bottom: 1rem; }
.profile-card {
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 1rem;
}
.profile-info { display: flex; align-items: center; margin-bottom: 1rem; }
.profile-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-right: 1rem;
  border: 2px solid var(--emerald-accent);
}
.profile-stats { display: flex; gap: 1rem; margin-bottom: 1rem; }
.stat-box {
  flex: 1;
  background-color: var(--offwhite-canvas);
  border-radius: 6px;
  padding: 0.5rem;
  font-weight: 600;
  color: var(--black-text);
}
.stat-box span { color: var(--emerald-accent); }
.profile-badges { display: flex; gap: 0.5rem; }
.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  color: #ffffff;
}
.badge.emerald { background-color: var(--emerald-accent); }
.badge.amber { background-color: var(--amber-secondary); color: var(--black-text); }

/* === Footer === */
.dashboard-footer {
  text-align: center;
  padding: 1rem;
  background-color: var(--offwhite-canvas);
  border-top: 1px solid rgba(0,0,0,0.1);
  font-style: italic;
  color: var(--emerald-accent);
}

/* === Buttons & Alerts === */
.button,
.btn,
button {
  background-color: var(--teal-primary);
  color: var(--offwhite-canvas);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
/* Default buttons: teal stays teal */
.button,
.btn,
button {
  background-color: var(--teal-primary);
  color: var(--offwhite-canvas);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.button:hover,
.btn:hover,
button:hover {
  background-color: #013c3d; /* darker teal */
  color: var(--offwhite-canvas);
}

/* Success buttons: emerald */
.button.success,
.btn.success {
  background-color: var(--emerald-accent);
  color: #ffffff;
}
.button.success:hover,
.btn.success:hover {
  background-color: #035205; /* darker emerald */
}

/* Highlight buttons: amber */
.button.highlight,
.btn.highlight {
  background-color: var(--amber-secondary);
  color: var(--black-text);
}
.button.highlight:hover,
.btn.highlight:hover {
  background-color: #e6ac00; /* darker amber */
}
}
.button.success,
.btn.success {
  background-color: var(--emerald-accent);
  color: #ffffff;
}
.alert-warning {
  background-color: var(--amber-secondary);
  color: var(--black-text);
}
.alert-critical {
  background-color: var(--burgundy-alert);
  color: var(--offwhite-canvas);
}
/* === Tablet (max-width: 1024px) === */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 200px 1fr; /* narrower sidebar */
  }
  .logo {
    width: 110px; /* scale logo slightly */
  }
  .search-bar {
    max-width: 300px; /* keep search bar compact */
  }
  .content {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
}

/* === Mobile collapse & overflow control (authoritative) === */
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }

  .dashboard {
    display: block;              /* cancel grid */
    grid-template-columns: 1fr;  /* single column */
    width: 100%;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -220px;                /* hidden by default */
    width: 220px;                /* must match desktop width */
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    background-color: var(--teal-primary);
    color: var(--offwhite-canvas);
    border-left: none;           /* remove phantom line */
  }
  .sidebar.open {
    left: 0;                     /* slide in when toggled */
  }

  .dashboard-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .search-container {
    flex: 1 1 100%;
    margin-right: 0;
  }
  .search-bar {
    width: 100%;
    max-width: 100%;
  }
  .wallet-btn {
    width: 100%;
    text-align: center;
  }

  .content {
    display: block;
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }

  
  /* Cards and tabs: ensure they fit the viewport */
  .storefront-card,
  .auction-card,
  .summary-box,
  .profile-card,
  .tab,
  .store-card,
  .payable-card {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }

  /* Images and inputs: no overflow */
  .logo {
    width: 110px;
    max-width: 100%;
    height: auto;
  }
  .card input,
  .card select,
  .card textarea {
    width: 100%;
    max-width: 100%;
  }

  /* Footer: compact */
  .dashboard-footer {
    font-size: 12px;
    padding: 0.5rem;
  }
}