:root {
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-lg: 0 24px 60px rgba(3, 8, 28, 0.32);
  --shadow-md: 0 14px 32px rgba(3, 8, 28, 0.22);
  --container-width: 1280px;
  --transition-fast: 180ms ease;
  --transition-normal: 280ms ease;
  --font-stack: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg-1: #12091f;
  --bg-2: #1a1040;
  --bg-3: #0f1b39;
  --bg-4: #241444;

  --surface: rgba(46, 33, 79, 0.82);
  --surface-strong: rgba(56, 42, 96, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --topbar-bg: rgba(14, 9, 32, 0.72);

  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-main: #f8f7ff;
  --text-soft: #cfc9e8;
  --text-muted: #9e97bd;
  --text-heading: #ffffff;

  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --accent-3: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #fb7185;

  --chip-bg: rgba(255, 255, 255, 0.07);
  --badge-bg: #2f7cf7;
  --card-glow: rgba(139, 92, 246, 0.25);
}

:root[data-theme="light"] {
  --bg-1: #f3f7ff;
  --bg-2: #e8efff;
  --bg-3: #eef4ff;
  --bg-4: #dfe9ff;

  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(27, 31, 59, 0.04);
  --topbar-bg: rgba(255, 255, 255, 0.72);

  --border: rgba(57, 70, 110, 0.12);
  --border-strong: rgba(57, 70, 110, 0.18);

  --text-main: #1f2544;
  --text-soft: #4c567d;
  --text-muted: #6f7a9f;
  --text-heading: #12172d;

  --accent: #7c3aed;
  --accent-2: #0ea5e9;
  --accent-3: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #e11d48;

  --chip-bg: rgba(37, 99, 235, 0.08);
  --badge-bg: #2563eb;
  --card-glow: rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-main);
  font-family: var(--font-stack);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.32), transparent 34%),
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.18), transparent 30%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 48%, var(--bg-3) 100%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.24;
  pointer-events: none;
  z-index: 0;
  animation: floatBlob 16s ease-in-out infinite;
}

body::before {
  top: 10%;
  left: -90px;
  background: rgba(139, 92, 246, 0.55);
}

body::after {
  right: -110px;
  bottom: 8%;
  background: rgba(34, 211, 238, 0.30);
  animation-delay: -6s;
}

@keyframes floatBlob {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-20px) scale(1.06);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.container-shell {
  width: min(var(--container-width), calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(64, 41, 150, 0.28);
}

.brand-overline {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-heading);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--text-soft);
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--text-heading);
  background: var(--surface-soft);
}

.theme-toggle,
.status-pill {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--chip-bg);
  color: var(--text-heading);
  font-weight: 700;
}

.theme-toggle {
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.42);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

.hero-section {
  padding: 54px 0 20px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 420px);
  gap: 28px;
  align-items: start;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-heading);
}

.hero-eyebrow {
  margin-bottom: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.hero-lead {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: 1.08rem;
  color: var(--text-soft);
}

.hero-service-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.service-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text-soft);
  font-weight: 700;
}

.hero-side-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.side-panel-title,
.section-title {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.runtime-mini-list {
  display: grid;
  gap: 12px;
}

.runtime-mini-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.runtime-mini-list div:last-child {
  border-bottom: 0;
}

.runtime-mini-list strong {
  color: var(--text-heading);
}

.content-stack {
  display: grid;
  gap: 20px;
  padding-bottom: 56px;
}

.alert-panel {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid transparent;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.alert-list {
  margin: 10px 0 0 18px;
}

.alert-success-panel {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.28);
  color: var(--text-heading);
}

.alert-danger-panel {
  background: rgba(251, 113, 133, 0.18);
  border-color: rgba(251, 113, 133, 0.28);
  color: var(--text-heading);
}

.alert-warning-panel {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--text-heading);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.summary-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: auto auto -32px -20px;
  width: 120px;
  height: 120px;
  background: var(--card-glow);
  filter: blur(36px);
  opacity: 0.55;
  pointer-events: none;
}

