:root {
  /* 369 Platform brand — aligned with login premium palette */
  --md-sys-color-primary: #222222;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #FFF8E7;
  --md-sys-color-on-primary-container: #222222;
  --md-sys-color-secondary: #C9A227;
  --md-sys-color-on-secondary: #222222;
  --md-sys-color-secondary-container: rgba(201, 162, 39, 0.12);
  --md-sys-color-on-secondary-container: #5B4A1F;
  --md-sys-color-surface: rgba(255, 255, 255, 0.97);
  --md-sys-color-surface-container: rgba(255, 255, 255, 0.92);
  --md-sys-color-surface-container-high: rgba(247, 245, 239, 0.98);
  --md-sys-color-on-surface: #222222;
  --md-sys-color-on-surface-variant: #3A3A3A;
  --md-sys-color-outline: rgba(34, 34, 34, 0.18);
  --md-sys-color-outline-variant: rgba(201, 162, 39, 0.14);
  --md-sys-color-error: #b3261e;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-success: #146c2e;
  --md-sys-color-success-container: #c8e6c9;
  --md-sys-color-warning: #e65100;
  --md-sys-color-warning-container: #fff3e0;

  /* Glass tokens */
  --md-glass-surface: rgba(255, 255, 255, 0.88);
  --md-glass-border: rgba(201, 162, 39, 0.18);
  --md-glass-blur: 16px;

  /* Elevation */
  --md-elevation-1: 0 1px 2px rgba(34, 34, 34, 0.05), 0 1px 3px rgba(34, 34, 34, 0.04);
  --md-elevation-2: 0 2px 6px rgba(34, 34, 34, 0.07), 0 1px 4px rgba(34, 34, 34, 0.05);
  --md-elevation-3: 0 4px 12px rgba(34, 34, 34, 0.09);

  /* State layers */
  --md-state-hover: rgba(201, 162, 39, 0.08);
  --md-state-focus: rgba(201, 162, 39, 0.12);
  --md-state-pressed: rgba(34, 34, 34, 0.08);

  /* Shape */
  --md-shape-small: 8px;
  --md-shape-medium: 12px;
  --md-shape-large: 16px;
  --md-shape-extra-large: 28px;

  /* Typography */
  --md-font-family: "Cairo", Roboto, "Segoe UI", Tahoma, sans-serif;
  --md-font-title-large: 28px;
  --md-font-title-medium: 22px;
  --md-font-body-large: 16px;
  --md-font-body-medium: 14px;
  --md-font-label-medium: 12px;
}

.mfg-m3-theme,
.sysadv-m3-theme {
  font-family: var(--md-font-family);
  color: var(--md-sys-color-on-surface);
}

.mfg-m3-theme .m3-page-header,
.sysadv-m3-theme .m3-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mfg-m3-theme .m3-page-title,
.sysadv-m3-theme .m3-page-title {
  font-size: var(--md-font-title-large);
  font-weight: 500;
  line-height: 36px;
  margin: 0;
  color: var(--md-sys-color-on-surface);
}

.mfg-m3-theme .m3-breadcrumbs,
.sysadv-m3-theme .m3-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-font-body-medium);
  margin-bottom: 8px;
}

.mfg-m3-theme .m3-breadcrumbs a,
.sysadv-m3-theme .m3-breadcrumbs a {
  color: var(--md-sys-color-secondary);
  text-decoration: none;
}

.mfg-m3-theme .m3-breadcrumbs a:hover,
.sysadv-m3-theme .m3-breadcrumbs a:hover {
  text-decoration: underline;
}

.mfg-m3-theme .m3-subtitle,
.sysadv-m3-theme .m3-subtitle {
  font-size: var(--md-font-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin: 4px 0 0;
}

.mfg-m3-theme .m3-card,
.sysadv-m3-theme .m3-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-shape-large);
  box-shadow: var(--md-elevation-1);
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 20px;
  margin-bottom: 16px;
}

.mfg-m3-theme .m3-card-title,
.sysadv-m3-theme .m3-card-title {
  font-size: var(--md-font-title-medium);
  font-weight: 500;
  line-height: 28px;
  margin: 0 0 16px;
  color: var(--md-sys-color-on-surface);
}

.mfg-m3-theme .m3-filled-button,
.mfg-m3-theme .m3-outlined-button,
.mfg-m3-theme .m3-text-button,
.sysadv-m3-theme .m3-filled-button,
.sysadv-m3-theme .m3-outlined-button,
.sysadv-m3-theme .m3-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 24px;
  border-radius: 999px;
  border: none;
  font-size: var(--md-font-body-medium);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.mfg-m3-theme .m3-filled-button,
.sysadv-m3-theme .m3-filled-button {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.mfg-m3-theme .m3-filled-button:hover,
.sysadv-m3-theme .m3-filled-button:hover {
  background: #4b5563;
  color: var(--md-sys-color-on-primary);
}

.mfg-m3-theme .m3-outlined-button,
.sysadv-m3-theme .m3-outlined-button {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.mfg-m3-theme .m3-outlined-button:hover,
.sysadv-m3-theme .m3-outlined-button:hover {
  background: var(--md-state-hover);
}

.mfg-m3-theme .m3-text-button,
.sysadv-m3-theme .m3-text-button {
  background: transparent;
  color: var(--md-sys-color-secondary);
}

.mfg-m3-theme .m3-text-button:hover,
.sysadv-m3-theme .m3-text-button:hover {
  background: var(--md-state-hover);
}

.mfg-m3-theme .m3-chip,
.sysadv-m3-theme .m3-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-font-label-medium);
}

.mfg-m3-theme .m3-chip.success,
.sysadv-m3-theme .m3-chip.success {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-success);
}

.mfg-m3-theme .m3-chip.warning,
.sysadv-m3-theme .m3-chip.warning {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-warning);
}

.mfg-m3-theme .m3-chip.error,
.sysadv-m3-theme .m3-chip.error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
}

.mfg-m3-theme .m3-field,
.sysadv-m3-theme .m3-field {
  margin-bottom: 16px;
}

.mfg-m3-theme .m3-field label,
.sysadv-m3-theme .m3-field label {
  display: block;
  font-size: var(--md-font-label-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
}

.mfg-m3-theme .m3-field .form-control,
.mfg-m3-theme .m3-field select,
.sysadv-m3-theme .m3-field .form-control,
.sysadv-m3-theme .m3-field select {
  width: 100%;
  min-height: 44px;
  border-radius: var(--md-shape-medium);
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  padding: 10px 14px;
}

.mfg-m3-theme .m3-filters,
.sysadv-m3-theme .m3-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.mfg-m3-theme .m3-stat-grid,
.sysadv-m3-theme .m3-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.mfg-m3-theme .m3-stat-card,
.sysadv-m3-theme .m3-stat-card {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: var(--md-shape-large);
  padding: 16px;
  border: 1px solid rgba(243, 189, 13, 0.2);
}

.mfg-m3-theme .m3-stat-card .value,
.sysadv-m3-theme .m3-stat-card .value {
  font-size: 24px;
  font-weight: 600;
}

.mfg-m3-theme table.dataTable,
.sysadv-m3-theme table.dataTable {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
}

.mfg-m3-theme table.dataTable thead th,
.sysadv-m3-theme table.dataTable thead th {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  border-bottom: 1px solid var(--md-sys-color-outline);
}

.mfg-m3-theme table.dataTable tbody td,
.sysadv-m3-theme table.dataTable tbody td {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding: 12px 10px;
}

@media print {
  .mfg-m3-theme .no-print,
  .sysadv-m3-theme .no-print {
    display: none !important;
  }
}
