/* Horizon Layout V5 — final compatibility layer for legacy API Bank pages. */
.horizon,body.horizon{
  --hz-control-h:34px;
  --hz-control-font:13px;
  --hz-label-font:12px;
  --hz-help-font:11.5px;
}

/* Logo-only navigation, matching the supplied Horizon BuilderKit shell. */
.horizon .hz-brand-link.hz-logo-only,
.horizon .hz-mobile-brand.hz-logo-only,
.horizon-landing .hz-landing-brand.hz-logo-only{
  display:flex!important;
  align-items:center!important;
  min-width:0!important;
  text-decoration:none!important;
}
.horizon .hz-brand-link.hz-logo-only{max-width:148px!important;height:37px!important;gap:0!important}
.horizon .hz-brand-link.hz-logo-only>img{
  display:block!important;width:auto!important;height:32px!important;max-width:132px!important;max-height:32px!important;
  object-fit:contain!important;object-position:left center!important;border-radius:0!important;flex:0 1 auto!important
}
.horizon .hz-mobile-brand.hz-logo-only{margin-right:auto!important;height:32px!important;gap:0!important}
.horizon .hz-mobile-brand.hz-logo-only>img{
  display:block!important;width:auto!important;height:26px!important;max-width:112px!important;max-height:26px!important;
  object-fit:contain!important;object-position:left center!important;border-radius:0!important
}
.horizon-landing .hz-landing-brand.hz-logo-only{margin-right:auto!important;max-width:160px!important;height:38px!important;gap:0!important}
.horizon-landing .hz-landing-brand.hz-logo-only>img{
  display:block!important;width:auto!important;height:32px!important;max-width:144px!important;max-height:32px!important;
  object-fit:contain!important;object-position:left center!important;border-radius:0!important
}

/* Structural safety: legacy pages must never create a second sidebar offset. */
body.horizon{overflow-x:hidden!important}
.horizon :is(.hz-main,.hz-panel,.hz-app-content,.dashboard-container,.dash-content,.container-fluid,.row,[class*=col-]){min-width:0}
.horizon .hz-app-content{width:100%!important;max-width:1280px!important;margin:0 auto!important}
.horizon .admin-dashboard,
.horizon .client-dashboard{
  width:100%!important;max-width:none!important;min-height:0!important;margin:0!important;padding:0!important;
  background:transparent!important;color:inherit!important;font-family:inherit!important
}
.horizon .dashboard-container{width:100%!important;max-width:none!important;margin:0!important;padding:0!important}
.horizon .dashboard-header{margin:0 0 20px!important;padding:0!important;display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:16px!important;flex-wrap:wrap!important}
.horizon .dashboard-title{margin:0!important;color:var(--hz-text)!important;font-size:20px!important;line-height:26px!important;font-weight:650!important;letter-spacing:-.45px!important}
.horizon .dashboard-subtitle{margin:3px 0 0!important;color:var(--hz-muted)!important;font-size:12px!important;line-height:18px!important}

/* Final form geometry: text sits optically centered in every control. */
.horizon form{min-width:0!important}
.horizon form :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),select,.form-control,.form-select,.custom-select,.dataTable-input,.dataTable-selector){
  box-sizing:border-box!important;width:100%!important;height:var(--hz-control-h)!important;min-height:var(--hz-control-h)!important;
  padding:6px 11px!important;border:1px solid var(--hz-border)!important;border-radius:8px!important;
  background:var(--hz-surface)!important;color:var(--hz-text)!important;box-shadow:0 1px 2px var(--hz-shadow)!important;
  font-family:inherit!important;font-size:var(--hz-control-font)!important;line-height:20px!important;font-weight:450!important;letter-spacing:0!important;
  vertical-align:middle!important;outline:0!important
}
.horizon form select,
.horizon form .form-select,
.horizon form .custom-select,
.horizon .dataTable-selector{
  padding-top:0!important;padding-bottom:0!important;padding-right:30px!important;line-height:calc(var(--hz-control-h) - 2px)!important
}
.horizon form textarea,
.horizon textarea.form-control{
  box-sizing:border-box!important;width:100%!important;height:auto!important;min-height:82px!important;padding:8px 11px!important;
  font-family:inherit!important;font-size:var(--hz-control-font)!important;line-height:20px!important;resize:vertical!important
}
.horizon form :is(input,textarea)::placeholder{font-size:inherit!important;line-height:inherit!important;color:var(--hz-faint)!important;opacity:1!important}
.horizon form :is(label,.form-label,.control-label,.tcb-field label,.admin-form-group label){
  display:block!important;margin:0 0 6px!important;color:var(--hz-text)!important;font-size:var(--hz-label-font)!important;line-height:16px!important;font-weight:550!important
}
.horizon form :is(.form-text,.help-block,small,.text-muted),
.horizon .form-group>small{
  margin-top:5px!important;color:var(--hz-muted)!important;font-size:var(--hz-help-font)!important;line-height:17px!important;font-weight:450!important
}
.horizon .form-group,.horizon .form-field,.horizon .admin-form-group,.horizon .tcb-field{min-width:0!important;margin-bottom:16px!important}

