:root {
  --evergreen: #123C36;
  --evergreen-deep: #0C2824;
  --evergreen-mid: #1A4E46;
  --ink: #143833;
  --muted: #4D6862;
  --line: rgba(18, 60, 54, 0.10);
  --turquoise: #23B5A5;
  --turquoise-deep: #0F7A6E;
  --mist: #F3F7F5;
  --mist-2: #E6EFEC;
  --white: #FFFFFF;
  --orange: #FD6606;
  --clay: #9A3E0C;
  --clay-soft: #FDE8DC;
  --good: #0F7A6E;
  --good-soft: #E5F6F3;
  --shadow: 0 1px 2px rgba(18, 60, 54, 0.04), 0 10px 28px rgba(18, 60, 54, 0.05);
  --radius: 16px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --sidebar: 264px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--mist);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: inherit; }

.splash {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  background: var(--evergreen);
  color: white;
}
.splash .logo-en { font-size: 40px; }
.splash .logo-ar { font-size: 42px; }
.splash .logo-mark { width: 64px; height: 48px; }
.splash p {
  margin: 8px 0 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  line-height: 1;
}
.logo-mark {
  width: 42px;
  height: 32px;
  display: block;
  flex: none;
}
.logo-rule {
  width: 1.5px;
  align-self: stretch;
  margin: 3px 0;
  border-radius: 99px;
  background: currentColor;
}
.logo-words {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.logo-en {
  position: relative;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.045em;
  padding-bottom: 5px;
}
.logo-en::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  border-radius: 99px;
  background: var(--turquoise);
}
.logo-ar {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
}

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  width: var(--sidebar);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  background: var(--evergreen);
  color: white;
}
.brand-product {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 32px; }
.nav a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 15px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.nav a.is-current {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.side-foot { margin-top: auto; padding-top: 24px; }
.side-foot p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.45;
}
.side-foot .rule {
  display: block;
  width: 28px;
  height: 2px;
  border-radius: 99px;
  background: var(--turquoise);
  margin-bottom: 12px;
}

.main { flex: 1; min-width: 0; padding: 36px 40px 80px; }
.page { max-width: 1100px; min-width: 0; }

.kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--turquoise-deep);
}
h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.lede {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
  min-width: 0;
}
.page-head > div { min-width: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  background: var(--evergreen);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--evergreen-mid); }
.btn.secondary {
  background: white;
  color: var(--evergreen);
  box-shadow: inset 0 0 0 1px rgba(18, 60, 54, 0.16);
}
.btn.secondary:hover { background: white; box-shadow: inset 0 0 0 1px var(--evergreen); }
.btn.quiet {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  padding-inline: 10px;
}
.btn.quiet:hover { color: var(--clay); background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 3px; }

.banner {
  background: var(--clay-soft);
  color: var(--clay);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.match-card {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 280px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.match-card:hover { border-color: rgba(35, 181, 165, 0.85); transform: translateY(-2px); }
.card-visual {
  height: 168px;
  overflow: hidden;
  background: #F7F8F6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-visual img {
  width: 100%;
  height: 168px;
  flex: none;
  object-fit: cover;
  object-position: center 46%;
}
.card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: white;
}
.card-body h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  background: var(--mist-2);
  color: var(--evergreen);
  white-space: nowrap;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--clay-soft); color: var(--clay); }
.engine-row { display: flex; margin-top: 16px; }

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.02em; font-weight: 600; }
.import-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; align-items: stretch; }
.fields { display: grid; gap: 14px; align-content: start; }
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--evergreen);
}
.field span.hint, .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
input[type="text"], input[type="date"], .name-input {
  font-weight: 400;
  background: white;
  border: 1px solid rgba(18, 60, 54, 0.14);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
}
input:focus {
  border-color: var(--turquoise);
  outline: none;
  box-shadow: 0 0 0 3px rgba(35, 181, 165, 0.22);
}
.drop {
  min-height: 100%;
  border: 1.5px dashed rgba(18, 60, 54, 0.22);
  border-radius: var(--radius);
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 28px;
  cursor: pointer;
}
.drop.is-over { border-color: var(--turquoise); background: #F7FFFD; }
.drop strong { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.drop input { display: none; }
.file-name { color: var(--evergreen); font-weight: 600; }
.upload-track {
  height: 6px;
  background: var(--mist-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.upload-track span { display: block; height: 100%; background: var(--turquoise); width: 0; }

.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; flex-wrap: wrap; }
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
}
.steps .n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}
.steps li.done { color: var(--good); }
.steps li.done .n { background: var(--good-soft); border-color: transparent; color: var(--good); }
.steps li.now { color: var(--evergreen); background: white; }
.steps li.now .n { background: var(--evergreen); color: white; border-color: var(--evergreen); }

.court-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.frame-stage {
  position: relative;
  background: var(--evergreen-deep);
  border-radius: 16px;
  overflow: hidden;
  cursor: crosshair;
}
.frame-stage img { width: 100%; height: auto; }
.marker {
  position: absolute;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  border-radius: 50%;
  background: var(--turquoise);
  color: var(--evergreen-deep);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px white;
  pointer-events: none;
}
.court-side h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.next-point { font-size: 16px; font-weight: 600; margin: 8px 0 2px; line-height: 1.35; }
.diagram { width: 100%; height: auto; margin: 4px 0 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0 4px; }
.kpi {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
}
.kpi .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
}
.kpi .value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.kpi .detail {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-top: auto;
  padding-top: 8px;
}
.kpi.warn .value { color: var(--clay); }
.kpi.good .value { color: var(--good); }

