/* TidyOne V13.5.41 — unified premium forms / modal dark-mode polish */
.modal .modal-card{
  background:#fff;
  border:1px solid #E2E8F0;
  box-shadow:0 26px 80px rgba(15,23,42,.22);
}
.modal .modal-head h3{color:#0F172A}
.modal .modal-head .help,.modal .modal-head .muted{color:#64748B}
.modal .form-group label,.modal .allocation-head strong{color:#1E293B}
.modal :is(.input,.select,input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  background:#fff;
  color:#0F172A;
  border-color:#CBD5E1;
}
.modal :is(input,textarea)::placeholder{color:#94A3B8;opacity:1}
.modal :is(.input,.select,input,select,textarea):focus{
  border-color:#7C3AED;
  box-shadow:0 0 0 3px rgba(124,58,237,.12);
  outline:none;
}
.modal .close{background:#F1F5F9;color:#334155;border:1px solid #E2E8F0}
.modal .modal-actions{
  position:sticky;
  bottom:-22px;
  z-index:7;
  margin:18px -22px -22px;
  padding:14px 22px 18px;
  background:linear-gradient(180deg,rgba(248,250,252,.94),#F8FAFC 35%);
  border-top:1px solid #E2E8F0;
  box-shadow:0 -12px 30px rgba(15,23,42,.06);
  backdrop-filter:blur(10px);
}
.modal .attach-box,.modal .allocation-box,.modal .beneficiary-link-row,.modal .mode-note{
  border-color:#DDD6FE;
  background:#FAF5FF;
}
.modal .allocation-box{overflow:visible}
.modal .allocation-head{padding-bottom:2px}
.modal .allocation-row{
  padding:10px;
  border:1px solid #E9D5FF;
  border-radius:12px;
  background:#fff;
}
.modal .allocation-summary{color:#6D28D9}
.modal .allocation-toggle{color:#5B21B6}
.modal .help,.modal .muted{color:#64748B}
.modal .btn-light{background:#fff;color:#1E293B;border-color:#CBD5E1}
.modal .btn-danger{background:#FEE2E2;color:#B91C1C;border:1px solid #FECACA}
.modal .btn-primary{box-shadow:0 8px 20px rgba(124,58,237,.18)}
.modal select option{background:#fff;color:#0F172A}

html[data-theme="dark"] .modal{background:rgba(2,8,23,.76)!important;backdrop-filter:blur(8px)}
html[data-theme="dark"] .modal .modal-card{
  background:linear-gradient(180deg,#0D1D2F,#091827)!important;
  color:#EAF2FC!important;
  border:1px solid #29435F!important;
  box-shadow:0 28px 90px rgba(0,0,0,.58),0 0 0 1px rgba(100,165,255,.04)!important;
}
html[data-theme="dark"] .modal .modal-head h3,
html[data-theme="dark"] .modal .form-group label,
html[data-theme="dark"] .modal .allocation-head strong{color:#F1F6FC!important}
html[data-theme="dark"] .modal :is(.help,.muted){color:#A7B9CC!important}
html[data-theme="dark"] .modal :is(.input,.select,input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  background:#071827!important;
  color:#EEF6FF!important;
  border:1px solid #355471!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.015)!important;
}
html[data-theme="dark"] .modal :is(input,textarea)::placeholder{color:#8EA4B9!important;opacity:1!important}
html[data-theme="dark"] .modal :is(.input,.select,input,select,textarea):focus{
  border-color:#8B72FF!important;
  box-shadow:0 0 0 3px rgba(139,92,246,.18)!important;
  outline:none!important;
}
html[data-theme="dark"] .modal select option{background:#0B1B2B!important;color:#EEF6FF!important}
html[data-theme="dark"] .modal input[type="date"]{color-scheme:dark}
html[data-theme="dark"] .modal .close{
  background:#10263B!important;
  color:#DCEBFA!important;
  border:1px solid #31506D!important;
}
html[data-theme="dark"] .modal .modal-actions{
  background:linear-gradient(180deg,rgba(9,24,39,.88),#081624 34%,#07131F)!important;
  border-top:1px solid #29435F!important;
  box-shadow:0 -16px 34px rgba(0,0,0,.28)!important;
}
html[data-theme="dark"] .modal .btn-light{
  background:#10263B!important;
  color:#EAF2FC!important;
  border:1px solid #365A79!important;
}
html[data-theme="dark"] .modal .btn-light:hover{background:#17344F!important;border-color:#527EA6!important}
html[data-theme="dark"] .modal .btn-primary{
  background:linear-gradient(135deg,#8B5CF6,#6D3DCE)!important;
  color:#fff!important;
  box-shadow:0 9px 24px rgba(109,61,206,.28)!important;
}
html[data-theme="dark"] .modal .btn-danger{
  background:#3A1821!important;
  color:#FFC2CF!important;
  border:1px solid #6B3040!important;
}
html[data-theme="dark"] .modal .btn-danger:hover{background:#4A1E2A!important;border-color:#8B4052!important}
html[data-theme="dark"] .modal .attach-box{
  background:#0A1A2B!important;
  border:1px dashed #3A5C7C!important;
}
html[data-theme="dark"] .modal .attach-name{color:#B9CAE0!important}
html[data-theme="dark"] .modal .quick-note,
html[data-theme="dark"] .modal .mode-note{
  background:#171B38!important;
  color:#CDBEFF!important;
  border-color:#514482!important;
}
html[data-theme="dark"] .modal .allocation-box{
  background:linear-gradient(180deg,#17162E,#12182B)!important;
  border:1px solid #584A8B!important;
  color:#EEF2FF!important;
}
html[data-theme="dark"] .modal .allocation-row{
  background:#0A1B2B!important;
  border:1px solid #334F6C!important;
  box-shadow:0 8px 22px rgba(0,0,0,.12)!important;
}
html[data-theme="dark"] .modal .allocation-summary{color:#C7B6FF!important}
html[data-theme="dark"] .modal .allocation-toggle{color:#C7B6FF!important}
html[data-theme="dark"] .modal .beneficiary-link-row{
  background:#0A1B2B!important;
  border-color:#334F6C!important;
  color:#EAF2FC!important;
}
html[data-theme="dark"] .modal .consent{
  background:#311B22!important;
  border-color:#673343!important;
  color:#FFD1DA!important;
}
html[data-theme="dark"] .modal input[type="checkbox"]{accent-color:#8B5CF6}

@media(max-width:760px){
  .modal{align-items:flex-end;padding:0!important}
  .modal .modal-card{
    width:100%!important;
    max-height:min(92vh,820px)!important;
    border-radius:22px 22px 0 0!important;
    padding:18px 16px 0!important;
  }
  .modal .modal-actions{
    bottom:0;
    margin:18px -16px 0!important;
    padding:13px 16px calc(13px + env(safe-area-inset-bottom))!important;
    gap:10px;
  }
  .modal .modal-actions .btn{min-height:44px}
  .modal .allocation-head{align-items:flex-start;flex-direction:column}
  .modal .allocation-head .btn{width:100%}
  .modal .allocation-row{grid-template-columns:1fr!important;gap:9px!important}
  .modal .allocation-row .btn{width:100%}
  .modal .select-action,.modal .inline-action{grid-template-columns:1fr!important}
  .modal .select-action .btn,.modal .inline-action .btn{width:100%}
}