.summary-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 900;
  color: var(--text-heading);
  margin-bottom: 10px;
}

.summary-text {
  color: var(--text-soft);
  font-size: 1rem;
}

.summary-card-accent .summary-value {
  color: var(--accent-2);
}

.summary-card-success .summary-value {
  color: var(--success);
}

.summary-card-info .summary-value {
  color: var(--accent);
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.data-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
  background-color: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.45rem;
  color: var(--text-heading);
  font-weight: 800;
}

.count-badge {
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  background: var(--badge-bg);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
}

.count-badge-cyan {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
}

.count-badge-green {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.panel-body {
  padding: 0;
  flex: 1;
}

.entity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entity-item {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.entity-item:last-child {
  border-bottom: 0;
}

.entity-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.entity-item-product {
  padding-bottom: 16px;
}

.entity-title {
  color: var(--text-heading);
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.entity-subtitle {
  color: var(--text-soft);
  font-size: 0.98rem;
}

.entity-meta {
  margin-top: 8px;
  color: var(--text-muted);
  font-weight: 700;
}

.entity-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.price-pill {
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.price-pill-green {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.empty-state {
  min-height: 220px;
  margin: 18px;
  border-radius: 18px;
  border: 1px dashed var(--border-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
}

.empty-state-soft {
  flex-direction: column;
  gap: 8px;
}

.empty-state-title {
  color: var(--text-heading);
  font-size: 1.15rem;
  font-weight: 800;
}

.empty-state-text {
  color: var(--text-soft);
  max-width: 280px;
}

.runtime-section {
  display: grid;
  gap: 12px;
}

.runtime-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.runtime-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.runtime-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-heading);
}

.runtime-card span {
  color: var(--text-soft);
}

.cta-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  background-color: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.cta-copy h3 {
  margin: 4px 0 10px;
  color: var(--text-heading);
  font-size: 1.9rem;
  font-weight: 900;
}

.cta-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
}

.cta-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.primary-btn {
  min-width: 210px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  padding: 0 22px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 48%, #22d3ee 100%);
  box-shadow: 0 18px 32px rgba(99, 102, 241, 0.30);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 22px 36px rgba(99, 102, 241, 0.35);
}

.primary-btn:active {
  transform: translateY(0);
}

@media (max-width: 1200px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .runtime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar-inner,
  .topbar-actions {
    align-items: flex-start;
  }

  .topbar-inner {
    flex-direction: column;
  }

  .cta-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-form {
    justify-content: stretch;
  }

  .primary-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container-shell {
    width: min(100% - 24px, var(--container-width));
  }

  .summary-grid,
  .runtime-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: 2.4rem;
  }

  .entity-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    gap: 8px;
  }
}
/* v2.0.9 layout refinement:
   Products become the primary shop area, orders become a right activity panel,
   customers move below as supporting customer context.
*/
@media (min-width: 1201px) {
  .data-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(340px, 0.9fr);
    grid-template-areas:
      "products products orders"
      "customers customers orders";
    align-items: stretch;
  }

  #products {
    grid-area: products;
    min-height: 360px;
  }

  #customers {
    grid-area: customers;
    min-height: 260px;
  }

  #orders {
    grid-area: orders;
    min-height: 640px;
  }

  #products .panel-body {
    display: block;
  }

  #products .entity-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #products .entity-item {
    border-bottom: 0;
    border-right: 1px solid var(--border);
    min-height: 190px;
  }

  #products .entity-item:nth-child(3n) {
    border-right: 0;
  }

  #customers .entity-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #customers .entity-item {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  #customers .entity-item:nth-child(2n) {
    border-right: 0;
  }
}

/* v2.0.10 responsive viewport refinement
   Goal:
   - wide monitors use more horizontal space
   - laptop layout stays balanced
   - tablet/mobile stack cleanly
*/

