:root {
  --navy-950: #071629;
  --navy-900: #0b1e35;
  --navy-800: #102a49;
  --navy-700: #173a62;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --green-600: #16865b;
  --green-100: #dcfce7;
  --amber-600: #c27609;
  --amber-100: #fef3c7;
  --red-600: #d13b45;
  --red-100: #fee2e2;
  --purple-600: #7c3aed;
  --teal-600: #0f8b8d;
  --surface: #ffffff;
  --background: #f3f6fa;
  --border: #dfe6ee;
  --text: #172033;
  --muted: #667085;
  --sidebar-width: 276px;
  --shadow: 0 12px 30px rgba(15, 35, 60, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family:
    Inter,
    "Segoe UI",
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.mes-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.mes-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  overflow-y: auto;
  color: #dce8f6;
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.25),
      transparent 36%
    ),
    var(--navy-950);
}

.mes-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 88px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.mes-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--blue-600);
  font-size: 21px;
  font-weight: 800;
}

.mes-brand strong,
.mes-brand span {
  display: block;
}

.mes-brand strong {
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.12em;
}

.mes-brand span {
  margin-top: 4px;
  color: #91a5bc;
  font-size: 10px;
}

.mes-navigation {
  padding: 16px 14px 32px;
}

.mes-navigation-label {
  margin: 22px 12px 8px;
  color: #7188a2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mes-navigation-link {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 44px;
  margin-bottom: 4px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #b9c8d8;
  font-size: 13px;
  font-weight: 600;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.mes-navigation-link:hover,
.mes-navigation-link.is-active {
  color: #fff;
  background: rgba(37, 99, 235, 0.2);
}

.mes-navigation-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  color: #8cb7ff;
  font-size: 17px;
}

.mes-main {
  grid-column: 2;
  min-width: 0;
}

.mes-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.mes-menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.mes-topbar-title {
  display: flex;
  flex-direction: column;
  margin-right: auto;
}

.mes-topbar-title span {
  color: var(--muted);
  font-size: 11px;
}

.mes-topbar-title strong {
  margin-top: 2px;
  font-size: 15px;
}

.mes-user {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mes-user-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy-800);
  font-weight: 700;
}

.mes-user-details {
  display: flex;
  flex-direction: column;
}

.mes-user-details strong {
  font-size: 12px;
}

.mes-user-details span {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mes-logout-button {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}

.mes-content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-eyebrow,
.panel-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-600);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-heading-status {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.page-heading-status div {
  display: flex;
  flex-direction: column;
}

.page-heading-status small,
.page-heading-status span {
  color: var(--muted);
  font-size: 10px;
}

.page-heading-status strong {
  margin: 2px 0;
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

.status-dot-success {
  background: var(--green-600);
  box-shadow: 0 0 0 5px var(--green-100);
}

.status-dot-warning {
  background: var(--amber-600);
  box-shadow: 0 0 0 5px var(--amber-100);
}

.demo-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 14px 17px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  color: #1e3a5f;
  background: #eff6ff;
}

.demo-notice div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.demo-notice strong {
  font-size: 12px;
}

.demo-notice span {
  font-size: 11px;
  line-height: 1.5;
}

.demo-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--blue-100);
  font-weight: 700;
}

.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.dashboard-card {
  position: relative;
  min-height: 145px;
  overflow: hidden;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(15, 35, 60, 0.04);
}

.dashboard-card-accent {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
}

.accent-blue {
  background: var(--blue-600);
}

.accent-green {
  background: var(--green-600);
}

.accent-amber {
  background: var(--amber-600);
}

.accent-red {
  background: var(--red-600);
}

.accent-purple {
  background: var(--purple-600);
}

.accent-teal {
  background: var(--teal-600);
}

.dashboard-card-label,
.dashboard-card-detail {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.dashboard-card-value {
  display: block;
  margin: 11px 0 9px;
  color: var(--navy-950);
  font-size: 29px;
}

.dashboard-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.dashboard-side-column {
  display: grid;
  align-content: start;
  gap: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 17px;
}

.panel-status,
.qc-label {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--green-600);
  background: var(--green-100);
  font-size: 9px;
  font-weight: 800;
}

.stage-list {
  display: grid;
  gap: 17px;
}

.stage-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.stage-row-heading div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-row-heading strong {
  color: var(--text);
  font-size: 12px;
}

.stage-order {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 7px;
  color: var(--blue-600);
  background: var(--blue-100);
  font-size: 9px;
  font-weight: 800;
}

.stage-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.stage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(
      90deg,
      var(--blue-600),
      #60a5fa
    );
}

.integration-status {
  display: flex;
  gap: 14px;
  padding: 15px;
  border-radius: 11px;
  background: var(--amber-100);
}

.integration-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--amber-600);
  font-size: 20px;
}

.integration-status strong {
  font-size: 12px;
}

.integration-status p {
  margin: 5px 0 0;
  color: #775113;
  font-size: 10px;
  line-height: 1.5;
}

