/* Rotary Conclave – theme aligned with Rotary India / rcvijayawada.rotaryindia.org
   Colors: Rotary Royal Blue #17458f, Rotary Gold #f7a81b (brandcenter.rotary.org) */
:root {
  --bg: #f5f5f5;
  --surface: #fff;
  --text: #222;
  --text-muted: #555;
  --accent: #f7a81b;
  --accent-hover: #e09810;
  --rotary-blue: #17458f;
  --rotary-blue-hover: #123870;
  --rotary-red: #b72126;
  --rotary-yellow: #ffc72c;
  --border: #d4d0c8;
  --error: #c00;
  --radius: 4px;
  --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Barlow Semi Condensed", "Poppins", sans-serif;
  /* Portrait ID card (750×1050) */
  --card-red: #ef1c23;
  --card-red-shadow: #c9151b;
  --card-yellow: #f4bf2a;
  --card-blue: #165c9c;
  --card-body-bg: #f1f1f1;
  --card-dark: #222222;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ----- Form page ----- */
.form-page {
  padding: 1.5rem 1rem;
  min-height: 100vh;
}

.form-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.form-header {
  margin-bottom: 1.5rem;
}

.form-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25em;
  color: var(--rotary-blue);
  letter-spacing: -0.02em;
}

.form-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.form-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.event-details-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.event-details-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--rotary-blue);
  margin: 0 0 0.75rem;
}

.event-detail {
  font-size: 0.9rem;
  color: var(--text);
  margin: 0.35em 0;
  line-height: 1.45;
}

.event-detail-icon {
  margin-right: 0.35rem;
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.event-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-option {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.event-option:hover {
  border-color: var(--rotary-blue);
  background: var(--bg);
}

.event-option input[type="radio"] {
  margin: 0.2rem 0 0;
  width: auto;
  flex-shrink: 0;
}

.event-option input[type="radio"]:checked + .event-option-text {
  font-weight: 600;
  color: var(--rotary-blue);
}

.event-option-text {
  flex: 1;
  font-size: 0.9375rem;
}

.event-option-fee {
  width: 100%;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-left: 1.5rem;
}

.field-event.field-has-error .event-option {
  border-color: var(--error);
}

/* Success state (event registration) */
.success-state {
  background: var(--surface);
  padding: 2rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
  animation: successFadeIn 0.4s ease-out;
}

.success-state[hidden] {
  display: none !important;
}

@keyframes successFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-tick-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
}

.success-tick {
  width: 100%;
  height: 100%;
  display: block;
}

.success-tick-circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: successCircle 0.5s ease-out 0.15s forwards;
}

.success-tick-path {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: successTick 0.35s ease-out 0.5s forwards;
}

@keyframes successCircle {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes successTick {
  to {
    stroke-dashoffset: 0;
  }
}

.success-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--rotary-blue);
  margin: 0 0 0.5rem;
}

