/* ====== CARD WRAP & HEADER ====== */
.cof-wrap{
  max-width:900px;margin:0 auto;background:#fff;border:1px solid #e6e9ef;
  border-radius:12px;box-shadow:0 10px 24px rgba(17,24,39,.06);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
  padding:0 22px 22px
}
.cof-head{background:#174A8B;border-radius:12px 12px 0 0;margin:0 -22px 18px;padding:16px 22px}
.cof-title{color:#fff;font-size:24px;line-height:1.2;font-weight:700}

/* ====== FORM GRID ====== */
.cof-label{color:#1f2937;font-size:14px;display:block;margin:6px 0 6px}
.cof-label b{color:#ef4444}
.cof-grid{display:grid;grid-template-columns:1fr;gap:14px}
.cof-col-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}

/* ====== INPUTS + ICONS ====== */
.cof-input{
  width:100%;height:42px;padding:10px 12px 10px 40px;font-size:14px;
  border:1px solid #cfd6e4;border-radius:10px;background:#fff;outline:none;
  transition:border-color .15s, box-shadow .15s;
  background-repeat:no-repeat;background-size:16px;background-position:12px 50%;
}
.cof-input:focus{border-color:#578fdb;box-shadow:0 0 0 3px rgba(23,74,139,.15)}
/*input[name="practice"]{*/
/*  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2389A' viewBox='0 0 24 24'><path d='M3 21V9l9-6 9 6v12h-7v-6H10v6H3z'/></svg>");*/
/*}*/
/*input[name="first_name"],input[name="last_name"]{*/
/*  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%2389A' viewBox='0 0 24 24'><path d='M12 12a5 5 0 1 0-5-5 5 5 0 0 0 5 5zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5z'/></svg>");*/
/*}*/
/*input[name="email"]{*/
/*  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%2389A' viewBox='0 0 24 24'><path d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5L4 8V6l8 5 8-5z'/></svg>");*/
/*}*/
/*input[name="phone"]{*/
/*  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%2389A' viewBox='0 0 24 24'><path d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.3 1.2.4 2.6.7 4 .7.6 0 1 .4 1 1V20c0 .6-.4 1-1 1A18 18 0 0 1 3 6c0-.6.4-1 1-1h3.4c.6 0 1 .4 1 1 0 1.4.2 2.8.7 4 .1.4 0 .8-.3 1.1L6.6 10.8z'/></svg>");*/
/*}*/
/* Practice (home) */
input[name="practice"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M3 21V9l9-6 9 6v12h-7v-6H10v6H3z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:16px 16px;background-position:12px center;
}

/* First / Last name (user) */
input[name="first_name"], input[name="last_name"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M12 12a5 5 0 1 0-5-5 5 5 0 0 0 5 5zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:16px 16px;background-position:12px center;
}

/* Email (envelope) */
input[name="email"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5L4 8V6l8 5 8-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:16px 16px;background-position:12px center;
}

/* Phone (handset) */
input[name="phone"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.3 1.2.4 2.6.7 4 .7.6 0 1 .4 1 1V20c0 .6-.4 1-1 1A18 18 0 0 1 3 6c0-.6.4-1 1-1h3.4c.6 0 1 .4 1 1 0 1.4.2 2.8.7 4 .1.4 0 .8-.3 1.1L6.6 10.8z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:16px 16px;background-position:12px center;
}
/* ====== SECTION TITLES ====== */
.cof-section{margin-top:8px}
.cof-section-title{font-weight:700;color:#174A8B;margin:12px 0 10px}

/* ====== TABLE HEADER (SR / Clinician / Payer / Fee) ====== */
.cof-table-head{
  display:grid !important;
  grid-template-columns:40px 1fr 1fr 190px 40px !important;
  gap:10px !important; align-items:center !important; width:100%;
  background:#f1f5f9; border:1px solid #e5e7eb;
  border-radius:12px 12px 0 0; padding:10px;
  color:#475569; font-weight:700; font-size:13px; box-sizing:border-box;
}
.cof-table-head > div{
  display:flex !important; align-items:center; height:38px;
  padding:0 12px; white-space:nowrap;
}
.cof-table-head .sr{ justify-content:center }
.cof-table-head .fee{ justify-content:flex-end }
.cof-table-head .rm{ padding:0 }
.cof-table-head > div::after{ content:""; }
.cof-table-head .th:not(.sr):not(.rm)::after{ content:"▾"; font-size:10px; margin-left:6px; color:#94a3b8; }

/* ====== APPLICATION ROWS ====== */
.cof-rows{display:grid;gap:10px;margin-top:0; overflow:visible !important;}
.cof-row{
  display:grid;grid-template-columns:40px 1fr 1fr 190px 40px;gap:10px;align-items:center;
  background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;padding:12px; overflow:visible !important;
}
.cof-rows .cof-row:first-child{ border-top-left-radius:0;border-top-right-radius:0;border-top:0; }

/* SR label (plain) */
.cof-row-hint{
  display:flex;align-items:center;justify-content:center;width:38px;height:38px;
  background:transparent !important;border:0 !important;box-shadow:none !important;border-radius:0 !important;
  color:#111827;font-weight:600;pointer-events:none;
}
button.cof-row-hint{-webkit-appearance:none;appearance:none}

/* Remove (×): simple text only */
.cof-remove,
.cof-remove:hover,
.cof-remove:focus,
.cof-remove:active{
  background:transparent !important;border:0 !important;box-shadow:none !important;outline:0 !important;
  width:auto !important;height:auto !important;padding:0 !important;margin:0 !important;border-radius:0 !important;
  color:#64748b !important;font-size:16px !important;line-height:1 !important;cursor:pointer !important;place-self:center end !important;
}
.cof-remove::before,.cof-remove::after{ content:none !important; display:none !important; }
.cof-remove:hover{ color:#b91c1c !important; }

/* Tom Select: make it look like input */
.ts-wrapper{ width:100% !important; }
.ts-wrapper.single .ts-control{
  border:1px solid #cfd6e4 !important;border-radius:10px !important;height:42px !important;
  padding:6px 12px !important;background:#fff !important;background-image:none !important;box-shadow:none !important;
}
.ts-wrapper .ts-control input{
  border:0 !important;background:transparent !important;box-shadow:none !important;outline:0 !important;
  padding:0 !important;margin:0 !important;height:24px !important;line-height:24px !important;
}
.ts-wrapper.single .ts-control .item{ background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important;margin:0 !important; }
.ts-wrapper.single .ts-dropdown{ border:1px solid #cfd6e4 !important;border-radius:10px !important; }
.ts-dropdown { z-index:99999 !important; } /* keep on top */

/* Fee */
.cof-fee-wrap{position:relative}
.cof-currency{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:#6b7280}
.cof-fee{padding-left:26px;height:42px}

/* ====== ACTIONS + STATS ====== */
.cof-actions{display:flex;gap:14px;align-items:flex-start;justify-content:space-between;margin-top:10px}
.cof-btn.add{background:#1f9df2;color:#fff;border:0;border-radius:8px;padding:10px 14px;font-weight:700;box-shadow:0 4px 12px rgba(31,157,242,.2)}
.cof-stats{margin-left:auto;text-align:right}
.cof-total{display:flex;justify-content:flex-end;gap:8px;font-size:16px;margin:8px 0 6px;border-top:1px solid #e5e7eb;padding-top:8px}
.cof-total.final{border-top:0;margin:8px 0 0}
.cof-discount.muted{color:#166534;background:#ecfdf5;display:inline-block;padding:4px 8px;border-radius:6px;margin-top:6px}
.cof-note{color:#64748b;font-size:13px;margin-top:6px}

/* ====== STRIPE / AMOUNT ====== */
.cof-stripe-badge{
  display:inline-block;border:1px solid #dae1ed;border-radius:8px;padding:10px 14px;margin:6px 0 12px;
  color:#111;font-weight:700;text-transform:lowercase;box-shadow:0 1px 0 rgba(16,24,40,.04)
}
.cof-amount-wrap{position:relative;width:260px;margin:6px 0 12px}
#cof-amount-readonly{padding-left:26px;height:42px;border:1px solid #cfd6e4;border-radius:10px}
.cof-card{border:1px solid #cfd6e4;border-radius:10px;padding:12px;background:#fff}

/* ====== CTA BUTTON & MSG ====== */
.cof-btn.primary{
  width:100%;margin-top:16px;background:#174A8B;color:#fff;border:0;border-radius:10px;
  padding:12px 18px;font-weight:800;cursor:pointer;box-shadow:0 4px 12px rgba(23,74,139,.25)
}
.cof-btn.primary:disabled{opacity:.6;cursor:not-allowed}
.cof-msg{margin-top:12px;padding:10px 12px;border-radius:10px;display:inline-block}
.cof-msg.ok{background:#ecfdf5;color:#065f46}
.cof-msg.err{background:#fef2f2;color:#991b1b}

/* ====== Responsive ====== */
@media (max-width:780px){
  .cof-col-2{grid-template-columns:1fr}
  .cof-table-head,
  .cof-row{grid-template-columns:34px 1fr 1fr 1fr 34px}
  .cof-actions{flex-direction:column;align-items:stretch}
  .cof-stats{text-align:left}
}
.cof-row{ overflow: visible; }   /* dropdown clip na ho */
/* Make sure the inner input is clickable/typeable */ 
.ts-wrapper .ts-control input {
  pointer-events: auto !important;
}

/* Keep dropdown above, and avoid clipping on grid rows */
.ts-dropdown { z-index: 99999 !important; }
.cof-rows, .cof-row { overflow: visible !important; }
.cof-create-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:.75rem; padding:.35rem .55rem;
}

.cof-create-text{ color:#111; }

.cof-ok-btn{
  border:1px solid #cfd6e4; border-radius:8px; background:#fff;
  padding:.28rem .6rem; font-weight:700; cursor:pointer;
  line-height:1; white-space:nowrap;
}
/*.cof-ok-btn:hover{ background:#f8fafc; }*/
.cof-ok-btn:focus{ outline:2px solid rgba(23,74,139,.25); outline-offset:2px; }
.cof-ok-btn{
  background:#174A8B; color:#fff; border-color:#174A8B;
}
/*.cof-ok-btn:hover{ filter:brightness(1.05); }*/

.ts-dropdown .cof-create-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:.75rem; padding:.35rem .55rem;
}
.ts-dropdown .cof-ok-btn{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 40px; height: 26px;              /* size visible */
  padding:.28rem .6rem; line-height:1;
  font-size:12px; font-weight:700;            /* <-- text visible */
  color:#174A8B;                                /* dark text */
  background:#fff; border:1px solid #cfd6e4; border-radius:8px;
  cursor:pointer; white-space:nowrap;
}
/*.ts-dropdown .cof-ok-btn:hover{ background:#f8fafc; }*/
.ts-dropdown .cof-ok-btn:focus{ outline:2px solid rgba(23,74,139,.25); outline-offset:2px; }
.ts-wrapper.single .ts-control{
  display:flex !important;
  align-items:center !important;
  flex-wrap: nowrap !important;   /* wrap NA ho */
  white-space: nowrap !important;  /* force single-line */
}

.ts-wrapper.single .ts-control .item{
  margin-right: 6px !important;
}

.ts-wrapper .ts-control input{
  vertical-align: middle !important;
  min-width: 2ch !important;      /* caret ko thodi jagah mile */
  /* width ko yahin control na karo; TomSelect apni width set karta rahe */
}
input[name="practice"],
input[name="first_name"],
input[name="last_name"],
input[name="email"],
input[name="phone"]{
  padding-left: 48px !important;         /* was 40px */
  background-position: 16px center !important;
  background-size: 18px 18px !important;
}

/* Encode icons so they don't break in some browsers/minifiers */

/* Practice (home) */
input[name="practice"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M3 21V9l9-6 9 6v12h-7v-6H10v6H3z'/%3E%3C/svg%3E") !important;
}

/* First / Last name (user) */
input[name="first_name"], input[name="last_name"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M12 12a5 5 0 1 0-5-5 5 5 0 0 0 5 5zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5z'/%3E%3C/svg%3E") !important;
}

/* Email (envelope) */
input[name="email"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5L4 8V6l8 5 8-5z'/%3E%3C/svg%3E") !important;
}

/* Phone (handset) */
input[name="phone"]{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2389A'%3E%3Cpath d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.3 1.2.4 2.6.7 4 .7.6 0 1 .4 1 1V20c0 .6-.4 1-1 1A18 18 0 0 1 3 6c0-.6.4-1 1-1h3.4c.6 0 1 .4 1 1 0 1.4.2 2.8.7 4 .1.4 0 .8-.3 1.1L6.6 10.8z'/%3E%3C/svg%3E") !important;
}

/* (optional) selection color ko halka rakho taa-ke icon ke pass sharp edge na lage */
.cof-input::selection { background: rgba(23,74,139,.18); }
.cof-modal{ position:fixed; inset:0; display:none; z-index:999999; }
.cof-modal.open{ display:block; }
.cof-overlay{ position:absolute; inset:0; background:rgba(23,74,139,.65); } /* blue dim */
.cof-dialog{
  position:relative; z-index:1; width:min(560px,92vw);
  margin:12vh auto 0; padding:22px; background:#fff; color:#111;
  border-radius:14px; box-shadow:0 24px 60px rgba(0,0,0,.25);
}
.cof-modal-title{ margin:0 0 8px; font-size:20px; color:#174A8B; font-weight:800; }
.cof-modal-text{ margin:0 0 14px; font-size:15px; line-height:1.5; }
.cof-modal-x{
  position:absolute; top:10px; right:12px; background:transparent; border:0;
  font-size:24px; line-height:1; color:#174A8B; cursor:pointer;
}
.cof-modal-ok{ width:100%; margin-top:6px; }

body.cof-modal-lock{ overflow:hidden; } /* page scroll lock */
/* ---- Modal close (×) : force small, no theme bleed ---- */
#cof-modal .cof-modal-x,
#cof-modal .cof-modal-x:focus,
#cof-modal .cof-modal-x:hover {
  all: unset;                     /* reset theme styles */
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;                    /* small square */
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #174A8B;                 /* × color */
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
#cof-modal .cof-modal-x:hover {
  background: #f1f5f9;
}
#cof-modal .cof-modal-x { display: none !important; }
.cof-ok-btn:hover {
  background: #174A8B !important;
  color: #fff !important;
  border-color: #174A8B !important;
  filter: none !important;
}

/* Kill hover on "+" button inside TomSelect dropdown */
.ts-dropdown .cof-ok-btn:hover {
  background: #fff !important;
  color: #174A8B !important;
  border-color: #cfd6e4 !important;
  filter: none !important;
}
@media (max-width: 780px) {
  .cof-row {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .cof-row-hint {
    align-self: flex-start;
    padding-left: 8px;
  }

  .cof-remove {
    align-self: flex-end;
    margin-top: 4px;
  }

  .cof-table-head {
    display: none !important;
  }

  .cof-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cof-stats {
    text-align: left;
  }

  .cof-fee-wrap,
  .ts-wrapper,
  input[name="clinician"] {
    width: 100%;
  }
}
/* red star utility (table headers waghera ke liye) */
.req-star{ color:#ef4444 !important; margin-left:4px; font-weight:700; }