/* Input groups keep icons/actions separate from copy; no text/icon overlap. */
.horizon .input-group{display:flex!important;align-items:stretch!important;width:100%!important;min-width:0!important;flex-wrap:nowrap!important}
.horizon .input-group>.form-control{flex:1 1 auto!important;min-width:0!important}
.horizon .input-group :is(.input-group-text,.btn){height:var(--hz-control-h)!important;min-height:var(--hz-control-h)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;padding-top:0!important;padding-bottom:0!important}
.horizon .input-group-text{font-size:12px!important;line-height:16px!important}
.horizon .hz-auth-control{min-width:0!important;align-items:stretch!important}
.horizon .hz-auth-control>input{height:var(--hz-control-h)!important;min-height:var(--hz-control-h)!important;padding-top:6px!important;padding-bottom:6px!important}
.horizon .hz-auth-control>i,.horizon .hz-auth-control>.hz-auth-control-action{width:var(--hz-control-h)!important;height:var(--hz-control-h)!important;min-height:var(--hz-control-h)!important}

/* Buttons use the same baseline/height as controls. */
.horizon :is(.btn,.btn-gradient,.btn-gradient-sm,.btn-save,.btn-login,.btn-reset,.login-do-btn,.tcb-btn,.captcha-btn,.profile-btn-v3,.btn-edit-sm,.btn-delete-sm,.btn-cancel-edit),
.horizon form button:not(.swal2-styled):not(.hz-auth-control-action):not(.hz-auth-link){
  box-sizing:border-box!important;min-height:var(--hz-control-h)!important;height:var(--hz-control-h)!important;padding:0 12px!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;
  border-radius:8px!important;font-family:inherit!important;font-size:12px!important;line-height:1!important;font-weight:550!important;white-space:nowrap!important
}
.horizon :is(.btn,.btn-gradient,.btn-save,.tcb-btn,.btn-edit-sm,.btn-delete-sm) i,
.horizon form button i{position:static!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;width:16px!important;height:16px!important;min-width:16px!important;margin:0!important;font-size:14px!important;line-height:16px!important;transform:none!important}

/* Legacy custom cards are normalized to Horizon cards. */
.horizon :is(.data-card,.glass-card,.settings-card,.admin-card,.bank-edit-modal){
  min-width:0!important;margin:0 0 16px!important;border:1px solid var(--hz-border)!important;border-radius:8px!important;
  background:var(--hz-surface)!important;color:var(--hz-text)!important;box-shadow:0 1px 3px var(--hz-shadow),0 1px 2px -1px var(--hz-shadow)!important;overflow:hidden!important
}
.horizon :is(.card-header-custom,.data-card>.card-header){
  min-height:44px!important;padding:8px 12px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:10px!important;
  border-bottom:1px solid var(--hz-border)!important;background:var(--hz-surface)!important
}
.horizon .card-header-custom h3{margin:0!important;color:var(--hz-text)!important;font-size:13px!important;line-height:20px!important;font-weight:650!important;display:flex!important;align-items:center!important;gap:8px!important}
.horizon .card-body-custom{padding:16px!important;background:var(--hz-surface)!important}
.horizon .card-tools{display:flex!important;align-items:center!important;gap:6px!important}
.horizon .btn-icon{width:32px!important;height:32px!important;min-height:32px!important;padding:0!important;border:1px solid var(--hz-border)!important;border-radius:8px!important;background:var(--hz-surface)!important;color:var(--hz-muted)!important;box-shadow:0 1px 2px var(--hz-shadow)!important}

/* Reusable form grids. */
.horizon .form-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:16px!important;min-width:0!important}
@media(min-width:768px){
  .horizon .form-grid.two-columns{grid-template-columns:repeat(2,minmax(0,1fr))!important;column-gap:24px!important;row-gap:16px!important}
}
.horizon :is(.form-actions,.admin-form-actions,.modal-footer){display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;flex-wrap:wrap!important}
.horizon .form-actions{margin-top:20px!important;padding-top:12px!important;border-top:1px solid var(--hz-border)!important;text-align:initial!important}

