:root {
  --ms-bg: #f5f1e8;
  --ms-bg-2: #fbf8f2;
  --ms-card: rgba(255, 255, 255, 0.82);
  --ms-surface: #fffdf9;
  --ms-surface-2: #f7efe0;
  --ms-border: rgba(80, 60, 28, 0.14);
  --ms-text: #1f2937;
  --ms-text-soft: #5f6473;
  --ms-gold: #c89a4f;
  --ms-gold-deep: #8c692b;
  --ms-shadow: 0 24px 70px rgba(50, 39, 20, 0.13);
  --ms-sidebar: #183d3a;
  --ms-sidebar-soft: #244e4b;
  --ms-revenue: linear-gradient(135deg, #d8b067 0%, #bf903a 100%);
  --ms-sales: linear-gradient(135deg, #d8b067 0%, #b47b2f 100%);
  --ms-orders: linear-gradient(135deg, #87b6b0 0%, #5d8e86 100%);
  --ms-expense: linear-gradient(135deg, #d98a6a 0%, #b95d42 100%);
  --ms-balance: linear-gradient(135deg, #7fb5c6 0%, #4a8ca3 100%);
  --ms-panel: #f7f4ee;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(200, 154, 79, 0.22), transparent 32%),
    linear-gradient(135deg, var(--ms-bg) 0%, var(--ms-bg-2) 100%);
  color: var(--ms-text);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  display: block;
  padding: 0;
}

#root {
  width: 100%;
  min-height: 100vh;
}

#root > div {
  width: 100%;
  min-height: 100vh;
}

#root form {
  display: grid;
  gap: 1rem;
}

#root form > div,
#root form > section,
#root form > label {
  display: grid;
  gap: 0.45rem;
}

/* Login-only polish: keep auth card centered and narrow without breaking dashboard layout */
#root > div > form,
#root > div > div > form,
#root > div > section > form,
#root > div > div:first-child > form {
  max-width: 430px;
  margin: 120px auto;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(80, 60, 28, 0.14);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(50, 39, 20, 0.13);
  padding: 28px 24px 20px;
}

#root > div > form h1,
#root > div > div > form h1,
#root > div > section > form h1,
#root > div > div:first-child > form h1 {
  font-size: clamp(2rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ms-text);
  margin: 0 0 0.7rem;
}

#root > div > form p,
#root > div > div > form p,
#root > div > section > form p,
#root > div > div:first-child > form p {
  margin: 0;
  color: var(--ms-text-soft);
  line-height: 1.6;
}

#root label,
#root small,
#root .text,
#root .placeholder,
#root .MuiInputLabel-root,
#root .field-label {
  color: var(--ms-text-soft);
}

#root input,
#root textarea,
#root select {
  width: 100%;
  border: 1px solid rgba(120, 92, 58, 0.18);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  padding: 0.82rem 0.95rem;
  font-size: 0.96rem;
  color: var(--ms-text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#root input:focus,
#root textarea:focus,
#root select:focus {
  outline: none;
  border-color: rgba(200, 154, 79, 0.75);
  box-shadow: 0 0 0 4px rgba(200, 154, 79, 0.12);
}

#root button,
#root [type="submit"],
#root button[type="button"] {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 14px;
  min-height: 48px;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--ms-gold) 0%, var(--ms-gold-deep) 100%);
  box-shadow: 0 14px 24px rgba(143, 105, 43, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

#root button:hover,
#root [type="submit"]:hover,
#root button[type="button"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(143, 105, 43, 0.24);
  filter: saturate(1.04);
}

#root .logo-wrap,
#root .logo,
#root .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#root .logo img,
#root .brand img,
#root img[alt="logo"],
#root img[alt="MiniShopBD"] {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(42, 33, 21, 0.12);
}

#root [class*="error"],
#root [class*="alert"],
#root [class*="warning"] {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 205, 121, 0.12);
  border: 1px solid rgba(188, 136, 59, 0.2);
  color: var(--ms-gold-deep);
}

@media (max-width: 1024px) {
  #root > div > form,
  #root > div > div > form,
  #root > div > section > form,
  #root > div > div:first-child > form {
    margin: 80px auto 48px;
    max-width: 92vw;
  }
}

@media (max-width: 540px) {
  #root > div > form,
  #root > div > div > form,
  #root > div > section > form,
  #root > div > div:first-child > form {
    max-width: calc(100vw - 32px);
    margin: 40px auto;
    border-radius: 18px;
    padding: 22px 16px 18px;
  }
}

.ms-product-tags {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(120, 92, 58, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.ms-product-tags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ms-product-tags-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ms-text);
}

.ms-product-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ms-tag-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 92, 58, 0.18);
  background: white;
  color: var(--ms-text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.ms-tag-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ms-tag-option:has(input:checked) {
  border-color: rgba(119, 170, 152, 0.7);
  background: rgba(92, 140, 128, 0.12);
  color: #234b40;
  box-shadow: 0 0 0 3px rgba(92, 140, 128, 0.08);
}

.ms-tag-option[data-tone="best_seller"]:has(input:checked) {
  background: rgba(244, 178, 54, 0.14);
  border-color: rgba(208, 138, 34, 0.55);
  color: #855c00;
}

.ms-tag-option[data-tone="hot"]:has(input:checked) {
  background: rgba(238, 96, 96, 0.12);
  border-color: rgba(201, 65, 65, 0.5);
  color: #8f2d2d;
}

.ms-tag-option[data-tone="new"]:has(input:checked) {
  background: rgba(71, 175, 122, 0.12);
  border-color: rgba(46, 144, 92, 0.5);
  color: #2b6b4e;
}

.ms-tag-option[data-tone="upcoming"]:has(input:checked) {
  background: rgba(76, 130, 255, 0.12);
  border-color: rgba(59, 105, 214, 0.5);
  color: #244fa8;
}

.ms-tag-option[data-tone="featured"]:has(input:checked) {
  background: rgba(165, 104, 255, 0.12);
  border-color: rgba(137, 86, 217, 0.5);
  color: #5d3e9a;
}

.ms-tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
  opacity: 0.9;
}