.report-mast {
  margin: -36px -40px 28px;
  padding: 20px 40px;
  background: var(--evergreen);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.mast-copy { text-align: right; }
.mast-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  color: var(--turquoise);
}
.mast-title {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

.report-title { font-size: 36px; letter-spacing: -0.035em; margin: 0; font-weight: 600; line-height: 1.1; }
.meta { color: var(--muted); margin: 8px 0 0; font-size: 14px; }
.section { margin-top: 32px; }
.section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.section h2::after {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: var(--turquoise);
}
.findings { display: grid; gap: 10px; }
.finding {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px 18px;
  align-items: start;
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 16px 18px;
  border-left: 3px solid var(--turquoise);
}
.finding.warn { border-left-color: var(--orange); }
.finding h3 { margin: 2px 0 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.finding p { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.55; }

.table-wrap {
  overflow-x: auto;
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  background: #F8FBFA;
}
th span {
  display: block;
  margin-top: 3px;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: none;
  font-size: 11px;
  color: #6D857F;
}
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
.name-input { min-width: 140px; padding: 8px 10px; }
td .pill { align-self: auto; }

.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
}
.pair h3 { margin: 0; font-size: 17px; font-weight: 600; }
.pair .who { color: var(--muted); margin: 2px 0 14px; font-size: 13px; }
.bar-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
}
.bar-row span { color: var(--ink); white-space: nowrap; }
.bar-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
}
.bar-track { position: relative; height: 8px; background: var(--mist-2); border-radius: 99px; }
.bar-fill { height: 100%; border-radius: 99px; min-width: 0; }
.bar-net { background: var(--turquoise); }
.bar-back { background: var(--evergreen); }
.bar-split { background: var(--orange); }
.bar-mid { background: #8AA39C; }
.bar-target {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  background: var(--evergreen);
  border-radius: 99px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.metrics div { font-variant-numeric: tabular-nums; min-width: 0; }
.metrics strong {
  display: block;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.metrics span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.figures { display: grid; gap: 14px; }
figure {
  margin: 0;
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}
figure img { width: 100%; height: auto; background: #F7F8F6; }
figcaption { padding: 14px 16px 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
figcaption strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; margin-bottom: 2px; }

video { width: 100%; border-radius: 14px; background: black; }
.video-block { margin-top: 12px; }
.video-block p { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.note { color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 78ch; margin: 10px 0 0; }
.report-foot {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.report-foot p { margin: 0 0 4px; }
.log {
  margin-top: 12px;
  background: var(--evergreen-deep);
  color: #D7E8E3;
  border-radius: 12px;
  padding: 12px 14px;
  overflow: auto;
  max-height: 240px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.missing { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.missing code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--ink);
}

@media (max-width: 980px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .pairs, .import-grid, .court-layout { grid-template-columns: 1fr; }
  h1, .report-title { font-size: 32px; }
}
@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    z-index: 4;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 16px 12px;
  }
  .brand { min-width: 0; }
  .brand-product, .side-foot { display: none; }
  .sidebar .logo-en { font-size: 22px; }
  .sidebar .logo-ar { font-size: 24px; }
  .sidebar .logo-mark { width: 36px; height: 28px; }
  .nav { margin: 0; flex-direction: row; width: 100%; }
  .main { padding: 22px 16px 48px; }
  .report-mast {
    margin: -22px -16px 20px;
    padding: 16px;
    align-items: flex-start;
  }
  .mast-copy { text-align: left; }
  .kpis, .pairs, .metrics { grid-template-columns: 1fr; }
  .page, .page-head, .lede, h1, .kicker { max-width: calc(100vw - 32px); }
  .page-head { flex-direction: column; align-items: flex-start; width: 100%; }
  .lede { width: 100%; }
  .finding { grid-template-columns: 1fr; gap: 6px; }
  .bar-row { grid-template-columns: 108px minmax(0, 1fr) 40px; }
}
@media print {
  .sidebar, .no-print, video, .page-actions { display: none !important; }
  body { background: white; }
  .main { padding: 0; }
  .report-mast {
    margin: 0 0 18px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .finding, .kpi, .pair, figure { break-inside: avoid; }
}
