@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');

/* ==========================================================================
   SRMB – Soteria Medical Bracelet
   Design system: navy / medical blue / teal, soft surfaces, LTR + RTL.
   ========================================================================== */

:root {
  --navy: #0c2b41;
  --navy-2: #123c56;
  --blue: #1677a8;
  --blue-dark: #0f6288;
  --teal: #0fa3a3;
  --cyan: #e8f5fa;
  --cyan-2: #f4fbfd;
  --ink: #14293b;
  --muted: #64798a;
  --line: #dbe6ee;
  --line-soft: #eaf1f6;
  --bg: #f5f9fc;
  --white: #ffffff;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --ok: #1b7f5a;
  --ok-bg: #e8f7f0;
  --warn: #a9761b;
  --warn-bg: #fdf6e5;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(12, 43, 65, .06), 0 2px 8px rgba(12, 43, 65, .05);
  --shadow: 0 10px 30px rgba(12, 43, 65, .09);
  --shadow-lg: 0 26px 60px rgba(12, 43, 65, .16);
  --font: 'DM Sans', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --head: 'Tajawal', 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body { font-family: var(--head); letter-spacing: 0; }

img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
h1, h2, h3, h4 { font-family: var(--head); margin: 0 0 .5rem; line-height: 1.22; letter-spacing: -.015em; color: var(--navy); }
h1 { font-size: clamp(2rem, 4.4vw, 3.15rem); font-weight: 800; }
h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 700; }
h3 { font-size: 1.16rem; font-weight: 700; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }

.skip {
  position: absolute; inset-inline-start: -9999px; top: .5rem; z-index: 200;
  background: var(--navy); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius-sm);
}
.skip:focus { inset-inline-start: .75rem; color: #fff; }

:focus-visible { outline: 3px solid rgba(22, 119, 168, .45); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: .78rem 1.4rem; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  text-align: center; line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff; box-shadow: 0 10px 22px rgba(22, 119, 168, .26); }
.btn-primary:hover { color: #fff; box-shadow: 0 14px 28px rgba(22, 119, 168, .32); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: #fff; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #f6cdc7; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .48rem .9rem; font-size: .83rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }

/* -------------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .26rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  letter-spacing: .01em; border: 1px solid transparent; white-space: nowrap;
}
.pill-pending { background: var(--warn-bg); color: var(--warn); border-color: #f0e0bb; }
.pill-approved { background: var(--ok-bg); color: var(--ok); border-color: #c6e9d8; }
.pill-rejected { background: var(--danger-bg); color: var(--danger); border-color: #f6cdc7; }
.pill-completed { background: var(--cyan); color: var(--blue-dark); border-color: #cfe8f2; }
.pill-b-pending { background: #eef2f6; color: var(--muted); border-color: var(--line); }
.pill-b-prepared { background: var(--cyan); color: var(--blue-dark); border-color: #cfe8f2; }
.pill-b-delivered { background: var(--ok-bg); color: var(--ok); border-color: #c6e9d8; }
.pill-b-deactivated { background: var(--danger-bg); color: var(--danger); border-color: #f6cdc7; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .74rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--blue);
}
html[dir="rtl"] .eyebrow { letter-spacing: 0; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 2px; }

/* ------------------------------------------------------------------- header */

.site-head {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.head-inner { display: flex; align-items: center; gap: 1rem; min-height: 74px; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--navy); margin-inline-end: auto; }
.brand:hover { color: var(--navy); }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--head); font-size: 1.16rem; letter-spacing: .06em; color: var(--navy); }
.brand-text small { font-size: .68rem; color: var(--muted); letter-spacing: .02em; }

.site-nav { display: flex; align-items: center; gap: .35rem; }
.site-nav a.nav-link {
  padding: .5rem .8rem; border-radius: 999px; color: var(--ink);
  font-weight: 600; font-size: .92rem;
}
.site-nav a.nav-link:hover { background: var(--cyan); color: var(--blue-dark); }
.site-nav a.nav-link.is-active { color: var(--blue-dark); background: var(--cyan); }