.status-list {
  margin: 15px 0 0;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.status-list div:last-child {
  border-bottom: 0;
}

.status-list dt,
.status-list dd {
  margin: 0;
  font-size: 10px;
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  text-align: right;
  font-weight: 700;
}

.activity-list {
  display: grid;
  gap: 16px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.activity-item div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activity-item strong {
  font-size: 11px;
}

.activity-item span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.activity-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-top: 3px;
  border-radius: 50%;
}

.activity-green {
  background: var(--green-600);
}

.activity-amber {
  background: var(--amber-600);
}

.activity-red {
  background: var(--red-600);
}

.dashboard-generated-at {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.placeholder-panel {
  display: grid;
  min-height: 380px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.placeholder-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 18px;
  color: var(--blue-600);
  background: var(--blue-100);
  font-size: 28px;
}

.placeholder-panel h2 {
  margin: 20px 0 5px;
}

.placeholder-panel p {
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.primary-button,
.login-button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--blue-600);
  font-weight: 700;
  cursor: pointer;
}

.login-page {
  background: var(--navy-950);
}

.login-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 100vh;
}

.login-brand-panel {
  display: grid;
  place-items: center;
  padding: 60px;
  color: #fff;
  background:
    linear-gradient(
      135deg,
      rgba(7, 22, 41, 0.96),
      rgba(16, 42, 73, 0.88)
    ),
    radial-gradient(
      circle at bottom right,
      #2563eb,
      transparent 52%
    );
}

.login-brand-content {
  max-width: 620px;
}

.login-logo {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 32px;
  place-items: center;
  border-radius: 17px;
  background: var(--blue-600);
  font-size: 28px;
  font-weight: 800;
}

.login-eyebrow {
  color: #7fb0ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-brand-content h1 {
  margin: 14px 0;
  font-size: clamp(32px, 4.5vw, 58px);
  line-height: 1.05;
}

.login-brand-content p {
  max-width: 570px;
  color: #afbed0;
  font-size: 15px;
  line-height: 1.8;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 35px;
  background: #fff;
}

.login-form {
  width: min(410px, 100%);
}

.login-form h2 {
  margin: 11px 0 8px;
  color: var(--navy-950);
  font-size: 27px;
}

.login-form > p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-form label {
  display: block;
  margin: 17px 0 7px;
  font-size: 11px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #cad4e0;
  border-radius: 8px;
  outline: 0;
}

.login-form input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.login-button {
  width: 100%;
  margin-top: 23px;
}

.form-error,
.mes-message {
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 11px;
}

.empty-state {
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1300px) {
  .dashboard-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .mes-layout {
    display: block;
  }

  .mes-sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .mes-sidebar.is-open {
    transform: translateX(0);
  }

  .mes-main {
    width: 100%;
  }

  .mes-menu-button {
    display: block;
  }

  .dashboard-layout-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    display: none;
  }
}

@media (max-width: 680px) {
  .mes-content {
    padding: 20px 15px;
  }

  .mes-topbar {
    padding: 10px 15px;
  }

  .mes-user-details {
    display: none;
  }

  .mes-logout-button {
    padding: 7px 9px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading-status {
    min-width: 0;
  }

  .demo-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-card {
    min-height: 130px;
  }
}

.mes-brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.mes-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mes-brand-text {
  min-width: 0;
}

.readiness-badge {
  align-self: center;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
}

.readiness-badge.waiting {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.readiness-badge.available {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.review-summary {
  min-height: 110px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.review-summary span,
.review-summary strong {
  display: block;
}

.review-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.review-summary strong {
  margin-top: 12px;
  color: var(--navy);
  font-size: 28px;
}

.review-grid {
  display: grid;
  gap: 18px;
}

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

.scan-target {
  display: grid;
  min-height: 210px;
  margin: 18px 0;
  padding: 30px;
  place-content: center;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
}

.scan-target strong {
  color: var(--navy);
  font-size: 25px;
  letter-spacing: .12em;
}

.scan-target span {
  max-width: 420px;
  margin-top: 12px;
  line-height: 1.6;
}

.review-search label {
  display: block;
  margin-bottom: 7px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.review-search > div {
  display: flex;
  gap: 8px;
}

.review-search input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.review-note {
  margin-top: 16px;
  padding: 12px 14px;
  color: #475569;
  background: #f8fafc;
  border-left: 3px solid #60a5fa;
  border-radius: 6px;
  line-height: 1.55;
}

.readiness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.readiness-row:last-child {
  border-bottom: 0;
}

.readiness-row strong,
.readiness-row span {
  display: block;
}

.readiness-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.readiness-row .readiness-state {
  padding: 6px 9px;
  color: #1d4ed8;
  background: #eff6ff;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.readiness-list {
  margin: 18px 0;
  padding-left: 22px;
}

.readiness-list li {
  margin: 10px 0;
  color: #334155;
  line-height: 1.5;
}

.readiness-list li::marker {
  color: #16a34a;
}

.readiness-list.pending li::marker {
  color: #d97706;
}

.report-catalogue {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-catalogue a,
.report-catalogue .report-disabled {
  position: relative;
  display: block;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.report-catalogue a:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(15, 44, 92, .08);
}

.report-catalogue strong,
.report-catalogue span {
  display: block;
}

.report-catalogue span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.report-catalogue em {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #166534;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.report-catalogue .report-disabled {
  opacity: .72;
}

.report-catalogue .report-disabled em {
  color: #64748b;
}

.readiness-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 18px 20px;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
}

.readiness-callout p {
  margin: 5px 0 0;
  line-height: 1.5;
}

.readiness-callout > span {
  flex: 0 0 auto;
  padding: 7px 10px;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 960px) {
  .review-summary-grid,
  .review-grid.two-column,
  .report-catalogue {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .review-summary-grid,
  .review-grid.two-column,
  .report-catalogue {
    grid-template-columns: 1fr;
  }

  .readiness-badge {
    align-self: flex-start;
  }
}

.mes-brand-text strong,
.mes-brand-text span {
  display: block;
}
