*{box-sizing:border-box}body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:#f4f6f9;color:#172033}.top{height:68px;background:#111827;color:#fff;display:flex;align-items:center;padding:0 24px;gap:28px;position:sticky;top:0;z-index:5}.brand{font-weight:800;letter-spacing:.08em}.home-brand{padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.brand span{font-weight:400;opacity:.55}.top nav{display:flex;gap:4px;flex:1}.top nav button,.top nav a,.userbox button{background:transparent;border:0;color:#cbd5e1;padding:9px 11px;border-radius:7px;text-decoration:none;cursor:pointer}.top nav button:hover,.top nav a:hover{background:#1f2937;color:#fff}.userbox{display:flex;gap:12px;align-items:center;font-size:14px}.userbox button{border:1px solid #374151}.view{padding:28px;max-width:1500px;margin:auto}.page-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}h1{margin:0 0 6px;font-size:28px}h2{font-size:18px;margin:0}.muted{color:#6b7280}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}.stat{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:18px}.stat b{display:block;font-size:30px;margin-bottom:4px}.stat span{color:#6b7280}.stat-click{cursor:pointer;transition:transform .08s,box-shadow .08s}.stat-click:hover{box-shadow:0 4px 12px #00000010;transform:translateY(-1px)}.stat.warn b{color:#b7791f}.stat.danger b{color:#c53030}.panel{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:18px;box-shadow:0 1px 2px #00000008}.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.toolbar{display:flex;gap:10px;margin-bottom:14px;align-items:flex-end}.date-range{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}.date-range label{margin:0;min-width:150px}.date-range label input{margin-top:5px}.toolbar input{flex:1}.toolbar select{width:180px}input,select,textarea{width:100%;border:1px solid #d1d5db;border-radius:7px;padding:9px 10px;background:#fff;font:inherit}label{display:block;font-size:13px;color:#4b5563;margin:10px 0}label input,label select,label textarea{margin-top:5px}.btn{border:1px solid #d1d5db;background:#fff;padding:9px 13px;border-radius:7px;cursor:pointer}.btn.primary{background:#2563eb;color:#fff;border-color:#2563eb}.btn.danger{background:#dc2626;color:#fff}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}th,td{text-align:left;padding:10px 8px;border-bottom:1px solid #eef0f3;white-space:nowrap}th{color:#6b7280;font-weight:600;background:#fafafa;position:sticky;top:0}.click{cursor:pointer}.click:hover{background:#f8fafc}.badge{display:inline-block;padding:4px 7px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:12px}.badge.warn{background:#fff7ed;color:#9a3412}.badge.danger{background:#fef2f2;color:#b91c1c}.badge.ok{background:#ecfdf5;color:#047857}.split{display:grid;grid-template-columns:1fr 1fr;gap:18px}.modal{position:fixed;inset:0;background:#11182780;display:flex;align-items:center;justify-content:center;padding:20px;z-index:20}.modal-box{background:#fff;border-radius:12px;width:min(900px,100%);max-height:90vh;overflow:auto;padding:24px;position:relative}.close{position:absolute;right:12px;top:10px;border:0;background:transparent;font-size:28px;cursor:pointer}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.full{grid-column:1/-1}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}.ok,.error{padding:10px;border-radius:7px;margin:10px 0}.ok{background:#ecfdf5;color:#047857}.error{background:#fef2f2;color:#b91c1c}.hidden{display:none!important}.center{min-height:100vh;display:flex;align-items:center;justify-content:center}.login-card{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:32px;width:min(420px,92vw);box-shadow:0 10px 30px #0000000d}.login-card h1{margin-top:20px}.login-card .btn{width:100%;margin-top:10px}.mt{margin-top:28px}.link{color:#2563eb;cursor:pointer}.small{font-size:12px;color:#6b7280}.payment-line{display:flex;justify-content:space-between;border-bottom:1px solid #eee;padding:8px 0}.danger-text{color:#b91c1c}.warning-text{color:#b45309}@media(max-width:900px){.top{height:auto;flex-wrap:wrap;padding:12px}.top nav{order:3;overflow:auto}.cards{grid-template-columns:1fr 1fr}.split,.formgrid{grid-template-columns:1fr}.view{padding:16px}.toolbar{flex-wrap:wrap}.toolbar input{min-width:220px}}
.admin-split{grid-template-columns:1.2fr .8fr}.perm-list{display:grid;gap:8px;margin-top:8px}.perm-item{display:flex;align-items:center;gap:9px;padding:9px 10px;border:1px solid #e5e7eb;border-radius:8px}.perm-item input{width:auto}.danger-link{color:#b42318;cursor:pointer}

.table-controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 12px;padding:10px 12px;background:#f8fafc;border:1px solid #e3e8ef;border-radius:10px}
.table-controls label{display:flex;align-items:center;gap:7px;font-size:13px;color:#526174}
.table-controls select{min-width:150px;padding:7px 10px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#172033}
.table-controls .sort-dir{min-width:150px}
.group-row td{background:#eef3f8;border-top:1px solid #d8e0e8;border-bottom:1px solid #d8e0e8;padding:9px 12px;color:#24364b}
.group-count{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:22px;margin-left:8px;padding:0 7px;border-radius:12px;background:#dce5ef;font-size:12px;color:#4b5d72}

th.sortable{cursor:pointer;user-select:none}th.sortable:hover{background:#f1f5f9;color:#172033}th.sortable.sorted{color:#172033}th .sort-arrow{display:inline-block;min-width:12px;margin-left:4px;font-weight:800}
.pagination{display:flex;align-items:center;justify-content:flex-end;gap:14px;padding:12px 4px 0;color:#6b7280;font-size:13px}.pagination label{display:flex;align-items:center;gap:7px;margin:0}.pagination select{width:auto;min-width:70px;padding:7px}.pager-buttons{display:flex;gap:6px}.pager-buttons .btn{padding:6px 10px}.pager-buttons .btn:disabled{opacity:.45;cursor:not-allowed}


/* v35: separate tariff action buttons */
.row-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.btn-sm{padding:7px 11px;font-size:13px;line-height:1.2;border-radius:7px}
.btn-secondary{background:#fff;border:1px solid #cbd5e1;color:#1d4ed8}
.btn-secondary:hover{background:#f8fafc}

/* v38: Excel-style filters */
.excel-filter-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 10px;padding:9px 11px;background:#f8fafc;border:1px solid #e3e8ef;border-radius:9px}
.filter-toggle{font-weight:600}.filter-summary{font-size:13px;flex:1}.filter-count{display:inline-flex;align-items:center;justify-content:center;min-width:19px;height:19px;padding:0 5px;border-radius:10px;background:#2563eb;color:#fff;font-size:11px;margin-left:4px}.filter-clear:disabled{opacity:.45;cursor:not-allowed}
.excel-filter-panel{border:1px solid #dbe2ea;background:#fff;border-radius:9px;padding:12px;margin-bottom:10px;box-shadow:0 5px 16px #0000000b}.filter-panel-head{display:flex;gap:12px;align-items:center;margin-bottom:10px}.filter-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.filter-field{margin:0;border:1px solid #e2e8f0;border-radius:8px;background:#fff}.filter-field summary{cursor:pointer;list-style:none;padding:9px 10px;font-size:13px;font-weight:600;color:#334155}.filter-field summary::-webkit-details-marker{display:none}.filter-field summary:after{content:'⌄';float:right;color:#64748b}.filter-options{max-height:230px;overflow:auto;padding:7px 10px 10px;border-top:1px solid #eef2f7}.filter-options label{display:flex;align-items:center;gap:7px;margin:5px 0;font-size:12px;color:#334155}.filter-options input{width:auto;margin:0}.filter-option-tools{display:flex;gap:10px;margin-bottom:5px}.link-btn{border:0;background:transparent;padding:0;color:#2563eb;cursor:pointer;font-size:12px}.th-filter{border:0;background:transparent;color:#64748b;font-size:10px;padding:2px 3px;margin-left:4px;border-radius:4px;cursor:pointer}.th-filter:hover,.th-filter.active{background:#dbeafe;color:#1d4ed8}
@media(max-width:900px){.filter-grid{grid-template-columns:1fr}}

/* v39: compact Excel-like column filter/sort popup */
.excel-filter-popover{position:fixed;z-index:10000;width:320px;max-width:calc(100vw - 16px);background:#fff;border:1px solid #cfd8e3;border-radius:10px;box-shadow:0 12px 32px #0f172a26;padding:10px;color:#172033}
.efp-title{font-size:15px;font-weight:700;padding:3px 4px 9px;border-bottom:1px solid #eef2f6}.efp-sort{display:grid;gap:2px;padding:6px 0;border-bottom:1px solid #eef2f6}.efp-sort button,.efp-tools button{border:0;background:transparent;text-align:left;padding:7px 8px;border-radius:6px;color:#1f2937;cursor:pointer;font-size:13px}.efp-sort button:hover,.efp-tools button:hover{background:#f1f5f9;color:#1d4ed8}.efp-search{display:flex;align-items:center;gap:7px;border:1px solid #cbd5e1;border-radius:7px;padding:0 9px;margin:9px 0 7px;height:34px}.efp-search input{border:0;outline:0;width:100%;font-size:13px;background:transparent}.efp-tools{display:flex;align-items:center;gap:4px;margin-bottom:5px}.efp-tools span{margin-left:auto;color:#64748b;font-size:11px;padding-right:5px}.efp-values{max-height:270px;overflow:auto;border:1px solid #e2e8f0;border-radius:7px;padding:5px;background:#fff}.efp-option{display:flex;align-items:center;gap:8px;padding:6px 7px;border-radius:5px;font-size:13px;cursor:pointer}.efp-option:hover{background:#f8fafc}.efp-option input{width:auto;margin:0}.efp-empty{padding:18px 8px;text-align:center;font-size:12px}.efp-footer{display:flex;justify-content:flex-end;gap:7px;padding-top:9px}.th-filter{font-size:10px}.th-filter.active{background:#dbeafe;color:#1d4ed8}
/* v40: compact Excel filter popup fallback */
.excel-filter-popover{position:fixed!important;z-index:2147483647!important;width:340px!important;max-width:calc(100vw - 16px)!important;box-sizing:border-box!important;background:#fff!important;border:1px solid #cfd8e3!important;border-radius:10px!important;box-shadow:0 12px 32px rgba(15,23,42,.16)!important;padding:10px!important;overflow:hidden!important}
.excel-filter-popover .efp-values{max-height:260px!important;overflow:auto!important}
/* v42: adaptive filter popup width, no wrapping */
.excel-filter-popover{
  width:max-content!important;
  min-width:300px!important;
  max-width:min(560px,calc(100vw - 16px))!important;
}
.excel-filter-popover .efp-title,
.excel-filter-popover .efp-sort button,
.excel-filter-popover .efp-tools button,
.excel-filter-popover .efp-option{
  white-space:nowrap!important;
}
.excel-filter-popover .efp-option span{
  display:block;
  min-width:0;
  max-width:470px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap!important;
}
.excel-filter-popover .efp-values{width:max-content;min-width:100%;max-width:calc(100vw - 56px);box-sizing:border-box}
.excel-filter-popover .efp-search{width:100%;box-sizing:border-box}

/* v42: filter values - text left, checkbox aligned to the right edge */
.excel-filter-popover .efp-values{overflow-x:hidden!important;}
.excel-filter-popover .efp-option{display:grid!important;grid-template-columns:minmax(0,1fr) 22px!important;align-items:center!important;column-gap:8px!important;width:100%!important;box-sizing:border-box!important;min-height:30px!important;padding:6px 7px!important;margin:0!important;}
.excel-filter-popover .efp-option span{display:block!important;min-width:0!important;max-width:none!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-option input{width:14px!important;height:14px!important;margin:0!important;justify-self:end!important;}
/* v43: force each filter value and checkbox onto the same row */
.excel-filter-popover .efp-values .efp-option{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:space-between!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  box-sizing:border-box!important;
  gap:10px!important;
  min-height:30px!important;
  padding:6px 7px!important;
  margin:0!important;
}
.excel-filter-popover .efp-values .efp-option > span{
  flex:1 1 auto!important;
  min-width:0!important;
  width:auto!important;
  max-width:none!important;
  display:block!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.excel-filter-popover .efp-values .efp-option > input[type="checkbox"]{
  flex:0 0 14px!important;
  width:14px!important;
  min-width:14px!important;
  max-width:14px!important;
  height:14px!important;
  margin:0!important;
  padding:0!important;
  justify-self:auto!important;
  align-self:center!important;
}

/* v44: checkbox row layout is also applied inline after dynamic rendering */
.excel-filter-popover .efp-values .efp-option{display:flex!important;align-items:center!important;justify-content:space-between!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;min-height:30px!important;gap:10px!important;}
.excel-filter-popover .efp-values .efp-option>span{flex:1 1 auto!important;min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-values .efp-option>input[type=checkbox]{flex:0 0 14px!important;width:14px!important;height:14px!important;margin:0!important;align-self:center!important;}

/* v45: adaptive filter width; JS calculates width from the longest value. */
.excel-filter-popover{max-width:calc(100vw - 16px)!important;}
.excel-filter-popover .efp-option > span{white-space:nowrap!important;}
.excel-filter-popover .efp-values{overflow-x:hidden!important;}
.excel-filter-popover .efp-values .efp-option{display:flex!important;align-items:center!important;justify-content:space-between!important;width:100%!important;box-sizing:border-box!important;min-width:0!important;}
.excel-filter-popover .efp-values .efp-option > input[type=checkbox]{flex:0 0 14px!important;width:14px!important;height:14px!important;margin-left:10px!important;}
.excel-filter-popover .efp-values .efp-option > span{flex:1 1 auto!important;min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-values .efp-option[data-filter-status] > span{overflow:visible!important;text-overflow:clip!important;}

/* v46: compact adaptive filter popups; full value is available on hover via title */
.excel-filter-popover .efp-option > span[title]{cursor:help;}
.excel-filter-popover .efp-option[data-filter-status] > span{overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important;}


/* v47: compact filter sizing and guaranteed full-value hover tooltip */
.excel-filter-popover .efp-option > span[data-full-value]{cursor:default;}
.efp-hover-tooltip{position:fixed!important;z-index:2147483647!important;max-width:390px!important;padding:7px 10px!important;background:#172033!important;color:#fff!important;border-radius:6px!important;box-shadow:0 8px 24px rgba(0,0,0,.22)!important;font:13px/1.35 inherit!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;pointer-events:none!important;}

/* v48: clear funnel filter icon and guaranteed visible checkbox controls */
.excel-filter-popover .efp-option{display:grid!important;grid-template-columns:minmax(0,1fr) 22px!important;align-items:center!important;column-gap:8px!important;width:100%!important;box-sizing:border-box!important;min-height:30px!important;padding:6px 7px!important;margin:0!important;border-radius:5px!important;cursor:pointer!important;}
.excel-filter-popover .efp-option>span{display:block!important;min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-option[data-filter-status="1"]>span{overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important;}
.excel-filter-popover .efp-option>input[type="checkbox"]{appearance:none!important;-webkit-appearance:none!important;display:block!important;position:relative!important;width:15px!important;height:15px!important;min-width:15px!important;max-width:15px!important;min-height:15px!important;margin:0!important;padding:0!important;border:1px solid #94a3b8!important;border-radius:3px!important;background:#fff!important;box-shadow:none!important;cursor:pointer!important;justify-self:end!important;}
.excel-filter-popover .efp-option>input[type="checkbox"]:checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option>input[type="checkbox"]:checked::after{content:""!important;position:absolute!important;left:3px!important;top:0px!important;width:5px!important;height:9px!important;border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;}
.th-filter{display:inline-flex!important;align-items:center!important;justify-content:center!important;width:24px!important;height:22px!important;padding:3px!important;margin-left:6px!important;border:1px solid #94a3b8!important;background:#fff!important;color:#475569!important;border-radius:5px!important;vertical-align:middle!important;cursor:pointer!important;}
.th-filter svg{width:14px!important;height:14px!important;display:block!important;fill:currentColor!important;}
.th-filter:hover,.th-filter.active{background:#eff6ff!important;border-color:#2563eb!important;color:#2563eb!important;}

/* v49: bulletproof filter rows - custom checkbox anchored to the right */
.excel-filter-popover .efp-option{position:relative!important;display:block!important;width:100%!important;box-sizing:border-box!important;min-height:30px!important;padding:6px 34px 6px 7px!important;margin:0!important;line-height:18px!important;white-space:nowrap!important;overflow:hidden!important;}
.excel-filter-popover .efp-option .efp-value-text{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-option .efp-checkbox{position:absolute!important;right:8px!important;top:50%!important;transform:translateY(-50%)!important;width:15px!important;height:15px!important;box-sizing:border-box!important;border:1px solid #94a3b8!important;border-radius:3px!important;background:#fff!important;display:block!important;}
.excel-filter-popover .efp-option .efp-checkbox.checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option .efp-checkbox.checked:after{content:""!important;position:absolute!important;left:3px!important;top:0px!important;width:5px!important;height:9px!important;border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;}
.excel-filter-popover .efp-option:hover{background:#f8fafc!important;}
.excel-filter-popover .efp-values{overflow-x:hidden!important;}

/* v50: filter trigger must remain visible even if legacy table/button CSS overrides it. */
th .th-filter{display:inline-flex!important;visibility:visible!important;opacity:1!important;position:relative!important;z-index:2!important;}
th .th-filter svg{display:block!important;visibility:visible!important;opacity:1!important;}

/* v51: checkbox inline style must remain visibly rendered */
.excel-filter-popover .efp-option .efp-checkbox{display:block!important;visibility:visible!important;opacity:1!important;border:1px solid #94a3b8!important;border-radius:3px!important;background:#fff!important;width:15px!important;height:15px!important;min-width:15px!important;min-height:15px!important;z-index:3!important;}
.excel-filter-popover .efp-option .efp-checkbox.checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option .efp-checkbox.checked:after{content:""!important;position:absolute!important;left:3px!important;top:0!important;width:5px!important;height:9px!important;border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;}

/* v52 filter checkbox robustness */
.excel-filter-popover .efp-checkbox.checked::after{content:""!important;position:absolute!important;left:3px!important;top:0!important;width:5px!important;height:9px!important;border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;}

/* v53: keep filter popup and footer inside viewport; never hide action buttons */
.excel-filter-popover{max-height:calc(100vh - 16px)!important;overflow:hidden!important;}
.excel-filter-popover .efp-values{min-height:120px!important;max-height:calc(100vh - 300px)!important;overflow-y:auto!important;overflow-x:hidden!important;}
.excel-filter-popover .efp-footer{position:relative!important;z-index:10!important;background:#fff!important;display:flex!important;visibility:visible!important;opacity:1!important;}
.excel-filter-popover .efp-checkbox{position:absolute!important;right:8px!important;top:50%!important;transform:translateY(-50%)!important;}
.excel-filter-popover .efp-option{position:relative!important;padding-right:34px!important;}

/* v54: robust native button checkbox. Avoid browser/input/span layout conflicts. */
.excel-filter-popover .efp-option{position:relative!important;display:flex!important;align-items:center!important;justify-content:space-between!important;width:100%!important;box-sizing:border-box!important;min-height:30px!important;padding:6px 7px!important;margin:0!important;gap:10px!important;white-space:nowrap!important;overflow:hidden!important;}
.excel-filter-popover .efp-option .efp-value-text{display:block!important;flex:1 1 auto!important;min-width:0!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.excel-filter-popover .efp-option .efp-check{display:block!important;flex:0 0 16px!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;margin:0!important;padding:0!important;position:relative!important;box-sizing:border-box!important;appearance:none!important;-webkit-appearance:none!important;border:1px solid #64748b!important;border-radius:3px!important;background:#fff!important;box-shadow:none!important;opacity:1!important;visibility:visible!important;cursor:pointer!important;}
.excel-filter-popover .efp-option .efp-check.checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option .efp-check.checked::after{content:""!important;position:absolute!important;left:4px!important;top:1px!important;width:5px!important;height:9px!important;border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;}
.excel-filter-popover .efp-option .efp-check:hover{border-color:#2563eb!important;}
.excel-filter-popover .efp-option[data-filter-status="1"] .efp-value-text{overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important;}


/* v55: stable custom checkbox - no native button/input rendering */
.excel-filter-popover .efp-option .efp-check{
  position:relative!important;
  display:inline-block!important;
  flex:0 0 16px!important;
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  min-height:16px!important;
  max-height:16px!important;
  margin:0 1px 0 8px!important;
  padding:0!important;
  box-sizing:border-box!important;
  border:1px solid #64748b!important;
  border-radius:3px!important;
  background:#fff!important;
  box-shadow:none!important;
  opacity:1!important;
  visibility:visible!important;
  cursor:pointer!important;
  align-self:center!important;
}
.excel-filter-popover .efp-option .efp-check.checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option .efp-check.checked::after{
  content:""!important;position:absolute!important;left:4px!important;top:1px!important;width:5px!important;height:9px!important;
  border:solid #fff!important;border-width:0 2px 2px 0!important;transform:rotate(45deg)!important;
}
.excel-filter-popover .efp-option .efp-check:focus{outline:2px solid #93c5fd!important;outline-offset:1px!important;}

/* v56: final checkbox sizing override. The checkbox is a span, so generic span rules must not stretch it. */
.excel-filter-popover .efp-option > .efp-check{
  display:block!important;
  position:absolute!important;
  right:8px!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  width:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  height:16px!important;
  min-height:16px!important;
  max-height:16px!important;
  flex:none!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
  border:1px solid #64748b!important;
  border-radius:3px!important;
  background:#fff!important;
  overflow:hidden!important;
  white-space:normal!important;
  z-index:10!important;
}
.excel-filter-popover .efp-option > .efp-check.checked{background:#2563eb!important;border-color:#2563eb!important;}
.excel-filter-popover .efp-option > .efp-check.checked::after{
  content:""!important;
  position:absolute!important;
  left:4px!important;
  top:1px!important;
  width:5px!important;
  height:9px!important;
  border:solid #fff!important;
  border-width:0 2px 2px 0!important;
  transform:rotate(45deg)!important;
}

/* v57: checkbox is a DIV, never let generic span/table rules affect it. */
.excel-filter-popover .efp-option > div.efp-check{
  position:absolute!important;
  right:8px!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  display:block!important;
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  min-height:16px!important;
  max-height:16px!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
  border:1px solid #64748b!important;
  border-radius:3px!important;
  background:#fff!important;
  overflow:hidden!important;
  opacity:1!important;
  visibility:visible!important;
  z-index:20!important;
  cursor:pointer!important;
}
.excel-filter-popover .efp-option > div.efp-check.checked{
  background:#2563eb!important;
  border-color:#2563eb!important;
}
.excel-filter-popover .efp-option > div.efp-check.checked::after{
  content:""!important;
  position:absolute!important;
  left:4px!important;
  top:1px!important;
  width:5px!important;
  height:9px!important;
  border:solid #fff!important;
  border-width:0 2px 2px 0!important;
  transform:rotate(45deg)!important;
}
.excel-filter-popover .efp-option > span.efp-value-text{
  display:block!important;
  width:auto!important;
  flex:1 1 auto!important;
  min-width:0!important;
  max-width:calc(100% - 28px)!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

/* v58: UTID needs a little extra horizontal room so the right-aligned checkbox never clips. */
.excel-filter-popover .efp-option > div.efp-check{
  flex:0 0 16px!important;
  width:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  height:16px!important;
  min-height:16px!important;
  max-height:16px!important;
  right:8px!important;
}
.excel-filter-popover .efp-option .efp-value-text{
  padding-right:26px!important;
  box-sizing:border-box!important;
}

/* v58 final: keep the values list exactly inside the popup width.
   This prevents the right-aligned checkbox from being clipped, especially for UTID. */
.excel-filter-popover .efp-values{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  box-sizing:border-box!important;
  overflow-x:hidden!important;
}
.excel-filter-popover .efp-option{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  box-sizing:border-box!important;
  padding-right:32px!important;
}
.excel-filter-popover .efp-option > div.efp-check{
  right:8px!important;
  width:16px!important;
  min-width:16px!important;
  max-width:16px!important;
}


/* v71: responsive tables — no artificial 1280px minimum. The table grows only to the
   practical widths below; if those columns really exceed the panel, only the table scrolls. */
.table-wrap table{width:max-content;min-width:100%;table-layout:auto;}
.table-wrap th,.table-wrap td{white-space:nowrap;}
.table-wrap th{overflow:visible!important;text-overflow:clip!important;}
.table-wrap th.col-serial_number{width:120px;min-width:120px;max-width:120px;}
.table-wrap th.col-utid{width:170px;min-width:170px;max-width:170px;}
.table-wrap th.col-kit_number{width:130px;min-width:130px;max-width:130px;}
.table-wrap th.col-account_name{width:200px;min-width:200px;max-width:200px;}
.table-wrap th.col-tariff_name,.table-wrap th.col-tariff_id{width:150px;min-width:150px;max-width:150px;}
.table-wrap th.col-card_name,.table-wrap th.col-card_id{width:150px;min-width:150px;max-width:150px;}
.table-wrap th.col-next_payment_date{width:135px;min-width:135px;max-width:135px;}
.table-wrap th.col-status{width:110px;min-width:110px;max-width:110px;}
.table-wrap th .th-filter{flex:0 0 24px;}
.table-wrap td{max-width:240px;overflow:hidden;text-overflow:ellipsis;}
.table-wrap td .cell-clip{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
/* v66 — group permissions and compact action links */
.link-button{border:0;background:transparent;color:#2563eb;padding:2px 0;cursor:pointer;font:inherit;text-decoration:none}
.link-button:hover{text-decoration:underline}
.perm-groups{display:flex;flex-direction:column;gap:14px;margin-top:8px;max-height:55vh;overflow:auto;padding-right:4px}
.perm-group{border:1px solid #e2e8f0;border-radius:10px;padding:10px 12px;background:#fff}
.perm-group-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;position:sticky;top:0;background:#fff;padding-bottom:7px;border-bottom:1px solid #edf1f5;z-index:1}
.perm-group-head span{display:flex;gap:10px}
.perm-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 14px}
.perm-item{display:flex;align-items:flex-start;gap:8px;padding:5px 2px;cursor:pointer;line-height:1.3}
.perm-item input{margin-top:2px;flex:0 0 auto}
@media(max-width:800px){.perm-list{grid-template-columns:1fr}.perm-group-head{align-items:flex-start;flex-direction:column}}

/* v70: keep the page inside the viewport. Wide tables scroll inside their own container,
   never the whole document. */
html,body{max-width:100%;overflow-x:hidden!important;}
.view{min-width:0!important;max-width:1500px!important;width:100%!important;}
.panel,.split,.split>*{min-width:0!important;}
.table-wrap{width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:auto!important;overflow-y:visible;}
.table-wrap table{max-width:none;}
@media(max-width:900px){.view{width:100%!important;max-width:100%!important}.split{min-width:0!important}.panel{min-width:0!important}}

/* v72: per-user Starlink column chooser */
.table-tools{display:flex;justify-content:flex-end;align-items:center;margin:0 0 8px;min-height:32px}
.column-chooser-btn{white-space:nowrap;font-size:13px!important;padding:5px 10px!important}
.column-chooser-popover{position:fixed;z-index:10050;background:#fff;border:1px solid #cbd5e1;border-radius:10px;box-shadow:0 12px 30px rgba(15,23,42,.18);padding:0;height:min(620px,calc(100vh - 20px));max-height:calc(100vh - 20px);display:flex;flex-direction:column;overflow:hidden;color:#172033}
.column-chooser-popover .cc-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #e2e8f0;font-size:15px}
.column-chooser-popover .cc-close{border:0;background:transparent;font-size:22px;line-height:1;cursor:pointer;color:#475569;padding:0 2px}
.column-chooser-popover .cc-tools{display:flex;gap:8px;padding:9px 12px;border-bottom:1px solid #e2e8f0}
.column-chooser-popover .cc-tools button{border:0;background:transparent;color:#2563eb;cursor:pointer;padding:3px 2px;font-size:13px}
.column-chooser-popover .cc-list{flex:1 1 auto;min-height:80px;max-height:none;overflow:auto;padding:7px 10px}
.column-chooser-popover .cc-list label{display:flex;align-items:center;gap:9px;padding:7px 5px;border-radius:6px;cursor:pointer;white-space:nowrap}
.column-chooser-popover .cc-list label:hover{background:#f1f5f9}
.column-chooser-popover .cc-list input{width:16px;height:16px;margin:0;flex:0 0 16px}
.column-chooser-popover .cc-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 12px;border-top:1px solid #e2e8f0;background:#fff}
.column-chooser-popover .cc-foot .muted{margin-right:auto;font-size:12px}

/* v74: column chooser always keeps its footer/buttons inside the viewport. */

/* Starlink column chooser: compact, sortable list */
.column-chooser-popover .cc-drag-hint{margin-left:auto;color:#94a3b8;font-size:11px;white-space:nowrap}
.column-chooser-popover .cc-item{display:flex;align-items:center;gap:8px;padding:7px 5px;border-radius:6px;cursor:default;white-space:nowrap;border:1px solid transparent}
.column-chooser-popover .cc-item:hover{background:#f1f5f9}
.column-chooser-popover .cc-item.dragging{opacity:.45}
.column-chooser-popover .cc-item.drag-over{border-color:#93c5fd;background:#eff6ff}
.column-chooser-popover .cc-drag{width:18px;flex:0 0 18px;text-align:center;color:#64748b;cursor:grab;font-size:16px;line-height:16px;user-select:none}
.column-chooser-popover .cc-drag:active{cursor:grabbing}
.column-chooser-popover .cc-item input{width:16px;height:16px;margin:0;flex:0 0 16px}
.column-chooser-popover .cc-item .cc-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (max-width:700px){.column-chooser-popover .cc-drag-hint{display:none}}
.perm-master{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;padding:10px 12px;border:1px solid #dbe3ec;border-radius:10px;background:#f8fafc}.perm-master span{display:flex;gap:12px;flex-wrap:wrap}.perm-master b{white-space:nowrap}
.perm-master{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;padding:10px 12px;border:1px solid #dbe3ec;border-radius:10px;background:#f8fafc}.perm-master span{display:flex;gap:12px;flex-wrap:wrap}.perm-master b{white-space:nowrap}

/* Mobile layout: controls remain usable without changing the desktop design. */
@media (max-width:640px){
  .top{position:relative;gap:10px;padding:10px 12px;align-items:center}
  .top nav{order:3;width:100%;flex:0 0 100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding-bottom:2px;overflow:visible;white-space:normal}
  .top nav button,.top nav a{display:block;width:100%;min-width:0;padding:9px 7px;font-size:13px;line-height:1.2;text-align:center}
  .userbox{margin-left:auto;gap:7px;font-size:12px;white-space:nowrap}
  .userbox button{padding:7px 8px}
  .view{padding:12px}
  .page-head{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:16px}
  .page-head>div:last-child,.page-head .actions{width:100%;flex-wrap:wrap}
  h1{font-size:23px}h2{font-size:17px}
  .cards{grid-template-columns:1fr;gap:10px;margin-bottom:14px}
  .stat{padding:14px}.stat b{font-size:26px}
  .panel{padding:12px;border-radius:10px}
  .panel-head{align-items:flex-start;gap:10px;flex-wrap:wrap}
  .toolbar{align-items:stretch;flex-direction:column;gap:8px;margin-bottom:10px}
  .toolbar input{min-width:0;width:100%}
  .date-range{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end;width:100%;gap:8px}
  .date-range label{min-width:0;width:100%;margin:0}
  .date-range label:only-child{grid-column:1/-1}
  .date-range button{min-width:0;width:100%;padding:9px 6px}
  .toolbar select{width:100%}
  .split,.formgrid{gap:12px}
  .table-tools{justify-content:flex-start}
  .table-wrap{margin:0 -2px;padding-bottom:4px}
  table{font-size:12px}th,td{padding:9px 7px}
  .pagination{justify-content:center;gap:8px;flex-wrap:wrap;text-align:center}
  .pagination label{margin:0}.pager-buttons{display:flex;gap:8px}
  .modal{align-items:flex-end;padding:0}
  .modal-box{width:100%;max-height:92vh;border-radius:14px 14px 0 0;padding:20px 16px}
  .actions{align-items:stretch;flex-direction:column}.actions .btn{width:100%}
  .login-card{padding:24px 20px;width:min(100% - 24px,420px)}
}
@media (max-width:380px){
  .home-brand{font-size:13px;letter-spacing:.05em;white-space:nowrap}
  .userbox #username{display:none}
}

.mobile-nav-toggle{display:none}
@media (max-width:640px){
  .mobile-nav-toggle{display:inline-flex;order:2;align-items:center;justify-content:center;gap:5px;border:1px solid #374151;border-radius:7px;background:#1f2937;color:#fff;padding:8px 10px;font:inherit;font-size:13px;cursor:pointer;white-space:nowrap}
  .top .userbox{order:2;margin-left:0}
  .top nav{display:none!important}
  .top nav.mobile-open{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;width:100%;flex:0 0 100%}
  .top nav.mobile-open button,.top nav.mobile-open a{display:block;width:100%;min-width:0;padding:9px 7px;font-size:13px;line-height:1.2;text-align:center}
}

/* Planned payments: a focused, contemporary period control bar. */
#planned .planned-range-toolbar{display:flex;align-items:stretch;gap:14px;padding:12px 14px;margin-bottom:12px;background:linear-gradient(135deg,#fff 0%,#f8fafc 100%);border:1px solid #e2e8f0;border-radius:14px;box-shadow:0 2px 7px rgba(15,23,42,.04)}
#planned .planned-range-toolbar>#plannedSearch{min-width:280px;border-color:#d9e1ec;background:#fff;padding:11px 13px;box-shadow:0 1px 2px rgba(15,23,42,.03)}
#planned .planned-range-toolbar>#plannedSearch:focus{border-color:#2563eb;outline:3px solid #dbeafe}
#planned .planned-date-controls{display:flex;align-items:end;gap:8px;padding-left:14px;border-left:1px solid #e2e8f0}
#planned .planned-date-controls label{min-width:132px;color:#64748b;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
#planned .planned-date-controls label input{border-color:#d9e1ec;padding:10px;background:#fff;color:#172033;font-size:14px;font-weight:600}
#planned .planned-date-controls .range-preset{border-color:#dbe3ee;background:#fff;color:#334155;font-weight:700;font-size:13px;box-shadow:0 1px 2px rgba(15,23,42,.04);transition:all .15s ease}
#planned .planned-date-controls .range-preset:hover{border-color:#93c5fd;background:#eff6ff;color:#1d4ed8;transform:translateY(-1px)}
#planned .planned-date-controls .range-refresh{border-color:#2563eb;background:#2563eb;color:#fff;font-weight:700;box-shadow:0 3px 8px rgba(37,99,235,.24)}
#planned .planned-date-controls .range-refresh:hover{background:#1d4ed8;border-color:#1d4ed8}
#planned .planned-summary-controls{padding:0 4px;margin:0 0 14px}
#planned .planned-summary-controls .date-range{gap:10px}
#planned .planned-summary-controls label{min-width:190px;color:#64748b;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
#planned .planned-summary-controls select,#planned .planned-summary-controls input{margin-top:5px;border-color:#d9e1ec;background:#fff;font-size:14px;font-weight:600;color:#172033}
@media(max-width:900px){#planned .planned-range-toolbar{align-items:stretch;flex-direction:column}#planned .planned-date-controls{padding:12px 0 0;border-left:0;border-top:1px solid #e2e8f0}}
@media(max-width:640px){#planned .planned-range-toolbar{padding:10px;border-radius:12px}#planned .planned-range-toolbar>#plannedSearch{min-width:0}#planned .planned-date-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:10px}#planned .planned-date-controls label{min-width:0}#planned .planned-date-controls .range-preset,#planned .planned-date-controls .range-refresh{width:100%;padding:10px 4px}#planned .planned-summary-controls{padding:0;margin-bottom:12px}#planned .planned-summary-controls .date-range{display:grid;grid-template-columns:1fr;gap:8px}#planned .planned-summary-controls label{min-width:0}}

/* v120: compact confirmations and message thread */
.flag-legend{font-size:12px;color:#64748b;margin:8px 0}.starlink-flag{width:17px!important;height:17px!important;min-width:17px;margin:0!important;padding:0!important;accent-color:#16a085;cursor:pointer}.starlink-flag:disabled{cursor:default;opacity:.65}
th.col-is_verified,td.col-is_verified,th.col-is_paid,td.col-is_paid{width:54px!important;min-width:54px!important;max-width:54px!important;padding:6px!important;text-align:center;white-space:nowrap}
th.col-is_verified .th-filter,th.col-is_paid .th-filter{margin-left:2px!important;width:18px!important;padding:1px!important}td.col-is_verified .cell-clip,td.col-is_paid .cell-clip{overflow:visible}.card-flags{display:flex;gap:20px;flex-wrap:wrap;margin:0 32px 12px 0}.card-flags label{display:flex;align-items:center;gap:8px;margin:0;font-size:14px}
.card-chat{margin-top:20px;border-top:1px solid #e2e8f0;padding-top:12px}.card-chat h3{margin:0 0 10px}.chat-thread{max-height:15em;overflow-y:auto;overscroll-behavior:contain;background:#f0f5f4;border:1px solid #e1ebe7;border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:10px}.chat-message{max-width:92%;align-self:flex-start;background:#fff;border:1px solid #e0e8e5;border-radius:12px 12px 12px 3px;padding:9px 12px;box-shadow:0 1px 2px #142b2010}.chat-mine{align-self:flex-end;background:#dff5e8;border-color:#c5e6d1;border-radius:12px 12px 3px 12px}.chat-meta{display:flex;gap:14px;flex-wrap:wrap;justify-content:space-between;font-size:11px;color:#61736b;margin-bottom:4px}.chat-meta b{color:#246147}.chat-body{font-size:14px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:15em;overflow-y:auto}.chat-message small{font-size:10px;color:#71847b}.chat-compose{display:flex;align-items:flex-end;gap:10px;margin-top:10px}.chat-compose textarea{flex:1;min-width:0;resize:vertical;max-height:15em;margin:0}.chat-compose button{flex-shrink:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
@media(max-width:600px){.chat-message{max-width:100%}.chat-compose{flex-wrap:wrap}.chat-compose textarea{flex-basis:100%}}

.table-wrap table.flag-table{min-width:0;width:max-content}

.chat-actions{display:flex;gap:12px;margin-top:6px;flex-wrap:wrap}.chat-actions .link-button{font-size:11px;padding:0;color:#52756a}.chat-editing{max-height:none;white-space:normal}.chat-editing textarea{width:100%;min-width:220px;margin:0}

.chat-change{display:block;margin-top:4px}.chat-deleted{background:#f1f3f5;border-style:dashed}.chat-deleted .chat-body{color:#728078;font-style:italic}