/* Logout is a POST form (state change), styled like the surrounding links. */
.site-nav .nav-form { display: inline-flex; margin: 0; }
.site-nav .nav-button {
  padding: .5rem .8rem; border-radius: 999px; color: var(--ink);
  font-weight: 600; font-size: .92rem;
  background: none; border: 0; font-family: inherit; cursor: pointer;
}
.site-nav .nav-button:hover { background: var(--cyan); color: var(--blue-dark); }

.lang-switch {
  display: inline-flex; align-items: center; padding: 3px; gap: 2px;
  background: #eef4f8; border-radius: 999px; border: 1px solid var(--line-soft);
  margin-inline-start: .4rem;
}
.lang-switch a {
  padding: .3rem .62rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  color: var(--muted);
}
.lang-switch a:hover { color: var(--blue-dark); }
.lang-switch a.is-current { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

.nav-toggle {
  display: none; align-items: center; gap: .4rem; font: inherit; font-size: .85rem; font-weight: 600;
  background: #fff; border: 1px solid var(--line); color: var(--navy);
  padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
}
.nav-toggle .ico { width: 18px; height: 18px; }

.admin-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem 0 .9rem; font-size: .88rem;
}
.admin-bar .who { font-weight: 700; color: var(--navy); margin-inline-end: auto; display: inline-flex; align-items: center; gap: .4rem; }

/* --------------------------------------------------------------------- hero */