/* Select2 follows the same 34px form primitive. */
.horizon .select2-container{width:100%!important;max-width:100%!important;min-width:0!important}
.horizon .select2-container .select2-selection--single{
  box-sizing:border-box!important;height:var(--hz-control-h)!important;min-height:var(--hz-control-h)!important;padding:0 28px 0 11px!important;
  border:1px solid var(--hz-border)!important;border-radius:8px!important;background:var(--hz-surface)!important;box-shadow:0 1px 2px var(--hz-shadow)!important
}
.horizon .select2-container--default .select2-selection--single .select2-selection__rendered{height:32px!important;padding:0!important;color:var(--hz-text)!important;font-size:var(--hz-control-font)!important;line-height:32px!important}
.horizon .select2-container--default .select2-selection--single .select2-selection__arrow{height:32px!important;right:4px!important}
.horizon .select2-container--default .select2-selection--single .select2-selection__clear{height:32px!important;line-height:32px!important}
.horizon .select2-dropdown{border-color:var(--hz-border)!important;border-radius:8px!important;background:var(--hz-surface)!important;color:var(--hz-text)!important;box-shadow:0 8px 24px var(--hz-shadow)!important;overflow:hidden!important}
.horizon .select2-results__option{font-size:12.5px!important;line-height:18px!important;padding:7px 10px!important}

/* Tables never push the application wider than the viewport. */
.horizon :is(.table-responsive,.dataTables_wrapper,.hz-table-scroll){width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
.horizon :is(table,.modern-table,.table){max-width:100%!important}
.horizon .modern-table{width:100%!important;border-collapse:collapse!important;font-size:12px!important}
.horizon .modern-table thead th{height:40px!important;padding:8px 10px!important;background:var(--hz-card)!important;color:var(--hz-muted)!important;border-bottom:1px solid var(--hz-border)!important;font-size:11.5px!important;line-height:16px!important;font-weight:550!important;white-space:nowrap!important}
.horizon .modern-table td{padding:9px 10px!important;border-bottom:1px solid var(--hz-card)!important;color:var(--hz-text)!important;vertical-align:middle!important;font-size:12px!important;line-height:18px!important}
.horizon code,.horizon pre{max-width:100%!important;overflow-wrap:anywhere!important;word-break:break-word!important}
.horizon .cron-link,.horizon .api-bank-link{max-width:min(520px,55vw)!important;padding:3px 6px!important;border-radius:5px!important;background:var(--hz-card)!important;color:var(--hz-text)!important;font-size:11px!important;line-height:16px!important;white-space:normal!important;word-break:break-all!important}
.horizon .bank-badge{display:inline-flex!important;align-items:center!important;min-height:22px!important;padding:2px 6px!important;border:1px solid var(--hz-border)!important;border-radius:5px!important;background:var(--hz-card)!important;color:var(--hz-text)!important;font-size:11px!important;line-height:16px!important;font-weight:550!important}
.horizon .bank-actions{display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:wrap!important}

/* Media and third-party widgets stay inside cards/forms. */
.horizon :is(img,svg,canvas,video){max-width:100%}
.horizon iframe{max-width:100%!important}
.horizon .modal-dialog{margin:auto!important}
.horizon .modal-content{max-height:calc(100vh - 48px)!important}
.horizon .modal-body{overflow:auto!important}
.horizon .dataTables_wrapper :is(.row,[class*=col-]){min-width:0!important}
.horizon .dataTables_wrapper .dataTables_filter input{width:auto!important;min-width:160px!important;max-width:100%!important;margin-left:6px!important}

/* Mobile: preserve touch targets while avoiding stacked overflow. */
@media(max-width:767px){
  .horizon,body.horizon{--hz-control-h:38px;--hz-control-font:13px;--hz-label-font:12px;--hz-help-font:11.5px}
  .horizon .hz-app-content{padding-left:12px!important;padding-right:12px!important}
  .horizon .dashboard-header{margin-bottom:14px!important;gap:10px!important}
  .horizon .dashboard-title{font-size:18px!important;line-height:24px!important}
  .horizon .card-body-custom{padding:12px!important}
  .horizon .form-grid.two-columns{grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
  .horizon .form-group,.horizon .form-field,.horizon .admin-form-group,.horizon .tcb-field{margin-bottom:12px!important}
  .horizon form :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),.form-control){padding-top:8px!important;padding-bottom:8px!important}
  .horizon form select,.horizon form .form-select,.horizon form .custom-select{padding-top:0!important;padding-bottom:0!important;line-height:36px!important}
  .horizon :is(.form-actions,.admin-form-actions){flex-direction:column!important;align-items:stretch!important}
  .horizon :is(.form-actions,.admin-form-actions)>*{width:100%!important;min-width:0!important}
  .horizon .cron-link,.horizon .api-bank-link{max-width:72vw!important}
  .horizon .dataTables_wrapper .dataTables_filter{width:100%!important;text-align:left!important}
  .horizon .dataTables_wrapper .dataTables_filter input{width:100%!important;min-width:0!important;margin:6px 0 0!important}
  body.horizon .modal{padding:12px!important}
  body.horizon .modal-content{max-height:calc(100vh - 24px)!important}
}

@media(max-width:575px){
  .horizon .hz-brand-link.hz-logo-only>img{height:30px!important;max-height:30px!important;max-width:120px!important}
  .horizon-landing .hz-landing-brand.hz-logo-only>img{height:28px!important;max-height:28px!important;max-width:124px!important}
  .horizon .modern-table{min-width:620px!important}
}
