:root {
  --brand-red: #D0343A;
  --brand-navy: #004B96;
  --brand-navy-2: #00366D;
  --ink: #172033;
  --muted: #687386;
  --line: #dfe4ec;
  --surface: #ffffff;
  --surface-soft: #f4f6f9;
  --success: #17744b;
  --danger: #a51f32;
  --shadow: 0 24px 70px rgba(0, 54, 109, .16);
  --radius: 24px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
a { color: inherit; }
img { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(20,42,74,.1);
}
.site-header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 118px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-logo { display: flex; align-items: center; text-decoration: none; }
.site-logo img { display: block; width: min(220px, 42vw); height: auto; object-fit: contain; object-position: left center; }
.header-links { display: flex; align-items: center; gap: 18px; }
.header-links a { text-decoration: none; font-weight: 750; color: var(--brand-navy); }

.button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(197,32,53,.25);
  outline-offset: 2px;
}
.button-primary { background: var(--brand-red); color: #fff; box-shadow: 0 10px 28px rgba(197,32,53,.24); }
.button-secondary { background: var(--brand-navy); color: #fff; }
.button-light { background: #fff; color: var(--brand-navy); border: 1px solid var(--line); }
.button-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.button-wide { width: 100%; }
.button-small { padding: 8px 12px; font-size: .9rem; border-radius: 11px; }

.hero {
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(197,32,53,.42), transparent 34%),
    linear-gradient(135deg, var(--brand-navy-2), var(--brand-navy));
  padding: 86px 0 92px;
  overflow: hidden;
}
.hero-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 60px;
  align-items: center;
}
.eyebrow { text-transform: uppercase; font-size: .78rem; letter-spacing: .16em; font-weight: 900; color: var(--brand-red); margin-bottom: 10px; }
.hero .eyebrow { color: #ffced5; }
.hero h1 { margin: 0 0 18px; font-size: clamp(2.6rem, 5vw, 5rem); line-height: .98; letter-spacing: -.055em; }
.hero p { margin: 0 0 30px; max-width: 650px; color: rgba(255,255,255,.82); font-size: 1.15rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-card-preview {
  position: relative;
  min-height: 390px;
  display: grid;
  place-items: center;
}
.hero-card-preview::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  filter: blur(2px);
}
.mini-card {
  position: relative;
  width: min(390px, 100%);
  background: #fff;
  color: var(--ink);
  border-radius: 30px;
  box-shadow: 0 40px 80px rgba(0,0,0,.28);
  overflow: hidden;
  transform: rotate(2deg);
}
.mini-card-top { height: 112px; background: linear-gradient(135deg, var(--brand-red), #9F252B); }
.mini-card-body { padding: 0 30px 30px; }
.mini-avatar { width: 112px; height: 112px; margin-top: -58px; border-radius: 50%; border: 6px solid #fff; background: var(--brand-navy); color: #fff; display: grid; place-items: center; font-size: 2rem; font-weight: 900; }
.mini-card h2 { margin: 16px 0 2px; font-size: 1.75rem; }
.mini-card p { margin: 0; color: var(--muted); font-size: 1rem; }
.mini-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.mini-actions span { background: var(--surface-soft); border-radius: 13px; padding: 12px 8px; text-align: center; font-size: .78rem; font-weight: 800; }

.directory-section { padding: 74px 0 100px; }
.content-width { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.04em; color: var(--brand-navy); }
.section-heading p { margin: 8px 0 0; color: var(--muted); }
.search-box { min-width: min(380px, 100%); position: relative; }
.search-box input { width: 100%; padding: 15px 18px 15px 46px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.search-box::before { content: "⌕"; position: absolute; left: 17px; top: 8px; font-size: 1.6rem; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.directory-card { background: #fff; border: 1px solid var(--line); border-radius: 21px; padding: 22px; text-decoration: none; display: flex; gap: 16px; align-items: center; box-shadow: 0 12px 35px rgba(20,42,74,.06); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.directory-card:hover { transform: translateY(-4px); box-shadow: 0 20px 45px rgba(20,42,74,.12); border-color: rgba(208,52,58,.35); }
.directory-avatar { flex: 0 0 auto; width: 74px; height: 74px; border-radius: 18px; object-fit: cover; background: var(--brand-navy); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 1.35rem; }
.directory-card h3 { margin: 0 0 3px; color: var(--brand-navy); font-size: 1.18rem; }
.directory-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.directory-card .dept { margin-top: 7px; color: var(--brand-red); font-weight: 800; font-size: .78rem; }
.empty-state { background: #fff; border: 1px dashed #c9d1dc; border-radius: 22px; padding: 50px; text-align: center; color: var(--muted); }

.site-footer { background: var(--brand-navy-2); color: rgba(255,255,255,.76); padding: 30px 0; }
.site-footer-inner { width: min(1180px, calc(100% - 32px)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.site-footer img { width: 200px; height: auto; object-fit: contain; object-position: left center; opacity: 1; }
.site-footer a { color: #fff; }

.card-page {
  min-height: 100vh;
  padding: 34px 16px 70px;
  background: linear-gradient(160deg, #00366D 0, #004B96 45%, #f2f4f8 45%, #f2f4f8 100%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--card-accent, #D0343A) 24%, transparent), transparent 33%),
    linear-gradient(160deg, #00366D 0, #004B96 45%, #f2f4f8 45%, #f2f4f8 100%);
}
.card-topbar { width: min(760px, 100%); margin: 0 auto 18px; display: flex; justify-content: space-between; align-items: center; }
.card-topbar img { width: 190px; height: auto; object-fit: contain; object-position: left; border-radius: 4px; }
.card-topbar-actions { display: flex; gap: 9px; }
.icon-button { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); color: #fff; border-radius: 14px; display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; }
.digital-card { width: min(760px, 100%); margin: 0 auto; background: #fff; border-radius: 30px; box-shadow: var(--shadow); overflow: hidden; }
.card-cover { height: 178px; position: relative; background: var(--card-accent, #D0343A); background: linear-gradient(135deg, var(--card-accent, #D0343A), color-mix(in srgb, var(--card-accent, #D0343A) 58%, #00366D)); }
.card-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.13)); }
.card-profile { padding: 0 34px 34px; }
.profile-photo, .profile-initials { width: 150px; height: 150px; border-radius: 28px; border: 7px solid #fff; margin-top: -82px; position: relative; z-index: 2; object-fit: cover; box-shadow: 0 12px 35px rgba(0,54,109,.18); }
.profile-initials { background: var(--brand-navy); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 2.8rem; }
.profile-heading { display: flex; justify-content: space-between; gap: 22px; align-items: start; }
.profile-copy { padding-top: 17px; }
.profile-copy h1 { margin: 0; color: var(--brand-navy); font-size: clamp(2rem, 7vw, 3.2rem); letter-spacing: -.045em; line-height: 1.05; }
.profile-copy .title { margin: 7px 0 0; color: var(--card-accent, #D0343A); font-size: 1.08rem; font-weight: 850; }
.profile-copy .org { margin: 3px 0 0; color: var(--muted); }
.card-primary-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-top: 28px; }
.card-action { min-height: 78px; border-radius: 17px; background: var(--surface-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: .78rem; font-weight: 850; color: var(--brand-navy); border: 1px solid transparent; }
.card-action:hover { border-color: color-mix(in srgb, var(--card-accent, #D0343A) 35%, #dfe4ec); background: #fff; }
.action-icon { font-size: 1.35rem; line-height: 1; }
.save-contact { margin-top: 13px; background: var(--card-accent, #D0343A); color: #fff; width: 100%; min-height: 54px; }
.card-section { padding: 26px 0; border-top: 1px solid var(--line); }
.card-section:first-of-type { margin-top: 26px; }
.card-section h2 { margin: 0 0 13px; color: var(--brand-navy); font-size: 1.15rem; }
.card-section p { margin: 0; color: #4f5b6e; white-space: pre-line; }
.detail-list { display: grid; gap: 11px; }
.detail-row { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; padding: 13px; border-radius: 14px; background: var(--surface-soft); }
.detail-row:hover { background: #e9edf3; }
.detail-symbol { width: 34px; height: 34px; border-radius: 10px; background: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.detail-row strong { display: block; color: var(--brand-navy); font-size: .83rem; }
.detail-row span { color: #4f5b6e; word-break: break-word; }
.social-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.social-link { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; font-weight: 800; color: var(--brand-navy); }
.social-link:hover { border-color: var(--card-accent, #D0343A); }
.card-brand-footer { display: flex; justify-content: center; padding: 20px; background: #f7f8fa; }
.card-brand-footer img { width: min(260px, 100%); height: auto; object-fit: contain; }

.modal { display: none; position: fixed; inset: 0; z-index: 100; padding: 18px; background: rgba(7,17,32,.72); align-items: center; justify-content: center; }
.modal.is-open { display: flex; }
.modal-panel { width: min(500px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; background: #fff; border-radius: 24px; box-shadow: 0 32px 100px rgba(0,0,0,.35); padding: 28px; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-soft); cursor: pointer; font-size: 1.2rem; }
.modal-panel h2 { margin: 0 42px 6px 0; color: var(--brand-navy); }
.modal-panel > p { color: var(--muted); margin-top: 0; }
.qr-box { width: 276px; max-width: 100%; margin: 22px auto; padding: 18px; border-radius: 20px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; }
.qr-box img, .qr-box canvas, .qr-box svg { max-width: 100%; height: auto !important; display: block; }
.qr-url { padding: 12px; background: var(--surface-soft); border-radius: 12px; font-size: .88rem; word-break: break-all; text-align: center; color: var(--muted); }

.stack-form { display: grid; gap: 16px; }
.stack-form label { display: grid; gap: 7px; font-weight: 800; color: var(--brand-navy); }
.stack-form input, .stack-form textarea, .stack-form select {
  width: 100%; border: 1px solid #cfd6e1; border-radius: 12px; padding: 12px 13px; background: #fff; color: var(--ink);
}
.stack-form textarea { min-height: 108px; resize: vertical; }
.stack-form small { color: var(--muted); font-weight: 500; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.checkbox-row { display: flex !important; grid-template-columns: none !important; align-items: flex-start; gap: 10px !important; font-weight: 600 !important; color: var(--ink) !important; }
.checkbox-row input { width: auto; margin-top: 4px; }

.alert { padding: 13px 15px; border-radius: 13px; margin: 14px 0; font-weight: 700; }
.alert-success { color: #0b5e3b; background: #e5f7ef; border: 1px solid #afe4ce; }
.alert-error { color: #841426; background: #fdebed; border: 1px solid #f5bbc4; }
.alert-info { color: #164b75; background: #eaf4fc; border: 1px solid #bbdcf4; }

.setup-body { background: linear-gradient(145deg, #e9edf3, #f9fafc); padding: 36px 16px; }
.setup-shell { min-height: calc(100vh - 72px); display: grid; place-items: center; }
.setup-card { width: min(820px, 100%); background: #fff; border-radius: 28px; box-shadow: var(--shadow); padding: clamp(26px, 6vw, 58px); }
.setup-logo { width: min(620px, 100%); height: auto; display: block; margin-bottom: 34px; }
.setup-card h1 { margin: 0 0 10px; color: var(--brand-navy); font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; }
.setup-card h2 { color: var(--brand-navy); }
.setup-card > p { color: var(--muted); }
.setup-card hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

.not-found { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--brand-navy); }
.not-found-card { width: min(560px, 100%); background: #fff; border-radius: 25px; padding: 40px; text-align: center; }
.not-found-card img { width: min(360px, 100%); height: auto; }
.not-found-card h1 { color: var(--brand-navy); }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card-preview { min-height: 340px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .section-heading { align-items: stretch; flex-direction: column; }
  .search-box { min-width: 0; }
}

@media (max-width: 620px) {
  .site-header-inner { min-height: 92px; }
  .site-logo img { width: 150px; height: auto; }
  .header-links a:not(.button) { display: none; }
  .hero { padding: 58px 0 68px; }
  .hero-card-preview { display: none; }
  .directory-section { padding: 54px 0 70px; }
  .card-grid { grid-template-columns: 1fr; }
  .site-footer-inner { flex-direction: column; text-align: center; }
  .site-footer img { object-position: center; }
  .card-page { padding: 18px 10px 48px; background: linear-gradient(170deg, #00366D 0, #004B96 35%, #f2f4f8 35%); }
  .card-topbar img { width: 145px; height: auto; }
  .digital-card { border-radius: 24px; }
  .card-cover { height: 145px; }
  .card-profile { padding: 0 20px 25px; }
  .profile-photo, .profile-initials { width: 122px; height: 122px; margin-top: -67px; border-radius: 23px; }
  .profile-initials { font-size: 2.2rem; }
  .profile-heading { display: block; }
  .profile-copy { padding-top: 14px; }
  .card-primary-actions { grid-template-columns: repeat(2, 1fr); }
  .social-grid { grid-template-columns: 1fr; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .setup-card { padding: 26px 20px; }
  .setup-logo { margin-bottom: 24px; }
}

@media print {
  .site-header, .card-topbar, .card-primary-actions, .save-contact, .modal, .site-footer { display: none !important; }
  body, .card-page { background: #fff !important; padding: 0; }
  .digital-card { box-shadow: none; border: 1px solid #ddd; }
}