.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(15, 163, 163, .34), transparent 62%),
    radial-gradient(760px 420px at 4% 108%, rgba(22, 119, 168, .38), transparent 60%),
    linear-gradient(160deg, #0a2537 0%, #0c2b41 45%, #123c56 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 70% 30%, #000 0%, transparent 72%);
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.06fr .94fr; gap: 3rem; align-items: center;
  padding: clamp(3rem, 7vw, 5.4rem) 0 clamp(3rem, 6vw, 4.6rem);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .9rem; border-radius: 999px; font-size: .72rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: #c9f3ef; background: rgba(15, 163, 163, .16); border: 1px solid rgba(15, 163, 163, .4);
}
html[dir="rtl"] .hero-badge { letter-spacing: 0; }
.hero h1 { color: #fff; margin: 1.15rem 0 .9rem; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, #6fe3d4, #7cc9f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { color: #c3d7e4; font-size: clamp(1rem, 1.6vw, 1.13rem); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.9rem; }
.hero-trust { display: grid; gap: .6rem; margin-top: 2.2rem; }
.hero-trust li { display: flex; align-items: center; gap: .6rem; color: #b9cfdd; font-size: .9rem; }
.hero-trust .ico { width: 18px; height: 18px; color: #6fe3d4; }

/* QR + NFC emphasis on the home hero */
.hero-tech { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: 1.6rem; }
.tech-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .8rem; border-radius: 999px;
  font-size: .76rem; font-weight: 800; letter-spacing: .08em;
  color: #eafcff; background: rgba(111, 227, 212, .14);
  border: 1px solid rgba(111, 227, 212, .45);
}
html[dir="rtl"] .tech-chip { letter-spacing: 0; }
.tech-chip .ico { width: 15px; height: 15px; color: #6fe3d4; }
.tech-note { color: #a9c3d3; font-size: .82rem; }
.steps-foot { text-align: center; margin-top: 1.5rem; }
.steps-note {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem 1rem; border-radius: 999px;
  font-size: .85rem; font-weight: 700; color: var(--blue-dark);
  background: rgba(22, 119, 168, .08); border: 1px solid rgba(22, 119, 168, .18);
}
.steps-note .ico { width: 16px; height: 16px; color: var(--teal, #0f8f8f); }

/* bracelet card mock */
.bracelet {
  position: relative; margin-inline: auto; width: min(360px, 100%);
  padding: 1.6rem; border-radius: 28px; text-align: center;
  background: linear-gradient(165deg, #ffffff 0%, #eef7fb 100%);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, .7);
}
.bracelet::before {
  content: ""; position: absolute; inset: 10px; border-radius: 22px;
  border: 1px dashed rgba(22, 119, 168, .28); pointer-events: none;
}
.bracelet-brand { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.bracelet-brand img { width: 34px; height: 34px; object-fit: contain; }
.bracelet-brand strong { font-family: var(--head); letter-spacing: .14em; color: var(--navy); font-size: 1.05rem; }
.bracelet-name { font-family: var(--head); font-weight: 800; color: var(--navy); font-size: 1.24rem; margin: .9rem 0 .1rem; }
.bracelet-meta { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.qr-plate {
  margin: 1.15rem auto .95rem; width: 148px; height: 148px; padding: 10px;
  background: #fff; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line);
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); gap: 2px;
}
.qr-plate i { background: var(--navy); border-radius: 1px; }
.qr-plate i.o { background: transparent; }
.bracelet-foot { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--blue-dark); }
.bracelet-note { font-size: .76rem; color: var(--muted); margin-top: .35rem; }

/* ----------------------------------------------------------------- sections */

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section-head { max-width: 44rem; margin-bottom: 2.4rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { margin-top: .6rem; }
.section-head p { color: var(--muted); font-size: 1.03rem; margin-top: .6rem; }
.section-alt { background: #fff; border-block: 1px solid var(--line-soft); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; counter-reset: step; }
.step {
  position: relative; padding: 1.6rem 1.3rem; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.step-num {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: .95rem; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal)); margin-bottom: .9rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { font-size: .9rem; color: var(--muted); margin: 0; }
.about-note {
  max-width: 44rem;
  margin: 2.2rem auto 0;
  text-align: center;
  font-size: .9rem;
  line-height: 1.75;
  color: var(--muted);
}

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
.feature {
  display: flex; gap: 1rem; padding: 1.5rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.feature .ico { width: 26px; height: 26px; color: var(--teal); }
.feature h3 { font-size: 1.02rem; margin-bottom: .25rem; }
.feature p { font-size: .9rem; color: var(--muted); margin: 0; }

.cta-band { padding: clamp(2.6rem, 5vw, 4rem) 0; }
.cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  padding: clamp(1.8rem, 4vw, 3rem); border-radius: var(--radius-lg); color: #fff;
  background: radial-gradient(700px 300px at 90% 10%, rgba(15, 163, 163, .5), transparent 60%), linear-gradient(135deg, #0c2b41, #123c56);
  box-shadow: var(--shadow-lg);
}
.cta-inner h2 { color: #fff; margin-bottom: .4rem; }
.cta-inner p { color: #c3d7e4; margin: 0; }

/* ------------------------------------------------------------------- footer */

.site-foot { background: #08202f; color: #9fb8c8; padding: 3rem 0 2rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 2rem; align-items: start; }
.foot-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.foot-brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #fff; padding: 4px; }
.foot-brand strong { color: #fff; font-family: var(--head); letter-spacing: .1em; font-size: 1.05rem; }
.site-foot p { font-size: .88rem; }
.site-foot h4 { color: #fff; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .7rem; }
html[dir="rtl"] .site-foot h4 { letter-spacing: 0; }
.site-foot li + li { margin-top: .45rem; }
.site-foot a { color: #b8cfdd; font-size: .89rem; }
.site-foot a:hover { color: #fff; }
.foot-bottom {
  margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .82rem;
}

/* -------------------------------------------------------------------- cards */

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: clamp(1.3rem, 3vw, 2rem); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1.06rem; }

.page-head { padding: 2.6rem 0 1.6rem; }
.page-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: .55rem 0 .4rem; }
.page-head p { color: var(--muted); max-width: 42rem; margin: 0; }

/* -------------------------------------------------------------------- forms */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.05rem 1.15rem; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: .38rem; }
.field > label { font-size: .855rem; font-weight: 700; color: var(--navy); }
.field .hint { font-size: .78rem; color: var(--muted); }
.req { color: var(--danger); }

input[type="text"], input[type="tel"], input[type="email"], input[type="date"],
input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .72rem .85rem; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364798a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-inline-end: 2.2rem; }
html[dir="rtl"] select { background-position: left .8rem center; }
input:hover, select:hover, textarea:hover { border-color: #c4d6e2; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 168, .14);
}
input:invalid:not(:placeholder-shown) { border-color: #e6b0a8; }
::placeholder { color: #9aaebc; }

.consent {
  display: flex; gap: .7rem; align-items: flex-start; padding: 1rem 1.1rem;
  background: var(--cyan-2); border: 1px solid #cfe8f2; border-radius: var(--radius-sm);
}
.consent input[type="checkbox"] { width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--blue); flex: 0 0 auto; }
.consent label { font-size: .9rem; font-weight: 500; color: var(--ink); }

fieldset { border: 0; margin: 0; padding: 0; }
.form-block + .form-block { margin-top: 1.9rem; padding-top: 1.6rem; border-top: 1px solid var(--line-soft); }
.form-block > h2 { font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.form-block > h2 .ico { color: var(--teal); width: 20px; height: 20px; }
.form-note { font-size: .82rem; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; }

/* ------------------------------------------------------------------- alerts */

.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .9rem 1.1rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500;
  border: 1px solid transparent; margin-bottom: 1.1rem;
}
.alert .ico { width: 19px; height: 19px; margin-top: .1rem; }
.alert-error, .alert-danger { background: var(--danger-bg); color: #8f2b20; border-color: #f6cdc7; }
.alert-success, .alert-ok { background: var(--ok-bg); color: #146347; border-color: #c6e9d8; }
.alert-info { background: var(--cyan); color: var(--blue-dark); border-color: #cfe8f2; }
.alert-warn, .alert-warning { background: var(--warn-bg); color: #7d5713; border-color: #f0e0bb; }
.alert ul { list-style: disc; padding-inline-start: 1.1rem; }

/* --------------------------------------------------------------- auth pages */

.auth-shell { min-height: calc(100vh - 200px); display: grid; place-items: center; padding: 3rem 0; }
.auth-card { width: min(460px, 100%); padding: clamp(1.6rem, 4vw, 2.4rem); }
.auth-card .brand-mark { display: flex; justify-content: center; margin-bottom: 1.1rem; }
.auth-card .brand-mark img { width: 56px; height: 56px; object-fit: contain; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: .35rem; }
.auth-card > p { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-foot { margin-top: 1.4rem; text-align: center; font-size: .85rem; color: var(--muted); }

/* ---------------------------------------------------------------- dashboard */

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .9rem; margin-bottom: 1.5rem; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.05rem 1.1rem; box-shadow: var(--shadow-sm);
}
.stat .k { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
html[dir="rtl"] .stat .k { letter-spacing: 0; }
.stat .v { font-family: var(--head); font-size: 1.75rem; font-weight: 800; color: var(--navy); line-height: 1.15; margin-top: .25rem; }
.stat.is-warn .v { color: var(--warn); }
.stat.is-ok .v { color: var(--ok); }
.stat.is-blue .v { color: var(--blue-dark); }

.toolbar { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line-soft); }
.toolbar form { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; flex: 1 1 320px; }
.toolbar .search-field { position: relative; flex: 1 1 240px; }
.toolbar .search-field .ico { position: absolute; inset-inline-start: .75rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.toolbar .search-field input { padding-inline-start: 2.3rem; }
.toolbar select { width: auto; min-width: 160px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 780px; }
table.data th {
  text-align: start; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: .8rem 1rem; background: #f8fbfd;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
html[dir="rtl"] table.data th { letter-spacing: 0; }
table.data td { padding: .85rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: #f9fcfe; }
table.data tbody tr:last-child td { border-bottom: 0; }
.cell-main { font-weight: 700; color: var(--navy); }
.cell-sub { font-size: .78rem; color: var(--muted); }
.row-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-flex; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--cyan); color: var(--blue-dark); border-color: #cfe8f2; }
.icon-btn.is-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn .ico { width: 17px; height: 17px; }

.empty-state { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty-state .ico { width: 34px; height: 34px; color: #b8cbd8; margin: 0 auto .7rem; }

.pager { display: flex; gap: .5rem; justify-content: center; align-items: center; padding: 1.1rem; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 .6rem;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: .86rem; font-weight: 600; color: var(--ink);
}
.pager .is-current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* -------------------------------------------------------------- patient view */

.detail-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 1.3rem; align-items: start; }
.dl { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.dl-row { display: grid; grid-template-columns: 190px 1fr; gap: 1rem; padding: .62rem 0; border-bottom: 1px dashed var(--line-soft); }
.dl-row:last-child { border-bottom: 0; }
.dl-row dt { font-size: .82rem; font-weight: 700; color: var(--muted); }
.dl-row dd { margin: 0; font-size: .92rem; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

.qr-card { text-align: center; }
.qr-box { width: 100%; max-width: 250px; margin: 1.1rem auto; padding: 12px; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
.qr-box canvas, .qr-box img { width: 100% !important; height: auto !important; display: block; }
.qr-box.is-off { opacity: .35; filter: grayscale(1); }
.qr-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 700; padding: .3rem .75rem; border-radius: 999px; }
.qr-status.on { background: var(--ok-bg); color: var(--ok); }
.qr-status.off { background: var(--danger-bg); color: var(--danger); }
.link-box {
  display: flex; gap: .4rem; align-items: center; margin-top: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8fbfd; padding: .35rem .35rem .35rem .7rem;
}
html[dir="rtl"] .link-box { padding: .35rem .7rem .35rem .35rem; }
.link-box input {
  border: 0; background: transparent; font-size: .78rem; color: var(--muted);
  padding: .3rem 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.link-box input:focus { box-shadow: none; }
.qr-meta { display: flex; justify-content: center; gap: 1.4rem; font-size: .8rem; color: var(--muted); margin-top: .9rem; flex-wrap: wrap; }

.danger-zone { border-color: #f6cdc7; }
.danger-zone .card-head { border-color: #f6cdc7; }
.danger-zone h3 { color: var(--danger); }

/* ----------------------------------------------------------- emergency page */

.er-body { background: #f2f6f9; }
.er-wrap { width: min(680px, 100% - 2rem); margin-inline: auto; padding: 1.1rem 0 2.5rem; }
.er-topbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .9rem 0; }
.er-topbar .brand-logo { width: 38px; height: 38px; }
.er-alert {
  display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, #c62828, #a31d1d); color: #fff; font-weight: 700; font-size: .88rem;
  box-shadow: 0 12px 26px rgba(198, 40, 40, .25);
}
.er-alert .ico { width: 20px; height: 20px; }
.er-card { margin-top: 1rem; background: #fff; border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.er-head {
  padding: 1.4rem 1.3rem; color: #fff;
  background: radial-gradient(600px 240px at 90% -30%, rgba(15, 163, 163, .45), transparent 60%), linear-gradient(150deg, #0c2b41, #123c56);
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
}
.er-avatar {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25);
  font-family: var(--head); font-size: 1.5rem; font-weight: 800; color: #fff;
}
.er-id { flex: 1 1 200px; min-width: 0; }
.er-id h1 { color: #fff; font-size: clamp(1.3rem, 4vw, 1.65rem); margin: 0; word-break: break-word; }
.er-id .meta { font-size: .84rem; color: #b9d2e0; margin-top: .2rem; }
.er-blood {
  text-align: center; padding: .6rem .9rem; border-radius: 16px; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28); min-width: 96px;
}
.er-blood .k { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #cfe6f1; }
html[dir="rtl"] .er-blood .k { letter-spacing: 0; }
.er-blood .v { font-family: var(--head); font-size: 1.7rem; font-weight: 800; color: #fff; line-height: 1.1; }

.er-call {
  display: flex; align-items: center; gap: .9rem; margin: 1rem 1.3rem 0; padding: .95rem 1.1rem;
  border-radius: 16px; background: linear-gradient(135deg, #0f9d6b, #0b7a52); color: #fff;
  box-shadow: 0 10px 22px rgba(15, 157, 107, .25); font-weight: 700;
}
.er-call:hover { color: #fff; transform: translateY(-1px); }
.er-call .ico { width: 24px; height: 24px; }
.er-call small { display: block; font-weight: 500; font-size: .78rem; opacity: .9; }
.er-call .num { margin-inline-start: auto; font-size: .95rem; letter-spacing: .02em; direction: ltr; }

.er-sections { padding: .4rem 1.3rem 1.4rem; }
.er-section { padding: 1rem 0; border-bottom: 1px solid var(--line-soft); }
.er-section:last-child { border-bottom: 0; }
.er-section h2 {
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--blue);
  margin: 0 0 .45rem; display: flex; align-items: center; gap: .45rem;
}
html[dir="rtl"] .er-section h2 { letter-spacing: 0; }
.er-section h2 .ico { width: 16px; height: 16px; }
.er-section p { margin: 0; font-size: .96rem; white-space: pre-wrap; word-break: break-word; }
.er-section.is-allergy p { color: #a33325; font-weight: 600; }
.er-none { color: var(--muted); font-style: italic; font-size: .9rem; }
.er-foot { padding: 0 1.3rem 1.4rem; }
.er-disclaimer {
  font-size: .76rem; color: var(--muted); background: #f7fafc; border: 1px dashed var(--line);
  border-radius: 12px; padding: .75rem .9rem; line-height: 1.6;
}
.er-brand { text-align: center; font-size: .74rem; color: var(--muted); margin-top: 1.2rem; }
.er-missing { margin-top: 2.5rem; text-align: center; padding: 2.2rem 1.4rem; }
.er-missing .ico { width: 44px; height: 44px; color: #b8cbd8; margin: 0 auto .8rem; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.4rem; padding-block: 2.8rem 3.2rem; }
  .bracelet { order: -1; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: .15rem;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: .7rem 1.1rem 1.1rem; box-shadow: var(--shadow);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a.nav-link { padding: .7rem .6rem; border-radius: 10px; }
  .lang-switch { margin: .5rem 0 0; align-self: flex-start; }
  .head-inner { position: relative; }
  .feature-grid { grid-template-columns: 1fr; }
  .admin-bar .who { width: 100%; }
}

@media (max-width: 640px) {
  .wrap { width: min(1180px, 100% - 1.6rem); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .steps { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
  .dl-row { grid-template-columns: 1fr; gap: .1rem; }
  .brand-text small { display: none; }
  .hero-actions .btn { width: 100%; }
  .er-head { padding: 1.1rem; gap: .8rem; }
  .er-avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 1.2rem; }
  .er-blood { min-width: 80px; padding: .45rem .7rem; }
  .er-blood .v { font-size: 1.4rem; }
  .er-call { margin-inline: .9rem; flex-wrap: wrap; }
  .er-call .num { margin-inline-start: 0; width: 100%; }
  .er-sections { padding-inline: .95rem; }
  table.data th, table.data td { padding: .7rem .75rem; }
}

@media print {
  .site-head, .site-foot, .toolbar, .row-actions, .qr-card .btn, .pager { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Public request tracking (status.php) */
.track-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.track-grid dt { font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.track-grid dd { margin: .2rem 0 0; font-weight: 600; color: var(--navy); }
@media (max-width: 560px) { .track-grid { grid-template-columns: 1fr; } }
