@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700;14..32,800;14..32,900&display=swap');

:root {
  --navy: #0d1b35;
  --deep-navy: #06182d;
  --deepest-navy: #03101f;
  --blue: #0a72ba;
  --bright-blue: #24b9f2;
  --cyan: #54d4ff;
  --pale: #f3f7fb;
  --line: #dbe5ef;
  --muted: #607087;
  --muted-dark: #91a7bf;
  --green: #36d28b;
  --amber: #ffc45b;
  --red: #ff8b8b;
  --glass: rgba(18, 48, 80, .72);
  --glass-line: rgba(111, 190, 239, .2);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  background: var(--pale);
  color: var(--navy);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  margin: 0;
  overflow-x: hidden;
}

body::selection { background: rgba(36, 185, 242, .3); }

body:has(.auth-shell),
body:has(.admin-shell) {
  background:
    radial-gradient(circle at 18% 38%, rgba(0, 151, 220, .15), transparent 26rem),
    radial-gradient(circle at 84% 22%, rgba(42, 116, 191, .13), transparent 32rem),
    linear-gradient(135deg, var(--deepest-navy), var(--deep-navy) 52%, #0b2747);
  color: #fff;
  min-height: 100vh;
}

body:has(.auth-shell) {
  display: flex;
  flex-direction: column;
}

body:has(.auth-shell) .site-header,
body:has(.auth-shell) .site-footer {
  flex: 0 0 auto;
}

body:has(.auth-shell)::before,
body:has(.admin-shell)::before {
  background-image:
    linear-gradient(rgba(113, 204, 250, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(113, 204, 250, .045) 1px, transparent 1px);
  background-size: 92px 92px;
  content: "";
  inset: 0;
  opacity: .55;
  pointer-events: none;
  position: fixed;
  animation: grid-drift 28s linear infinite;
}

body:has(.auth-shell)::after,
body:has(.admin-shell)::after {
  background:
    radial-gradient(circle at 17% 21%, rgba(84, 212, 255, .8) 0 1px, transparent 2px),
    radial-gradient(circle at 65% 14%, rgba(84, 212, 255, .75) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 56%, rgba(84, 212, 255, .7) 0 1px, transparent 2px),
    radial-gradient(circle at 43% 78%, rgba(84, 212, 255, .6) 0 1px, transparent 2px);
  content: "";
  inset: 0;
  opacity: .6;
  pointer-events: none;
  position: fixed;
  animation: signal-twinkle 5s ease-in-out infinite alternate;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button,
.download-button,
.secondary-button {
  align-items: center;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  padding: .8rem 1.15rem;
  text-decoration: none;
}

.site-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1.1rem max(1.25rem, calc((100vw - 1180px) / 2));
  position: relative;
  z-index: 5;
}

.portal-status-rail {
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(10, 114, 186, .18);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(13, 27, 53, .12);
  display: flex;
  gap: .7rem;
  left: 50%;
  max-width: calc(100vw - 2rem);
  padding: .42rem .7rem;
  position: fixed;
  top: .75rem;
  transform: translateX(-50%);
  width: min(330px, calc(100vw - 2rem));
  z-index: 12;
}

body:has(.auth-shell) .portal-status-rail,
body:has(.admin-shell) .portal-status-rail {
  background: rgba(8, 34, 61, .72);
  border-color: rgba(84, 212, 255, .2);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: #c7e8f6;
}

.portal-status-label,
.portal-status-state {
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-status-label { color: var(--muted); }
body:has(.auth-shell) .portal-status-label,
body:has(.admin-shell) .portal-status-label { color: #9bc1d8; }
.portal-status-state { color: #087443; }
body:has(.auth-shell) .portal-status-state,
body:has(.admin-shell) .portal-status-state { color: var(--cyan); }

.portal-progress-track {
  background: rgba(10, 114, 186, .12);
  border: 1px solid rgba(10, 114, 186, .12);
  border-radius: 999px;
  flex: 1;
  height: 5px;
  min-width: 72px;
  overflow: hidden;
  position: relative;
}

body:has(.auth-shell) .portal-progress-track,
body:has(.admin-shell) .portal-progress-track {
  background: rgba(84, 212, 255, .1);
  border-color: rgba(84, 212, 255, .18);
}

.portal-progress-track i {
  background: linear-gradient(90deg, transparent, var(--bright-blue), var(--cyan), transparent);
  border-radius: inherit;
  display: block;
  height: 100%;
  left: -55%;
  position: absolute;
  width: 55%;
  animation: status-progress 3.2s ease-in-out infinite;
}

.brand {
  align-items: center;
  color: var(--navy);
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 52px;
  max-width: 112px;
  object-fit: contain;
  width: auto;
}

.brand-logo-dark { display: none; }

.brand small {
  color: var(--muted);
  display: block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body:has(.auth-shell) .brand-logo,
body:has(.admin-shell) .brand-logo { filter: none; }

body:has(.auth-shell) .brand-logo-light,
body:has(.admin-shell) .brand-logo-light { display: none; }

body:has(.auth-shell) .brand-logo-dark,
body:has(.admin-shell) .brand-logo-dark { display: block; }

body:has(.auth-shell) .site-header,
body:has(.admin-shell) .site-header {
  background: rgba(4, 20, 38, .66);
  border-bottom-color: rgba(113, 204, 250, .13);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03);
}

body:has(.auth-shell) .brand,
body:has(.admin-shell) .brand { color: #f4fbff; }

body:has(.auth-shell) .brand span,
body:has(.admin-shell) .brand span { color: var(--cyan); }

body:has(.auth-shell) .brand small,
body:has(.admin-shell) .brand small { color: rgba(202, 230, 246, .58); }

.admin-nav {
  align-items: center;
  display: flex;
  font-size: .9rem;
  gap: 1rem;
}

.admin-nav span { color: var(--muted); font-weight: 700; }
body:has(.admin-shell) .admin-nav span { color: rgba(216, 238, 250, .7); }
.admin-nav a { color: var(--blue); font-weight: 700; }
body:has(.admin-shell) .admin-nav a { color: #91dfff; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: .8rem;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 4rem;
  padding: 1.4rem max(1.25rem, calc((100vw - 1180px) / 2));
  position: relative;
  z-index: 1;
}

body:has(.auth-shell) .site-footer,
body:has(.admin-shell) .site-footer {
  border-top-color: rgba(113, 204, 250, .13);
  color: rgba(190, 221, 239, .52);
}

body:has(.auth-shell) .site-footer { margin-top: 0; }

.public-shell,
.admin-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 4rem 1.25rem;
  position: relative;
  z-index: 1;
}

.hero {
  background: var(--navy);
  color: #fff;
  padding: clamp(2rem, 6vw, 5rem);
  position: relative;
}

.hero::after {
  border: 1px solid rgba(90, 180, 255, .35);
  content: "";
  inset: 1.2rem;
  pointer-events: none;
  position: absolute;
}

.hero > * { position: relative; z-index: 1; }

.eyebrow {
  color: var(--blue);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.hero .eyebrow { color: #5ab4ff; }
.hero h1,
.result-top h1,
.admin-heading h1,
.not-found h1 {
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  letter-spacing: -.055em;
  line-height: 1.05;
  margin: .65rem 0;
}

.arabic { color: #8abfe8; font-size: 1.1rem; font-weight: 700; }
.hero-copy { color: rgba(255, 255, 255, .7); margin: 1rem 0 2rem; max-width: 650px; }
.search-form { max-width: 780px; }

.search-form label,
.stack-form label,
.certificate-form label {
  display: block;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  margin-bottom: .45rem;
  text-transform: uppercase;
}

.search-row { display: flex; gap: .75rem; }

.search-row input,
.stack-form input,
.certificate-form input,
.certificate-form textarea,
.certificate-form select {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  font: inherit;
  padding: .85rem 1rem;
  width: 100%;
}

.search-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
}

.search-row button,
.stack-form button,
.certificate-form button,
.download-button {
  background: var(--blue);
  color: #fff;
}

.search-row button:hover,
.stack-form button:hover,
.certificate-form button:hover,
.download-button:hover {
  background: #168bd6;
  text-decoration: none;
}

.info-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1.25rem;
}

.info-grid article,
.card {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(13, 27, 53, .06);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.info-grid article { padding: 1.4rem; }
.info-grid article:hover,
.result-side .card:hover { border-color: rgba(10, 114, 186, .35); box-shadow: 0 18px 40px rgba(13, 27, 53, .11); transform: translateY(-2px); }
.info-grid b { color: var(--blue); font-family: ui-monospace, monospace; }
.info-grid h2 { font-size: 1rem; margin: 1rem 0 .35rem; }
.info-grid p { color: var(--muted); font-size: .9rem; margin: 0; }

.result-top,
.admin-heading {
  align-items: end;
  display: flex;
  gap: 1.25rem;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.result-top h1,
.admin-heading h1 { font-size: clamp(2rem, 4vw, 3.5rem); }

.status-pill {
  align-items: center;
  border: 1px solid;
  display: inline-flex;
  font-size: .82rem;
  font-weight: 900;
  gap: .5rem;
  padding: .65rem .9rem;
  text-transform: uppercase;
}

.status-active { background: #eaf8f0; border-color: #a9dfbd; color: #087443; }
.status-expired { background: #fff5e8; border-color: #f0ca91; color: #a55a00; }
.status-revoked { background: #fff0f0; border-color: #e7b0b0; color: #a12626; }
.status-neutral { background: #f1f4f7; border-color: #d1dae4; color: var(--muted); }

.pulse {
  background: #1aa35c;
  border-radius: 100%;
  height: .65rem;
  position: relative;
  width: .65rem;
}

.pulse::after {
  animation: pulse 1.5s infinite;
  border: 2px solid #1aa35c;
  border-radius: 100%;
  content: "";
  inset: -4px;
  position: absolute;
}

@keyframes pulse {
  0%, 100% { opacity: .15; transform: scale(.8); }
  50% { opacity: .9; transform: scale(1.2); }
}

.result-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) 300px; }
.record-bar { background: var(--navy); color: #fff; padding: 1.2rem 1.4rem; }
.record-bar span {
  color: rgba(255, 255, 255, .55);
  display: block;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.record-bar strong { display: block; font-family: ui-monospace, monospace; letter-spacing: .05em; margin-top: .3rem; }
.details { display: grid; gap: 0 2rem; grid-template-columns: repeat(2, 1fr); margin: 0; padding: 1rem 1.4rem; }
.details div { border-top: 1px solid var(--line); padding: 1rem 0; }
.details dt { color: #8491a2; font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.details dd { font-size: .95rem; font-weight: 700; margin: .25rem 0 0; overflow-wrap: anywhere; }
.decision { background: #eef7fd; border-left: 4px solid var(--blue); margin: 0 1.4rem 1.4rem; padding: 1rem 1.1rem; }
.decision b, .standards b { color: var(--blue); display: block; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.decision strong { display: block; margin-top: .25rem; }
.standards { border-top: 1px solid var(--line); padding: 1.15rem 1.4rem; }
.standards p { color: var(--muted); font-size: .9rem; margin: .35rem 0 0; }
.result-side { display: flex; flex-direction: column; gap: 1rem; }
.qr-card { padding: 1.35rem; }
.qr-card > b { display: block; }
.qr-card p { color: var(--muted); font-size: .85rem; margin: .2rem 0 1rem; }
.qr-card img { display: block; height: 190px; margin: 0 auto 1rem; max-width: 100%; object-fit: contain; width: 190px; }
.qr-card code { color: #7b8999; display: block; font-size: .68rem; overflow-wrap: anywhere; }
.secondary-button { background: #fff; border: 1px solid var(--line); color: var(--navy); }
.secondary-button:hover { background: #f8fbfe; text-decoration: none; }
.notice { color: var(--muted); font-size: .8rem; margin: 2rem auto 0; max-width: 760px; text-align: center; }
.not-found { border-top: 4px solid #d78a19; max-width: 760px; padding: 3rem; }
.not-found h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.not-found p { color: var(--muted); max-width: 620px; }
.not-found code { background: #f7f9fb; color: #6c7b8e; display: block; font-size: .85rem; margin: 1.4rem 0; overflow-wrap: anywhere; padding: .75rem; }

/* IBOS-inspired authentication shell */
.auth-shell {
  align-items: center;
  display: grid;
  gap: clamp(3rem, 9vw, 9rem);
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  margin: 0 auto;
  max-width: 1180px;
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(2rem, 5vh, 4rem) 1.25rem;
  position: relative;
  width: 100%;
  z-index: 1;
}

.auth-shell::before,
.auth-shell::after {
  background: linear-gradient(90deg, transparent, rgba(84, 212, 255, .05) 16%, rgba(84, 212, 255, .82) 50%, rgba(84, 212, 255, .05) 84%, transparent);
  content: "";
  height: 1px;
  left: -28vw;
  opacity: .72;
  pointer-events: none;
  position: absolute;
  width: 58vw;
}

.auth-shell::before {
  top: 30%;
  animation: signal-sweep 9s ease-in-out infinite;
}

.auth-shell::after {
  left: auto;
  right: -25vw;
  top: 69%;
  animation: signal-sweep-reverse 12s ease-in-out 1.4s infinite;
}

.auth-brand-panel { padding: 1rem 0 1rem clamp(0rem, 5vw, 3rem); }

.auth-brand-logo {
  display: block;
  height: 112px;
  margin: 0 0 2.6rem;
  max-width: 215px;
  object-fit: contain;
  object-position: left center;
  width: auto;
}

.auth-globe {
  background:
    radial-gradient(circle at 30% 26%, rgba(133, 237, 255, .96), transparent 3%),
    radial-gradient(circle at 34% 28%, rgba(21, 182, 245, .34), transparent 46%),
    radial-gradient(circle at 50% 50%, rgba(15, 87, 148, .5), rgba(3, 18, 38, .05) 68%);
  border: 1px solid rgba(84, 212, 255, .3);
  border-radius: 50%;
  box-shadow: 0 0 0 12px rgba(34, 176, 237, .035), 0 0 42px rgba(26, 187, 255, .22);
  height: 146px;
  margin: 0 0 3.2rem 1rem;
  overflow: hidden;
  position: relative;
  width: 146px;
  animation: globe-hover 6s ease-in-out infinite;
}

.auth-globe::before,
.auth-globe::after,
.auth-globe span {
  border: 1px solid rgba(42, 207, 255, .72);
  border-radius: 50%;
  content: "";
  inset: 8%;
  position: absolute;
}

.auth-globe::before { transform: rotate(34deg) scaleX(.43); }
.auth-globe::after { transform: rotate(-34deg) scaleX(.43); }
.auth-globe span:nth-child(1) { border-color: rgba(42, 207, 255, .56); transform: rotate(90deg) scaleY(.35); }
.auth-globe span:nth-child(2) { border-color: rgba(110, 222, 255, .43); transform: rotate(90deg) scaleY(.68); }
.auth-globe span:nth-child(3) {
  animation: globe-signal 4s linear infinite;
  border-color: rgba(110, 222, 255, .5);
  border-style: dashed;
  inset: 22% 8%;
}

.auth-brand-kicker {
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .2em;
  margin: 0 0 .8rem;
  padding-left: 1.8rem;
  position: relative;
  text-transform: uppercase;
}

.auth-brand-kicker::before {
  background: var(--cyan);
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  top: 50%;
  width: 1.25rem;
}

.auth-brand-kicker::after {
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--cyan);
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  top: calc(50% - 2px);
  width: 4px;
  animation: kicker-signal 3.5s ease-in-out infinite;
}

.auth-brand-panel h1 {
  color: #f7fcff;
  font-size: clamp(2.9rem, 6vw, 4.8rem);
  letter-spacing: -.07em;
  line-height: .95;
  margin: 0;
  max-width: 540px;
}

.auth-brand-panel h1 em { color: #147fc4; font-style: normal; }
.auth-brand-panel h1 sup { color: var(--cyan); font-size: .28em; letter-spacing: 0; margin-left: .1em; vertical-align: top; }
.auth-brand-title { color: #bfeaff; font-size: 1.3rem; font-weight: 800; letter-spacing: .01em; margin: .75rem 0 0; }
.auth-brand-copy { color: rgba(202, 229, 244, .66); font-size: .94rem; line-height: 1.7; margin: 1rem 0 1.3rem; max-width: 450px; }
.auth-brand-tagline { color: var(--cyan); font-size: .72rem; font-weight: 900; letter-spacing: .14em; margin: 0; text-transform: uppercase; }

.auth-card {
  background: linear-gradient(145deg, rgba(22, 57, 91, .88), rgba(8, 29, 54, .88));
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: #f4fbff;
  padding: 2rem 1.45rem 1.1rem;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.auth-card::before {
  background: linear-gradient(90deg, transparent, rgba(84, 212, 255, .16), transparent);
  content: "";
  height: 1px;
  left: -100%;
  position: absolute;
  top: 0;
  width: 76%;
  animation: card-scan 7s ease-in-out infinite;
}

.auth-card-meta { align-items: center; color: #9bb6cc; display: flex; font-size: .62rem; font-weight: 900; justify-content: space-between; letter-spacing: .16em; text-transform: uppercase; }
.secure-label { color: var(--cyan); letter-spacing: .07em; }
.secure-label::before { content: "⌑ "; font-size: .85rem; }
.auth-card h2 { color: #f7fcff; font-size: 1.65rem; letter-spacing: -.035em; margin: 1.7rem 0 .25rem; }
.auth-subtitle { color: rgba(202, 229, 244, .62); font-size: .82rem; margin: 0 0 1.7rem; }
.auth-card .stack-form { gap: 1rem; }
.auth-card .stack-form label { color: #c9deec; font-size: .65rem; letter-spacing: .05em; margin-bottom: .4rem; }
.auth-card .stack-form input { background: #eaf2fc; border: 1px solid rgba(151, 201, 233, .4); border-radius: 6px; color: var(--navy); font-size: .9rem; padding: .78rem .85rem; }
.auth-card .stack-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(84, 212, 255, .16); outline: none; }
.auth-card .stack-form button { background: linear-gradient(100deg, #4dcbfa, #159bd8); border-radius: 6px; box-shadow: 0 8px 22px rgba(22, 166, 223, .2); margin-top: .45rem; padding: .85rem 1rem; }
.auth-card .stack-form button:hover { background: linear-gradient(100deg, #6bd8ff, #1eafe9); }
.auth-card .flash { border-radius: 6px; font-size: .8rem; margin: 0 0 1rem; }
.auth-card .flash.error { background: rgba(255, 127, 127, .12); border-color: rgba(255, 148, 148, .35); color: #ffc4c4; }
.auth-card-footer { border-top: 1px solid rgba(143, 202, 236, .13); color: rgba(184, 215, 233, .46); display: flex; font-size: .62rem; justify-content: space-between; margin-top: 1.6rem; padding-top: 1rem; }

/* Dark workspace treatment for the authenticated admin area */
.admin-shell { padding-top: 3rem; }
.admin-heading h1 { color: #f5fbff; margin-bottom: 0; }
.admin-heading .eyebrow { color: var(--cyan); }
body:has(.admin-shell) .card { background: rgba(12, 40, 68, .82); border-color: rgba(113, 204, 250, .16); box-shadow: 0 20px 52px rgba(0, 0, 0, .18); color: #eaf7ff; }
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; min-width: 760px; width: 100%; }
th, td { border-bottom: 1px solid rgba(143, 202, 236, .13); padding: 1rem 1.2rem; text-align: left; vertical-align: middle; }
th { background: rgba(2, 17, 34, .4); color: #83a5bf; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
td { color: #e6f4fc; font-size: .9rem; }
td strong, td small { display: block; }
td small { color: #8eacc1; margin-top: .2rem; }
.status-text { font-size: .75rem; font-weight: 900; text-transform: uppercase; }
.actions { display: flex; gap: 1rem; white-space: nowrap; }
.actions a { color: #8bddff; }
.empty-state { padding: 3rem; text-align: center; }
.empty-state p { color: #9bb6cc; }
.certificate-form { display: grid; gap: 1.2rem; padding: 1.5rem; }
.certificate-form label { color: #bcd5e5; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.file-field { background: rgba(2, 17, 34, .28); border: 1px dashed rgba(84, 212, 255, .35); padding: 1rem; }
.file-field small { color: #9bb6cc; display: block; font-size: .75rem; font-weight: 400; letter-spacing: 0; margin: .25rem 0 .7rem; text-transform: none; }
.form-actions { display: flex; gap: .75rem; padding-top: .4rem; }
body:has(.admin-shell) .certificate-form input,
body:has(.admin-shell) .certificate-form textarea,
body:has(.admin-shell) .certificate-form select { background: rgba(235, 246, 255, .96); }
body:has(.admin-shell) .secondary-button { background: transparent; border-color: rgba(143, 202, 236, .28); color: #bfeaff; }
body:has(.admin-shell) .secondary-button:hover { background: rgba(84, 212, 255, .1); }

.flash {
  animation: notification-in .45s cubic-bezier(.2, .8, .2, 1) both;
  backdrop-filter: blur(18px);
  border: 1px solid;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .2);
  left: 50%;
  margin: 0;
  max-width: min(560px, calc(100vw - 2rem));
  padding: .85rem 1.1rem .85rem 2.75rem;
  position: fixed;
  top: 4.65rem;
  transform: translateX(-50%);
  width: max-content;
  z-index: 20;
}

.flash::before {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "✓";
  display: inline-flex;
  font-size: .68rem;
  font-weight: 900;
  height: 1.1rem;
  justify-content: center;
  left: .9rem;
  position: absolute;
  top: calc(50% - .55rem);
  width: 1.1rem;
}

.flash.error { background: #fff0f0; border-color: #e7b0b0; color: #a12626; }
.flash.error::before { content: "!"; }
.flash.success { background: #eaf8f0; border-color: #a9dfbd; color: #087443; }
body:has(.auth-shell) .flash.success,
body:has(.admin-shell) .flash.success { background: rgba(30, 111, 86, .84); border-color: rgba(116, 236, 190, .35); color: #d4ffec; }
body:has(.auth-shell) .flash.error,
body:has(.admin-shell) .flash.error { background: rgba(118, 36, 58, .9); border-color: rgba(255, 151, 170, .38); color: #ffe1e6; }

body:has(.auth-shell) .auth-card .flash,
body:has(.admin-shell) .auth-card .flash {
  position: fixed;
}

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 92px 92px, 92px 92px; }
}

@keyframes signal-twinkle {
  from { opacity: .25; transform: scale(1); }
  to { opacity: .78; transform: scale(1.015); }
}

@keyframes signal-sweep {
  0%, 12% { opacity: 0; transform: translate3d(-6vw, 0, 0); }
  28%, 62% { opacity: .72; }
  88%, 100% { opacity: 0; transform: translate3d(108vw, 0, 0); }
}

@keyframes signal-sweep-reverse {
  0%, 12% { opacity: 0; transform: translate3d(8vw, 0, 0); }
  30%, 68% { opacity: .58; }
  92%, 100% { opacity: 0; transform: translate3d(-108vw, 0, 0); }
}

@keyframes globe-hover {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50% { transform: translate3d(0, -7px, 0) rotate(2deg); }
}

@keyframes globe-signal {
  0% { opacity: .28; transform: rotate(0deg) scaleX(.92); }
  50% { opacity: .9; transform: rotate(180deg) scaleX(1.06); }
  100% { opacity: .28; transform: rotate(360deg) scaleX(.92); }
}

@keyframes kicker-signal {
  0%, 100% { left: 0; opacity: .3; }
  45%, 65% { left: 1.1rem; opacity: 1; }
}

@keyframes card-scan {
  0%, 18% { left: -78%; opacity: 0; }
  35%, 62% { opacity: 1; }
  82%, 100% { left: 110%; opacity: 0; }
}

@keyframes status-progress {
  0% { left: -55%; opacity: 0; }
  18% { opacity: 1; }
  72% { opacity: .92; }
  100% { left: 105%; opacity: 0; }
}

@keyframes notification-in {
  from { opacity: 0; transform: translate(-50%, -14px) scale(.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  body:has(.auth-shell)::before,
  body:has(.auth-shell)::after,
  body:has(.admin-shell)::before,
  body:has(.admin-shell)::after,
  .auth-shell::before,
  .auth-shell::after,
  .auth-globe,
  .auth-globe span:nth-child(3),
  .auth-brand-kicker::after,
  .auth-card::before,
  .portal-progress-track i,
  .flash {
    animation: none;
  }
}

@media (max-width: 860px) {
  .auth-shell { gap: 2rem; grid-template-columns: 1fr; min-height: auto; padding-bottom: 4rem; padding-top: 3rem; }
  .auth-brand-panel { padding-left: 0; }
  .auth-brand-logo { height: 86px; margin-bottom: 2rem; }
  .auth-brand-panel h1 { font-size: clamp(2.7rem, 12vw, 4.4rem); }
  .auth-card { max-width: 520px; }
}

@media (max-height: 760px) and (min-width: 861px) {
  .auth-shell { gap: clamp(2rem, 7vw, 6rem); padding-bottom: 1.5rem; padding-top: 1.5rem; }
  .auth-brand-logo { height: 82px; margin-bottom: 1.6rem; }
  .auth-brand-panel h1 { font-size: clamp(2.5rem, 5vw, 3.9rem); }
  .auth-brand-copy { margin-bottom: .8rem; margin-top: .7rem; }
  .auth-card { padding-top: 1.45rem; }
  .auth-card h2 { margin-top: 1.1rem; }
  .auth-subtitle { margin-bottom: 1.1rem; }
  .auth-card-footer { margin-top: 1.1rem; }
}

@media (max-width: 760px) {
  .site-header, .site-footer, .result-top, .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-nav { flex-wrap: wrap; }
  .search-row, .info-grid, .result-grid, .details, .form-grid { display: grid; grid-template-columns: 1fr; }
  .search-row button { width: 100%; }
  .public-shell, .admin-shell { padding-top: 2rem; }
  .hero::after { inset: .75rem; }
  .hero { padding: 2rem 1.2rem; }
  .not-found { padding: 2rem 1.2rem; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .portal-status-rail { gap: .45rem; }
  .portal-status-label { display: none; }
  .portal-status-state { font-size: .52rem; }
  .flash { top: 4.2rem; }
}