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

:root, .cards-page-root {
  --primary: #1b3d6c;
  --primary-mid: #25528f;
  --accent: #2563eb;
  --accent-light: #4f8cf6;
  --gold: #d4a017;
  --gold-glow: rgba(212, 160, 23, 0.45);
  --gold-gradient: linear-gradient(135deg, #f9d976 0%, #e9b638 50%, #b8860b 100%);
  --bg: #0d1a2d;
  --card-bg-dark: linear-gradient(145deg, #1b3d6c 0%, #244f8a 55%, #2e62a8 100%);
  --surface: #172a47;
  --surface-light: #1f375c;
  --border: rgba(255, 255, 255, 0.15);
  --text-white: #ffffff;
  --text-muted: #9bb2d4;
  --radius-card: 16px;
  --shadow-card: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 40px rgba(37, 99, 235, 0.25);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.empty-layout {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-height: 100vh !important;
}

.cards-page-root {
  display: block !important;
  width: 100% !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: var(--bg) !important;
  color: var(--text-white) !important;
  font-family: 'Cairo', sans-serif !important;
  line-height: 1.6 !important;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(212, 160, 23, 0.1) 0%, transparent 45%),
    linear-gradient(180deg, rgba(27, 61, 108, 0.8) 0%, #0d1a2d 100%) !important;
}


*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  :root {
    --primary: #1b3d6c;
    --primary-mid: #25528f;
    --accent: #2563eb;
    --accent-light: #4f8cf6;
    --gold: #d4a017;
    --gold-glow: rgba(212, 160, 23, 0.45);
    --gold-gradient: linear-gradient(135deg, #f9d976 0%, #e9b638 50%, #b8860b 100%);
    --bg: #0d1a2d;
    --card-bg-dark: linear-gradient(145deg, #1b3d6c 0%, #244f8a 55%, #2e62a8 100%);
    --surface: #172a47;
    --surface-light: #1f375c;
    --border: rgba(255, 255, 255, 0.15);
    --text-white: #ffffff;
    --text-muted: #9bb2d4;
    --radius-card: 16px;
    --shadow-card: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 40px rgba(37, 99, 235, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body {
    background-color: var(--bg);
    color: var(--text-white);
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
      radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.18) 0%, transparent 45%),
      radial-gradient(circle at 85% 80%, rgba(212, 160, 23, 0.1) 0%, transparent 45%),
      linear-gradient(180deg, rgba(27, 61, 108, 0.8) 0%, #0d1a2d 100%);
  }

  /* TOP APP HEADER */
  .header {
    background: rgba(27, 61, 108, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }

  .header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
  }

  .header-logo-box {
    background: #ffffff;
    padding: 5px 9px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .header-logo-box img {
    height: 36px;
    width: auto;
    object-fit: contain;
  }

  .header-title h1 {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(90deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .header-title p {
    font-size: 11.5px;
    color: var(--gold);
    letter-spacing: 0.5px;
    font-weight: 600;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
  }

  .btn-gold {
    background: var(--gold-gradient);
    color: #08162d;
    box-shadow: 0 4px 18px var(--gold-glow);
  }

  .btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 160, 23, 0.6);
  }

  .btn-outline {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid var(--border);
  }

  .btn-outline:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
  }

  /* MAIN LAYOUT */
  .main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px 70px;
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 40px;
    align-items: start;
  }

  /* LEFT: PREVIEW & 3D STAGE */
  .stage-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
  }

  .stage-header {
    text-align: center;
    max-width: 600px;
  }

  .stage-header .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    background: rgba(212, 160, 23, 0.15);
    border: 1px solid rgba(212, 160, 23, 0.35);
    border-radius: 20px;
    font-size: 12px;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 10px;
  }

  .stage-header h2 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
  }

  .stage-header p {
    font-size: 13.5px;
    color: var(--text-muted);
  }

  /* LANYARD SIMULATION */
  .lanyard-assembly {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
  }

  .lanyard-strap {
    width: 36px;
    height: 60px;
    background: linear-gradient(90deg, #142e52 0%, #25528f 50%, #142e52 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lanyard-strap::after {
    content: "ICT • ICT • ICT";
    writing-mode: vertical-rl;
    font-size: 7px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: rgba(212, 160, 23, 0.85);
    letter-spacing: 2px;
  }

  .lanyard-clip {
    width: 22px;
    height: 28px;
    background: linear-gradient(135deg, #cfd8dc 0%, #eceff1 45%, #90a4ae 100%);
    border-radius: 6px 6px 10px 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lanyard-clip-ring {
    width: 12px;
    height: 12px;
    border: 2px solid #78909c;
    border-radius: 50%;
    margin-top: 5px;
  }

  /* 3D CARD DISPLAY & FLIP CONTAINER */
  .card-3d-scene {
    perspective: 1200px;
    width: 340px;
    height: 538px; /* Standard CR80 Ratio (54mm x 85.6mm) */
    margin: -8px auto 0;
    cursor: pointer;
    position: relative;
  }

  .card-3d-object {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }

  .card-3d-object.flipped {
    transform: rotateY(180deg);
  }

  /* CRITICAL: CARD FACES PINNED AT TOP:0 LEFT:0 */
  .card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 340px;
    height: 538px;
    box-sizing: border-box;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
  }

  /* ========================================================
     THEME 1: CYBER LUXURY MIDNIGHT (FRONT)
  ======================================================== */
  .card-front {
    background: linear-gradient(160deg, #1b3d6c 0%, #244f8a 45%, #1d4377 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px 20px 16px;
    color: #fff;
    transform: rotateY(0deg);
    z-index: 2;
  }

  /* Hologram & Circuit Mesh Overlays */
  .card-front::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
      radial-gradient(circle at 10% 90%, rgba(212, 160, 23, 0.15) 0%, transparent 40%),
      radial-gradient(circle at 90% 10%, rgba(37, 99, 235, 0.25) 0%, transparent 50%),
      linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.04) 50%, transparent 60%);
    pointer-events: none;
  }

  /* Dynamic Holographic Glare */
  .card-glare {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.12) 45%, rgba(212, 160, 23, 0.15) 50%, transparent 65%);
    opacity: 0.6;
    pointer-events: none;
    mix-blend-mode: overlay;
  }

  /* Top Lanyard Slot on Card */
  .card-slot {
    width: 44px;
    height: 7px;
    background: #142845;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin: -6px auto 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
    position: relative;
    z-index: 10;
  }

  /* Front Header */
  .card-front-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .card-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .card-logo-container {
    background: #ffffff;
    padding: 3px 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  }

  .card-logo-container img {
    height: 30px;
    width: auto;
    object-fit: contain;
  }

  .card-brand-titles h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffffff;
    line-height: 1;
  }

  .card-brand-titles p {
    font-size: 8px;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-top: 2px;
  }

  /* Smart Chip & NFC Icons */
  .card-tech-indicators {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .smart-chip {
    width: 32px;
    height: 22px;
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 40%, #aa771c 100%);
    border-radius: 4px;
    position: relative;
    border: 1px solid rgba(0,0,0,0.3);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    overflow: hidden;
  }

  .smart-chip::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 2px;
  }

  .smart-chip::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.35);
    top: 50%;
  }

  .nfc-icon svg {
    width: 15px;
    height: 15px;
    fill: rgba(255, 255, 255, 0.7);
  }

  /* PHOTO SECTION */
  .card-photo-wrapper {
    position: relative;
    margin: 8px auto 4px;
    width: 102px;
    height: 102px;
    z-index: 2;
  }

  .card-photo-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 3.5px;
    background: linear-gradient(135deg, var(--gold) 0%, rgba(26, 111, 212, 0.8) 50%, var(--gold) 100%);
    box-shadow: 0 0 16px rgba(212, 160, 23, 0.35), 0 6px 14px rgba(0, 0, 0, 0.4);
    position: relative;
  }

  .card-photo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #112038;
    display: block;
    border: 2px solid #142e52;
  }

  .card-photo-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1b3d6c 0%, #25528f 100%);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 8px;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 12px;
    white-space: nowrap;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .card-photo-badge .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 6px #00e676;
  }

  /* EMPLOYEE DETAILS */
  .card-body-info {
    text-align: center;
    position: relative;
    z-index: 2;
    margin-top: 6px;
  }

  .card-name-ar {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 2px;
  }

  .card-name-en {
    font-family: 'Inter', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    color: #9cb5db;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-transform: uppercase;
  }

  .card-job-title {
    display: inline-block;
    background: rgba(212, 160, 23, 0.12);
    border: 1px solid rgba(212, 160, 23, 0.35);
    color: #ffd875;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 4px;
    max-width: 92%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-dept {
    font-size: 9.5px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
  }

  /* FRONT FOOTER METADATA */
  .card-front-footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 2;
    text-align: center;
  }

  .meta-box {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .meta-label {
    font-size: 7.5px;
    color: #8ba2c4;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
  }

  .meta-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 1px;
  }

  .meta-value.gold {
    color: var(--gold);
  }

  /* SECURITY HOLOGRAM STAMP */
  .hologram-seal {
    position: absolute;
    bottom: 44px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe082 0%, #80deea 30%, #e1bee7 60%, #ffd54f 100%);
    opacity: 0.65;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 3;
    animation: hologramSpin 14s linear infinite;
  }

  .hologram-seal svg {
    width: 16px;
    height: 16px;
    fill: #1b3d6c;
  }

  @keyframes hologramSpin {
    0% { transform: rotate(0deg); filter: hue-rotate(0deg); }
    100% { transform: rotate(360deg); filter: hue-rotate(360deg); }
  }

  /* ========================================================
     CARD BACK (الوجه الخلفي) - POSITIONED AT TOP:0 LEFT:0
  ======================================================== */
  .card-back {
    background: linear-gradient(160deg, #17355e 0%, #20467c 50%, #193a68 100%);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 0 14px 0;
    color: #ffffff;
    z-index: 1;
  }

  /* Magnetic Stripe */
  .magnetic-stripe {
    width: 100%;
    height: 38px;
    background: #02050b;
    margin-top: 18px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.9);
    position: relative;
  }

  .magnetic-stripe::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
  }

  .back-content {
    padding: 10px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
  }

  /* TERMS & LEGAL NOTICE */
  .back-notice {
    font-size: 8px;
    line-height: 1.45;
    color: #a0aec0;
    text-align: justify;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 6px 9px;
    border-radius: 8px;
  }

  .back-notice strong {
    color: var(--gold);
    display: block;
    margin-bottom: 2px;
  }

  /* QR & INFO ROW */
  .back-codes-grid {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
  }

  .qr-box {
    background: #ffffff;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }

  .qr-box img {
    width: 68px;
    height: 68px;
    display: block;
  }

  .back-meta-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .back-emergency {
    font-size: 8px;
    color: #8fa5c5;
    line-height: 1.35;
  }

  .back-emergency-val {
    color: var(--gold);
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    direction: ltr;
    display: inline-block;
  }

  /* VECTOR SVG BARCODE CONTAINER - NEVER OVERFLOWS! */
  .barcode-card-row {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 7px 10px 5px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }

  .barcode-svg-wrapper {
    width: 100%;
    height: 32px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .barcode-svg-wrapper svg {
    width: 100%;
    height: 100%;
    max-width: 280px;
    display: block;
  }

  .barcode-digits {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: var(--gold);
    letter-spacing: 2px;
    margin-top: 2px;
  }

  /* SIGNATURE & STAMP ROW */
  .back-signatures {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 4px;
  }

  .sig-block {
    text-align: center;
    width: 46%;
  }

  .sig-line {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.35);
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Brush Script MT', cursive, sans-serif;
    color: #d4a017;
    font-size: 14px;
  }

  .sig-label {
    font-size: 7.5px;
    color: #8fa5c5;
    margin-top: 2px;
  }

  /* BACK FOOTER CONTACTS */
  .back-footer-contacts {
    padding: 8px 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: #8fa5c5;
    direction: ltr;
    font-family: 'Inter', sans-serif;
  }

  .back-footer-contacts a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
  }

  /* 3D CONTROLS BAR */
  .controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17, 32, 56, 0.85);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 40px;
    backdrop-filter: blur(10px);
  }

  .control-btn {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
  }

  .control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .control-btn.active {
    background: var(--gold-gradient);
    color: #08162d;
    box-shadow: 0 2px 10px var(--gold-glow);
  }

  /* RIGHT: LIVE EDITOR & CONTROLS */
  .editor-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  }

  .editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
  }

  .editor-header h3 {
    font-size: 17px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .editor-header h3 svg {
    width: 20px;
    height: 20px;
    fill: var(--gold);
  }

  /* PRESET PROFILES BUTTONS */
  .preset-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .preset-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: #cfd9e8;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
  }

  .preset-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .preset-pill.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-light);
    box-shadow: 0 2px 10px rgba(26, 111, 212, 0.4);
  }

  /* FORM INPUTS */
  .form-group {
    margin-bottom: 14px;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 5px;
  }

  .form-input, .form-select {
    width: 100%;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    padding: 9px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    transition: var(--transition);
  }

  .form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.25);
  }

  /* PHOTO UPLOAD BOX */
  .photo-upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
    position: relative;
  }

  .photo-upload-zone:hover {
    border-color: var(--gold);
    background: rgba(212, 160, 23, 0.05);
  }

  .photo-upload-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }

  .photo-upload-zone p {
    font-size: 12px;
    color: var(--text-muted);
  }

  .photo-upload-zone span {
    color: var(--gold);
    font-weight: 700;
  }

  /* THEME PICKER */
  .theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .theme-btn {
    border: 2px solid transparent;
    padding: 9px 8px;
    border-radius: 12px;
    background: var(--surface-light);
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
  }

  .theme-btn .circle-preview {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .theme-btn.active {
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(212, 160, 23, 0.35);
  }

  /* ALTERNATIVE THEMES APPLIED VIA CLASSES */
  .card-3d-object.theme-white .card-front {
    background: linear-gradient(160deg, #f8fafc 0%, #edf2f7 50%, #e2e8f0 100%);
    color: #1b3d6c;
    border-color: #cbd5e1;
  }

  .card-3d-object.theme-white .card-front-header {
    border-color: #cbd5e1;
  }

  .card-3d-object.theme-white .card-brand-titles h3 {
    color: #1b3d6c;
  }

  .card-3d-object.theme-white .card-name-ar {
    color: #1b3d6c;
  }

  .card-3d-object.theme-white .card-name-en {
    color: #475569;
  }

  .card-3d-object.theme-white .card-dept {
    color: #64748b;
  }

  .card-3d-object.theme-white .card-front-footer {
    border-color: #cbd5e1;
  }

  .card-3d-object.theme-white .meta-value {
    color: #1b3d6c;
  }

  .card-3d-object.theme-white .meta-label {
    color: #64748b;
  }

  .card-3d-object.theme-white .nfc-icon svg {
    fill: #1b3d6c;
  }

  .card-3d-object.theme-white .card-slot {
    background: #cbd5e1;
    border-color: #94a3b8;
  }

  /* White theme: override gold/yellow elements */
  .card-3d-object.theme-white .card-job-title {
    background: rgba(27, 61, 108, 0.1);
    border-color: rgba(27, 61, 108, 0.35);
    color: #1b3d6c;
  }

  .card-3d-object.theme-white .meta-value.gold {
    color: #1b3d6c !important;
  }

  .card-3d-object.theme-white .card-brand-titles p {
    color: #25528f;
  }

  /* CYBER BLUE THEME */
  .card-3d-object.theme-cyber .card-front {
    background: linear-gradient(160deg, #15345d 0%, #1e4e89 50%, #183e6f 100%);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
  }

  .card-3d-object.theme-cyber .card-photo-ring {
    background: linear-gradient(135deg, #00f0ff 0%, #0077fe 100%);
  }

  .card-3d-object.theme-cyber .card-job-title {
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.4);
    color: #00f0ff;
  }

  /* SPEC SHEET GUIDE / FEATURES LIST */
  .specs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px;
  }

  .specs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .spec-card {
    background: rgba(17, 32, 56, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(8px);
    transition: var(--transition);
  }

  .spec-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
  }

  .spec-icon {
    width: 42px;
    height: 42px;
    background: rgba(212, 160, 23, 0.12);
    border: 1px solid rgba(212, 160, 23, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
  }

  .spec-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--gold);
  }

  .spec-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
  }

  .spec-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.55;
  }

  /* ==========================================================
     PRINT MEDIA STYLES - PRECISE SCALED CR80 PVC PRINTING
  ========================================================== */
  .print-sheet {
    display: none;
  }

  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }

  @media print {
    body {
      background: #ffffff !important;
      color: #000000 !important;
      padding: 0 !important;
      margin: 0 !important;
    }

    .header, .editor-panel, .controls-bar, .specs-container, .stage-header, .lanyard-assembly, .stage-wrapper {
      display: none !important;
    }

    .main-container {
      display: block !important;
      padding: 0 !important;
      margin: 0 !important;
      max-width: 100% !important;
    }

    .print-sheet {
      display: block !important;
      padding: 5mm 0;
    }

    .print-info-header {
      text-align: center;
      margin-bottom: 22px;
    }

    .print-info-header h2 {
      font-size: 15pt;
      color: #1b3d6c;
      font-weight: 800;
      margin-bottom: 3px;
    }

    .print-info-header p {
      font-size: 9.5pt;
      color: #64748b;
    }

    .print-grid {
      display: flex !important;
      flex-direction: row !important;
      justify-content: center !important;
      align-items: flex-start !important;
      gap: 36px !important;
      margin: 20px auto 0 !important;
      page-break-inside: avoid;
    }

    .print-card-wrapper {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }

    .print-card-label {
      font-size: 10pt;
      font-weight: 800;
      color: #1b3d6c;
      letter-spacing: 0.5px;
    }

    /* Standard CR80 Box: 54mm x 85.6mm */
    .print-card-box {
      width: 54mm !important;
      height: 85.6mm !important;
      position: relative !important;
      overflow: hidden !important;
      border: 1px dashed #718096 !important;
      border-radius: 3.18mm !important;
      box-sizing: border-box !important;
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
      background: #142e52 !important;
    }

    /* Scaling 340px x 538px down precisely into 54mm x 85.6mm */
    .print-card-box .card-face {
      position: absolute !important;
      top: 0 !important;
      left: 0 !important;
      right: auto !important;
      bottom: auto !important;
      width: 340px !important;
      height: 538px !important;
      transform-origin: top left !important;
      transform: scale(0.600) !important;
      border: none !important;
      box-shadow: none !important;
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
    }

    .print-guide-footer {
      margin-top: 36px;
      text-align: center;
      font-size: 9pt;
      color: #718096;
      border-top: 1px dashed #cbd5e1;
      padding-top: 14px;
      max-width: 600px;
      margin-left: auto;
      margin-right: auto;
      line-height: 1.6;
    }
  }

  /* RESPONSIVE */
  @media (max-width: 1100px) {
    .main-container {
      grid-template-columns: 1fr;
    }
    .specs-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 768px) {
    .header {
      flex-direction: column;
      align-items: stretch;
      padding: 10px 14px;
      gap: 10px;
    }
    .header-actions {
      flex-wrap: wrap;
      justify-content: center;
      gap: 6px;
    }
    .header-actions .btn {
      flex: 1 1 auto;
      justify-content: center;
      padding: 7px 12px;
      font-size: 11px;
    }
    .controls-bar {
      flex-wrap: wrap;
      justify-content: center;
      gap: 6px;
    }
    .control-btn {
      flex: 1 1 45%;
      font-size: 11.5px;
      padding: 8px 10px;
      justify-content: center;
    }
    .editor-panel {
      padding: 16px 14px;
    }
  }

  @media (max-width: 600px) {
    .header {
      padding: 10px 12px;
    }
    .main-container {
      padding: 16px 10px 50px;
    }
    .card-3d-scene {
      width: 300px;
      height: 475px;
    }
    .card-face {
      width: 300px;
      height: 475px;
    }
    .specs-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 380px) {
    .card-3d-scene {
      width: 270px;
      height: 428px;
    }
    .card-face {
      width: 270px;
      height: 428px;
    }
    .control-btn {
      flex: 1 1 100%;
    }
  }