:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #165d59;
  --soft: #eef7f5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.is-ar {
  direction: rtl;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

a {
  color: var(--brand);
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.top-title {
  font-size: 18px;
  font-weight: 850;
}

.top-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.language-switch button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  padding: 0 13px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.language-switch button {
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
}

.language-switch button.is-active {
  background: var(--brand);
  color: #fff;
}

.doc-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 20px auto 48px;
}

.doc-section {
  margin-top: 14px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.intro {
  border-left: 5px solid var(--brand);
}

body.is-ar .intro {
  border-left-width: 1px;
  border-right: 5px solid var(--brand);
}

h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: 0;
}

h3 {
  margin: 16px 0 8px;
  font-size: 17px;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.lead {
  color: #344054;
  font-size: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.primary {
  background: var(--brand);
  color: #fff;
}

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

.simple-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.simple-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.simple-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.flow {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

body.is-ar .flow li {
  grid-template-columns: 34px minmax(0, 1fr);
  text-align: right;
}

.flow li > div {
  min-width: 0;
}

.num {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  line-height: 1;
}

.flow strong {
  display: block;
  margin-bottom: 4px;
}

.flow span {
  color: var(--muted);
  line-height: 1.65;
}

.flow .num {
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.65;
}

th {
  background: #f0f3f7;
  color: #344054;
  font-weight: 850;
}

tr:last-child td {
  border-bottom: 0;
}

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

figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: zoom-in;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  border-top: 1px solid var(--line);
}

.note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(22, 93, 89, 0.24);
  border-radius: 8px;
  background: var(--soft);
  color: #184744;
  line-height: 1.7;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
}

.image-modal[hidden] {
  display: none;
}

.image-modal-panel {
  width: min(1180px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.32);
}

.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 850;
}

.image-modal-close {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  font-weight: 850;
  cursor: pointer;
}

.image-modal-body {
  overflow: auto;
  padding: 12px;
  background: #f8fafc;
}

.image-modal-body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .simple-grid,
  .image-grid {
    grid-template-columns: 1fr;
  }
}
