/* Approved hajj-ikram / Balady identity; all assets served locally. */
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/balady-arabic.woff2') format('woff2');
  unicode-range:
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/balady-latin.woff2') format('woff2');
}
:root {
  --g: #1b8354;
  --gd: #166a45;
  --gs: #f3fcf6;
  --bg: #f9fafb;
  --line: #d2d6db;
  --tx: #161616;
  --muted: #6c737f;
  --red: #b42318;
  --radius: 6px;
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  scroll-padding-top: 20px;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--tx);
  background: var(--bg);
  font:
    14px/1.7 'IBM Plex Sans Arabic',
    Tahoma,
    sans-serif;
}
[hidden] {
  display: none !important;
}
button,
input,
textarea,
select {
  font: inherit;
  touch-action: manipulation;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #fff;
  background: var(--g);
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}
button:hover {
  background: var(--gd);
}
button.light,
button.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--tx);
  font-weight: 400;
}
button.light:hover,
button.ghost:hover {
  background: var(--gs);
  border-color: var(--g);
}
button.danger {
  color: var(--red);
  background: #fff;
  border-color: #fecdca;
}
button.danger:hover,
button.x:hover {
  background: #fff1f0;
  border-color: var(--red);
}
button.x {
  background: transparent;
  color: var(--red);
  padding: 6px;
  min-width: 40px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button[aria-busy='true'] {
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #54c08a;
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: -80px;
  right: 20px;
  z-index: 3000;
  padding: 10px 20px;
  background: #fff;
  color: var(--gd);
}
.skip-link:focus {
  top: 10px;
}
.site-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 40px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  display: block;
  width: auto;
  height: 50px;
  flex-shrink: 0;
}
.brand-divider {
  height: 32px;
  border-inline-start: 1px solid var(--line);
}
.product-name h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
}
.product-name small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.sp {
  flex: 1;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.header-actions button {
  font-size: 13px;
}
.title-band {
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 40px;
  background: var(--gs);
  border-bottom: 1px solid #e4eee8;
}
.title-band small {
  color: var(--muted);
  font-size: 12px;
}
.title-band h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.6;
}
.step-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 45%;
}
.step-progress span {
  direction: ltr;
  white-space: nowrap;
  color: var(--g);
  font-size: 18px;
  padding-inline-end: 14px;
  border-inline-end: 1px solid #c9dfd1;
}
.step-progress strong {
  font-size: 13px;
  font-weight: 400;
}
.layout {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 40px 112px;
  align-items: start;
}
#steps {
  position: sticky;
  top: 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
