/* ============================================================
     CSS VARIABLES & RESET
  ============================================================ */
  :root{
    --navy:#0a2342;
    --navy-mid:#153660;
    --navy-light:#1e4d8c;
    --gold:#c9952a;
    --gold-light:#e8b84b;
    --cream:#faf7f2;
    --cream-dark:#f0ead8;
    --white:#ffffff;
    --text:#1a1a2e;
    --text-muted:#5a6477;
    --border:#d5cbb8;
    --border-focus:#1e4d8c;
    --error:#c0392b;
    --success:#1a7a4a;
    --input-bg:#ffffff;
    --shadow-sm:0 1px 4px rgba(10,35,66,.08);
    --shadow-md:0 4px 20px rgba(10,35,66,.12);
    --shadow-lg:0 12px 48px rgba(10,35,66,.18);
    --radius:6px;
    --radius-lg:12px;
    --transition:.22s cubic-bezier(.4,0,.2,1);
  }
  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
  html{font-size:15px;scroll-behavior:smooth;}
  body{
    font-family:'DM Sans',sans-serif;
    background:var(--cream);
    color:var(--text);
    min-height:100vh;
    line-height:1.6;
  }

  /* ============================================================
     UTILITY
  ============================================================ */
  .hidden{display:none!important;}
  .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);}

  /* ============================================================
     HEADER
  ============================================================ */
  .site-header{
    background:var(--navy);
    color:var(--white);
    padding:0 2rem;
    display:flex;
    align-items:center;
    gap:1.5rem;
    min-height:80px;
    position:sticky;top:0;z-index:100;
    box-shadow:0 2px 16px rgba(0,0,0,.3);
  }
  .header-emblem{
    width:60px;height:60px;flex-shrink:0;
    background:var(--white);
    border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    font-size:1.8rem;
  }
  .header-text h1{
    font-family:'EB Garamond',serif;
    font-size:1.25rem;
    font-weight:700;
    letter-spacing:.02em;
    line-height:1.2;
  }
  .header-text p{
    font-size:.75rem;
    color:var(--gold-light);
    letter-spacing:.06em;
    text-transform:uppercase;
    font-weight:500;
  }
  .header-user{
    margin-left:auto;
    display:flex;align-items:center;gap:.75rem;
    font-size:.85rem;
  }
  .header-user span{color:var(--cream-dark);}
  .btn-logout{
    background:transparent;
    border:1px solid rgba(255,255,255,.3);
    color:var(--white);
    padding:.35rem .9rem;
    border-radius:var(--radius);
    cursor:pointer;
    font-size:.8rem;
    transition:var(--transition);
  }
  .btn-logout:hover{background:rgba(255,255,255,.12);}

  /* decorative gold bar */
  .gold-bar{height:3px;background:linear-gradient(90deg,var(--gold),var(--gold-light),var(--gold));}

  /* ============================================================
     PAGE WRAPPER
  ============================================================ */
  .page{min-height:calc(100vh - 83px);padding:2rem 1rem 4rem;}

  /* ============================================================
     LOGIN PAGE
  ============================================================ */
  .login-wrap{
    max-width:460px;
    margin:3rem auto 0;
  }
  .login-card{
    background:var(--white);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow-lg);
    overflow:hidden;
  }
  .login-card-header{
    background:var(--navy);
    padding:1.8rem 2rem;
    text-align:center;
  }
  .login-card-header h2{
    font-family:'EB Garamond',serif;
    font-size:1.5rem;
    color:var(--white);
    font-weight:600;
  }
  .login-card-header p{
    color:var(--gold-light);
    font-size:.8rem;
    letter-spacing:.05em;
    text-transform:uppercase;
    margin-top:.25rem;
  }
  .login-card-body{padding:2rem;}
  .tab-row{
    display:flex;gap:0;
    border:1px solid var(--border);
    border-radius:var(--radius);
    overflow:hidden;
    margin-bottom:1.5rem;
  }
  .tab-btn{
    flex:1;
    padding:.6rem;
    border:none;background:var(--cream);
    cursor:pointer;
    font-family:'DM Sans',sans-serif;
    font-size:.85rem;
    font-weight:500;
    color:var(--text-muted);
    transition:var(--transition);
  }
  .tab-btn.active{background:var(--navy);color:var(--white);}
  .tab-btn:not(.active):hover{background:var(--cream-dark);}

  /* ============================================================
     FORM ELEMENTS (shared)
  ============================================================ */
  .form-group{margin-bottom:1.15rem;}
  .form-group label{
    display:block;
    font-size:.8rem;
    font-weight:600;
    color:var(--navy-mid);
    margin-bottom:.35rem;
    letter-spacing:.02em;
  }
  .form-group label .req{color:var(--error);margin-left:2px;}
  .form-control{
    width:100%;
    padding:.6rem .85rem;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--input-bg);
    font-family:'DM Sans',sans-serif;
    font-size:.9rem;
    color:var(--text);
    transition:border-color var(--transition),box-shadow var(--transition);
    outline:none;
  }
  .form-control:focus{
    border-color:var(--border-focus);
    box-shadow:0 0 0 3px rgba(30,77,140,.12);
  }
  .form-control.error{border-color:var(--error);}
  select.form-control{cursor:pointer;}
  .form-hint{font-size:.75rem;color:var(--text-muted);margin-top:.3rem;}
  .error-msg{font-size:.75rem;color:var(--error);margin-top:.3rem;display:none;}
  .error-msg.show{display:block;}

  /* Radio / checkbox */
  .radio-group,.check-group{display:flex;gap:1.2rem;flex-wrap:wrap;margin-top:.25rem;}
  .radio-opt,.check-opt{
    display:flex;align-items:center;gap:.4rem;
    font-size:.88rem;cursor:pointer;
  }
  .radio-opt input,.check-opt input{accent-color:var(--navy-light);}

  /* ============================================================
     BUTTONS
  ============================================================ */
  .btn{
    display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
    padding:.65rem 1.6rem;
    border:none;border-radius:var(--radius);
    font-family:'DM Sans',sans-serif;
    font-size:.9rem;font-weight:600;
    cursor:pointer;
    transition:var(--transition);
    text-decoration:none;
  }
  .btn-primary{
    background:var(--navy);color:var(--white);
    box-shadow:0 2px 8px rgba(10,35,66,.25);
  }
  .btn-primary:hover{background:var(--navy-light);box-shadow:0 4px 16px rgba(10,35,66,.3);}
  .btn-gold{
    background:var(--gold);color:var(--white);
    box-shadow:0 2px 8px rgba(201,149,42,.3);
  }
  .btn-gold:hover{background:var(--gold-light);}
  .btn-outline{
    background:transparent;
    border:1.5px solid var(--navy);
    color:var(--navy);
  }
  .btn-outline:hover{background:var(--navy);color:var(--white);}
  .btn-sm{padding:.4rem 1rem;font-size:.8rem;}
  .btn-danger{background:#c0392b;color:var(--white);}
  .btn-danger:hover{background:#a93226;}
  .btn-success{background:var(--success);color:var(--white);}
  .btn-full{width:100%;}

  /* ============================================================
     REGISTER LINK
  ============================================================ */
  .login-footer{
    text-align:center;
    margin-top:1.2rem;
    font-size:.85rem;
    color:var(--text-muted);
  }
  .login-footer a{
    color:var(--navy-light);
    font-weight:600;
    cursor:pointer;
    text-decoration:none;
  }
  .login-footer a:hover{text-decoration:underline;}

  /* ============================================================
     MODAL
  ============================================================ */
  .modal-overlay{
    position:fixed;inset:0;
    background:rgba(10,35,66,.55);
    backdrop-filter:blur(3px);
    z-index:500;
    display:flex;align-items:center;justify-content:center;
    padding:1rem;
    opacity:0;pointer-events:none;
    transition:opacity .25s ease;
  }
  .modal-overlay.open{opacity:1;pointer-events:all;}
  .modal{
    background:var(--white);
    border-radius:var(--radius-lg);
    width:100%;max-width:560px;
    max-height:90vh;
    overflow-y:auto;
    box-shadow:var(--shadow-lg);
    transform:translateY(20px);
    transition:transform .25s ease;
  }
  .modal-overlay.open .modal{transform:translateY(0);}
  .modal-header{
    background:var(--navy);
    padding:1.2rem 1.5rem;
    display:flex;align-items:center;justify-content:space-between;
    border-radius:var(--radius-lg) var(--radius-lg) 0 0;
    position:sticky;top:0;z-index:1;
  }
  .modal-header h3{
    font-family:'EB Garamond',serif;
    font-size:1.25rem;
    color:var(--white);
    font-weight:600;
  }
  .modal-header .gold-pill{
    font-size:.7rem;
    background:var(--gold);
    color:var(--white);
    padding:.2rem .6rem;
    border-radius:20px;
    letter-spacing:.05em;
    text-transform:uppercase;
  }
  .modal-close{
    background:transparent;
    border:none;
    color:rgba(255,255,255,.7);
    font-size:1.4rem;
    cursor:pointer;
    line-height:1;
    transition:color .2s;
  }
  .modal-close:hover{color:var(--white);}
  .modal-body{padding:1.5rem;}
  .modal-footer{
    padding:1rem 1.5rem;
    border-top:1px solid var(--border);
    display:flex;justify-content:flex-end;gap:.75rem;
  }

  /* ============================================================
     APPLICATION FORM – LAYOUT
  ============================================================ */
  .app-container{max-width:900px;margin:0 auto;}

  /* Progress stepper */
  .stepper{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    position:relative;
    margin-bottom:2.5rem;
    padding:0 .5rem;
  }
  .stepper::before{
    content:'';
    position:absolute;
    top:20px;left:0;right:0;
    height:2px;
    background:var(--border);
    z-index:0;
  }
  .stepper-progress{
    position:absolute;
    top:20px;left:0;
    height:2px;
    background:var(--gold);
    z-index:1;
    transition:width .4s ease;
  }
  .step{
    display:flex;flex-direction:column;align-items:center;gap:.5rem;
    position:relative;z-index:2;
    flex:1;
  }
  .step-circle{
    width:40px;height:40px;
    border-radius:50%;
    border:2px solid var(--border);
    background:var(--white);
    display:flex;align-items:center;justify-content:center;
    font-size:.8rem;font-weight:700;
    color:var(--text-muted);
    transition:var(--transition);
  }
  .step.active .step-circle{
    border-color:var(--navy);
    background:var(--navy);
    color:var(--white);
    box-shadow:0 0 0 4px rgba(30,77,140,.18);
  }
  .step.done .step-circle{
    border-color:var(--success);
    background:var(--success);
    color:var(--white);
  }
  .step-label{
    font-size:.7rem;
    font-weight:600;
    text-align:center;
    color:var(--text-muted);
    max-width:80px;
    line-height:1.3;
  }
  .step.active .step-label{color:var(--navy);}
  .step.done .step-label{color:var(--success);}

  /* Form card */
  .form-card{
    background:var(--white);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow-md);
    overflow:hidden;
    animation:fadeUp .35s ease forwards;
  }
  @keyframes fadeUp{
    from{opacity:0;transform:translateY(12px);}
    to{opacity:1;transform:translateY(0);}
  }
  .form-card-header{
    background:linear-gradient(135deg,var(--navy) 0%,var(--navy-mid) 100%);
    padding:1.4rem 2rem;
    display:flex;align-items:center;gap:1rem;
  }
  .form-card-header .step-badge{
    width:36px;height:36px;
    border-radius:50%;
    background:var(--gold);
    color:var(--white);
    display:flex;align-items:center;justify-content:center;
    font-family:'EB Garamond',serif;
    font-size:1rem;
    font-weight:700;
    flex-shrink:0;
  }
  .form-card-header h2{
    font-family:'EB Garamond',serif;
    font-size:1.3rem;
    color:var(--white);
    font-weight:600;
  }
  .form-card-header p{
    font-size:.75rem;
    color:rgba(255,255,255,.65);
    margin-top:.1rem;
  }
  .form-card-body{padding:2rem;}

  /* Grid */
  .grid-2{display:grid;grid-template-columns:1fr 1fr;gap:1rem 1.5rem;}
  .grid-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:1rem 1.5rem;}
  .col-span-2{grid-column:span 2;}
  .col-span-3{grid-column:span 3;}

  /* Section divider */
  .section-divider{
    border:none;
    border-top:1px solid var(--border);
    margin:1.5rem 0;
  }
  .section-title{
    font-family:'EB Garamond',serif;
    font-size:1.05rem;
    color:var(--navy);
    font-weight:600;
    margin-bottom:1rem;
    padding-bottom:.4rem;
    border-bottom:2px solid var(--gold);
    display:inline-block;
  }

  /* Upload area */
  .upload-area{
    border:2px dashed var(--border);
    border-radius:var(--radius);
    padding:1.5rem;
    text-align:center;
    cursor:pointer;
    transition:var(--transition);
    background:var(--cream);
    position:relative;
  }
  .upload-area:hover,.upload-area.dragover{
    border-color:var(--navy-light);
    background:#eef3fa;
  }
  .upload-area input[type=file]{
    position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;
  }
  .upload-icon{font-size:2rem;color:var(--text-muted);margin-bottom:.5rem;}
  .upload-area p{font-size:.82rem;color:var(--text-muted);}
  .upload-area .file-name{
    font-size:.8rem;color:var(--navy);font-weight:600;margin-top:.5rem;
  }
  .upload-preview{
    display:flex;align-items:center;gap:.75rem;
    background:var(--cream);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:.6rem .85rem;
    margin-top:.5rem;
  }
  .upload-preview .preview-img{
    width:48px;height:48px;object-fit:cover;
    border-radius:4px;border:1px solid var(--border);
  }
  .upload-preview .preview-name{font-size:.82rem;color:var(--text);flex:1;}
  .upload-preview .remove-file{
    background:none;border:none;color:var(--error);cursor:pointer;font-size:.9rem;
  }

  /* Dynamic entry rows */
  .entry-card{
    background:var(--cream);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:1.2rem;
    margin-bottom:.85rem;
    position:relative;
  }
  .entry-card .remove-entry{
    position:absolute;top:.75rem;right:.75rem;
    background:none;border:1px solid var(--border);
    border-radius:var(--radius);
    padding:.2rem .55rem;
    font-size:.75rem;
    color:var(--error);
    cursor:pointer;
    transition:var(--transition);
  }
  .entry-card .remove-entry:hover{background:var(--error);color:var(--white);border-color:var(--error);}

  .add-row-btn{
    display:flex;align-items:center;gap:.5rem;
    background:none;
    border:1.5px dashed var(--navy-light);
    color:var(--navy-light);
    border-radius:var(--radius);
    padding:.6rem 1.2rem;
    font-size:.85rem;font-weight:600;
    cursor:pointer;
    transition:var(--transition);
    font-family:'DM Sans',sans-serif;
  }
  .add-row-btn:hover{background:var(--navy-light);color:var(--white);}

  /* Form footer navigation */
  .form-footer{
    display:flex;align-items:center;justify-content:space-between;
    padding:1.25rem 2rem;
    background:var(--cream);
    border-top:1px solid var(--border);
    gap:1rem;
  }
  .form-footer .step-info{
    font-size:.8rem;color:var(--text-muted);
  }

  /* ============================================================
     CONDITIONAL FIELDS
  ============================================================ */
  .conditional-field{
    background:var(--cream);
    border-left:3px solid var(--gold);
    padding:.75rem 1rem;
    border-radius:0 var(--radius) var(--radius) 0;
    margin-top:.5rem;
  }

  /* ============================================================
     PAYMENT SECTION
  ============================================================ */
  .payment-card{
    background:var(--white);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    overflow:hidden;
    box-shadow:var(--shadow-md);
  }
  .payment-header{
    background:linear-gradient(135deg,var(--gold) 0%,var(--gold-light) 100%);
    padding:1.4rem 2rem;
  }
  .payment-header h2{
    font-family:'EB Garamond',serif;
    font-size:1.4rem;
    color:var(--white);
    font-weight:700;
  }
  .payment-header p{color:rgba(255,255,255,.85);font-size:.85rem;}
  .payment-body{padding:2rem;}
  .fee-table{width:100%;border-collapse:collapse;margin-bottom:1.5rem;}
  .fee-table th,.fee-table td{
    padding:.7rem 1rem;
    text-align:left;
    border-bottom:1px solid var(--border);
    font-size:.88rem;
  }
  .fee-table th{background:var(--cream);font-weight:600;color:var(--navy);}
  .fee-total td{font-weight:700;color:var(--navy);font-size:1rem;}
  .payment-methods{display:flex;gap:.75rem;flex-wrap:wrap;margin-bottom:1.5rem;}
  .pay-method{
    flex:1;min-width:120px;
    border:2px solid var(--border);
    border-radius:var(--radius);
    padding:.85rem;
    text-align:center;
    cursor:pointer;
    transition:var(--transition);
    font-size:.82rem;font-weight:600;color:var(--text-muted);
  }
  .pay-method:hover,.pay-method.selected{border-color:var(--navy);color:var(--navy);background:#eef3fa;}
  .pay-method .pay-icon{font-size:1.6rem;display:block;margin-bottom:.4rem;}

  /* ============================================================
     SUCCESS PAGE
  ============================================================ */
  .success-page{
    max-width:560px;
    margin:3rem auto;
    text-align:center;
  }
  .success-icon{
    width:80px;height:80px;
    background:var(--success);
    border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    font-size:2.5rem;
    color:var(--white);
    margin:0 auto 1.5rem;
    box-shadow:0 0 0 8px rgba(26,122,74,.15);
  }
  .success-page h2{
    font-family:'EB Garamond',serif;
    font-size:1.8rem;
    color:var(--navy);
    margin-bottom:.75rem;
  }
  .success-page p{color:var(--text-muted);margin-bottom:.5rem;}
  .app-number{
    background:var(--navy);
    color:var(--gold-light);
    font-family:'EB Garamond',serif;
    font-size:1.4rem;
    padding:.75rem 2rem;
    border-radius:var(--radius);
    display:inline-block;
    letter-spacing:.1em;
    margin:1rem 0;
  }

  /* ============================================================
     TOAST
  ============================================================ */
  .toast-container{
    position:fixed;bottom:1.5rem;right:1.5rem;
    display:flex;flex-direction:column;gap:.5rem;
    z-index:1000;
  }
  .toast{
    background:var(--navy);
    color:var(--white);
    padding:.75rem 1.25rem;
    border-radius:var(--radius);
    font-size:.85rem;
    display:flex;align-items:center;gap:.6rem;
    box-shadow:var(--shadow-md);
    animation:slideIn .3s ease;
    max-width:300px;
  }
  .toast.success{background:var(--success);}
  .toast.error{background:var(--error);}
  @keyframes slideIn{
    from{opacity:0;transform:translateX(20px);}
    to{opacity:1;transform:translateX(0);}
  }

  /* ============================================================
     RESPONSIVE
  ============================================================ */
  @media(max-width:640px){
    .grid-2,.grid-3{grid-template-columns:1fr;}
    .col-span-2,.col-span-3{grid-column:span 1;}
    .stepper{gap:.25rem;}
    .step-label{font-size:.6rem;max-width:56px;}
    .form-card-body{padding:1rem;}
    .form-footer{flex-direction:column;}
    .site-header{padding:0 1rem;}
  }