:root {
  color-scheme: light;
  --forest: #153c32;
  --deep: #102f27;
  --jade: #286653;
  --mist: #e6efe7;
  --paper: #fbf8ee;
  --ivory: #f2eddf;
  --ink: #23382f;
  --muted: #526358;
  --line: #e1dacb;
  --gold: #e9cc93;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font: 16px/1.5 var(--sans);
  background: #e9eadf;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid #995a20; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

#shell {
  max-width: 750px;
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--paper);
  box-shadow: 0 0 65px #17332a14;
}

#header {
  position: sticky;
  inset-block-start: 0;
  z-index: 3;
  background: var(--paper);
}

.topbar, .notice, .roles, main { padding-inline: clamp(16px, 4.5vw, 36px); }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(67px + env(safe-area-inset-top));
  padding-block-start: env(safe-area-inset-top);
  background: var(--forest);
  color: var(--paper);
}

.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img { width: 35px; height: 35px; border: 1px solid #b7aa8055; border-radius: 9px; }
.brand strong { font: 500 23px/1 var(--serif); letter-spacing: .095em; }
.brand small { color: var(--gold); font-size: 14px; line-height: 1; }
.top-actions, .actions, .tags, .card-top, .field-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions { gap: 7px; }
.top-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-inline: 9px;
  border: 1px solid #efe2b246;
  border-radius: 100px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.icon { width: 20px; height: 20px; flex: none; }
.top-action .icon { width: 15px; height: 15px; }
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding-block: 6px;
  background: #efe3c6;
  color: #543d23;
  font-size: clamp(11px, 2.9vw, 12px);
  font-weight: 650;
  line-height: 1.35;
}
.notice .icon { width: 14px; height: 14px; }
.roles {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: auto;
  scrollbar-width: none;
  padding-block: 9px;
  border-bottom: 1px solid var(--line);
}
.role {
  display: inline-flex;
  white-space: nowrap;
  min-height: 39px;
  align-items: center;
  padding-inline: 11px;
  border: 1px solid var(--line);
  border-radius: 100px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}
.role[aria-current] { background: var(--forest); border-color: var(--forest); color: white; }
main { padding-block: 20px calc(96px + env(safe-area-inset-bottom)); }
main:focus { outline: none; }
main > * + * { margin-block-start: 17px; }