#steps button {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  text-align: start;
  background: transparent;
  color: #495057;
  border: 0;
  border-inline-start: 3px solid transparent;
  border-radius: 4px;
  margin: 2px 0;
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 400;
}
#steps button:hover {
  background: var(--bg);
}
#steps button.on {
  color: var(--gd);
  border-inline-start-color: var(--g);
  background: var(--gs);
  font-weight: 600;
}
.step-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  background: #fff;
  color: var(--muted);
}
.on .step-number {
  color: #fff;
  background: var(--g);
  border-color: var(--g);
}
main {
  min-width: 0;
  outline: none;
}
.page {
  display: none;
  min-width: 0;
  padding: 28px 32px 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.page.on {
  display: block;
}
.page > h2 {
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e9ecef;
  font-size: 20px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.page > h2:has(+ .hint) {
  margin-bottom: 12px;
}
.hint {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin: 0 0 22px;
}
.row > label {
  font-weight: 400;
}
input[type='text'],
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid #9da4ae;
  border-radius: 4px;
  color: var(--tx);
  background: #fff;
  direction: rtl;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
input[type='text']:hover,
textarea:hover {
  border-color: #495057;
}
input[type='text']:focus,
textarea:focus {
  border-color: var(--g);
}
textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.8;
}
input[type='checkbox'] {
  accent-color: var(--g);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.dyn-table {
  min-width: 0;
}
.dyn-head,
.dyn-row {
  display: grid;
  grid-template-columns: var(--columns);
  gap: 12px;
  align-items: start;
}
.dyn-head {
  padding: 12px;
  background: var(--bg);
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 4px 4px 0 0;
  font-size: 12px;
}
.dyn-row {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-top: 0;
}
.dyn-row > * {
  min-width: 0;
}
.dyn-row textarea {
  min-height: 68px;
  font-size: 13px;
}
.dyn-row input {
  font-size: 13px;
}
.table-versions {
  --columns: 0.8fr 1.1fr 1.4fr 2.6fr 40px;
}
.table-usecases {
  --columns: 0.8fr 1.5fr 1.5fr 3fr 40px;
}
.table-workflow {
  --columns: 0.7fr 1.4fr 2.4fr 2.4fr 40px;
}
.table-states {
  --columns: 0.6fr 1.3fr 2fr 2fr 1.3fr 40px;
}
.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px 0;
  margin: 20px 0;
}
.card .ch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
}
.card .ch button {
  min-height: 36px;
  font-size: 12px;
}
.box {
  background: var(--gs);
  border: 1px solid #d9e9df;
  border-inline-start: 3px solid var(--g);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 24px;
  line-height: 2;
  overflow-wrap: anywhere;
}
.box b {
  color: var(--gd);
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.chk {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0;
}
pre.rev {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 2.2;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 20px;
}
.generate-action {
  margin-top: 24px;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(12 17 27 / 0.55);
}
.modal-overlay.open {
  display: flex;
}
body:has(.modal-overlay.open) {
  overflow: hidden;
}
.modal-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 48px rgb(16 24 40 / 0.18);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
}
.modal-close {
  min-width: 40px;
  padding: 8px;
  background: transparent;
  color: var(--muted);
}
.modal-close:hover {
  color: var(--tx);
  background: var(--bg);
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
}
.modal-desc {
  margin: 0;
  color: #495057;
  font-size: 13px;
  background: var(--gs);
  border-inline-start: 3px solid var(--g);
  border-radius: 4px;
  padding: 12px 16px;
}
.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-tab-btn {
  background: #fff;
  color: #495057;
  border-color: var(--line);
  font-size: 13px;
  font-weight: 400;
}
.modal-tab-btn:hover {
  color: var(--gd);
  background: var(--gs);
}
.modal-tab-btn.active {
  color: var(--gd);
  background: var(--gs);
  border-color: var(--g);
}
.modal-code-wrap {
  min-height: 200px;
  overflow: hidden;
  background: #161e2b;
  border-radius: var(--radius);
}
.modal-code {
  margin: 0;
  padding: 16px;
  max-height: 340px;
  overflow: auto;
  color: #e5e7eb;
  font:
    12px/1.7 Consolas,
    monospace;
  direction: ltr;
  text-align: left;
  user-select: text;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  z-index: 2000;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  border-radius: var(--radius);
  background: #104631;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  box-shadow: 0 4px 12px rgb(16 24 40 / 0.12);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.diagram-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
  background: #fff;
}
.diagram-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.diagram-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.diagram-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: #e7f3ed;
  color: var(--gd);
  font-size: 11px;
}
.diagram-badge.warn {
  color: #93370d;
  background: #fffaeb;
}
.diagram-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.diagram-actions button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}
.diagram-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 480px;
  overflow: auto;
  padding: 20px;
  background: #fff;
}
.diagram-preview-box svg {
  max-width: 100%;
  height: auto;
}
.diagram-preview-box img {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
}
.diagram-placeholder {
  color: var(--muted);
  text-align: center;
  padding: 30px;
}
.diagram-placeholder.error {
  color: var(--red);
}
.diagram-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  color: var(--muted);
  font-size: 12px;
}
.diagram-toggle-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tx);
  cursor: pointer;
}
textarea.drawio-textarea {
  height: 240px;
  direction: ltr;
  text-align: left;
  background: var(--bg);
  font:
    12px/1.7 Consolas,
    monospace;
}
.xml-input-wrap {
  margin: 10px 0;
}
.file-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.clipboard-proxy {
  position: fixed;
  opacity: 0;
}
@media (min-width: 1100px) {
  .page:first-child .row {
    max-width: 680px;
  }
}
@media (max-width: 1100px) {
  .site-header {
    gap: 16px;
    padding: 16px 24px;
    flex-wrap: wrap;
  }
  .header-actions {
    margin-inline-start: auto;
  }
  .title-band {
    padding: 24px;
  }
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    padding-inline: 24px;
  }
  .page {
    padding: 24px;
  }
  .dyn-head {
    display: none;
  }
  .dyn-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
    gap: 16px;
  }
  .dyn-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .dyn-cell::before {
    content: attr(data-label);
    font-size: 12px;
    color: #495057;
  }
  .dyn-row > button {
    justify-self: end;
    grid-column: 1 / -1;
  }
}
@media (max-width: 760px) {
  .site-header {
    padding: 16px;
    gap: 12px;
  }
  .brand-logo {
    height: 42px;
  }
  .product-name h1 {
    font-size: 15px;
  }
  .site-header .sp {
    display: none;
  }
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .header-actions button {
    padding: 8px 4px;
    font-size: 12px;
  }
  .title-band {
    min-height: 120px;
    padding: 20px 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .title-band h2 {
    font-size: 24px;
  }
  .step-progress {
    max-width: 100%;
  }
  .step-progress span {
    font-size: 14px;
  }
  .layout {
    display: block;
    padding: 16px 16px 120px;
  }
  #steps {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 6px;
    margin-bottom: 16px;
    scrollbar-width: thin;
  }
  #steps button {
    flex: 0 0 auto;
    width: auto;
    padding: 10px;
    margin: 0;
    border-inline-start: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  #steps button.on {
    border-bottom-color: var(--g);
  }
  .page {
    padding: 20px 16px;
  }
  .page > h2 {
    font-size: 18px;
  }
  .row {
    margin-bottom: 20px;
  }
  .card {
    padding: 16px 12px 0;
  }
  .modal-overlay {
    padding: 12px;
  }
  .modal-card {
    max-height: calc(100dvh - 24px);
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
  .modal-header h3 {
    font-size: 16px;
  }
  .modal-actions {
    width: 100%;
  }
  .modal-actions button {
    flex: 1 1 auto;
    font-size: 12px;
  }
  .modal-tabs button {
    flex: 1 1 auto;
  }
}
@media (max-width: 440px) {
  .dyn-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .site-header,
  .title-band,
  #steps,
  .modal-overlay,
  .toast,
  .skip-link {
    display: none !important;
  }
  body,
  .page {
    background: #fff;
  }
  .layout {
    display: block;
    padding: 0;
  }
  .page {
    border: 0;
    padding: 0;
  }
}
