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

  :root {
    --brand:       #08c;
    --brand-dark:  #006394;
    --brand-light: #e8f4fb;
    --accent:      #00b4a0;
    --text:        #1c2b38;
    --muted:       #6b8499;
    --border:      rgba(0, 0, 0, 0.25);
    --bg:          #f4f8fb;
    --white:       #ffffff;
    --error:       #d63637;
    --step-done:   #00b4a0;
    --radius:      14px;
    --shadow:      0 4px 32px rgba(26,111,163,.10);
    --transition:  .35s cubic-bezier(.4,0,.2,1);
  }

  .hero h1 {
    text-transform: none !important;
  }

  body {
    font-family: 'Open Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* ── HEADER ── */
  .site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(26,111,163,.07);
  }
  .logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
  }
  .logo-icon {
    width: 36px; height: 36px;
    background: var(--brand);
    border-radius: 10px;
    display: grid; place-items: center;
    color: white; font-size: 18px;
  }
  .logo-text { font-family: 'Open Sans', sans-serif; font-size: 1.15rem; color: var(--text); line-height:1.1; }
  .logo-sub { font-size: .7rem; color: var(--muted); font-weight: 400; letter-spacing: .03em; }
  .header-badge {
    font-size: .78rem; font-weight: 500; color: var(--brand);
    background: var(--brand-light); border-radius: 20px;
    padding: .3rem .85rem; border: 1px solid #bee3f5;
  }

  /* ── HERO ── */
  .hero {
    background: linear-gradient(135deg, #2c5787 0%, #3498db 60%, #67e6f7 100%);
    padding: 2.5rem 2rem 3.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  .hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(0,180,160,.25) 0%, transparent 60%);
  }
  .hero h1 {
    font-family: 'Open Sans', sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    color: white; position: relative; margin-bottom: .5rem;
  }
  .hero p {
    color: rgba(255,255,255,.8); font-size: .95rem;
    max-width: 480px; margin: 0 auto; position: relative;
  }

  /* ── MAIN CONTAINER ── */
  .wizard-wrap {
    max-width: 760px;
    width: 100%;
    margin: -2rem auto 3rem;
    padding: 0 1.25rem;
    position: relative;
    z-index: 10;
    flex: 1;
  }

  /* ── STEP INDICATOR ── */
  .steps-bar {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 1.25rem 1.75rem;
    border: 1px solid var(--border);
    border-bottom: none;
    gap: 0;
  }
  .step-item {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
  }
  .step-item:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 .5rem;
    transition: background var(--transition);
  }
  .step-item.done:not(:last-child)::after { background: var(--step-done); }
  .step-item.active:not(:last-child)::after { background: var(--border); }

  .step-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 600;
    color: var(--muted);
    background: var(--white);
    transition: all var(--transition);
    flex-shrink: 0;
    cursor: default;
  }
  .step-item.active .step-dot {
    border-color: var(--brand);
    background: var(--brand);
    color: white;
    box-shadow: 0 0 0 4px rgba(26,111,163,.15);
  }
  .step-item.done .step-dot {
    border-color: var(--step-done);
    background: var(--step-done);
    color: white;
  }
  .step-label {
    font-size: .72rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    margin-left: .5rem;
    display: none;
  }
  @media (min-width: 520px) { .step-label { display: block; } }
  .step-item.active .step-label { color: var(--brand); font-weight: 600; }
  .step-item.done .step-label  { color: var(--step-done); }

  /* ── CARD ── */
  .wizard-card {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 2rem 2rem 1.75rem;
    box-shadow: var(--shadow);
  }

  /* ── PATIENT BANNER ── */
  .patient-banner {
    background: linear-gradient(90deg, var(--brand-light) 0%, #e0f5f3 100%);
    border: 1px solid #bee3f5;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
  }
  .patient-banner > div { flex: 1; }
  .cmg-logout-btn {
    flex-shrink: 0;
    font-size: .78rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .35rem .75rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
  }
  .cmg-logout-btn:hover { color: var(--error); border-color: var(--error); }

  .edit-data-bar {
    background: linear-gradient(90deg, #fff8e4 0%, #fff2c9 100%);
    border: 1px solid #ffdf75;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    font-size: .8rem;
    color: #776d56;
    margin-bottom: .75rem;
  }
  .edit-data-bar a {
    flex-shrink: 0;
    font-size: .78rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .35rem .75rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
  }
  .edit-data-bar a:hover { color: var(--brand); border-color: var(--brand); }

  .field-input-wrap {
    position: relative;
  }
  .field-input-wrap > input,
  .field-input-wrap > .ts-wrapper .ts-control {
    padding-right: 2.2rem;
  }
  .field-edit-btn {
    position: absolute;
    right: .55rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    color: #55b1bd;
    font-size: .85rem;
    padding: .15rem;
    line-height: 1;
    transition: color var(--transition);
    z-index: 1;
    border-radius: 4px;
    border: 1px solid #55b1bd;
    background-color: #c5e5e9;
  }
  .form-grid.edit-mode .field-edit-btn { display: block; }
  .field-edit-btn:hover { color: var(--brand); }

  .save-success-bar {
    background: linear-gradient(90deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: .8rem;
    color: #166534;
  }

  .patient-avatar {
    width: 44px; height: 44px;
    background: var(--brand);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-size: 1.1rem;
    flex: none !important;
  }
  .patient-name { font-weight: 600; font-size: 1rem; color: var(--text); }
  .patient-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }

  /* ── PANELS ── */
  .panel { display: none; animation: fadeUp .3s ease; }
  .panel.active { display: block; }
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .panel-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.35rem;
    margin-bottom: .35rem;
    color: var(--text);
  }
  .panel-desc {
    font-size: .88rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
  }

  /* ── INTL TEL INPUT ── */
  .iti { width: 100%; }
  .iti__tel-input {
    width: 100%;
    padding: .7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'Open Sans', sans-serif;
    font-size: .9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
  }
  .iti__tel-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,111,163,.12);
  }
  .iti__tel-input.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(214,54,55,.1);
  }
  .iti__flag-container { z-index: 20; }

  /* ── FORM ELEMENTS ── */
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .form-grid.cols-1 { grid-template-columns: 1fr; }
  @media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

  .field { display: flex; flex-direction: column; gap: .4rem; }
  .field.span-2 { grid-column: span 2; }
  @media (max-width: 560px) { .field.span-2 { grid-column: span 1; } }

  label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  /* ── FILE DROP ── */
  .file-drop {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--muted);
    font-size: .88rem;
    transition: border-color var(--transition), background var(--transition);
  }
  .file-drop:hover, .file-drop.drag-over {
    border-color: var(--brand);
    background: rgba(8,136,204,.04);
    color: var(--brand);
  }
  .file-drop.has-file {
    border-color: var(--brand);
    border-style: solid;
    color: var(--text);
    background: rgba(8,136,204,.04);
  }
  .file-drop-icon { font-size: 1.3rem; }

  .file-preview {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    background: rgba(8,136,204,.05);
  }
  .file-preview-icon { font-size: 1.5rem; flex-shrink: 0; }
  .file-preview-info {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
  }
  .file-preview-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .file-preview-size { font-size: .75rem; color: var(--muted); }
  .file-preview-remove {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: .25rem .4rem;
    border-radius: 4px;
    transition: background var(--transition), color var(--transition);
  }
  .file-preview-remove:hover { background: #fee2e2; color: var(--error); }

  input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
  select, textarea {
    width: 100%;
    padding: .7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'Open Sans', sans-serif;
    font-size: .9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
  }
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b8499' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
  }
  textarea { resize: vertical; min-height: 90px; }
  input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,111,163,.12);
  }
  input.error, select.error, textarea.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(224,82,82,.1);
  }

  .required {
    color: var(--error);
  }

  .field-error { font-size: .75rem; color: var(--error); display: none; }
  .field-error.show { display: block; }

  /* ── RADIO CARDS ── */
  .radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .65rem;
  }
  .radio-card input { display: none; }
  .radio-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    padding: .85rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-size: .82rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
    transition: all var(--transition);
    background: var(--white);
  }
  .radio-card label .icon { font-size: 1.4rem; }
  .radio-card input:checked + label {
    border-color: var(--brand);
    background: var(--brand-light);
    color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,111,163,.1);
  }
  .radio-card label:hover { border-color: var(--brand); color: var(--brand); }

  /* ── TOGGLE SWITCH ── */
  .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    margin-bottom: .6rem;
    transition: border-color var(--transition), background var(--transition);
  }
  .toggle-row:hover { border-color: var(--brand); background: var(--brand-light); }
  .toggle-row.checked { border-color: var(--brand); background: var(--brand-light); }
  .toggle-info { display: flex; flex-direction: column; gap: .15rem; }
  .toggle-title { font-size: .9rem; font-weight: 500; color: var(--text); }
  .toggle-sub   { font-size: .77rem; color: var(--muted); }

  .switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
  .switch input { opacity: 0; width: 0; height: 0; }
  .slider {
    position: absolute; inset: 0;
    border-radius: 12px;
    background: var(--border);
    cursor: pointer;
    transition: background var(--transition);
  }
  .slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    border-radius: 50%;
    background: white;
    transition: transform var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
  }
  .switch input:checked ~ .slider { background: var(--brand); }
  .switch input:checked ~ .slider::before { transform: translateX(18px); }

  /* ── SUMMARY ── */
  .summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: 1.5rem;
  }
  @media (max-width: 560px) { .summary-grid { grid-template-columns: 1fr; } }
  .summary-item {
    background: var(--bg);
    border-radius: 9px;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
  }
  .summary-item.highlight {
    background: var(--brand-light);
    border-color: #bee3f5;
    grid-column: span 2;
  }
  @media (max-width: 560px) { .summary-item.highlight { grid-column: span 1; } }
  .summary-key { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
  .summary-val { font-size: .9rem; color: var(--text); font-weight: 500; }

  .info-box {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 10px;
    padding: .9rem 1.1rem;
    font-size: .83rem;
    color: #7a5c00;
    line-height: 1.55;
    margin-bottom: 1rem;
  }
  .info-box strong { color: #5a4200; }

  .ioma-notice {
    background: var(--brand-light);
    border: 1px solid #bee3f5;
    border-radius: 10px;
    padding: .85rem 1.1rem;
    font-size: .83rem;
    color: var(--brand-dark);
    margin-bottom: 1rem;
  }

  /* ── ACTIONS ── */
  .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
  }
  .btn {
    padding: .7rem 1.75rem;
    border-radius: 2em;
    font-family: 'Open Sans', sans-serif;
    font-size: .9rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    transition: 0.3s all ease;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    top: 0;
  }

  .btn:hover {
    top: 3px;
  }

  .btn-primary {
    background: var(--brand);
    color: white;
    box-shadow: 0 5px 0 var(--brand-dark);
  }

  .btn-primary:hover {
    box-shadow: 0 2px 0 var(--brand-dark);
  }

  .btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 5px 0 #495057;
  }

  .btn-secondary:hover {
    box-shadow: 0 2px 0 #495057;
  }

  .btn-ghost {
    background: var(--bg);
    color: var(--muted);
    box-shadow: 0 5px 0 #e3e3e3;
  }

  .btn-ghost:hover { 
    box-shadow: 0 2px 0 #e3e3e3;
  }
   
  .btn-success {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 16px rgba(0,180,160,.3);
  }
  .btn-success:hover {
    background: #009a88;
    transform: translateY(-1px);
  }

  /* ── SUCCESS STATE ── */
  .success-screen {
    text-align: center;
    padding: 2rem 1rem 1rem;
    display: none;
  }
  .success-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--accent), #00c8b2);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(0,180,160,.3);
    animation: popIn .5s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .success-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.6rem;
    margin-bottom: .6rem;
  }
  .success-body { color: var(--muted); font-size: .9rem; line-height: 1.6; max-width: 400px; margin: 0 auto 1.5rem; }
  .pickup-list {
    background: var(--bg);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-align: left;
    border: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text);
    margin: 0 auto 1.5rem;
    max-width: 380px;
  }
  .pickup-list h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; font-weight: 600; }
  .pickup-list li { list-style: none; padding: .25rem 0; display: flex; align-items: center; gap: .5rem; }
  .pickup-list li::before { content: '📍'; font-size: .85rem; }

  /* ── PROGRESS BAR ── */
  .progress-line {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0;
  }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    border-radius: 2px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
  }

  /* ── LOGIN ── */
  .cmg-login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 1.25rem;
  }
  .cmg-login-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
  }
  .cmg-login-logo {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  .cmg-login-title {
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: .25rem;
  }
  .cmg-login-sub {
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 2rem;
  }
  .cmg-login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    text-align: left;
  }
  .cmg-login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: .6rem 1rem;
    font-size: .82rem;
    color: var(--error);
  }
  .cmg-login-btn {
    width: 100%;
    justify-content: center;
    margin-top: .5rem;
  }
  .cmg-login-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: .85rem;
    color: #166534;
    line-height: 1.5;
  }
  .cmg-forgot-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: .82rem;
  }
  .cmg-forgot-link a {
    color: var(--brand);
    text-decoration: none;
  }
  .cmg-forgot-link a:hover { text-decoration: underline; }

  /* ── FOOTER ── */
  site-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: .78rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--white);
  }

  .highlight-red {
    color:#921717;
  }

  input[type=text]:disabled, input[type=email]:disabled, input[type=tel]:disabled, select:disabled {
    background-color:#EAEAEA;
  }