/* Dashboard foundation: keep the existing component structure, but restore clear
   page-level layout and neutral surfaces after the bundled utility styles load. */
#root .min-h-screen {
  min-height: 100vh !important;
  background: #f8fafc !important;
  color: #111827 !important;
}

#root .min-h-screen > div {
  min-width: 0 !important;
}

#root aside {
  width: 256px !important;
  min-width: 256px !important;
  background: #111827 !important;
  color: #f9fafb !important;
  border-right: 1px solid #1f2937 !important;
}

#root main {
  min-width: 0 !important;
  background: #f8fafc !important;
  color: #111827 !important;
}

#root main > div,
#root main .p-8,
#root main .p-6 {
  max-width: 1440px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 28px 32px !important;
}

#root main h1,
#root main h2,
#root main h3,
#root main h4 {
  color: #111827 !important;
  letter-spacing: -0.025em !important;
}

#root main p,
#root main label,
#root main .text-gray-500,
#root main .text-gray-600,
#root main .text-slate-500,
#root main .text-slate-600 {
  color: #64748b !important;
}

#root main .grid {
  min-width: 0 !important;
}

#root main .grid > * {
  min-width: 0 !important;
}

#root main .bg-white {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05) !important;
}

#root main .bg-primary-600,
#root main .bg-primary-700,
#root main .bg-primary-800,
#root main .bg-primary-900 {
  background: #f97316 !important;
  color: #ffffff !important;
}

#root main .bg-primary-50,
#root main .bg-orange-50 {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}

#root main .text-primary-600,
#root main .text-primary-700,
#root main .text-orange-600,
#root main .text-orange-700 {
  color: #ea580c !important;
}

#root main .border-gray-200,
#root main .border-gray-300,
#root main .border-primary-200 {
  border-color: #e5e7eb !important;
}

#root main table {
  width: 100% !important;
  min-width: 620px !important;
}

#root main .overflow-x-auto {
  max-width: 100% !important;
  overflow-x: auto !important;
}

#root main button {
  border-radius: 8px !important;
  box-shadow: none !important;
}

#root main button.bg-primary-600,
#root main button.bg-primary-700,
#root main a.bg-primary-600,
#root main a.bg-primary-700 {
  background: #f97316 !important;
  color: #ffffff !important;
}

#root main input,
#root main textarea,
#root main select {
  min-width: 0 !important;
  border-color: #d1d5db !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

@media (max-width: 1023px) {
  #root aside {
    width: 78px !important;
    min-width: 78px !important;
  }

  #root main > div,
  #root main .p-8,
  #root main .p-6 {
    padding: 24px !important;
  }
}

@media (max-width: 767px) {
  #root aside {
    display: none !important;
  }

  #root main > div,
  #root main .p-8,
  #root main .p-6 {
    padding: 18px 16px !important;
  }

  #root main .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #root main .flex {
    flex-wrap: wrap !important;
  }

  #root main h1 {
    font-size: 1.65rem !important;
  }
}

.ms-tone-revenue {
  background: linear-gradient(135deg, #d9b777 0%, #ba8540 100%) !important;
  color: #fff !important;
}

.ms-tone-order {
  background: linear-gradient(135deg, #8bc2b8 0%, #5b938a 100%) !important;
  color: #fff !important;
}

.ms-tone-expense {
  background: linear-gradient(135deg, #e4a487 0%, #bf6a4c 100%) !important;
  color: #fff !important;
}

.ms-tone-balance {
  background: linear-gradient(135deg, #9ac0d7 0%, #5f8ca9 100%) !important;
  color: #fff !important;
}

.ms-product-tags {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(120, 92, 58, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.ms-product-tags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ms-product-tags-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ms-text);
}

.ms-product-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ms-tag-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 92, 58, 0.18);
  background: white;
  color: var(--ms-text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.ms-tag-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ms-tag-option:has(input:checked) {
  border-color: rgba(119, 170, 152, 0.7);
  background: rgba(92, 140, 128, 0.12);
  color: #234b40;
  box-shadow: 0 0 0 3px rgba(92, 140, 128, 0.08);
}

.ms-tag-option[data-tone="best_seller"]:has(input:checked) {
  background: rgba(244, 178, 54, 0.14);
  border-color: rgba(208, 138, 34, 0.55);
  color: #855c00;
}

.ms-tag-option[data-tone="hot"]:has(input:checked) {
  background: rgba(238, 96, 96, 0.12);
  border-color: rgba(201, 65, 65, 0.5);
  color: #8f2d2d;
}

.ms-tag-option[data-tone="new"]:has(input:checked) {
  background: rgba(71, 175, 122, 0.12);
  border-color: rgba(46, 144, 92, 0.5);
  color: #2b6b4e;
}

.ms-tag-option[data-tone="upcoming"]:has(input:checked) {
  background: rgba(76, 130, 255, 0.12);
  border-color: rgba(59, 105, 214, 0.5);
  color: #244fa8;
}

.ms-tag-option[data-tone="featured"]:has(input:checked) {
  background: rgba(165, 104, 255, 0.12);
  border-color: rgba(137, 86, 217, 0.5);
  color: #5d3e9a;
}

.ms-tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
  opacity: 0.9;
}