.hero {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  background: var(--forest);
  color: var(--paper);
  padding: 24px 20px 22px;
  border-radius: 22px 22px 45px 22px;
  min-height: 222px;
}
[dir="rtl"] .hero { border-radius: 22px 22px 22px 45px; }
.hero h1, .heading h1, .section-title, .dialog-title { font-family: var(--serif); font-weight: 500; line-height: 1.08; }
[lang="ar"] .hero h1, [lang="ar"] .heading h1, [lang="ar"] .section-title, [lang="ar"] .dialog-title { font-family: 'Traditional Arabic', Tahoma, var(--sans); line-height: 1.35; }
.hero h1 { font-size: clamp(38px, 8.8vw, 65px); letter-spacing: -.04em; max-width: 11ch; }
[lang="ar"] .hero h1 { letter-spacing: normal; max-width: 14ch; }
.hero p { font-size: 14px; color: #e4e8d9; max-width: 26ch; margin-block: 10px 16px; }
.hero-art { position: absolute; z-index: -1; inset-inline-end: -16px; inset-block-end: -22px; width: min(45%, 195px); color: var(--gold); opacity: .72; }
[dir="rtl"] .hero-art { transform: scaleX(-1); }
.hero-art svg { display: block; width: 100%; }
.heading h1 { font-size: clamp(36px, 8vw, 54px); letter-spacing: -.032em; }
[lang="ar"] .heading h1 { letter-spacing: normal; }
.heading p { color: var(--muted); font-size: 14px; margin-block-start: 7px; max-width: 58ch; }
.section-title { font-size: clamp(25px, 6vw, 35px); }
.section-title + p { margin-block-start: 6px; }
.card, .form, .tip { background: #fffdf6; padding: 15px; border: 1px solid var(--line); border-radius: 15px; }
.card h2 { font-size: 19px; line-height: 1.2; }
.card h3 { font-size: 17px; line-height: 1.3; }
.card p, .form p, .tip p, .fine { color: var(--muted); font-size: 14px; }
.card p, .tip p { margin-block-start: 5px; }
.stack > * + * { margin-block-start: 9px; }
.card-top { flex-wrap: nowrap; gap: 11px; }
.card-top > div:not(.avatar) { min-width: 0; }
.card-top .grow { flex: 1; }
.card-link {
  display: block;
  text-decoration: none;
  transition: border-color .16s, background .16s;
}
.card-link:hover { border-color: #8ba08e; background: #faf9ef; }
.card-link .chevron { margin-inline-start: auto; color: var(--jade); }
[dir="rtl"] .chevron { transform: scaleX(-1); }
.tags { gap: 6px; margin-block-start: 10px; }
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  color: #2d5948;
  background: var(--mist);
}
.pill.neutral { color: #5b4b38; background: #f1eadb; }
.pill.alert { color: #783b2d; background: #f6e8df; }
.avatar {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid #9bb19d;
  border-radius: 24px 24px 10px 10px;
  font: 500 18px/1 var(--serif);
  background: #e5efe5;
  color: #285447;
}
.avatar.clay { color: #753d2b; border-color: #d9b9a3; background: #f3e5d8; }
.avatar.sand { color: #645027; border-color: #d8c8a0; background: #f3ecd8; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--forest);
  border-radius: 9px;
  background: var(--forest);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.24;
  text-align: center;
}
.button:hover { background: #205446; }
.button.gold { color: #292e23; background: var(--gold); border-color: var(--gold); }
.button.quiet { color: var(--forest); background: transparent; border-color: #c3cdbf; }
.button.quiet:hover { background: var(--mist); }
.button.danger { color: #793b2d; background: transparent; border-color: #debfb5; }
.button.danger:hover { background: #f6e8df; }
.button .icon { width: 16px; height: 16px; }
.card .actions, .form .actions { margin-block-start: 11px; }
.quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quick-links .icon { color: var(--jade); }
.quick-links h2 { margin-block-start: 7px; font-size: 16px; }
.quick-links p { font-size: 13px; }

.filters, .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fields > label, .filters > label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
select {
  width: 100%;
  min-width: 0;
  min-height: 45px;
  padding-inline: 8px 6px;
  border: 1px solid #bdc3b5;
  border-radius: 7px;
  background: #fffdf7;
  color: var(--ink);
  font-size: 16px;
}
.form > * + * { margin-block-start: 10px; }
.check { display: flex; align-items: flex-start; gap: 8px; min-height: 44px; padding-block: 9px; font-size: 14px; font-weight: 650; }
.check input { accent-color: var(--forest); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.slot-list { display: grid; gap: 7px; }
.slot-choice { position: relative; }
.slot-choice input { position: absolute; opacity: 0; }
.slot-choice input:focus-visible + label { outline: 2px solid #995a20; outline-offset: 2px; }
.slot-choice label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; min-height: 47px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; }
.slot-choice input:checked + label { border-color: var(--jade); background: var(--mist); }
.slot-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.slot-time { font-weight: 650; }
.empty { padding-block: 18px; }
.tip { border-inline-start: 3px solid #a9783e; background: #f8f0df; }
.tip h2 { font-size: 15px; }
.tip .actions { margin-block-start: 9px; }
.tour {
  border: 1px solid #b6c8b6;
  background: var(--mist);
  border-radius: 13px;
  padding: 11px 13px;
}
.tour-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-count { color: var(--jade); font-size: 12px; font-weight: 800; }
.tour-close { border: 0; padding: 5px; line-height: 0; color: var(--forest); background: transparent; }
.tour h2 { font-size: 16px; }
.tour p { font-size: 14px; margin-block: 4px 8px; }
.tour .button { min-height: 37px; }
.tour .button[hidden] { display: none; }
.progress { appearance: none; display: block; width: 100%; height: 3px; margin-block: 5px 8px; border: 0; border-radius: 10px; background: #cfdbcf; color: var(--jade); }
.progress::-webkit-progress-bar { border-radius: 10px; background: #cfdbcf; }
.progress::-webkit-progress-value { border-radius: 10px; background: var(--jade); }
.progress::-moz-progress-bar { border-radius: 10px; background: var(--jade); }
.feedback { border-inline-start: 3px solid var(--jade); color: var(--forest); background: var(--mist); padding: 9px 11px; border-radius: 7px; font-size: 14px; }
.feedback.error { border-color: #a65343; background: #f6e8df; color: #793b2d; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--mist); border-radius: 12px; padding: 11px 13px; }
.stat strong { display: block; font: 500 32px/1 var(--serif); color: var(--forest); }
.stat span { font-size: 13px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--jade); font-size: 14px; font-weight: 700; text-decoration: none; min-height: 36px; }
.back .icon { width: 14px; height: 14px; transform: rotate(180deg); }
[dir="rtl"] .back .icon { transform: none; }
.sample-cert { background: var(--ivory); padding-inline: 10px; border-radius: 8px; color: #5b4b38; font-size: 13px; font-weight: 650; }
.sample-cert summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
.sample-cert p { padding-block-end: 10px; font-weight: 400; }
.details-list { display: grid; gap: 7px; margin: 11px 0 0; }
.details-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-block-end: 1px solid var(--line); padding-block-end: 6px; font-size: 14px; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; font-weight: 650; }
.steps { padding-inline-start: 20px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.steps li + li { margin-block-start: 5px; }

#tabs {
  z-index: 3;
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  max-width: 750px;
  margin-inline: auto;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 -5px 22px #23382f0b;
}
.tab {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-height: 50px;
  padding: 4px 2px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  text-align: center;
  font-size: clamp(10px, 2.9vw, 12px);
  font-weight: 700;
  line-height: 1.15;
}
.tab[aria-current] { color: var(--forest); background: var(--mist); }
.tabs .icon { width: 19px; height: 19px; }

dialog {
  max-width: min(calc(100% - 28px), 415px);
  width: 100%;
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 17px 64px #132d2460;
}
dialog::backdrop { background: #112f24a5; }
.dialog-title { font-size: 27px; margin-block: 6px; }
dialog p { font-size: 14px; color: var(--muted); margin-block-end: 13px; }

@media (min-width: 520px) {
  .hero { padding: 28px; min-height: 250px; }
  .hero-art { inset-inline-end: 15px; }
  .hero p { max-width: 34ch; }
  .card, .form, .tip { padding: 17px; }
}
@media (max-width: 355px) {
  .brand small { display: none; }
  .role { padding-inline: 8px; }
  .hero { padding-inline: 15px; }
  .hero-art { opacity: .46; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