.success-message {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.success-actions .btn {
  width: 100%;
}

.reg-form {
  background: var(--surface);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.reg-form .field {
  margin-bottom: 1rem;
}

.reg-form .field:last-of-type {
  margin-bottom: 1.25rem;
}

.reg-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.reg-form .req {
  color: var(--error);
}

.reg-form input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.reg-form input::placeholder {
  color: var(--text-muted);
}

.reg-form input:focus {
  outline: none;
  border-color: var(--rotary-blue);
}

.reg-form .field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.reg-form .field-error {
  display: block;
  font-size: 0.8125rem;
  color: var(--error);
  margin-top: 0.35rem;
  min-height: 1.2em;
}

.reg-form .field-has-error input {
  border-color: var(--error);
}

.reg-form .field-photo.field-has-error .photo-preview-wrap {
  border-color: var(--error);
}

.form-error {
  font-size: 0.875rem;
  color: var(--error);
  margin: 0 0 0.5rem;
  min-height: 1.25em;
}

/* Photo picker (upload / selfie) */
.field-photo label {
  margin-bottom: 0.5rem;
}

.photo-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.photo-preview-wrap {
  width: 80px;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.25rem;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.btn-photo {
  width: auto;
}

/* Crop modal */
.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.crop-modal[hidden] {
  display: none;
}

.crop-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.crop-modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crop-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.crop-modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.crop-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}

.crop-modal-close:hover {
  color: var(--text);
}

.crop-container-wrap {
  width: 320px;
  height: 320px;
  max-width: 85vw;
  max-height: 50vh;
  background: #000;
}

.crop-container-wrap .cropper-container {
  width: 100% !important;
  height: 100% !important;
}

.crop-source-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.crop-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.crop-modal-actions .btn {
  width: auto;
}

/* Camera modal */
.camera-wrap {
  width: 320px;
  height: 240px;
  max-width: 95vw;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(247, 168, 27, 0.12);
}

/* ----- ID Card page: portrait event badge 750×1050 -----
   Sections: header | yellow section | blue host strip | ribbon | main body | footer | rotary wheel
   Plus: responsive (scale), print
   ----- */
html.card-html {
  overflow-x: hidden;
  max-width: 100%;
}

body.card-page {
  padding: 1rem 0.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #e0e0e0;
  overflow-x: hidden;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0;
}

.card-page .card-container {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}

/* Scaler: fixed design size, scaled down on small screens */
.id-card-scaler {
  width: 750px;
  height: 1050px;
  flex-shrink: 0;
  transform-origin: top center;
}

.id-card {
  width: 750px;
  height: 1050px;
  position: relative;
  overflow: hidden;
  background: #f1f1f1;
  border-radius: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* ----- ID card template (ID_Card.jpeg + overlay fields) ----- */
.id-card-template .id-card-template-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
}

.id-card-template .id-card-overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* All dynamic text: centered on card, clean sans-serif */
.id-card-template .id-card-field {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  max-width: 620px;
  margin: 0;
  padding: 0;
  text-align: center;
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
  box-sizing: border-box;
}

/* Name: largest, bright red, bold – below date/venue on template */
.id-card-field-name {
  top: 56%;
  font-size: 40px;
  font-weight: 700;
  color: #ef1c23;
}

/* Club: smaller, dark grey, regular */
.id-card-field-club {
  top: 60%;
  font-size: 26px;
  font-weight: 400;
  color: #333;
}

/* Company: large, blue, bold */
.id-card-field-company {
  top: 64%;
  font-size: 36px;
  font-weight: 700;
  color: #165c9c;
}

/* Designation: large, blue, bold (slightly smaller than company) */
.id-card-field-designation {
  top: 68%;
  font-size: 34px;
  font-weight: 700;
  color: #165c9c;
}

/* Phone: small, dark grey, regular */
.id-card-field-phone {
  top: 72%;
  font-size: 26px;
  font-weight: 400;
  color: #333;
}

/* Serial: large, bright red, bold – above footer */
.id-card-field-serial {
  top: 78%;
  font-size: 38px;
  font-weight: 700;
  color: #ef1c23;
  letter-spacing: 0.04em;
}

/* Curved sections layer (red, yellow, blue, body, footer) - used when not template */
.id-card-curves-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ========== 1. TOP RED HEADER ========== */
.id-card-top-header {
  height: 180px;
  background: transparent;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 40px 44px 0;
  box-sizing: border-box;
}

.id-card-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
  text-align: left;
}

.id-card-emblem {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.id-card-brand-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  text-align: left;
}

.id-card-rotary-text {
  font-family: "Montserrat", "Arial Black", sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.id-card-district-text {
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.id-card-end-polio-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 70px;
  margin: 0;
  font-family: "Anton", "Montserrat", "Arial Black", sans-serif;
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  z-index: 1;
}

.id-card-end-yellow {
  color: #ffc928;
}

.id-card-polio-white {
  color: #fff;
}

.id-card-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  z-index: 1;
  text-align: right;
}

.id-card-unite-line {
  font-family: "Montserrat", "Arial Black", sans-serif;
  font-size: 13px;
  font-weight: 800;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

/* ========== 2. YELLOW KARTHAVYAM SECTION ========== */
.id-card-yellow-section {
  height: 155px;
  margin-top: -2px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.id-card-karthavyam-title {
  margin: 0;
  font-family: "Baloo 2", "Anton", "Arial Black", sans-serif;
  font-size: 92px;
  font-weight: 900;
  color: #ef1c23;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
  text-shadow:
    2px 2px 0 #fff,
    -2px -2px 0 #fff,
    2px -2px 0 #fff,
    -2px 2px 0 #fff,
    4px 4px 8px rgba(201, 21, 27, 0.5),
    0 0 24px rgba(255, 255, 255, 0.25);
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
}

/* ========== 3. BLUE HOST CLUB CURVED BAND ========== */
.id-card-blue-band {
  height: 135px;
  margin-top: -2px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  padding: 0 44px;
  box-sizing: border-box;
  text-align: center;
}

.id-card-host-label {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  margin: 0;
  text-align: center;
}

.id-card-host-name {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #f4bf2a;
  line-height: 1.25;
  margin: 0;
  text-align: center;
}

.id-card-host-district {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin: 0;
  text-align: center;
}

/* ========== 4. BIZ CONNECT RIBBON ========== */
.id-card-biz-ribbon {
  position: absolute;
  left: 50%;
  top: 400px;
  transform: translateX(-50%);
  width: 400px;
  height: 105px;
  background: #ef1c23;
  background: linear-gradient(180deg, #f02a2f 0%, #ef1c23 35%, #c9151b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
}

.id-card-biz-ribbon::before,
.id-card-biz-ribbon::after {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 100%;
  background: linear-gradient(135deg, #8b0f14 0%, #6b0a0e 50%, #5a080c 100%);
  border-radius: 3px;
  box-shadow: inset 2px 0 6px rgba(0, 0, 0, 0.4);
}

.id-card-biz-ribbon::before {
  left: -10px;
  transform: skewY(-3deg);
}

.id-card-biz-ribbon::after {
  right: -10px;
  transform: skewY(3deg);
}

.id-card-biz-ribbon-text {
  font-family: "Baloo 2", "Anton", "Arial Black", sans-serif;
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  -webkit-text-stroke: 2.5px #000;
  paint-order: stroke fill;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 0 0 2px #000, 2px 2px 6px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.03em;
  z-index: 1;
}

/* ========== 5. MAIN WHITE/LIGHT BODY SECTION ========== */
.id-card-main-body {
  margin-top: -2px;
  height: 432px;
  max-height: 432px;
  background: transparent;
  padding: 48px 44px 44px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
}

.id-card-event-datetime {
  font-family: "Montserrat", "Poppins", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #165c9c;
  margin: 0 0 8px;
  line-height: 1.25;
  text-align: center;
  flex-shrink: 0;
}

.id-card-event-venue {
  font-family: "Poppins", sans-serif;
  font-size: 20px;
  color: #222;
  margin: 0 0 18px;
  line-height: 1.35;
  text-align: center;
  flex-shrink: 0;
}

.id-card-event-venue strong {
  font-weight: 800;
}

/* ========== 6. PARTICIPANT DETAILS BLOCK ========== */
.id-card-participant-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 4px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
  max-width: 680px;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.id-card-participant-name,
.id-card-participant-club,
.id-card-participant-company,
.id-card-participant-designation,
.id-card-participant-phone,
.id-card-participant-serial {
  display: block;
  width: 100%;
  margin: 0;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.id-card-participant-name {
  font-family: "Montserrat", "Arial Black", sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: #ef1c23;
  line-height: 1.2;
}

.id-card-participant-club {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 34px;
  font-weight: 600;
  color: #222;
  line-height: 1.2;
}

.id-card-participant-company {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 34px;
  font-weight: 700;
  color: #165c9c;
  line-height: 1.2;
}

.id-card-participant-designation {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: #165c9c;
  line-height: 1.2;
}

.id-card-participant-phone {
  font-family: "Poppins", "Montserrat", sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: #222;
  line-height: 1.2;
}

.id-card-participant-serial {
  font-family: "Montserrat", "Arial Black", sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: #ef1c23;
  letter-spacing: 0.06em;
  margin-top: 16px;
  line-height: 1.2;
}

/* ========== 7. BOTTOM RED PATTERN FOOTER ========== */
.id-card-footer-pattern {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 160px;
  z-index: 2;
  pointer-events: none;
}

/* ========== 8. ROTARY WHEEL BOTTOM RIGHT ========== */
.id-card-rotary-wheel {
  position: absolute;
  right: 18px;
  bottom: 8px;
  width: 145px;
  height: 145px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.id-card-wheel-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* ----- responsive: scale card proportionally on smaller screens ----- */
/* Mobile: scale card to viewport width, no horizontal scroll */
@media (max-width: 780px) {
  html.card-html,
  html.card-html body.card-page {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .card-page {
    padding: 0.5rem 0 1rem;
    width: 100%;
    min-width: 0;
  }

  .card-page .card-container {
    position: relative;
    max-width: 100vw !important;
    width: 100vw !important;
    min-width: 0;
    height: calc(1050px * (100vw / 750));
    overflow: hidden !important;
    flex-shrink: 0;
  }

  .card-page .id-card-scaler {
    position: absolute !important;
    left: 50% !important;
    top: 0 !important;
    width: 750px;
    height: 1050px;
    transform: translateX(-50%) scale(calc(100vw / 750)) !important;
    transform-origin: top center;
  }

  .card-page .card-actions {
    width: 100%;
    max-width: 100vw;
    padding: 0 0.75rem;
    margin-top: 1rem;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  .card-page .card-actions .btn {
    min-height: 44px;
    padding: 0.6rem 1rem;
    box-sizing: border-box;
  }
}

/* Desktop: no scale, normal flow */
@media (min-width: 781px) {
  .card-page .id-card-scaler {
    transform: none !important;
    position: relative;
  }
}

/* ----- print: preserve design, exact colors, no cutoff ----- */
@media print {
  .card-page {
    background: #fff;
    padding: 0;
  }

  .card-actions {
    display: none !important;
  }

  .id-card-scaler {
    transform: none !important;
    width: 750px !important;
    height: 1050px !important;
  }

  .id-card {
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .card-container {
    max-width: none;
  }
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 750px;
}

.card-actions .btn {
  width: 100%;
}

.download-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--surface, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.download-overlay-text {
  font-size: 1.15rem;
  color: var(--text, #333);
  margin: 0;
}

.download-done-msg {
  text-align: center;
  padding: 2rem 1rem;
}
.download-done-msg p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}
.download-done-msg .btn {
  margin-top: 1rem;
}

/* ----- Admin login ----- */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-login-box {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-login-box h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--rotary-blue);
}

.admin-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.admin-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  opacity: 0.9;
}

.admin-form .field {
  margin-bottom: 1rem;
}

.admin-form .field label {
  display: block;
  font-size: 0.8125rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.admin-form input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.admin-form button {
  margin-top: 0.25rem;
  width: 100%;
}

/* ----- Admin dashboard ----- */
.admin-dashboard-page {
  min-height: 100vh;
  padding: 1rem;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0;
  color: var(--rotary-blue);
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-actions .btn {
  width: auto;
}

/* Admin filters */
.admin-filters {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.admin-filters .btn {
  width: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  min-height: auto;
}

.admin-filter-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.admin-filter-input {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  font-family: inherit;
}

.admin-filter-select {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
}

/* Admin pagination */
.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.admin-pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.admin-pagination-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.admin-pagination-btn {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--rotary-blue);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  min-width: 2.25rem;
  text-align: center;
}

.admin-pagination-btn:hover {
  background: var(--bg);
  border-color: var(--rotary-blue);
}

.admin-pagination-btn-current {
  background: var(--rotary-blue);
  color: #fff;
  border-color: var(--rotary-blue);
  pointer-events: none;
}

/* Admin form modal */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.admin-modal-box {
  position: relative;
  background: var(--surface);
  border-radius: 8px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-modal-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--rotary-blue);
}

.admin-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}

.admin-modal-close:hover {
  color: var(--text);
}

.admin-modal-body {
  padding: 1rem;
}

.admin-modal-body .reg-form {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.reg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.reg-table th,
.reg-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.reg-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  white-space: nowrap;
}

.reg-table td {
  color: var(--text);
}

.reg-table tbody tr:last-child td {
  border-bottom: none;
}

.reg-table tbody tr:hover {
  background: var(--bg);
}

.reg-table code {
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.15em 0.35em;
  border-radius: 2px;
}

.reg-table a {
  color: var(--rotary-blue);
  text-decoration: none;
}

.reg-table a:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

.reg-table-actions {
  white-space: nowrap;
}

.reg-table .btn-link {
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0 0.25rem;
  text-decoration: none;
}

.reg-table .btn-link-edit {
  color: var(--rotary-blue);
  margin-right: 0.5rem;
}

.reg-table .btn-link-edit:hover {
  text-decoration: underline;
}

.reg-table .btn-link-delete {
  color: var(--error);
}

.reg-table .btn-link-delete:hover {
  text-decoration: underline;
}

.admin-form-wrap {
  max-width: 440px;
  margin-top: 0.5rem;
}

.admin-form-wrap .reg-form {
  margin: 0;
}

.admin-form-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

@media (max-width: 640px) {
  .reg-table thead {
    display: none;
  }

  .reg-table tr {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }

  .reg-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.35rem 0;
    border: none;
  }

  .reg-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
  }

  .reg-table td:first-child {
    font-weight: 600;
    padding-top: 0;
  }

  .reg-table .empty-state {
    display: block;
    padding: 1.5rem !important;
  }
}

@media (max-width: 640px) {
  .reg-table td[data-label]::before {
    content: attr(data-label);
  }
}
