:root {
  --brand-blue: #204090;
  --brand-red: #D02020;
  --brand-ink: #183070;
  --navy: #183070;
  --paper: #F3F5F9;
  --surface: #ffffff;
  --ink: #10182C;
  --muted: #5C6780;
  --line: #E2E6EF;
  --line-strong: #C9D0DC;
  --soft: #E7EDF8;
  --red-soft: #FDECEC;
  --ok: #183070;
  --ok-bg: #E7EDF8;
  --bad: #D02020;
  --shadow: 0 18px 50px rgba(16, 24, 44, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
.skip { position: absolute; right: -999px; }
.skip:focus { right: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 20; }
a { color: inherit; }

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 0 28px;
  background: #183070;
  color: #fff;
}
.top::after {
  content: "";
  position: absolute;
  right: 0; left: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #D02020 0%, #204090 58%, #28408C 100%);
}
.top-end { display: flex; align-items: center; gap: 12px; }
.brand-lock {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 44px; height: 44px;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  object-fit: contain;
}
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; padding: 6px; }
.brand-lock strong, .clinic { display: block; font-size: 15px; font-weight: 700; }
.brand-lock small { color: #A8B6D4; font-size: 11px; margin-top: 2px; }
.ghost {
  font: inherit;
  cursor: pointer;
  background: rgba(255,255,255,.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  padding: 8px 16px;
}
.ghost:hover { background: rgba(255,255,255,.12); }
.live-pill {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #D5DEF0;
  font-size: 12px;
  font-weight: 700;
}
.live-pill span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3D6AD6;
  box-shadow: 0 0 0 5px rgba(61,106,214,.16);
}
.live-pill.busy span { background: #D02020; box-shadow: 0 0 0 5px rgba(208,32,32,.16); }

.desk-kicker {
  margin: 0 0 6px;
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
main {
  width: min(860px, calc(100% - 32px));
  margin: 28px auto 80px;
}
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}
h1 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.25;
  font-weight: 800;
}
.lead { color: var(--muted); line-height: 1.8; margin: 0; }
.lead b { color: var(--navy); }
.last-card {
  min-width: 220px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.last-card span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.last-card strong { font-size: 13px; line-height: 1.5; word-break: break-word; color: var(--navy); }

.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
}
.flash.ok { background: var(--ok-bg); color: var(--navy); }
.flash.bad { background: var(--red-soft); color: var(--bad); }

.cert {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.crop { display: none; }
.cert-band {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  background: #183070;
  color: #fff;
}
.cert-band span { font-size: 12px; color: #A8B6D4; font-weight: 600; }
.cert-band span:last-child { text-align: start; }
.cert-band b {
  font-size: 1.25rem;
  white-space: nowrap;
  font-weight: 800;
}
.cert-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 28px 28px 10px;
}
.stamp-well {
  background: var(--soft);
  border: 1px dashed #C5D0EA;
  border-radius: 16px;
  padding: 16px 14px 18px;
  text-align: center;
}
.stamp-label {
  display: block;
  color: var(--brand-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  margin-bottom: 10px;
}
.stamp-frame {
  position: relative;
  background: #fff;
  border: 1px solid #C5D0EA;
  border-radius: 12px;
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 8px;
}
#captcha-img {
  max-width: 100%;
  height: 60px;
  object-fit: contain;
  image-rendering: pixelated;
}
.icon-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 34px; height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--brand-blue);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: #d9e3f4; }
.stamp-input { display: block; margin-top: 12px; font-size: 13px; font-weight: 800; text-align: start; }
.stamp-input input {
  margin-top: 7px;
  text-align: center;
  letter-spacing: .28em;
  font-weight: 800;
  text-transform: uppercase;
}
.fields { display: grid; gap: 16px; align-content: start; }
label { display: block; font-size: 13px; font-weight: 800; }
.req { color: var(--brand-red); margin-inline-start: 4px; font-weight: 800; }
input, select {
  width: 100%;
  margin-top: 7px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 12px 13px;
}
input:focus, select:focus {
  outline: 3px solid rgba(32,64,144,.28);
  outline-offset: 2px;
  border-color: #204090;
}
.extras {
  margin: 6px 28px 0;
  border-top: 1px solid var(--line);
  padding: 6px 0 6px;
}
.extras summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 0;
}
.extra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0 14px;
}
.extra-grid label:last-child { grid-column: 1 / -1; }

.print-bar {
  width: 100%;
  margin: 4px 0 0;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: #204090;
  padding: 18px 20px;
}
.print-bar:hover { background: #183070; }
.print-bar:disabled { opacity: .7; cursor: wait; }
.bar-slot { display: none; }
.cert.is-printing { opacity: .72; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(880px 420px at 92% -12%, rgba(208,32,32,.10), transparent 55%),
    radial-gradient(720px 380px at 6% 112%, rgba(32,64,144,.16), transparent 52%),
    linear-gradient(180deg, #E3F4FB 0%, #C9E8F6 52%, #B7DDF2 100%);
}
.login-wrap {
  width: min(440px, calc(100% - 32px));
  background: #fff;
  color: var(--ink);
  padding: 28px 28px 26px;
  border: 1px solid #B7D4EC;
  border-top: 3px solid #D02020;
  border-radius: 24px;
  box-shadow: 0 22px 48px rgba(32, 64, 144, .12);
}
.login-head {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  margin: 0 0 18px;
  padding: 0 0 16px;
  border-bottom: 1px solid #D4E6F4;
}
.login-head .brand-mark { flex: 0 0 auto; background: #F4FBFE; border: 1px solid #C5DCF0; }
.login-head .desk-kicker { color: #D02020; margin: 0 0 2px; }
.login-head .clinic { color: #204090; }
.login-head small { color: #5B8EC8; font-size: 11px; }
.login-wrap h1 { color: #183070; font-size: 22px; text-align: start; margin: 0 0 6px; }
.login-wrap .lead { color: var(--muted); text-align: start; margin-bottom: 8px; font-size: 13px; }
.login-wrap label { display: grid; gap: 8px; margin: 14px 0; font-size: 12px; }
.login-wrap input { height: 48px; margin-top: 0; padding: 0 14px; border-color: #B7D4EC; }
.login-wrap button[type=submit] {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  background: #204090;
}
.login-wrap button[type=submit]:hover { background: #183070; }

@media (max-width: 760px) {
  .hero, .cert-body { grid-template-columns: 1fr; }
  .last-card { max-width: none; }
  .cert-band { grid-template-columns: 1fr; text-align: center; }
  .cert-band span:last-child { text-align: center; }
  .extra-grid { grid-template-columns: 1fr; }
  .top { padding: 0 16px; }
  .live-pill { display: none; }
}