:root {
  --container-width: 1680px;
}

.container-shell {
  width: clamp(320px, 88vw, var(--container-width));
}

/* Summary cards adapt to available width instead of fixed 4-column behavior only */
.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

/* Better large-screen layout */
@media (min-width: 1400px) {
  .hero-section {
    padding: 44px 0 24px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 460px);
  }

  .data-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(380px, 0.85fr);
    grid-template-areas:
      "products products orders"
      "customers customers orders";
    gap: 24px;
  }

  #products {
    grid-area: products;
  }

  #customers {
    grid-area: customers;
  }

  #orders {
    grid-area: orders;
  }

  #products .entity-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  #products .entity-item {
    min-height: 180px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  #products .entity-item:last-child {
    border-right: 0;
  }

  #customers .entity-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  #customers .entity-item {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  #customers .entity-item:last-child {
    border-right: 0;
  }

  .data-panel {
    min-height: 430px;
  }

  #orders {
    min-height: 650px;
  }
}

/* Ultra-wide monitors: use space, but do not stretch text too much */
@media (min-width: 1800px) {
  :root {
    --container-width: 1760px;
  }

  .container-shell {
    width: clamp(320px, 84vw, var(--container-width));
  }

  .data-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.35fr) minmax(420px, 0.8fr);
  }

  .summary-card {
    padding: 26px;
  }

  .entity-item {
    padding: 22px;
  }
}

/* Laptop / medium screens */
@media (max-width: 1399px) {
  .container-shell {
    width: min(1180px, calc(100% - 48px));
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .data-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: none;
  }

  #products,
  #customers,
  #orders {
    grid-area: auto;
  }

  #products .entity-list,
  #customers .entity-list {
    display: block;
  }

  #products .entity-item,
  #customers .entity-item {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

/* Smaller laptops / tablets */
@media (max-width: 1100px) {
  .data-grid {
    grid-template-columns: 1fr;
  }

  .data-panel {
    min-height: auto;
  }

  #orders {
    min-height: auto;
  }

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

  .topbar-actions {
    justify-content: flex-start;
  }
}

/* Phones */
@media (max-width: 640px) {
  .container-shell {
    width: min(100% - 24px, var(--container-width));
  }

  .hero-section {
    padding: 34px 0 18px;
  }

  .hero-copy h1 {
    font-size: 2.25rem;
  }

  .hero-lead {
    font-size: 0.98rem;
  }

  .summary-grid,
  .runtime-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
  }

  .theme-toggle,
  .status-pill {
    height: 40px;
    padding: 0 12px;
    font-size: 0.86rem;
  }

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

  .price-pill {
    margin-top: 6px;
  }

  .cta-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-form,
  .primary-btn {
    width: 100%;
  }
}

/* Shop order form
   Keeps the order creation flow visually aligned with the dashboard cards. */

.shop-order-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1.5fr) minmax(110px, 0.5fr) auto;
  gap: 14px;
  align-items: end;
  width: 100%;
}

.shop-form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.shop-form-field label {
  color: var(--muted-text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-form-field select,
.shop-form-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(12, 9, 34, 0.72);
  color: var(--text);
  font-size: 0.86rem;
  outline: none;
  padding: 0 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.shop-form-field select:focus,
.shop-form-field input:focus {
  border-color: rgba(45, 212, 255, 0.7);
  box-shadow:
    0 0 0 3px rgba(45, 212, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.shop-form-field select option {
  background: #1d153f;
  color: #ffffff;
}

.shop-order-button {
  min-height: 44px;
  padding-left: 22px;
  padding-right: 22px;
  white-space: nowrap;
}

.shop-order-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1100px) {
  .shop-order-form {
    grid-template-columns: 1fr 1fr;
  }

  .shop-form-field-quantity {
    max-width: 180px;
  }

  .shop-order-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .shop-order-form {
    grid-template-columns: 1fr;
  }

  .shop-form-field-quantity {
    max-width: none;
  }
}
