:root {
  --ink: #14201c;
  --muted: #64706b;
  --surface: #ffffff;
  --surface-soft: #f4f6f5;
  --line: #d9dfdc;
  --brand: #0b4a36;
  --brand-deep: #062d22;
  --gold: #c69b2f;
  --blue: #2f6d91;
  --success: #247647;
  --warning: #9a6813;
}

* { box-sizing: border-box; }

html { background: var(--surface-soft); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
}

a { color: inherit; }

.topbar {
  min-height: 68px;
  padding: 8px max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: var(--brand-deep);
  border-bottom: 3px solid var(--gold);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 6px;
}

.brand span { display: grid; gap: 1px; }
.brand strong { color: #f1cc6a; font-size: 20px; }
.brand small { color: #c8d5cf; font-size: 11px; }

.topbar nav { display: flex; align-items: center; gap: 4px; }

.topbar nav a {
  padding: 9px 12px;
  color: #dfe9e4;
  text-decoration: none;
  border-radius: 6px;
}

.topbar nav a:hover,
.topbar nav a.active { background: rgba(255, 255, 255, .1); color: #fff; }

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: 0; }
.page-heading p:last-child { margin: 10px 0 0; color: var(--muted); }

.registry-state {
  min-width: 160px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.registry-state span {
  width: 9px;
  height: 9px;
  background: var(--warning);
  border-radius: 50%;
}

.registry-state.ready span { background: var(--success); }

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary div {
  min-height: 92px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-inline-start: 1px solid var(--line);
}

.summary div:first-child { border-inline-start: 0; }
.summary strong { font-size: 28px; color: var(--brand); }
.summary span { color: var(--muted); font-size: 13px; }

.directory {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.toolbar {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
  gap: 12px;
  background: #eef2f0;
  border-bottom: 1px solid var(--line);
}

.toolbar label { display: grid; gap: 6px; }
.toolbar label span { color: var(--muted); font-size: 12px; font-weight: 700; }

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bfc9c4;
  border-radius: 5px;
  font: inherit;
}

input:focus,
select:focus { outline: 3px solid rgba(47, 109, 145, .18); border-color: var(--blue); }

.directory-head {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.directory-head h2 { margin: 0; font-size: 19px; }
.directory-head span { color: var(--muted); font-size: 13px; }

.route-row {
  min-height: 58px;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) minmax(120px, .8fr) minmax(220px, 1.3fr) 130px 36px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e8ecea;
}

.route-row:last-child { border-bottom: 0; }
.route-header { min-height: 42px; color: var(--muted); background: #fafbfa; font-size: 12px; font-weight: 800; }
.route-title { font-weight: 750; }
.route-domain { color: var(--blue); font-size: 13px; }
.route-path { overflow-wrap: anywhere; direction: ltr; text-align: left; color: #43524b; font-family: ui-monospace, monospace; font-size: 12px; }

.route-status {
  width: fit-content;
  padding: 4px 7px;
  color: var(--success);
  background: #eaf5ee;
  border: 1px solid #bedac8;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.route-status.review { color: var(--warning); background: #fff7e8; border-color: #ead4a7; }

.open-route {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--brand);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.open-route:hover { color: #fff; background: var(--brand); }

.empty-state { margin: 0; padding: 44px; color: var(--muted); text-align: center; }

@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar nav { width: 100%; overflow-x: auto; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary div:nth-child(3) { border-inline-start: 0; border-top: 1px solid var(--line); }
  .summary div:nth-child(4) { border-top: 1px solid var(--line); }
  .toolbar { grid-template-columns: 1fr; }
  .route-header { display: none; }
  .route-row {
    grid-template-columns: 1fr 34px;
    gap: 6px 12px;
  }
  .route-title,
  .route-domain,
  .route-path,
  .route-status { grid-column: 1; }
  .open-route { grid-column: 2; grid-row: 1 / span 4; }
}

/* SHEIKHA ROUTE · DOMAIN · ENGINE REGISTRY V3 */
.summary {
  grid-template-columns: repeat(4, 1fr);
}

.toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 240px) minmax(170px, 240px);
}

.route-row {
  grid-template-columns:
    minmax(200px, 1.45fr)
    minmax(120px, .8fr)
    minmax(150px, .9fr)
    minmax(130px, .8fr)
    minmax(190px, 1.15fr)
    90px
    36px;
}

.route-engine {
  display: grid;
  gap: 2px;
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.route-engine strong {
  color: var(--brand);
}

.route-engine small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.route-integration {
  direction: ltr;
  text-align: left;
  color: #596b63;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

@media (max-width: 1080px) {
  .summary { grid-template-columns: repeat(3, 1fr); }
  .summary div:nth-child(4) { border-inline-start: 0; }
  .summary div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .route-row {
    grid-template-columns:
      minmax(180px, 1.3fr)
      minmax(110px, .7fr)
      minmax(140px, .8fr)
      minmax(170px, 1fr)
      80px
      34px;
  }
  .route-integration { display: none; }
}

@media (max-width: 820px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .route-row { grid-template-columns: 1fr 34px; }
  .route-title,
  .route-domain,
  .route-engine,
  .route-integration,
  .route-path,
  .route-status { grid-column: 1; }
  .route-integration { display: block; }
  .open-route { grid-column: 2; grid-row: 1 / span 6; }
}

/* SHEIKHA END-TO-END ASSIGNMENT GOVERNANCE SUMMARY */
.governance-summary-card {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}

.governance-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.governance-summary-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.governance-state {
  min-width: 260px;
  display: grid;
  gap: 5px;
  text-align: left;
  direction: ltr;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.governance-state strong {
  color: var(--brand);
}

.governance-state span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.governance-stage-table {
  overflow-x: auto;
}

.governance-stage-row {
  display: grid;
  grid-template-columns:
    minmax(210px, 1.3fr)
    minmax(110px, .55fr)
    minmax(180px, .8fr)
    minmax(220px, 1fr)
    minmax(260px, 1.25fr);
  gap: 12px;
  align-items: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

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

.governance-stage-header {
  font-weight: 700;
  background: var(--soft);
}

.governance-stage-row span {
  overflow-wrap: anywhere;
}

.governance-stage-row strong {
  display: block;
}

.governance-stage-row small {
  display: block;
  margin-top: 3px;
  direction: ltr;
  text-align: left;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.governance-stage-status {
  color: var(--brand);
  font-family: ui-monospace, monospace;
}

.governance-stage-status.review {
  color: #8b5a00;
}

@media (max-width: 900px) {
  .governance-summary-head {
    display: grid;
  }

  .governance-state {
    min-width: 0;
    text-align: right;
    direction: rtl;
  }

  .governance-stage-row {
    grid-template-columns: 1fr;
  }

  .governance-stage-header {
    display: none;
  }
}
