
:root{
  --primary:#2E2E2E;--secondary:#B08D3F;--accent:#C24F4F;
  --button-active-bg:#2E2E2E;--button-active-text:#fff;
  --button-hover-bg:#B08D3F;--button-hover-text:#fff;
  --heading-font:"Arial Nova",Arial,sans-serif;--body-font:"Arial Nova",Arial,sans-serif;
  --heading-size:28px;--heading-weight:700;--heading-style:normal;
  --heading-line-height:1.2;--heading-letter-spacing:0px;--heading-transform:none;
  --body-size:14px;--body-weight:400;--body-style:normal;
  --body-line-height:1.5;--body-letter-spacing:0px;
  --bg:#f3f5f8;--card:#fff;--line:#dfe5ec;--text:#172033;--muted:#657187;
  --success:#16834b;--warning:#b76b00;--danger:#bd2d38;--info:#2f6fce;
  --radius:15px;--shadow:0 10px 30px rgba(15,23,42,.07)
}
*{box-sizing:border-box}
body{
  margin:0;background:var(--bg);color:var(--text);font-family:var(--body-font);
  font-size:var(--body-size);font-weight:var(--body-weight);font-style:var(--body-style);
  line-height:var(--body-line-height);letter-spacing:var(--body-letter-spacing)
}
button,input,select,textarea,table,th,td{font-family:var(--body-font)}
h1,h2,h3,h4,h5,h6{
  font-family:var(--heading-font);font-weight:var(--heading-weight);font-style:var(--heading-style);
  line-height:var(--heading-line-height);letter-spacing:var(--heading-letter-spacing);
  text-transform:var(--heading-transform)
}
button{cursor:pointer}
input,select,textarea{
  width:100%;border:1px solid #cbd3dd;border-radius:9px;background:#fff;
  padding:10px 11px;color:var(--text);outline:none
}
input:focus,select:focus,textarea:focus{
  border-color:var(--secondary);box-shadow:0 0 0 3px color-mix(in srgb,var(--secondary) 18%,transparent)
}
textarea{resize:vertical;min-height:82px}
input[readonly]{background:#eef2f6;color:#526075;font-weight:700}
.app{display:grid;grid-template-columns:280px minmax(0,1fr);min-height:100vh}
.sidebar{
  position:sticky;top:0;height:100vh;padding:20px 16px;color:#fff;
  background:linear-gradient(180deg,var(--primary),color-mix(in srgb,var(--primary) 74%,#000));
  display:flex;flex-direction:column;z-index:30
}
.brand-lockup{display:flex;align-items:center;gap:11px;padding:3px 6px 20px}
.brand-mark{
  width:46px;height:46px;border-radius:13px;display:grid;place-items:center;
  background:var(--secondary);font-size:19px;font-weight:900
}
.brand-lockup strong{display:block;font-size:15px}.brand-lockup small{color:rgba(255,255,255,.68)}
.nav{display:flex;flex-direction:column;gap:5px}
.nav-btn{
  border:0;border-radius:10px;background:transparent;color:rgba(255,255,255,.78);
  padding:11px 12px;text-align:left;display:flex;align-items:center;gap:10px;
  width:100%;font-weight:700;transition:.18s
}
.nav-btn:hover{background:var(--button-hover-bg);color:var(--button-hover-text);transform:translateX(2px)}
.nav-btn.active{background:var(--button-active-bg);color:var(--button-active-text)}
.nav-btn.nav-separated{
  margin-top:14px;
  position:relative
}
.nav-btn.nav-separated::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:-8px;
  height:1px;
  background:rgba(255,255,255,.18)
}
.nav-icon{width:19px;height:19px;min-width:19px}.nav-icon svg{
  width:19px;height:19px;display:block;fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round
}
.sidebar-foot{margin-top:auto;padding:14px 7px 2px;color:rgba(255,255,255,.62);font-size:11px}
.main{padding:25px;min-width:0}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px}
.topbar h1{margin:0 0 5px;font-size:var(--heading-size)}
.topbar p{margin:0;color:var(--muted)}
.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.tab{display:none}.tab.active{display:block}
.grid{display:grid;gap:16px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid.four{grid-template-columns:repeat(4,minmax(0,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);min-width:0}
.card-title{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}
.card-title h3,.card h3{margin:0;font-size:calc(var(--heading-size) - 9px)}
.help{color:var(--muted);font-size:calc(var(--body-size) - 1px);line-height:1.5}
.field{display:flex;flex-direction:column;gap:6px}.field.full{grid-column:1/-1}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
label{font-weight:800;color:#354156;font-size:calc(var(--body-size) - 1px)}
.actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:15px}
.btn{border:0;border-radius:9px;padding:10px 13px;font-weight:800;transition:.17s}
.btn:hover{transform:translateY(-1px)}
.btn.primary{background:var(--button-active-bg);color:var(--button-active-text)}
.btn.primary:hover{background:var(--button-hover-bg);color:var(--button-hover-text)}
.btn.secondary{background:#e8edf3;color:#263346}
.btn.shade{background:var(--secondary);color:#fff}
.btn.success{background:var(--success);color:#fff}
.btn.danger{background:#fee4e6;color:#9f202a}
.btn.ghost{background:#fff;border:1px solid var(--line);color:#334155}
.btn.small{padding:7px 9px;font-size:12px}
.btn:disabled{
  cursor:not-allowed;
  opacity:.48;
  transform:none!important
}
.pill,.badge{
  display:inline-flex;align-items:center;justify-content:center;border-radius:999px;
  padding:5px 9px;font-size:11px;font-weight:900;white-space:nowrap
}
.pill{background:color-mix(in srgb,var(--secondary) 15%,#fff);color:var(--primary)}
.badge.draft,.badge.unpaid,.badge.active{background:#e9eef5;color:#43536a}
.badge.approved,.badge.ready,.badge.sent{background:#e1ecff;color:#2459a9}
.badge.paid,.badge.completed{background:#dcfce7;color:#146c3b}
.badge.partial{background:#fff0c9;color:#875400}
.badge.overdue,.badge.void,.badge.cancelled{background:#fee2e2;color:#a5222b}
.badge.archived{background:#eceef1;color:#596273}
.metric{background:#fff;border:1px solid var(--line);border-radius:14px;padding:17px;box-shadow:var(--shadow)}
.metric-head{display:flex;justify-content:space-between;gap:10px;align-items:center}
.metric small{color:var(--muted);font-weight:700}.metric strong{display:block;margin-top:8px;font-size:25px;color:var(--primary)}
.metric-icon{
  width:var(--dashboard-icon-box,50px);
  height:var(--dashboard-icon-box,50px);
  flex:0 0 var(--dashboard-icon-box,50px);
  border-radius:13px;display:grid;place-items:center;
  background:color-mix(in srgb,var(--secondary) 14%,#fff);color:var(--primary);
  transition:width .18s ease,height .18s ease,transform .18s ease
}
.metric:hover .metric-icon{transform:translateY(-1px)}
.metric-icon svg{
  width:var(--dashboard-icon-svg,28px);
  height:var(--dashboard-icon-svg,28px);
  fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round
}
.notice{
  border-left:4px solid var(--secondary);background:color-mix(in srgb,var(--secondary) 10%,#fff);
  border-radius:9px;padding:11px 13px;color:#405069;font-size:13px
}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:11px;background:#fff}
table{width:100%;border-collapse:collapse;min-width:850px}
th,td{padding:10px 11px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top;font-size:13px}
th{background:#f6f8fa;color:#4c5a6e;white-space:nowrap;position:sticky;top:0;z-index:2}
tbody tr:hover{background:#fbfcfd}
.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:13px}
.filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.filters input{max-width:280px}.filters select{max-width:180px}
.empty{text-align:center;color:var(--muted);padding:30px}
.section-switch{display:flex;gap:7px;background:#edf1f5;border-radius:10px;padding:4px}
.switch-btn{border:0;background:transparent;border-radius:8px;padding:8px 11px;font-weight:800;color:#5a687b}
.switch-btn.active{background:#fff;color:var(--primary);box-shadow:0 2px 8px rgba(15,23,42,.08)}
.activity-list{display:grid;gap:9px}.activity{
  border-left:3px solid var(--secondary);padding:8px 10px;background:#f8fafc;border-radius:0 9px 9px 0
}
.activity strong{display:block;font-size:13px}.activity small{color:var(--muted)}
.status-bars{display:grid;gap:10px}.status-bar-row{display:grid;grid-template-columns:95px 1fr 40px;gap:9px;align-items:center}
.status-track{height:9px;background:#e8edf2;border-radius:999px;overflow:hidden}.status-fill{height:100%;background:var(--secondary);border-radius:999px}
.storage-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.storage-item{
  background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:11px
}.storage-item small{display:block;color:var(--muted)}.storage-item strong{display:block;margin-top:4px}
.draft-state{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:12px}.draft-dot{width:8px;height:8px;border-radius:50%;background:#94a3b8}
.draft-state.saved .draft-dot{background:var(--success)}
.calc-panel{
  background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 70%,var(--secondary)));
  border-radius:14px;color:#fff;padding:18px;position:sticky;top:18px
}
.calc-panel small{color:rgba(255,255,255,.72)}.calc-panel strong{display:block;font-size:31px;margin:7px 0 15px}
.calc-row{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-top:1px solid rgba(255,255,255,.14)}
.palette-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.palette{
  position:relative;border:1px solid var(--line);border-radius:13px;background:#fff;
  padding:0;overflow:hidden;text-align:left;min-height:105px;transition:.18s
}
.palette:hover{transform:translateY(-2px);box-shadow:0 9px 20px rgba(15,23,42,.09)}
.palette.active{border-color:var(--secondary);box-shadow:0 0 0 3px color-mix(in srgb,var(--secondary) 16%,transparent)}
.palette-colors{display:grid;grid-template-columns:repeat(4,1fr);height:42px}.palette-content{padding:10px 11px;display:flex;justify-content:space-between;gap:8px}
.palette-name{font-weight:900;font-size:12px}.palette-meta{display:block;color:var(--muted);font-size:10px;margin-top:3px}
.palette-check{width:23px;height:23px;border-radius:50%;display:grid;place-items:center;background:#f1f5f9;color:transparent}
.palette.active .palette-check{background:var(--secondary);color:#fff}.palette-default{
  position:absolute;right:7px;top:7px;border-radius:999px;padding:3px 6px;background:rgba(255,255,255,.92);font-size:8px;font-weight:900
}
.brand-preview{border-radius:15px;padding:20px;color:#fff;min-height:190px;background:linear-gradient(135deg,var(--primary),var(--secondary))}
.brand-preview h2{margin:7px 0 5px}.brand-line{width:90px;height:5px;background:var(--accent);border-radius:999px}
.custom-grid,.type-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.color-control{border:1px solid var(--line);border-radius:10px;padding:8px;background:#fbfcfd}.color-row{display:grid;grid-template-columns:40px 1fr;gap:7px}
.color-row input[type=color]{height:37px;padding:2px}.hex{font-family:monospace;text-transform:uppercase;font-weight:800}
.hex.invalid{border-color:var(--danger)}
.type-panel{border:1px solid var(--line);border-radius:12px;padding:12px;background:#fbfcfd}.type-panel h4{margin:0 0 10px}
.type-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.type-preview{border:1px solid var(--line);border-radius:12px;padding:15px;background:#f9fbfc}
.logo-preview{width:76px;height:76px;border:1px dashed #96a2b3;border-radius:11px;display:grid;place-items:center;overflow:hidden;background:#f8fafc}
.logo-preview img{width:100%;height:100%;object-fit:contain}
.invoice-shell{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}
.invoice-paper{background:#fff;border:1px solid #d8dee6;box-shadow:0 12px 38px rgba(15,23,42,.1);min-height:850px}
.invoice-band{background:var(--primary);color:#fff;text-align:center;padding:16px;font-family:var(--heading-font);font-size:25px;font-weight:var(--heading-weight)}
.invoice-top{display:grid;grid-template-columns:190px 1fr 270px;min-height:190px}
.invoice-logo{
  display:grid;place-items:center;padding:7px;background:#fff;border-right:2px solid var(--primary);overflow:hidden
}
.invoice-logo img{
  display:block;
  width:auto;
  height:auto;
  max-width:165px;
  max-height:155px;
  object-fit:contain;
  object-position:center;
  margin:auto
}
.invoice-logo .fallback{width:88px;height:88px;border-radius:20px;background:var(--primary);color:#fff;display:grid;place-items:center;font-size:27px;font-weight:900}
.invoice-agent,.invoice-meta,.invoice-bill,.invoice-referral-details,.payment-box{padding:17px}
.invoice-agent{background:color-mix(in srgb,var(--secondary) 9%,#fff)}
.invoice-subhead{margin:-17px -17px 12px;padding:9px 12px;background:var(--secondary);color:#fff;font-family:var(--heading-font);font-weight:var(--heading-weight)}
.invoice-meta-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:11px}
.invoice-party-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  border-top:3px solid #fff;
  border-bottom:1px solid var(--line)
}
.invoice-bill{min-width:0}
.invoice-referral-details{
  min-width:0;
  background:#fbfcfd
}
.invoice-referral-row{
  display:grid;
  grid-template-columns:120px minmax(0,1fr);
  gap:10px;
  align-items:start;
  padding:5px 0;
  border-bottom:1px solid #edf1f5
}
.invoice-referral-row:last-child{border-bottom:0}
.invoice-referral-label{color:var(--muted);font-weight:700}
.invoice-referral-value{font-weight:800;color:var(--text);overflow-wrap:anywhere}
.invoice-items{min-width:0;border:0;border-radius:0}
.invoice-items th{
  background:var(--primary);
  color:#fff;
  text-align:center
}
.invoice-items td{
  text-align:center;
  vertical-align:middle
}
.invoice-total{display:flex;justify-content:flex-end;padding:24px 17px}.total-box{width:330px}.total-line{display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px solid var(--line)}
.total-line.grand{font-size:19px;color:var(--primary);font-weight:900;border-top:3px solid var(--primary)}
.payment-box{margin:0 17px 20px;background:color-mix(in srgb,var(--secondary) 9%,#fff)}
.invoice-controls{position:sticky;top:18px}
.invoice-email-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:12px}
.invoice-email-actions .btn{width:100%}
.invoice-pdf-status{display:flex;gap:9px;align-items:flex-start}
.invoice-pdf-status .pdf-icon{width:30px;height:30px;min-width:30px;border-radius:9px;display:grid;place-items:center;background:color-mix(in srgb,var(--primary) 10%,#fff);color:var(--primary);font-weight:900}
.email-history-box{margin-top:14px;padding-top:13px;border-top:1px solid var(--line)}
.email-history-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.email-history-head h4{margin:0}
.email-history-list{display:grid;gap:7px}
.email-history-item{padding:9px 10px;border:1px solid var(--line);border-radius:10px;background:#fbfcfd}
.email-history-item strong{display:block;font-size:12px}
.email-history-item small{display:block;color:var(--muted);margin-top:3px;line-height:1.35}
.email-history-item .sent{color:var(--success)}
.email-history-item .failed{color:var(--danger)}
.email-preview-card{width:min(760px,100%)}
.email-preview-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding-bottom:13px;border-bottom:1px solid var(--line)}
.email-preview-head h2{margin:0 0 4px}.email-preview-head p{margin:0;color:var(--muted)}
.email-preview-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.email-preview-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}
.email-preview-stat{padding:10px;border:1px solid var(--line);border-radius:10px;background:#fbfcfd}
.email-preview-stat small{display:block;color:var(--muted)}.email-preview-stat strong{display:block;margin-top:3px}
.email-attachment-card{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;padding:12px;border:1px solid color-mix(in srgb,var(--primary) 25%,var(--line));border-radius:12px;background:color-mix(in srgb,var(--primary) 5%,#fff)}
.email-attachment-main{display:flex;gap:10px;align-items:center;min-width:0}.email-attachment-icon{width:38px;height:38px;min-width:38px;border-radius:10px;background:var(--primary);color:#fff;display:grid;place-items:center;font-weight:900}
.email-attachment-meta{min-width:0}.email-attachment-meta strong,.email-attachment-meta small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.email-attachment-meta small{color:var(--muted);margin-top:3px}
.email-send-status{margin-top:11px;display:none}.email-send-status.show{display:block}
#emailPreviewModal{z-index:12000}
#emailPreviewModal .modal-card{position:relative;z-index:12001}
.email-preview-actions{
  position:sticky;
  bottom:-19px;
  z-index:12005;
  margin:14px -19px -19px;
  padding:14px 19px 16px;
  background:#fff;
  border-top:1px solid var(--line)
}
.email-preview-actions .btn{pointer-events:auto}
#emailPreviewCancel{pointer-events:auto!important}
#emailPreviewRetry[hidden]{display:none!important}
#emailPreviewRetry:not([hidden]){display:inline-flex}
body > .html2pdf__overlay,
body > .html2pdf__container,
body > iframe.html2canvas-container{
  pointer-events:none!important
}
.invoice-pdf-stage{position:fixed;left:-12000px;top:0;width:780px;background:#fff;z-index:-50;pointer-events:none}
.invoice-pdf-stage .invoice-paper{width:780px;border:0;box-shadow:none;min-height:0;background:#fff}
.invoice-pdf-stage .watermark-draft{display:none!important}
.invoice-pdf-stage .invoice-top{grid-template-columns:180px 1fr 220px;min-height:180px}
.invoice-pdf-stage .invoice-logo{padding:5px;background:#fff}
.invoice-pdf-stage .invoice-logo img{
  display:block!important;
  width:auto!important;
  height:auto!important;
  max-width:170px!important;
  max-height:145px!important;
  object-fit:contain!important;
  object-position:center!important;
  margin:auto!important
}
.invoice-pdf-stage .invoice-agent,.invoice-pdf-stage .invoice-meta,.invoice-pdf-stage .invoice-bill,.invoice-pdf-stage .invoice-referral-details,.invoice-pdf-stage .payment-box{padding:12px}
.invoice-pdf-stage .invoice-subhead{margin:-12px -12px 9px}
.invoice-pdf-stage .invoice-party-row{grid-template-columns:1fr 1fr}
.invoice-pdf-stage .invoice-referral-details{border-top:0}
.invoice-pdf-stage .invoice-referral-row{grid-template-columns:105px minmax(0,1fr);padding:4px 0}
.invoice-pdf-stage .invoice-total{padding:18px 12px}.invoice-pdf-stage .payment-box{margin:0 12px 12px}
@media(max-width:560px){.invoice-email-actions,.email-preview-grid,.email-preview-summary{grid-template-columns:1fr}}
.watermark{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;overflow:hidden}
.watermark span{transform:rotate(-32deg);font-size:80px;font-weight:900;color:rgba(190,40,50,.09);text-transform:uppercase}
.invoice-paper{position:relative;overflow:hidden}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.56);display:none;align-items:center;justify-content:center;padding:18px;z-index:100}
.modal.open{display:flex}.modal-card{width:min(680px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:16px;padding:19px;box-shadow:0 25px 70px rgba(0,0,0,.25)}
@media(max-width:1200px){.grid.four{grid-template-columns:repeat(2,1fr)}.invoice-shell{grid-template-columns:1fr}.invoice-controls{position:static}}
@media(max-width:980px){.app{grid-template-columns:1fr}.sidebar{position:static;height:auto}.nav{display:grid;grid-template-columns:repeat(2,1fr)}.sidebar-foot{display:none}.main{padding:18px}.invoice-top{grid-template-columns:160px 1fr 240px}}
@media(max-width:800px){.grid.two,.grid.three,.form-grid,.custom-grid,.type-grid{grid-template-columns:1fr}.field.full{grid-column:auto}.palette-grid{grid-template-columns:repeat(2,1fr)}.invoice-top{grid-template-columns:1fr}.invoice-logo{border-right:0;border-bottom:2px solid var(--primary)}.invoice-party-row{grid-template-columns:1fr}.invoice-referral-details{border-top:1px solid var(--line)}}
@media(max-width:560px){.nav{grid-template-columns:1fr}.grid.four{grid-template-columns:1fr}.palette-grid{grid-template-columns:1fr}.topbar{display:block}.top-actions{justify-content:flex-start;margin-top:12px}.main{padding:11px}.storage-grid,.type-controls{grid-template-columns:1fr}}
@media print{
  @page{size:letter portrait;margin:.25in}

  html,body{
    margin:0!important;padding:0!important;width:100%!important;height:auto!important;min-height:0!important;
    background:#fff!important;overflow:visible!important
  }
  body.invoice-native-print{background:#fff!important}
  body.invoice-native-print > :not(#appShell){display:none!important}
  body.invoice-native-print #appShell{display:block!important;width:100%!important;min-height:0!important}
  body.invoice-native-print #appShell > .sidebar{display:none!important}
  body.invoice-native-print #appShell > .main{display:block!important;width:100%!important;min-height:0!important;margin:0!important;padding:0!important}
  body.invoice-native-print #appShell > .main > :not(#invoice){display:none!important}
  body.invoice-native-print #invoice{display:block!important;width:100%!important;margin:0!important;padding:0!important}
  body.invoice-native-print #invoice .invoice-shell{display:block!important;width:100%!important;margin:0!important;padding:0!important}
  body.invoice-native-print #invoice .invoice-controls{display:none!important}

  body.invoice-native-print #invoicePaper{
    display:block!important;position:static!important;left:auto!important;top:auto!important;
    width:100%!important;max-width:none!important;min-height:0!important;margin:0!important;
    border:0!important;box-shadow:none!important;overflow:visible!important;background:#fff!important;
    -webkit-print-color-adjust:exact!important;print-color-adjust:exact!important
  }
  body.invoice-native-print #invoicePaper *,
  body.invoice-native-print #invoicePaper *::before,
  body.invoice-native-print #invoicePaper *::after{
    -webkit-print-color-adjust:exact!important;print-color-adjust:exact!important
  }
  body.invoice-native-print .watermark-draft{display:none!important}
  body.invoice-native-print .invoice-band{padding:12px}
  body.invoice-native-print .invoice-top{grid-template-columns:180px 1fr 220px;min-height:180px}
  body.invoice-native-print .invoice-logo{padding:5px;background:#fff}
  body.invoice-native-print .invoice-logo img{
    display:block;width:auto;height:auto;max-width:170px;max-height:145px;
    object-fit:contain;object-position:center;margin:auto
  }
  body.invoice-native-print .invoice-agent,
  body.invoice-native-print .invoice-meta,
  body.invoice-native-print .invoice-bill,
  body.invoice-native-print .invoice-referral-details,
  body.invoice-native-print .payment-box{padding:12px}
  body.invoice-native-print .invoice-subhead{margin:-12px -12px 9px}
  body.invoice-native-print .invoice-party-row{grid-template-columns:1fr 1fr}
  body.invoice-native-print .invoice-referral-details{border-top:0}
  body.invoice-native-print .invoice-referral-row{grid-template-columns:105px minmax(0,1fr);padding:4px 0}
  body.invoice-native-print .invoice-total{padding:18px 12px}
  body.invoice-native-print .payment-box{margin:0 12px 12px}
  body.invoice-native-print .invoice-top,
  body.invoice-native-print .invoice-party-row,
  body.invoice-native-print .invoice-items thead,
  body.invoice-native-print .invoice-items tr,
  body.invoice-native-print .invoice-total{break-inside:avoid;page-break-inside:avoid}
}

body.security-locked .app{display:none}
.security-gate{
  position:fixed;inset:0;z-index:500;display:none;align-items:center;justify-content:center;
  padding:20px;background:
    radial-gradient(circle at top left,color-mix(in srgb,var(--secondary) 24%,transparent),transparent 38%),
    linear-gradient(145deg,#111827,#1f2937 58%,#111827);color:#fff
}
.security-gate.open{display:flex}
.security-panel{
  width:min(510px,100%);max-height:94vh;overflow:auto;border-radius:21px;padding:25px;
  background:rgba(255,255,255,.97);color:var(--text);box-shadow:0 30px 90px rgba(0,0,0,.38);
  border:1px solid rgba(255,255,255,.35)
}
.security-brand{display:flex;align-items:center;gap:13px;margin-bottom:21px}
.security-logo{
  width:54px;height:54px;border-radius:16px;display:grid;place-items:center;
  background:linear-gradient(135deg,var(--primary),var(--secondary));color:#fff;
  font-family:var(--heading-font);font-size:21px;font-weight:900
}
.security-brand h2{margin:0 0 3px;font-size:24px}.security-brand p{margin:0;color:var(--muted)}
.security-view{display:none}.security-view.active{display:block}
.security-view h3{margin:0 0 7px}.security-view>p{margin:0 0 16px;color:var(--muted)}
.security-message{
  display:none;margin:12px 0;border-radius:9px;padding:10px 11px;font-size:13px;
  background:#fee2e2;color:#9f202a
}
.security-message.show{display:block}
.security-message.success{background:#dcfce7;color:#146c3b}
.security-actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:16px}
.security-actions .btn{flex:1}
.security-link{border:0;background:none;color:var(--info);font-weight:800;padding:7px 0}
.security-note{
  margin-top:14px;padding:11px;border-radius:10px;background:#f3f6f9;color:#56647a;
  font-size:12px;line-height:1.55
}
.security-code{
  padding:14px;border:1px dashed var(--secondary);border-radius:11px;background:#f8fafc;
  font-family:Consolas,"Courier New",monospace;font-size:18px;font-weight:900;
  letter-spacing:.08em;text-align:center;word-break:break-word;color:var(--primary)
}
.password-wrap{position:relative}.password-wrap input{padding-right:72px}
.password-toggle{
  position:absolute;right:7px;top:50%;transform:translateY(-50%);
  border:0;background:#eef2f6;color:#445168;border-radius:7px;padding:5px 8px;font-size:11px;font-weight:800
}
.strength-track{height:6px;border-radius:999px;background:#e6ebf1;overflow:hidden;margin-top:7px}
.strength-fill{height:100%;width:0;background:var(--danger);transition:.2s}
.security-status-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}
.security-status-item{border:1px solid var(--line);background:#f8fafc;border-radius:10px;padding:10px}
.security-status-item small{display:block;color:var(--muted)}.security-status-item strong{display:block;margin-top:4px;font-size:13px}
.security-settings-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px}
.security-box{border:1px solid var(--line);border-radius:12px;padding:13px;background:#fbfcfd}
.security-box h4{margin:0 0 10px}.security-box .form-grid{gap:9px}
.lock-indicator{display:inline-flex;align-items:center;gap:6px}
.lock-indicator:before{content:"";width:8px;height:8px;border-radius:50%;background:var(--success)}
.secret-modal-input{margin-top:11px}
.modal-card.compact{width:min(460px,100%)}
.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:15px}
@media(max-width:850px){
  .security-status-grid{grid-template-columns:repeat(2,1fr)}
  .security-settings-grid{grid-template-columns:1fr}
}
@media(max-width:520px){
  .security-panel{padding:18px}.security-status-grid{grid-template-columns:1fr}
}


.nav-btn[data-tab="security"]{
  margin-top:4px
}


.partner-profile-modal .modal-card{
  width:min(980px,100%);
  padding:0;
  overflow:hidden
}
.partner-profile-head{
  display:flex;align-items:center;justify-content:space-between;gap:18px;
  padding:22px 24px;
  color:#fff;
  background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 68%,var(--secondary)))
}
.partner-profile-identity{display:flex;align-items:center;gap:14px;min-width:0}
.partner-avatar{
  width:58px;height:58px;min-width:58px;border-radius:17px;
  display:grid;place-items:center;background:var(--secondary);color:#fff;
  font-family:var(--heading-font);font-size:20px;font-weight:900
}
.partner-profile-head h2{margin:0 0 4px;font-size:24px}
.partner-profile-head p{margin:0;color:rgba(255,255,255,.72)}
.partner-modal-close{
  width:36px;height:36px;border:0;border-radius:10px;
  background:rgba(255,255,255,.14);color:#fff;font-size:22px;line-height:1
}
.partner-modal-close:hover{background:rgba(255,255,255,.24)}
.partner-profile-body{padding:20px;max-height:calc(92vh - 105px);overflow:auto}
.partner-profile-metrics{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px;margin-bottom:15px
}
.partner-profile-metric{
  border:1px solid var(--line);border-radius:11px;padding:11px;background:#f8fafc
}
.partner-profile-metric small{display:block;color:var(--muted);font-weight:700}
.partner-profile-metric strong{display:block;margin-top:5px;color:var(--primary);font-size:17px}
.partner-profile-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px
}
.partner-detail-card{
  border:1px solid var(--line);border-radius:12px;padding:14px;background:#fff
}
.partner-detail-card.full{grid-column:1/-1}
.partner-detail-card h4{margin:0 0 11px;font-size:15px}
.partner-detail-list{display:grid;gap:8px}
.partner-detail-row{
  display:grid;grid-template-columns:130px minmax(0,1fr);gap:10px;
  padding-bottom:8px;border-bottom:1px solid #edf1f5
}
.partner-detail-row:last-child{border-bottom:0;padding-bottom:0}
.partner-detail-row span:first-child{color:var(--muted);font-weight:700}
.partner-detail-row span:last-child{font-weight:700;overflow-wrap:anywhere}
.partner-notes{
  min-height:58px;padding:10px;border-radius:9px;background:#f8fafc;
  color:#445168;white-space:pre-wrap
}
.partner-history-title{
  display:flex;align-items:center;justify-content:space-between;gap:10px;margin:18px 0 9px
}
.partner-history-title h4{margin:0}
.partner-profile-actions{
  position:sticky;bottom:-20px;margin:18px -20px -20px;padding:13px 20px;
  display:flex;justify-content:flex-end;gap:9px;flex-wrap:wrap;
  border-top:1px solid var(--line);background:rgba(255,255,255,.97);
  backdrop-filter:blur(8px)
}
.partner-action-group{display:flex;gap:5px;flex-wrap:wrap}
@media(max-width:850px){
  .partner-profile-metrics{grid-template-columns:repeat(2,1fr)}
  .partner-profile-grid{grid-template-columns:1fr}
  .partner-detail-card.full{grid-column:auto}
}
@media(max-width:560px){
  .partner-profile-head{padding:17px}
  .partner-profile-body{padding:13px}
  .partner-profile-metrics{grid-template-columns:1fr 1fr}
  .partner-detail-row{grid-template-columns:1fr;gap:3px}
  .partner-profile-actions{margin:15px -13px -13px;bottom:-13px;padding:11px 13px}
}


.payment-builder{
  grid-column:1/-1;
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background:#fbfcfd
}
.payment-builder-head{
  display:flex;justify-content:space-between;align-items:flex-start;gap:12px;
  padding:13px 14px;border-bottom:1px solid var(--line);background:#fff
}
.payment-builder-head h4{margin:0 0 4px}
.rich-toolbar{
  display:flex;align-items:center;gap:5px;flex-wrap:wrap;
  padding:9px;border-bottom:1px solid var(--line);background:#f4f7fa
}
.toolbar-group{
  display:flex;align-items:center;gap:4px;padding-right:7px;margin-right:2px;
  border-right:1px solid #d8dee7
}
.toolbar-group:last-child{border-right:0;padding-right:0}
.editor-tool{
  min-width:31px;height:31px;border:1px solid #d6dde6;border-radius:7px;
  background:#fff;color:#334155;font-size:12px;font-weight:900;padding:0 8px
}
.editor-tool:hover{border-color:var(--secondary);color:var(--primary);background:#fff}
.editor-tool.wide{min-width:auto}
.payment-editor{
  min-height:190px;max-height:390px;overflow:auto;padding:15px;background:#fff;
  outline:none;line-height:1.55
}
.payment-editor:focus{
  box-shadow:inset 0 0 0 3px color-mix(in srgb,var(--secondary) 18%,transparent)
}
.payment-editor:empty:before{
  content:attr(data-placeholder);color:#94a3b8;pointer-events:none
}
.payment-editor p:first-child{margin-top:0}
.payment-editor .payment-highlight,
.payment-rich-content .payment-highlight{
  border-left:4px solid var(--accent);
  background:color-mix(in srgb,var(--accent) 10%,#fff);
  border-radius:8px;padding:9px 11px;margin:9px 0
}
.payment-builder-options{
  display:grid;grid-template-columns:1fr;gap:9px;
  padding:12px;border-top:1px solid var(--line);background:#f8fafc
}
.payment-check{
  display:flex;align-items:flex-start;gap:8px;padding:9px;
  border:1px solid var(--line);border-radius:9px;background:#fff
}
.payment-check input{width:auto;margin-top:3px}
.payment-live-preview{
  grid-column:1/-1;border-top:1px solid var(--line);padding:13px;background:#eef2f6
}
.payment-live-preview h4{margin:0 0 9px}
.payment-preview-paper{
  background:#fff;border:1px solid #d7dde5;border-radius:10px;padding:15px;
  box-shadow:0 5px 18px rgba(15,23,42,.05)
}
.payment-rich{
  margin:0 17px 20px;
  padding:17px;
  border:1px solid color-mix(in srgb,var(--secondary) 35%,var(--line));
  border-radius:10px;
  background:color-mix(in srgb,var(--secondary) 9%,#fff)
}
.payment-rich.payment-no-border{border-color:transparent}
.payment-rich.payment-no-highlight{background:#fff}
.payment-rich.payment-keep-together{break-inside:avoid;page-break-inside:avoid}
.payment-rich-heading{
  margin:-17px -17px 13px;padding:9px 12px;
  background:var(--secondary);color:#fff;
  font-family:var(--heading-font);font-weight:var(--heading-weight)
}
.payment-rich.payment-no-border .payment-rich-heading{margin-top:-16px}
.payment-rich-content{overflow-wrap:anywhere}
.payment-rich-content p{margin:0 0 9px}
.payment-rich-content p:last-child{margin-bottom:0}
.payment-rich-content ul,.payment-rich-content ol{margin:7px 0 9px;padding-left:24px}
.payment-rich-content hr{border:0;border-top:1px solid color-mix(in srgb,var(--secondary) 45%,var(--line));margin:12px 0}
.payment-rich-content a{color:var(--info);text-decoration:underline;font-weight:700}
.payment-size-small{font-size:.86em}.payment-size-normal{font-size:1em}.payment-size-large{font-size:1.2em}
.builder-status{font-size:11px;color:var(--muted);font-weight:800}
@media(max-width:1050px){
  .payment-builder-options{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:620px){
  .payment-builder-options{grid-template-columns:1fr}
  .toolbar-group{border-right:0;padding-right:0}
}
@media print{
  .payment-rich{break-inside:avoid;page-break-inside:avoid}
}


.app-dialog{
  position:fixed;inset:0;z-index:700;display:none;align-items:center;justify-content:center;
  padding:20px;background:rgba(15,23,42,.58);backdrop-filter:blur(4px)
}
.app-dialog.open{display:flex}
.app-dialog-card{
  width:min(500px,100%);border-radius:18px;overflow:hidden;background:#fff;
  border:1px solid color-mix(in srgb,var(--secondary) 35%,#d8dee6);
  box-shadow:0 28px 80px rgba(15,23,42,.28)
}
.app-dialog-head{
  display:flex;align-items:center;gap:12px;padding:17px 18px;
  background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 75%,var(--secondary)));
  color:#fff
}
.app-dialog-icon{
  width:38px;height:38px;min-width:38px;border-radius:11px;display:grid;place-items:center;
  background:rgba(255,255,255,.14);font-size:19px;font-weight:900
}
.app-dialog-head h3{margin:0;font-size:18px}
.app-dialog-body{padding:18px}
.app-dialog-message{color:#475569;line-height:1.6;white-space:pre-line}
.app-dialog-input{margin-top:13px}
.app-dialog-input textarea{min-height:95px}
.app-dialog-actions{
  display:flex;justify-content:flex-end;gap:9px;flex-wrap:wrap;
  padding:14px 18px;border-top:1px solid var(--line);background:#f8fafc
}
.app-dialog-card.dialog-success .app-dialog-head{background:linear-gradient(135deg,#16734a,#1c8f5c)}
.app-dialog-card.dialog-warning .app-dialog-head{background:linear-gradient(135deg,#9a5a00,#c17b16)}
.app-dialog-card.dialog-danger .app-dialog-head{background:linear-gradient(135deg,#9e2430,#c43b46)}
.app-dialog-card.dialog-info .app-dialog-head{background:linear-gradient(135deg,var(--primary),var(--secondary))}
.app-dialog-card.dialog-confirm .app-dialog-head{background:linear-gradient(135deg,var(--primary),var(--secondary))}
.app-dialog-card.dialog-input .app-dialog-head{background:linear-gradient(135deg,var(--primary),var(--secondary))}
.app-dialog-card.dialog-danger .dialog-confirm-btn{background:var(--danger);color:#fff}
.app-dialog-card.dialog-warning .dialog-confirm-btn{background:var(--warning);color:#fff}
.app-dialog-card.dialog-success .dialog-confirm-btn{background:var(--success);color:#fff}
.app-dialog-card.dialog-info .dialog-confirm-btn,
.app-dialog-card.dialog-confirm .dialog-confirm-btn,
.app-dialog-card.dialog-input .dialog-confirm-btn{
  background:var(--button-active-bg);color:var(--button-active-text)
}
.app-dialog-actions .btn:hover{background:var(--button-hover-bg);color:var(--button-hover-text)}


/* ===== Phase 1: Agent Account + Data Protection ===== */
.account-gate{
  position:fixed;inset:0;z-index:25000;display:flex;align-items:center;justify-content:center;
  padding:22px;background:
    radial-gradient(circle at top left,color-mix(in srgb,var(--secondary) 22%,transparent),transparent 38%),
    linear-gradient(145deg,#101827,#1c2738 58%,#101827);color:#fff
}
.account-gate.hidden{display:none}
.account-panel{
  width:min(520px,100%);background:#fff;color:var(--text);border-radius:22px;overflow:hidden;
  border:1px solid rgba(255,255,255,.14);box-shadow:0 32px 90px rgba(0,0,0,.34)
}
.account-head{
  padding:22px;background:linear-gradient(135deg,var(--primary),var(--secondary));color:#fff;
  display:flex;align-items:center;gap:13px
}
.account-head .account-logo{
  width:48px;height:48px;border-radius:14px;background:#fff;color:var(--primary);
  display:grid;place-items:center;font-weight:950;font-size:18px
}
.account-head h2{margin:0 0 3px}.account-head p{margin:0;color:rgba(255,255,255,.78);font-size:13px}
.account-body{padding:22px}.account-view{display:none}.account-view.active{display:block}
.account-body h3{margin:0 0 6px}.account-body .help{margin-bottom:16px}
.account-message{
  display:none;margin-top:12px;padding:11px 12px;border-radius:10px;
  background:#fff1f2;color:#9f1239;border:1px solid #fecdd3;font-weight:700;font-size:13px
}
.account-message.show{display:block}.account-message.success{background:#ecfdf3;color:#166534;border-color:#bbf7d0}
.account-note{margin-top:15px;padding:12px;border-radius:10px;background:#f7f8fa;color:#64748b;font-size:12px;line-height:1.55}
.account-loading{padding:24px;text-align:center;font-weight:800;color:#64748b}
.agent-account-strip{
  margin-top:10px;padding:10px;border-radius:10px;background:rgba(255,255,255,.08);font-size:11px
}
.agent-account-strip strong{display:block;color:#fff;font-size:12px;margin-bottom:2px}
.sidebar-account-actions{display:flex;gap:6px;margin-top:8px}
.sidebar-account-actions .btn{padding:6px 8px;font-size:10px}
/* v32.6.3: role visibility uses the HTML hidden attribute + authenticated policy.
   No global .agent-only display override is allowed because it can conflict
   with role rendering and Dashboard visibility controls. */

.protection-hero{
  background:linear-gradient(135deg,var(--primary),var(--secondary));color:#fff;
  border-radius:18px;padding:20px;display:flex;justify-content:space-between;gap:16px;align-items:center
}
.protection-hero h2{margin:0 0 5px}.protection-hero p{margin:0;color:rgba(255,255,255,.78)}
.protection-status-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px}
.protection-stat{background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px}
.protection-stat small{display:block;color:var(--muted);font-weight:800;margin-bottom:6px}
.protection-stat strong{display:block;font-size:17px;overflow-wrap:anywhere}
.protection-good{color:var(--success)}.protection-warn{color:#a16207}.protection-bad{color:var(--danger)}
.backup-history{display:flex;flex-direction:column;gap:9px}
.backup-history-item{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;
  border:1px solid var(--line);border-radius:11px;padding:11px;background:#fff
}
.backup-history-item strong{display:block}.backup-history-item small{display:block;color:var(--muted);margin-top:3px}
.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid var(--line);border-radius:11px}
.toggle-switch{display:flex;align-items:center;gap:8px;font-weight:800}
.agent-table .status-active{color:var(--success);font-weight:900}
.agent-table .status-disabled{color:var(--danger);font-weight:900}
.restore-vault-collapsible{
  margin-top:14px;
  text-align:left
}
.restore-vault-toggle{
  width:auto!important;
  min-width:0!important;
  border:1px solid var(--line);
  background:#f8fafc;
  color:var(--primary);
  border-radius:8px;
  padding:7px 10px;
  font-size:11px;
  font-weight:850;
  cursor:pointer;
  line-height:1.25
}
.restore-vault-toggle:hover{
  background:#eef3f7;
  border-color:#cbd5e1
}
.restore-vault-toggle[aria-expanded="true"]{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff
}
.cloud-restore-box{
  margin-top:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f8fafc;
  color:var(--text)
}
.cloud-restore-box[hidden]{display:none!important}
.cloud-restore-box h4{
  margin:0 0 5px;
  color:var(--primary)
}
.cloud-restore-box p{
  margin:0 0 10px;
  color:var(--muted);
  font-size:12px;
  line-height:1.5
}
.cloud-restore-box label{color:var(--text)}
.cloud-restore-box input,
.cloud-restore-box select{
  background:#fff;
  color:var(--text)
}
.cloud-restore-box .security-message{
  color:#9f202a
}
.cloud-restore-box .security-message.success{
  color:#146c3b
}
@media(max-width:900px){
  .protection-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
  .protection-status-grid{grid-template-columns:1fr}
  .backup-history-item{grid-template-columns:1fr}
}


/* ===== v31.5 checkbox alignment + secure branded sidebar block ===== */
.invite-whitelist-option{
  text-align:left !important;
}
.invite-whitelist-option label{
  display:flex !important;
  align-items:flex-start !important;
  justify-content:flex-start !important;
  text-align:left !important;
  width:100%;
  gap:10px;
}
.invite-whitelist-option input[type="checkbox"]{
  width:auto !important;
  min-width:auto !important;
  max-width:none !important;
  height:auto !important;
  flex:0 0 auto !important;
  margin:3px 0 0 0 !important;
}
.invite-whitelist-option small{
  display:block;
  text-align:left !important;
  margin:6px 0 0 28px;
}

/* Secure branded footer block */
.sidebar-security-brand{
  margin-top:10px;
  display:block;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  text-align:left;
}
.sidebar-security-title{
  display:flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
  margin-bottom:5px;
}
.sidebar-security-icon{
  width:22px;
  height:22px;
  flex:0 0 22px;
  display:grid;
  place-items:center;
  color:#fff;
  opacity:.95;
}
.sidebar-security-title strong{
  display:block;
  font-size:11px;
  line-height:1.25;
  color:#fff;
}
.sidebar-security-copy span{
  display:block;
  font-size:9px;
  line-height:1.45;
  color:rgba(255,255,255,.78);
}
.sidebar-security-copy span + span{margin-top:2px}


/* ===== v31.6 Data Protection Hardening ===== */
.integrity-badge{
  display:inline-flex;align-items:center;gap:5px;
  padding:4px 8px;border-radius:999px;font-size:10px;font-weight:900;
  white-space:nowrap
}
.integrity-verified{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.integrity-failed{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.integrity-unknown{background:#f1f5f9;color:#475569;border:1px solid #dbe3ec}
.backup-health-notice{
  margin-top:14px;padding:12px 14px;border-radius:11px;border:1px solid var(--line);
  background:#f8fafc;line-height:1.5
}
.backup-health-notice.good{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.backup-health-notice.warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.backup-health-notice.bad{background:#fff1f2;border-color:#fecdd3;color:#9f1239}
.backup-history-meta{display:flex;flex-wrap:wrap;gap:7px;align-items:center;margin-top:5px}
.backup-history-meta small{margin:0}
.restore-method-tabs{
  display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:14px 0
}
.restore-method-btn{
  border:1px solid var(--line);background:#f8fafc;color:var(--text);
  border-radius:10px;padding:11px 10px;font-weight:900;cursor:pointer;text-align:center
}
.restore-method-btn.active{
  background:var(--primary);border-color:var(--primary);color:#fff
}
.restore-safety-note{
  margin:12px 0;padding:10px 11px;border-radius:9px;background:#f8fafc;
  border:1px solid var(--line);font-size:12px;color:var(--muted);line-height:1.5
}
.backup-restore-modal{z-index:18000}
.backup-restore-modal .modal-card{max-width:500px}
@media(max-width:600px){
  .restore-method-tabs{grid-template-columns:1fr}
}


/* ===== v31.6.2 Invoice Branding refinement ===== */
.branding-settings-section{padding:2px 0}
.branding-settings-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px}
.branding-settings-heading h4{margin:0 0 3px;font-size:15px}
.branding-settings-divider{height:1px;background:var(--line);margin:22px 0}


/* ===== v31.7 Agent Password Recovery ===== */
.account-link-row{
  display:flex;align-items:center;justify-content:flex-end;margin-top:7px
}
.account-link{
  border:0;background:none;padding:4px 0;color:var(--info);font-weight:850;
  font-size:12px;cursor:pointer
}
.account-link:hover{text-decoration:underline}
.account-recovery-separator{
  height:1px;background:var(--line);margin:15px 0
}
.account-recovery-status{
  margin:12px 0;padding:11px 12px;border-radius:10px;background:#f8fafc;
  border:1px solid var(--line);font-size:12px;line-height:1.5;color:var(--muted)
}
.account-recovery-status strong{color:var(--text)}
.account-actions-split{
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap
}


/* ===== v31.7.2 Global Dashboard Appearance ===== */
.dashboard-appearance-card .card-title{align-items:flex-start}
.dashboard-appearance-toolbar{
  display:grid;grid-template-columns:minmax(210px,280px) 1fr;gap:16px;align-items:end
}
.dashboard-icon-admin-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px
}
.dashboard-icon-admin-item{
  border:1px solid var(--line);border-radius:12px;padding:12px;background:#fbfcfd
}
.dashboard-icon-admin-item label{
  display:block;margin-bottom:7px;font-size:12px;font-weight:850;color:#475569
}
.dashboard-icon-admin-preview{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px
}
.dashboard-icon-preview-item{
  display:flex;align-items:center;gap:10px;min-width:0;
  border:1px solid var(--line);border-radius:11px;padding:10px;background:#fff
}
.dashboard-icon-preview-item .metric-icon{margin-left:auto}
.dashboard-icon-preview-item span:first-child{
  min-width:0;font-size:11px;font-weight:800;color:#526176;line-height:1.35
}
.dashboard-appearance-message{
  margin-top:12px;padding:10px 12px;border-radius:10px;
  background:#f8fafc;border:1px solid var(--line);font-size:12px;color:var(--muted)
}
.dashboard-appearance-message.success{
  background:#ecfdf3;border-color:#bbf7d0;color:#166534
}
.dashboard-appearance-message.error{
  background:#fff1f2;border-color:#fecdd3;color:#9f1239
}
@media(max-width:1000px){
  .dashboard-icon-admin-grid,.dashboard-icon-admin-preview{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:620px){
  .dashboard-appearance-toolbar{grid-template-columns:1fr}
  .dashboard-icon-admin-grid,.dashboard-icon-admin-preview{grid-template-columns:1fr}
}


/* ===== v31.7.4 Conditional Custom Branding Controls ===== */
.custom-branding-settings{
  max-height:5000px;opacity:1;transform:translateY(0);overflow:visible;
  transition:max-height .28s ease,opacity .22s ease,transform .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease;
}
.custom-branding-settings.is-hidden{
  max-height:0!important;opacity:0;transform:translateY(-6px);overflow:hidden;
  margin-top:0!important;padding-top:0!important;padding-bottom:0!important;
  border-width:0!important;pointer-events:none;
}


/* ===== v31.7.5 Master Directory Category Management ===== */
#manageMasterCategories{display:none}
body.agent-admin #manageMasterCategories{display:inline-flex}
.category-manager-modal{
  position:fixed;inset:0;z-index:1350;display:none;align-items:center;justify-content:center;
  padding:24px;background:rgba(15,23,42,.58);backdrop-filter:blur(3px)
}
.category-manager-modal.open{display:flex}
.category-manager-card{
  width:min(920px,100%);max-height:min(760px,92vh);display:flex;flex-direction:column;
  background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 28px 80px rgba(15,23,42,.3);overflow:hidden
}
.category-manager-head{
  display:flex;justify-content:space-between;gap:18px;align-items:flex-start;
  padding:20px 22px;border-bottom:1px solid var(--line);background:#fbfcfd
}
.category-manager-head h3{margin:0 0 4px}
.category-manager-close{
  width:36px;height:36px;border:0;border-radius:10px;background:#eef2f6;color:#475569;
  font-size:24px;line-height:1;cursor:pointer
}
.category-manager-close:hover{background:#e2e8f0;color:#0f172a}
.category-manager-body{padding:20px 22px;overflow:auto}
.category-add-panel{
  border:1px solid var(--line);border-radius:13px;padding:14px;background:#f8fafc
}
.category-manager-message{min-height:18px;margin-top:8px;font-size:12px;color:var(--muted)}
.category-manager-message.success{color:#166534}
.category-manager-message.error{color:#9f1239}
.category-manager-columns{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px
}
.category-list-panel{border:1px solid var(--line);border-radius:13px;background:#fff;overflow:hidden}
.category-list-heading{
  display:flex;justify-content:space-between;align-items:center;gap:12px;padding:13px 14px;
  background:#f8fafc;border-bottom:1px solid var(--line)
}
.category-list{display:grid;gap:0}
.category-item{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:11px 14px;border-bottom:1px solid var(--line)
}
.category-item:last-child{border-bottom:0}
.category-item-name{min-width:0}
.category-item-name strong{display:block;font-size:13px;overflow-wrap:anywhere}
.category-item-name small{display:block;color:var(--muted);margin-top:2px}
.category-lock{
  flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:5px 8px;border-radius:999px;
  background:#eef2f6;color:#64748b;font-size:10px;font-weight:850;text-transform:uppercase;letter-spacing:.04em
}
.category-actions{display:flex;gap:6px;flex:0 0 auto}
.category-actions .btn{padding:6px 9px;font-size:11px}
.category-manager-empty{padding:22px;text-align:center;color:var(--muted);font-size:12px}
.category-manager-foot{
  display:flex;justify-content:space-between;gap:15px;align-items:center;
  padding:14px 22px;border-top:1px solid var(--line);background:#fbfcfd
}
@media(max-width:720px){
  .category-manager-columns{grid-template-columns:1fr}
  .category-manager-foot{align-items:flex-start;flex-direction:column}
}


/* ===== v31.7.6 Admin Master Directory Entries ===== */
#addMasterDirectoryEntry{display:none}
body.agent-admin #addMasterDirectoryEntry{display:inline-flex}
.master-admin-col{display:none}
body.agent-admin th.master-admin-col,
body.agent-admin td.master-admin-col{display:table-cell}
.master-entry-source{
  display:inline-flex;align-items:center;margin-left:7px;padding:3px 7px;border-radius:999px;
  background:color-mix(in srgb,var(--secondary) 12%,#fff);color:var(--primary);
  font-size:9px;font-weight:900;text-transform:uppercase;letter-spacing:.04em;vertical-align:middle
}
.master-system-lock{font-size:11px;color:var(--muted);font-weight:800}
.master-entry-modal{
  position:fixed;inset:0;z-index:1360;display:none;align-items:center;justify-content:center;
  padding:24px;background:rgba(15,23,42,.58);backdrop-filter:blur(3px)
}
.master-entry-modal.open{display:flex}
.master-entry-card{
  width:min(720px,100%);max-height:min(820px,92vh);display:flex;flex-direction:column;
  background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 28px 80px rgba(15,23,42,.3);overflow:hidden
}
.master-entry-head{
  display:flex;justify-content:space-between;gap:18px;align-items:flex-start;
  padding:20px 22px;border-bottom:1px solid var(--line);background:#fbfcfd
}
.master-entry-head h3{margin:0 0 4px}
.master-entry-close{
  width:36px;height:36px;border:0;border-radius:10px;background:#eef2f6;color:#475569;
  font-size:24px;line-height:1;cursor:pointer
}
.master-entry-close:hover{background:#e2e8f0;color:#0f172a}
.master-entry-body{padding:20px 22px;overflow:auto}
.master-entry-message{min-height:18px;margin-top:10px;font-size:12px;color:var(--muted)}
.master-entry-message.success{color:#166534}
.master-entry-message.error{color:#9f1239}
.master-entry-foot{
  display:flex;justify-content:flex-end;gap:9px;padding:14px 22px;
  border-top:1px solid var(--line);background:#fbfcfd
}


/* ===== v31.7.8 Agent Category Suggestions + Admin Approval ===== */
.master-suggestion-callout{
  display:flex;align-items:center;justify-content:space-between;gap:20px;
  margin-bottom:16px;padding:17px 18px;border:1px solid color-mix(in srgb,var(--secondary) 38%,#dbe4ee);
  border-radius:14px;background:linear-gradient(135deg,color-mix(in srgb,var(--secondary) 8%,#fff),#fff);
  box-shadow:0 7px 22px rgba(15,23,42,.05)
}
.master-suggestion-copy{display:flex;flex-direction:column;gap:4px;min-width:0}
.master-suggestion-copy strong{font-size:15px;color:#1e293b}
.master-suggestion-copy span{font-size:12px;color:var(--muted);line-height:1.45}
.master-pending-panel{
  display:none;margin-bottom:16px;border:1px solid #f2c96d;border-radius:14px;background:#fffdf5;
  box-shadow:0 7px 22px rgba(120,78,0,.06);overflow:hidden
}
body.agent-admin .master-pending-panel{display:block}
.master-pending-head{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:15px 17px;border-bottom:1px solid #f4dfaa;background:#fff8df
}
.master-pending-head h3{margin:0 0 3px}
.master-pending-actions{display:flex;align-items:center;gap:8px}
.master-pending-list{display:grid}
.master-pending-item{
  display:grid;grid-template-columns:minmax(180px,.85fr) minmax(0,1.6fr) auto;
  gap:16px;align-items:center;padding:14px 17px;border-bottom:1px solid #f5ead0
}
.master-pending-item:last-child{border-bottom:0}
.master-pending-agent strong,.master-pending-details strong{display:block}
.master-pending-agent small,.master-pending-details small{display:block;color:var(--muted);margin-top:3px}
.master-pending-fields{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;margin-top:7px
}
.master-pending-field{font-size:11px;color:#475569}
.master-pending-field b{color:#1e293b}
.master-pending-buttons{display:flex;gap:7px;justify-content:flex-end;flex-wrap:wrap}
.master-suggested-badge{
  position:relative;display:inline-flex;align-items:center;margin-left:7px;padding:3px 7px;border-radius:999px;
  background:#eaf5ff;color:#15548d;font-size:9px;font-weight:900;text-transform:uppercase;
  letter-spacing:.04em;vertical-align:middle;cursor:help
}
.master-suggested-badge:hover::after{
  content:attr(data-tooltip);position:absolute;z-index:30;left:50%;bottom:calc(100% + 7px);
  transform:translateX(-50%);white-space:nowrap;padding:6px 8px;border-radius:7px;background:#0f172a;color:#fff;
  font-size:10px;font-weight:700;text-transform:none;letter-spacing:0;box-shadow:0 8px 20px rgba(15,23,42,.2)
}
.master-suggested-badge:hover::before{
  content:"";position:absolute;left:50%;bottom:calc(100% + 2px);transform:translateX(-50%);
  border:5px solid transparent;border-top-color:#0f172a
}
@media(max-width:800px){
  .master-suggestion-callout,.master-pending-head{align-items:flex-start;flex-direction:column}
  .master-pending-item{grid-template-columns:1fr}
  .master-pending-buttons{justify-content:flex-start}
}


/* ===== v31.7.13 Welcome Email Automation ===== */
.invite-welcome-option{
  margin-top:10px;padding:12px 13px;border:1px solid color-mix(in srgb,var(--secondary) 34%,#dbe4ee);
  border-radius:11px;background:color-mix(in srgb,var(--secondary) 7%,#fff);
  text-align:left!important
}
.invite-welcome-option label{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  gap:10px;
  width:100%;
  margin:0;
  font-weight:850;
  color:#243247;
  text-align:left!important;
  line-height:1.45
}
.invite-welcome-option input[type="checkbox"]{
  width:auto!important;
  min-width:auto!important;
  max-width:none!important;
  height:auto!important;
  flex:0 0 auto!important;
  margin:3px 0 0 0!important;
  padding:0!important;
  vertical-align:top!important
}
.invite-welcome-option small{
  display:block;
  margin:6px 0 0 28px;
  color:var(--muted);
  line-height:1.45;
  text-align:left!important
}
.welcome-template-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(340px,.85fr);gap:20px;align-items:start}
.welcome-template-variables{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin-top:12px;padding:10px 11px;background:#f8fafc;border:1px solid var(--line);border-radius:10px;font-size:11px}
.welcome-template-variables code{padding:4px 6px;border-radius:6px;background:#eaf0f6;color:#19324a;font-weight:850}
.welcome-email-preview{background:#eef2f5;border:1px solid var(--line);border-radius:14px;padding:16px;min-height:440px}
.welcome-preview-shell{max-width:570px;margin:auto;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 10px 26px rgba(15,23,42,.09)}
.welcome-preview-top{background:#193a54;color:#fff;padding:22px 24px;border-bottom:5px solid #b6923d}
.welcome-preview-brand{font-weight:900;font-size:19px;line-height:1.05}
.welcome-preview-brand small{display:block;margin-top:5px;font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:#d9e4ec}
.welcome-preview-body{padding:25px 24px;color:#263648;font-size:13px;line-height:1.65}
.welcome-preview-kicker{display:inline-block;padding:5px 8px;border-radius:999px;background:#f5edd7;color:#8a691d;font-size:9px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}
.welcome-preview-body h2{margin:12px 0 10px;color:#193a54;font-size:23px}
.welcome-preview-cta{display:inline-block;margin:8px 0 18px;padding:11px 15px;border-radius:8px;background:#193a54;color:#fff;font-weight:900}
.welcome-preview-closing{padding:13px 14px;border-radius:9px;background:#f7f9fb;border-left:4px solid #b6923d}
.welcome-preview-footer{padding:15px 24px;background:#f5f7f9;color:#68778a;font-size:9px;line-height:1.6;text-align:center;border-top:1px solid #e2e8ef}
.welcome-status{display:inline-flex;padding:4px 7px;border-radius:999px;font-size:10px;font-weight:900}
.welcome-status.scheduled{background:#dcfce7;color:#166534}
.welcome-status.error{background:#fee2e2;color:#991b1b}
.welcome-status.off{background:#eef2f6;color:#64748b}
@media(max-width:980px){.welcome-template-grid{grid-template-columns:1fr}}


/* ===== v31.8.3 Category Visibility Controls ===== */
.category-visibility-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin:0 0 14px;padding:12px 13px;border:1px solid var(--line);border-radius:11px;background:#f8fafc}
.category-visibility-summary{display:flex;flex-wrap:wrap;gap:8px}
.category-status-summary{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border-radius:999px;font-size:11px;font-weight:850;border:1px solid var(--line);background:#fff}
.category-status-summary.enabled{color:#166534;background:#ecfdf3;border-color:#bbf7d0}
.category-status-summary.disabled{color:#64748b;background:#f1f5f9;border-color:#dbe3ec}
.category-status-filter-field{margin:0!important;min-width:180px}
.category-item.category-disabled{background:#f8fafc;opacity:.82}
.category-item-status{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border-radius:999px;font-size:10px;font-weight:900;white-space:nowrap}
.category-item-status.enabled{background:#dcfce7;border:1px solid #bbf7d0;color:#166534}
.category-item-status.disabled{background:#e2e8f0;border:1px solid #cbd5e1;color:#475569}
.category-actions{flex-wrap:wrap;justify-content:flex-end}
.category-visibility-btn{min-width:72px}
.category-disabled-note{color:#64748b!important;font-weight:750}
@media(max-width:650px){.category-visibility-toolbar{align-items:stretch;flex-direction:column}.category-status-filter-field{min-width:0}}


/* ===== v31.8.4 Branded dialog stacking fix =====
   Confirmation/warning dialogs must always appear above management modals. */
.app-dialog{
  z-index:30000!important
}
.app-dialog.open,
.app-dialog[aria-hidden="false"]{
  z-index:30000!important
}
.app-dialog-card{
  position:relative;
  z-index:30001
}


/* ===== v31.9 Master Directory Full Administration ===== */
.category-manager-card-wide{width:min(1040px,94vw)}
.category-list-panel-full{width:100%}
.category-status-summary.archived{color:#7c2d12;background:#fff7ed;border-color:#fed7aa}
.category-origin-badge,.master-entry-status-badge{
 display:inline-flex;align-items:center;padding:3px 7px;border-radius:999px;
 font-size:9px;font-weight:900;letter-spacing:.02em;margin-left:6px;vertical-align:middle
}
.category-origin-badge{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.master-entry-status-badge.enabled{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.master-entry-status-badge.disabled{background:#e2e8f0;color:#475569;border:1px solid #cbd5e1}
.master-entry-status-badge.archived{background:#ffedd5;color:#9a3412;border:1px solid #fed7aa}
.master-entry-status-badge.inherited{background:#fef3c7;color:#92400e;border:1px solid #fde68a}
.master-entry-origin-info{
 display:none;margin:0 0 12px;padding:9px 11px;border-radius:9px;
 border:1px solid var(--line);background:#f8fafc;font-size:11px;color:var(--muted)
}
.master-entry-origin-info.show{display:block}
.category-item-v319{
 display:grid;grid-template-columns:minmax(210px,1fr) 90px 105px minmax(280px,auto);
 align-items:center;gap:10px;padding:11px 12px;border-bottom:1px solid var(--line)
}
.category-item-v319:last-child{border-bottom:0}
.category-item-v319.archived{background:#fffaf5;opacity:.86}
.category-v319-meta small{display:block;color:var(--muted);margin-top:3px}
.category-v319-order{text-align:center;font-weight:800}
.category-v319-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.master-row-disabled{opacity:.68;background:#f8fafc}
.master-row-archived{opacity:.62;background:#fff7ed}
@media(max-width:820px){
 .category-item-v319{grid-template-columns:1fr}
 .category-v319-order{text-align:left}
 .category-v319-actions{justify-content:flex-start}
}


/* ===== v31.10 Agent Account Administration ===== */
.agent-account-summary{display:flex;gap:7px;flex-wrap:wrap;margin:0 0 14px}
.agent-summary-chip{
 border:1px solid var(--line);background:#fff;color:var(--muted);border-radius:999px;
 padding:7px 10px;font-size:11px;font-weight:850;cursor:pointer
}
.agent-summary-chip strong{margin-left:4px;color:inherit}
.agent-summary-chip.active{background:var(--primary);border-color:var(--primary);color:#fff}
.agent-account-toolbar{display:flex;align-items:flex-end;gap:12px;margin:0 0 14px}
.agent-account-status{
 display:inline-flex;align-items:center;justify-content:center;border-radius:999px;
 padding:5px 9px;font-size:10px;font-weight:900;text-transform:capitalize;white-space:nowrap
}
.agent-account-status.active{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.agent-account-status.suspended{background:#fef3c7;color:#92400e;border:1px solid #fde68a}
.agent-account-status.disabled{background:#e2e8f0;color:#475569;border:1px solid #cbd5e1}
.agent-account-status.banned{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.agent-account-status.archived{background:#ffedd5;color:#9a3412;border:1px solid #fed7aa}
.agent-account-row-archived{opacity:.72;background:#fffaf5}
.agent-account-row-banned{background:#fff7f7}
.agent-account-row-suspended{background:#fffcf0}
.agent-manage-modal{
 position:fixed;inset:0;display:none;align-items:center;justify-content:center;
 padding:24px;background:rgba(15,23,42,.66);z-index:18000
}
.agent-manage-modal.open{display:flex}
.agent-manage-card{
 width:min(1120px,96vw);max-height:92vh;overflow:hidden;background:#fff;
 border-radius:16px;box-shadow:0 28px 80px rgba(15,23,42,.28);display:flex;flex-direction:column
}
.agent-manage-head,.agent-manage-foot{
 padding:17px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:14px
}
.agent-manage-foot{border-bottom:0;border-top:1px solid var(--line)}
.agent-manage-head h3{margin:0}
.agent-manage-close{
 border:0;background:transparent;font-size:28px;line-height:1;color:var(--muted);cursor:pointer
}
.agent-manage-body{padding:18px 20px;overflow:auto}
.agent-manage-overview{
 display:flex;align-items:center;justify-content:space-between;gap:16px;
 padding:13px 14px;margin-bottom:15px;border:1px solid var(--line);
 border-radius:12px;background:#f8fafc
}
.agent-account-identity{display:flex;flex-direction:column;gap:3px}
.agent-account-identity>div{display:flex;align-items:center;gap:7px}
.agent-account-identity>span{font-size:12px;color:var(--muted)}
.agent-manage-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.agent-manage-section{
 border:1px solid var(--line);border-radius:12px;padding:14px;background:#fff
}
.agent-manage-section-full{grid-column:1/-1}
.agent-manage-section-title{display:flex;justify-content:space-between;gap:10px;margin-bottom:11px}
.agent-manage-section-title h4{margin:0 0 3px}
.agent-status-email-option{
 display:flex;align-items:center;gap:8px;margin:10px 0;font-size:12px;font-weight:750;color:var(--muted)
}
.agent-status-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.agent-history-list{display:flex;flex-direction:column;gap:8px;max-height:340px;overflow:auto}
.agent-history-item{
 display:grid;grid-template-columns:145px minmax(180px,1fr) minmax(200px,2fr);
 gap:10px;padding:10px 11px;border:1px solid var(--line);border-radius:9px;background:#f8fafc
}
.agent-history-item strong{font-size:11px}
.agent-history-item small{color:var(--muted);line-height:1.45}
.agent-history-event{font-weight:850;font-size:11px}
.managed-suspension-options{margin-top:8px;padding:10px;border:1px solid #fde68a;border-radius:9px;background:#fffbeb}
@media(max-width:850px){
 .agent-account-toolbar{flex-direction:column;align-items:stretch}
 .agent-manage-grid{grid-template-columns:1fr}
 .agent-manage-section-full{grid-column:auto}
 .agent-history-item{grid-template-columns:1fr}
}



/* ===== v32.2 database-first compatibility additions ===== */
[hidden]{display:none!important}
.database-pill{background:#ecfdf3!important;color:#166534!important;border-color:#bbf7d0!important}
.success-notice{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.future-card{min-height:240px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center}
.future-card p{max-width:720px;color:var(--muted);line-height:1.65}
.roadmap-list{margin-top:12px}.roadmap-list>div{display:flex;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}.roadmap-list strong{min-width:60px}.roadmap-list span{color:var(--muted)}
.nav-icon{display:grid;place-items:center;font-size:16px;font-weight:900}
.category-list-row-v32{display:grid;grid-template-columns:minmax(200px,1fr) 90px 105px minmax(260px,auto);align-items:center;gap:10px;padding:11px 12px;border-bottom:1px solid var(--line)}
.category-list-row-v32:last-child{border-bottom:0}.category-list-row-v32 small{display:block;color:var(--muted);margin-top:3px}.category-list-row-v32 .actions{justify-content:flex-end;flex-wrap:wrap}
.partner-status{display:inline-flex;padding:4px 7px;border-radius:999px;font-size:9px;font-weight:900}.partner-status.active{background:#dcfce7;color:#166534}.partner-status.archived{background:#ffedd5;color:#9a3412}
.agent-db-status{display:inline-flex;padding:4px 7px;border-radius:999px;font-size:9px;font-weight:900;text-transform:capitalize}.agent-db-status.active{background:#dcfce7;color:#166534}.agent-db-status.suspended{background:#fef3c7;color:#92400e}.agent-db-status.disabled{background:#e2e8f0;color:#475569}.agent-db-status.banned{background:#fee2e2;color:#991b1b}.agent-db-status.archived{background:#ffedd5;color:#9a3412}
.history-item-v32{padding:9px 0;border-bottom:1px solid var(--line)}.history-item-v32 strong{display:block;font-size:11px}.history-item-v32 small{color:var(--muted)}
.logo-preview img{width:100%;height:100%;object-fit:contain;border-radius:inherit}
.palette-card.active{outline:3px solid color-mix(in srgb,var(--secondary) 35%,transparent);outline-offset:2px}
.palette-card.custom-palette{border-style:dashed}
body.appearance-compact .card{padding:14px}body.appearance-compact .main{padding:20px}body.appearance-compact .grid{gap:12px}
body.appearance-spacious .card{padding:24px}body.appearance-spacious .main{padding:32px}body.appearance-spacious .grid{gap:22px}
@media(max-width:820px){.category-list-row-v32{grid-template-columns:1fr}.category-list-row-v32 .actions{justify-content:flex-start}}


/* ===== v32.2.4 Authentication Gate Stabilization =====
   The approved LIVE account gate uses .hidden as its closed state. */
.account-gate.hidden{display:none!important}
.account-view{display:none}
.account-view.active{display:block}


/* ===== v32.3 Database Referral Form + Referral Records ===== */
.referral-workspace{grid-template-columns:minmax(0,1fr) 330px}
.badge.pending{background:#fff0c9;color:#875400}
.badge.invoiced{background:#e1ecff;color:#2459a9}
.referral-record-toolbar{align-items:flex-start;gap:14px}
.referral-record-filters{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;max-width:100%}
.referral-record-filters input,.referral-record-filters select{min-width:135px}
.referral-record-filters #recordSearch{min-width:200px}
.referral-action-group{display:flex;flex-wrap:wrap;gap:6px;min-width:300px}
.archived-row{opacity:.76;background:#fafbfc}
.referral-detail-card{width:min(980px,94vw)}
.referral-detail-section{border:1px solid var(--line);border-radius:12px;padding:14px;background:#fff}
.referral-detail-section.full{grid-column:1/-1}
.referral-detail-section h4{margin:0 0 10px;color:var(--primary)}
.referral-detail-line{display:flex;justify-content:space-between;gap:14px;padding:8px 0;border-bottom:1px solid var(--line);font-size:12px}
.referral-detail-line:last-child{border-bottom:0}
.referral-detail-line span{color:var(--muted)}
.referral-detail-line strong{text-align:right;overflow-wrap:anywhere}
.referral-long-text{white-space:pre-wrap;line-height:1.6;color:#405069;font-size:13px;overflow-wrap:anywhere}
#referralMessage.account-message.show{margin:12px 0}
@media(max-width:1050px){
 .referral-workspace{grid-template-columns:1fr}
 .referral-record-filters{justify-content:flex-start}
}
@media(max-width:720px){
 .referral-record-filters{flex-direction:column;width:100%}
 .referral-record-filters input,.referral-record-filters select,.referral-record-filters button{width:100%;min-width:0}
 .referral-detail-section.full{grid-column:auto}
}


/* ===== v32.4 Database Invoice + Payments + PDF + Email ===== */
.payment-workspace{grid-template-columns:390px minmax(0,1fr)}
.payment-other-method{display:grid;gap:6px;margin-top:4px;padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:#f8fafc}
.payment-other-method[hidden]{display:none}
.payment-other-method .help{font-size:11px;line-height:1.4}
.invoice-main-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.invoice-main-actions .btn{flex:1 1 95px}
#invoiceRecordFilters.hidden,#referralRecordFilters.hidden{display:none!important}
#invoiceRecordsView.hidden,#referralRecordsView.hidden{display:none!important}
#emailPreviewStatus.show{display:block}
#voidInvoiceMessage.show,#paymentMessage.show{margin-top:12px}
.invoice-paper .badge{vertical-align:middle}
.invoice-paper .payment-box p:first-child{margin-top:0}
.invoice-paper .payment-box p:last-child{margin-bottom:0}
.invoice-paper .payment-box ul,.invoice-paper .payment-box ol{margin:8px 0 8px 20px;padding:0}
.invoice-paper .payment-box{line-height:1.55}
@media(max-width:1050px){
 .invoice-shell{grid-template-columns:1fr}
 .invoice-controls{position:static}
 .payment-workspace{grid-template-columns:1fr}
}


/* ===== v32.4.1 Email Service Administration ===== */
.email-service-card{position:relative}
.email-service-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
#emailServiceStatus.email-service-ok{background:#e7f7ee;color:#157347;border-color:#b8e3c8}
#emailServiceStatus.email-service-off{background:#fff4df;color:#8a5a00;border-color:#ecd39e}
#emailServiceKeyState{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
#emailServiceMessage.show{margin-top:12px}


/* ===== v32.4.2 Professional Email Templates + Notification Branding ===== */
.email-template-hero{
 display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;
 border-radius:16px;background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 66%,var(--secondary)));
 color:#fff;box-shadow:var(--shadow)
}
.email-template-hero h2{margin:0 0 6px;color:#fff}.email-template-hero p{margin:0;max-width:760px;color:rgba(255,255,255,.82);line-height:1.55}
.email-template-hero-badges{display:flex;flex-wrap:wrap;gap:7px;justify-content:flex-end}
.email-template-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
.email-template-workspace{display:grid;grid-template-columns:220px minmax(340px,.9fr) minmax(390px,1.1fr);gap:16px;align-items:start}
.email-template-list{display:grid;gap:8px;align-content:start}
.email-template-list-item{
 width:100%;display:grid;grid-template-columns:42px minmax(0,1fr);gap:10px;align-items:center;text-align:left;
 border:1px solid var(--line);border-radius:12px;padding:10px;background:#fff;color:var(--text);cursor:pointer
}
.email-template-list-item:hover{border-color:color-mix(in srgb,var(--primary) 38%,var(--line));background:color-mix(in srgb,var(--primary) 3%,#fff)}
.email-template-list-item.active{border-color:var(--primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--primary) 12%,transparent);background:color-mix(in srgb,var(--primary) 5%,#fff)}
.email-template-list-icon{
 width:42px;height:42px;border-radius:11px;display:grid;place-items:center;background:color-mix(in srgb,var(--primary) 9%,#fff);
 color:var(--primary);font-size:10px;font-weight:900;letter-spacing:.04em
}
.email-template-list-item strong,.email-template-list-item small{display:block;overflow:hidden;text-overflow:ellipsis}
.email-template-list-item strong{font-size:12px}.email-template-list-item small{margin-top:3px;color:var(--muted);font-size:10px;white-space:normal;line-height:1.35}
.email-template-editor{min-width:0;padding:0 2px}
.email-template-editor-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}
.email-template-editor-head h3{margin:0 0 3px}
.email-template-toggle{
 display:flex;align-items:center;gap:7px;white-space:nowrap;padding:7px 9px;border:1px solid var(--line);border-radius:9px;background:#f8fafc;
 font-size:11px;font-weight:800;color:var(--text);cursor:pointer
}
.email-template-toggle input{width:auto}
.email-template-variables{margin-top:13px;padding:12px;border:1px solid var(--line);border-radius:11px;background:#fafbfd}
.email-template-variables>strong{display:block;margin-bottom:8px;font-size:11px}
.email-variable-list{display:flex;flex-wrap:wrap;gap:6px}
.email-variable-chip{
 display:flex;align-items:center;gap:6px;border:1px solid #d6dfeb;background:#fff;border-radius:8px;padding:6px 8px;cursor:pointer;text-align:left
}
.email-variable-chip:hover{border-color:var(--primary)}
.email-variable-chip code{font-size:10px;font-weight:900;color:var(--primary)}
.email-variable-chip span{font-size:9px;color:var(--muted)}
.email-template-test-row{margin-top:13px;padding-top:13px;border-top:1px solid var(--line)}
.email-template-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:12px}
#emailTemplateDirtyState.email-template-dirty{background:#fff0c9;color:#875400;border-color:#f1d690}
#emailTemplateDirtyState.email-template-saved{background:#e7f7ee;color:#157347;border-color:#b8e3c8}
.email-template-preview-panel{min-width:0;position:sticky;top:18px}
.email-preview-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:9px}
.email-preview-toolbar>div:first-child strong,.email-preview-toolbar>div:first-child small{display:block}
.email-preview-toolbar>div:first-child strong{font-size:11px;color:var(--text)}
.email-preview-toolbar>div:first-child small{margin-top:3px;color:var(--muted);font-size:10px;line-height:1.35;overflow-wrap:anywhere}
.email-template-preview-frame-wrap{
 margin:0 auto 8px;background:#dfe5ec;border:1px solid #ced7e3;border-radius:14px;padding:10px;
 transition:max-width .2s ease,width .2s ease
}
.email-template-preview-frame-wrap.desktop{width:100%;max-width:720px}
.email-template-preview-frame-wrap.mobile{width:390px;max-width:100%}
.email-template-preview-frame-wrap iframe{display:block;width:100%;height:760px;border:0;border-radius:9px;background:#f3f5f8}
.email-compatibility-card .storage-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:1380px){
 .email-template-workspace{grid-template-columns:190px minmax(330px,1fr)}
 .email-template-preview-panel{grid-column:1/-1;position:static}
 .email-template-preview-frame-wrap.desktop{max-width:760px}
}
@media(max-width:900px){
 .email-template-hero{align-items:flex-start;flex-direction:column}
 .email-template-hero-badges{justify-content:flex-start}
 .email-template-workspace{grid-template-columns:1fr}
 .email-template-list{grid-template-columns:repeat(2,minmax(0,1fr))}
 .email-template-preview-panel{grid-column:auto}
}
@media(max-width:560px){
 .email-template-list{grid-template-columns:1fr}
 .email-template-editor-head{flex-direction:column}
 .email-template-toggle{white-space:normal}
 .email-template-preview-frame-wrap{padding:5px}
 .email-template-preview-frame-wrap iframe{height:690px}
 .email-compatibility-card .storage-grid{grid-template-columns:1fr}
}


/* ===== v32.5 Reporting + Server Data Protection ===== */
.reports-hero{
 display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;border-radius:16px;
 background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 66%,var(--secondary)));color:#fff;box-shadow:var(--shadow)
}
.reports-hero h2{margin:0 0 6px;color:#fff}.reports-hero p{margin:0;color:rgba(255,255,255,.82);line-height:1.55;max-width:800px}
.reports-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
.reports-filter-card{padding:16px 18px}.reports-filters{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.reports-filters select,.reports-filters input{min-width:140px}.report-period-label{margin-top:9px;font-size:11px;color:var(--muted);font-weight:800}
.reports-metric-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.reports-chart-grid>.card{min-width:0}
.report-bar-list{display:grid;gap:12px}.report-bar-list.compact{gap:9px}
.report-bar-row{display:grid;gap:6px}.report-bar-label{display:flex;justify-content:space-between;gap:12px;align-items:center;font-size:11px}
.report-bar-label span{color:var(--text);font-weight:700}.report-bar-label strong{font-size:10px;color:var(--muted);text-align:right}
.report-bar-track{height:9px;border-radius:999px;background:#edf1f5;overflow:hidden}
.report-bar-track i{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,var(--primary),var(--secondary));min-width:3px}
.report-trend-chart{display:grid;gap:13px;max-height:520px;overflow:auto;padding-right:3px}
.trend-month{display:grid;grid-template-columns:62px minmax(0,1fr);gap:10px;align-items:start}
.trend-label{font-size:10px;font-weight:900;color:var(--muted);padding-top:3px}
.trend-bars{display:grid;gap:6px}.trend-bars>div{display:grid;grid-template-columns:58px minmax(70px,1fr) 78px;gap:7px;align-items:center}
.trend-bars small{font-size:9px;color:var(--muted)}.trend-bars span{height:7px;background:#edf1f5;border-radius:999px;overflow:hidden}
.trend-bars span i{display:block;height:100%;background:linear-gradient(90deg,var(--primary),var(--secondary));border-radius:999px}
.trend-bars b{font-size:9px;text-align:right;color:var(--text)}
.dashboard-insight-grid .card{min-height:260px}.dashboard-list{display:grid;gap:8px}
.dashboard-list-item{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:#fafbfd}
.dashboard-list-item span{min-width:0}.dashboard-list-item strong,.dashboard-list-item small{display:block}
.dashboard-list-item strong{font-size:11px}.dashboard-list-item small{font-size:9px;color:var(--muted);margin-top:3px;overflow-wrap:anywhere}
.dashboard-list-item b{font-size:11px;white-space:nowrap;color:var(--primary)}
.dashboard-list-button{width:100%;font:inherit;color:inherit;cursor:pointer;text-align:left}.dashboard-list-button:hover{border-color:var(--primary);background:#fff}
.restore-preview-panel{margin-top:17px;padding:16px;border:1px solid var(--line);border-radius:12px;background:#fafbfd}
.restore-preview-panel.hidden{display:none!important}
.restore-card input[type=file]{background:#fff}
#backupHistoryBody .badge.expired,#backupHistoryBody .badge.deleted{background:#eef1f4;color:#667085}
#backupHistoryBody .badge.complete{background:#e7f7ee;color:#157347}
#backupScheduleState.email-service-ok{background:#e7f7ee;color:#157347;border-color:#b8e3c8}
#backupCreateMessage.show,#backupPolicyMessage.show,#restoreValidateMessage.show,#restoreExecuteMessage.show{margin-top:12px}
@media(max-width:1250px){
 .reports-metric-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:900px){
 .reports-hero{align-items:flex-start;flex-direction:column}
 .reports-filters{justify-content:flex-start}
 .reports-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:560px){
 .reports-filters{display:grid;width:100%}.reports-filters select,.reports-filters input,.reports-filters button{width:100%;min-width:0}
 .reports-metric-grid{grid-template-columns:1fr}
 .trend-month{grid-template-columns:1fr}.trend-bars>div{grid-template-columns:50px minmax(60px,1fr) 70px}
}


/* ===== v32.6 Phase 1 Final Hardening + System Health ===== */
.health-hero{
 display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;border-radius:16px;
 background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 66%,var(--secondary)));color:#fff;box-shadow:var(--shadow)
}
.health-hero h2{margin:0 0 6px;color:#fff}.health-hero p{margin:0;color:rgba(255,255,255,.82);line-height:1.55;max-width:820px}
.health-hero-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.health-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
.health-pill.pass,.health-badge.pass{background:#e7f7ee;color:#157347;border-color:#b8e3c8}
.health-pill.warning,.health-badge.warning{background:#fff4df;color:#8a5a00;border-color:#ecd39e}
.health-pill.fail,.health-badge.fail{background:#feecec;color:#b4232d;border-color:#f4b9be}
.health-fail-notice{background:#fef2f2!important;border-color:#fecaca!important;color:#991b1b!important}
.health-check-list{display:grid;gap:15px}
.health-check-category{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.health-check-category h4{margin:0;padding:10px 12px;background:#f8fafc;border-bottom:1px solid var(--line);font-size:11px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.health-check-row{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 12px;border-bottom:1px solid #eef2f6}
.health-check-row:last-child{border-bottom:0}
.health-check-icon{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;font-weight:900;font-size:12px}
.health-check-row.pass .health-check-icon{background:#e7f7ee;color:#157347}
.health-check-row.warning .health-check-icon{background:#fff4df;color:#8a5a00}
.health-check-row.fail .health-check-icon{background:#feecec;color:#b4232d}
.health-check-copy{min-width:0}.health-check-copy strong,.health-check-copy small{display:block}
.health-check-copy strong{font-size:11px}.health-check-copy small{font-size:9px;color:var(--muted);line-height:1.5;margin-top:3px}
.health-check-result{display:flex;align-items:center;gap:7px;white-space:nowrap}.health-check-result b{font-size:9px;letter-spacing:.05em}
.health-check-row.pass .health-check-result b{color:#157347}.health-check-row.warning .health-check-result b{color:#8a5a00}.health-check-row.fail .health-check-result b{color:#b4232d}
.health-issue-count{font-size:9px;color:var(--muted);background:#f2f4f7;padding:4px 6px;border-radius:999px}
.health-activity-list{display:grid;gap:8px;max-height:520px;overflow:auto}
.health-activity-item{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:#fafbfd}
.health-activity-item>span{min-width:0}.health-activity-item strong,.health-activity-item small,.health-activity-item b{display:block}
.health-activity-item strong{font-size:10px;text-transform:capitalize}.health-activity-item small{font-size:9px;color:var(--muted);line-height:1.45;margin-top:3px}
.health-activity-item>span:last-child{text-align:right;flex:0 0 auto}.health-activity-item b{font-size:9px}
.health-baseline-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.health-baseline-grid>div{padding:12px;border:1px solid var(--line);border-radius:10px;background:#fafbfd}
.health-baseline-grid strong,.health-baseline-grid span{display:block}.health-baseline-grid strong{font-size:11px;color:var(--primary)}
.health-baseline-grid span{font-size:9px;color:var(--muted);line-height:1.5;margin-top:4px}
#healthRepairMessage.show{margin-top:12px}
@media(max-width:1000px){
 .health-baseline-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
 .health-hero{align-items:flex-start;flex-direction:column}.health-hero-actions{justify-content:flex-start}
 .health-check-row{grid-template-columns:30px minmax(0,1fr)}.health-check-result{grid-column:2;justify-content:flex-start}
 .health-baseline-grid{grid-template-columns:1fr}
}

/* ===== v32.6.1 Dashboard + Invoice Branding Polish ===== */
.agent-only[hidden],.admin-only[hidden]{display:none!important}
.platform-status-card{min-height:260px}
.platform-status-grid{display:grid;gap:9px}
.platform-status-row{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:9px;align-items:center;padding:12px 13px;border:1px solid var(--line);border-radius:11px;background:#fafbfd}
.platform-status-row strong{font-size:11px}.platform-status-row b{font-size:10px;text-align:right}.platform-status-dot{width:9px;height:9px;border-radius:50%;background:#94a3b8;box-shadow:0 0 0 4px rgba(148,163,184,.12)}
.platform-status-row.pass b{color:#157347}.platform-status-row.pass .platform-status-dot{background:#22a06b;box-shadow:0 0 0 4px rgba(34,160,107,.12)}
.platform-status-row.warning b,.platform-status-row.pending b{color:#9a6700}.platform-status-row.warning .platform-status-dot,.platform-status-row.pending .platform-status-dot{background:#d69e2e;box-shadow:0 0 0 4px rgba(214,158,46,.12)}
.platform-status-row.fail b{color:#b4232d}.platform-status-row.fail .platform-status-dot{background:#d64550;box-shadow:0 0 0 4px rgba(214,69,80,.12)}
.system-update-list{display:grid;gap:10px}.system-update-card{position:relative;border:1px solid var(--line);border-left-width:5px;border-radius:12px;padding:13px 14px;background:#fff;overflow:hidden}.system-update-card.general{border-left-color:#2f6fce;background:linear-gradient(90deg,rgba(47,111,206,.055),#fff 25%)}.system-update-card.success{border-left-color:#16834b;background:linear-gradient(90deg,rgba(22,131,75,.055),#fff 25%)}.system-update-card.alert{border-left-color:#b76b00;background:linear-gradient(90deg,rgba(183,107,0,.07),#fff 25%)}
.system-update-card h4{margin:8px 0 5px;font-size:13px}.system-update-card p{margin:0;color:var(--muted);font-size:10px;line-height:1.6;white-space:pre-wrap}.system-update-type{display:flex;align-items:center;gap:7px}.system-update-type>span{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;font-size:9px;font-weight:900}.system-update-type b{font-size:8px;letter-spacing:.07em}.system-update-type small{margin-left:auto;color:var(--muted);font-size:9px}.system-update-card.general .system-update-type>span{background:#e9f1fc;color:#2f6fce}.system-update-card.success .system-update-type>span{background:#e7f7ee;color:#16834b}.system-update-card.alert .system-update-type>span{background:#fff4df;color:#9a6700}
.system-update-admin-grid{align-items:start}.system-update-preview-label{font-size:9px;font-weight:900;letter-spacing:.08em;color:var(--muted);margin-bottom:8px}.system-update-history-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}.system-update-history-head h4{margin:0}.system-update-admin-list{display:grid;gap:8px;margin-top:10px}.system-update-admin-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center;border:1px solid var(--line);border-radius:11px;padding:11px 12px;background:#fafbfd}.system-update-admin-item.archived{opacity:.72}.system-update-admin-item strong{display:block;font-size:11px;margin-top:6px}.system-update-admin-item p{margin:4px 0 5px;color:var(--muted);font-size:9px;line-height:1.5}.system-update-admin-item small{font-size:8px;color:var(--muted)}.system-update-admin-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:5px}.system-update-mini-type{display:inline-flex;border-radius:999px;padding:3px 6px;font-size:7px;font-weight:900;letter-spacing:.06em;background:#e9f1fc;color:#2f6fce}.system-update-mini-type.success{background:#e7f7ee;color:#16834b}.system-update-mini-type.alert{background:#fff4df;color:#9a6700}

.branding-top-grid{align-items:stretch}.brand-preview{min-height:100%;padding:22px;background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--secondary) 88%,#c9a84d));box-shadow:var(--shadow)}
.palette-card{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 28px;grid-template-rows:42px auto;border:1px solid var(--line);border-radius:12px;background:#fff;padding:0;overflow:hidden;text-align:left;cursor:pointer;transition:.17s;min-height:90px}.palette-card:hover{transform:translateY(-1px);box-shadow:0 7px 18px rgba(15,23,42,.08)}.palette-card.active{border-color:var(--secondary);outline:2px solid color-mix(in srgb,var(--secondary) 25%,transparent);outline-offset:1px}.palette-swatch{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,1fr);height:42px}.palette-swatch i{display:block}.palette-card-copy{padding:9px 10px}.palette-card-copy strong,.palette-card-copy small{display:block}.palette-card-copy strong{font-size:10px}.palette-card-copy small{font-size:8px;color:var(--muted);margin-top:3px}.palette-select-mark{align-self:center;justify-self:center;width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:#f1f5f9;color:transparent;font-size:10px;font-weight:900}.palette-card.active .palette-select-mark{background:var(--secondary);color:#fff}.palette-card.custom-palette{border-style:solid}
.branding-company-card,.branding-invoice-defaults-card{min-height:560px}.branding-default-fields{margin-bottom:4px}.payment-builder{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}.payment-builder-head{padding:12px;background:#fbfcfe;border-bottom:1px solid var(--line)}.rich-toolbar{padding:7px 9px;border-bottom:1px solid var(--line);background:#f8fafc;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.quick-block-label{font-size:8px;font-weight:900;color:var(--muted)}.payment-editor{min-height:175px;border:0!important;border-radius:0!important;padding:14px!important}.branding-logo-block{margin-top:13px;padding-top:12px;border-top:1px solid var(--line)}.branding-logo-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.branding-logo-actions .logo-preview{width:64px;height:64px}.logo-upload-message{font-size:9px;line-height:1.45;color:var(--muted);max-width:420px}.logo-upload-message.success{color:#157347;font-weight:800}.logo-upload-message.error{color:#b4232d;font-weight:800}.branding-save-actions{margin-top:13px}.branding-save-actions .btn{font-weight:900}
#systemUpdateAdminMessage.show{margin-top:10px}
@media(max-width:900px){.system-update-admin-item{grid-template-columns:1fr}.system-update-admin-actions{justify-content:flex-start}.dashboard-agent-status-grid{grid-template-columns:1fr!important}.branding-company-card,.branding-invoice-defaults-card{min-height:auto}}
@media(max-width:560px){.platform-status-row{grid-template-columns:12px 1fr}.platform-status-row b{grid-column:2;text-align:left}.branding-logo-actions{align-items:flex-start;flex-direction:column}}


/* ===== v32.6.2 Agent Dashboard Completion ===== */
.dashboard-agent-status-grid,.dashboard-agent-secondary-grid{align-items:stretch}
.dashboard-agent-status-grid>.card,.dashboard-agent-secondary-grid>.card{min-height:280px}

.dashboard-invoice-status{display:grid;gap:14px;padding-top:6px}
.dashboard-invoice-status-row{
 display:grid;grid-template-columns:125px minmax(0,1fr) 32px;gap:12px;align-items:center
}
.dashboard-invoice-status-row>span{font-size:15px;color:var(--text)}
.dashboard-invoice-status-row>strong{font-size:14px;text-align:right;color:var(--text)}
.dashboard-invoice-status-track{
 height:10px;background:#e6ebf2;border-radius:999px;overflow:hidden
}
.dashboard-invoice-status-track i{
 display:block;height:100%;min-width:0;border-radius:999px;
 background:linear-gradient(90deg,var(--secondary),color-mix(in srgb,var(--secondary) 82%,var(--primary)))
}

.dashboard-activity-list{display:grid;gap:10px;max-height:390px;overflow:auto;padding-right:2px}
.dashboard-activity-item{
 display:grid;grid-template-columns:34px minmax(0,1fr);gap:10px;align-items:center;
 padding:12px 13px;background:#f8fafc;border-radius:10px;border-left:4px solid var(--secondary)
}
.dashboard-activity-icon{
 width:28px;height:28px;border-radius:9px;display:grid;place-items:center;
 background:color-mix(in srgb,var(--secondary) 13%,#fff);color:var(--primary);
 font-size:10px;font-weight:900
}
.dashboard-activity-item strong,.dashboard-activity-item small{display:block}
.dashboard-activity-item strong{font-size:12px;line-height:1.35}
.dashboard-activity-item small{margin-top:4px;font-size:10px;color:var(--muted)}

.dashboard-top-partners-card{min-height:330px}
.dashboard-top-partners-table{min-width:720px}
.dashboard-top-partners-table thead th{
 background:#f7f9fc;font-size:11px;color:var(--muted);font-weight:800
}
.dashboard-top-partners-table tbody td{font-size:12px;vertical-align:middle}
.dashboard-top-partners-table tbody td:first-child strong{font-size:13px}
.dashboard-top-partners-table tbody td small{font-size:9px;color:var(--muted)}
.dashboard-top-partners-table tbody td:nth-child(2),
.dashboard-top-partners-table tbody td:nth-child(3),
.dashboard-top-partners-table tbody td:nth-child(4){font-variant-numeric:tabular-nums}

.platform-status-card .platform-status-row{min-height:52px}
.system-updates-dashboard-card{min-height:280px}

@media(max-width:900px){
 .dashboard-agent-secondary-grid{grid-template-columns:1fr!important}
 .dashboard-invoice-status-row{grid-template-columns:95px minmax(0,1fr) 28px}
}
@media(max-width:560px){
 .dashboard-invoice-status-row{grid-template-columns:76px minmax(0,1fr) 24px;gap:8px}
 .dashboard-invoice-status-row>span{font-size:12px}
 .dashboard-invoice-status-row>strong{font-size:12px}
 .dashboard-top-partners-table{min-width:620px}
}


/* ===== v32.6.3 Dashboard Role Visibility + Admin Controls ===== */
[data-dashboard-section][hidden],[data-dashboard-grid][hidden]{display:none!important}
.dashboard-status-grid>.card{min-height:260px}
.dashboard-visibility-table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px}
.dashboard-visibility-table{width:100%;min-width:620px;border-collapse:collapse}
.dashboard-visibility-table th,.dashboard-visibility-table td{padding:12px 14px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
.dashboard-visibility-table tr:last-child td{border-bottom:0}
.dashboard-visibility-table th{background:#f7f9fc;font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
.dashboard-visibility-table th:nth-child(2),.dashboard-visibility-table th:nth-child(3),
.dashboard-visibility-table td:nth-child(2),.dashboard-visibility-table td:nth-child(3){width:150px;text-align:center}
.dashboard-visibility-table td>strong{font-size:11px}
.dashboard-visibility-table td>small{font-size:9px;color:var(--muted);line-height:1.45}
.dashboard-role-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;cursor:pointer;user-select:none}
.dashboard-role-toggle input{position:absolute;opacity:0;pointer-events:none}
.dashboard-role-toggle-track{position:relative;width:38px;height:21px;border-radius:999px;background:#d8dee8;transition:.16s ease;box-shadow:inset 0 0 0 1px rgba(15,23,42,.05)}
.dashboard-role-toggle-track i{position:absolute;left:3px;top:3px;width:15px;height:15px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(15,23,42,.18);transition:.16s ease}
.dashboard-role-toggle input:checked+.dashboard-role-toggle-track{background:var(--primary)}
.dashboard-role-toggle input:checked+.dashboard-role-toggle-track i{transform:translateX(17px)}
.dashboard-role-toggle b{font-size:9px;color:var(--muted);min-width:37px;text-align:left}
.dashboard-role-toggle.locked{cursor:not-allowed;opacity:.72}
.dashboard-role-toggle.locked .dashboard-role-toggle-track{background:#e7ebf1}
.dashboard-role-toggle.locked .dashboard-role-toggle-track:after{content:"";position:absolute;inset:6px 14px;border:1.5px solid #7b8798;border-top:0;border-radius:2px}
.dashboard-role-toggle.locked b{color:#7b8798}
#dashboardVisibilityMessage.show{margin-top:12px}

@media(max-width:720px){
 .dashboard-visibility-table{min-width:560px}
}


/* ===== v32.6.4 Dashboard Layout & Visibility Manager ===== */
.dashboard-layout-grid{
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:16px;
 align-items:start
}
.dashboard-layout-section{min-width:0;margin:0!important}
.dashboard-layout-section.dashboard-width-full{grid-column:1 / -1}
.dashboard-layout-section.dashboard-width-half{grid-column:auto}
#dashboardMetrics.dashboard-width-half{grid-template-columns:repeat(2,minmax(0,1fr))}
.dashboard-layout-grid>.card{height:100%}
.dashboard-layout-grid .dashboard-top-partners-table{min-width:680px}

.dashboard-layout-manager-grid{
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:14px;
 align-items:start
}
.dashboard-layout-role-card{
 border:1px solid var(--line);
 border-radius:13px;
 background:#f9fbfd;
 overflow:hidden
}
.dashboard-layout-role-head{
 display:flex;
 align-items:flex-start;
 justify-content:space-between;
 gap:12px;
 padding:14px;
 background:#fff;
 border-bottom:1px solid var(--line)
}
.dashboard-layout-role-head h4{margin:0 0 4px;font-size:13px}
.dashboard-layout-role-head small{display:block;color:var(--muted);font-size:9px;line-height:1.45}
.dashboard-layout-sortable{display:grid;gap:8px;padding:10px;min-height:120px}
.dashboard-layout-item{
 display:grid;
 grid-template-columns:28px minmax(0,1fr) auto;
 gap:9px;
 align-items:center;
 padding:10px;
 background:#fff;
 border:1px solid var(--line);
 border-radius:10px;
 box-shadow:0 2px 8px rgba(15,23,42,.025);
 cursor:grab;
 transition:opacity .14s ease,transform .14s ease,border-color .14s ease,box-shadow .14s ease
}
.dashboard-layout-item:active{cursor:grabbing}
.dashboard-layout-item.dragging{opacity:.52;box-shadow:0 9px 20px rgba(15,23,42,.12);transform:scale(.99);border-color:var(--primary)}
.dashboard-layout-item.security-locked{background:#fbfbfc}
.dashboard-layout-drag{
 width:27px;height:34px;border-radius:8px;display:grid;place-items:center;
 background:#f0f3f7;color:#687386;font-weight:900;font-size:16px
}
.dashboard-layout-item-copy{min-width:0}
.dashboard-layout-item-copy strong,.dashboard-layout-item-copy small{display:block}
.dashboard-layout-item-copy strong{font-size:10px;color:var(--text)}
.dashboard-layout-item-copy small{font-size:8px;color:var(--muted);line-height:1.4;margin-top:3px}
.dashboard-layout-item-controls{
 display:flex;align-items:center;justify-content:flex-end;gap:9px;flex-wrap:wrap
}
.dashboard-layout-width-control{
 display:flex;align-items:center;gap:5px;font-size:8px;color:var(--muted);font-weight:800
}
.dashboard-layout-width-control select{
 min-width:76px;height:31px;padding:4px 24px 4px 8px;font-size:9px;border-radius:8px
}
.dashboard-layout-move-buttons{display:inline-flex;gap:3px}
.dashboard-layout-move{
 width:29px;height:29px;padding:0;border:1px solid var(--line);border-radius:7px;background:#fff;
 color:var(--primary);font-weight:900;cursor:pointer
}
.dashboard-layout-move:hover{border-color:var(--primary);background:#f7fafc}
.dashboard-layout-legend{
 display:flex;align-items:center;gap:14px;flex-wrap:wrap;
 margin-top:12px;padding:10px 12px;border-radius:10px;background:#f7f9fc;color:var(--muted);font-size:9px
}
.dashboard-layout-legend b{color:var(--primary)}
.dashboard-layout-admin-card .dashboard-role-toggle{min-width:82px}
.dashboard-layout-admin-card .dashboard-role-toggle-track{flex:0 0 auto}

@media(max-width:1120px){
 .dashboard-layout-manager-grid{grid-template-columns:1fr}
}
@media(max-width:900px){
 .dashboard-layout-grid{grid-template-columns:1fr}
 .dashboard-layout-section.dashboard-width-half,
 .dashboard-layout-section.dashboard-width-full{grid-column:1}
 #dashboardMetrics.dashboard-width-half{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:620px){
 .dashboard-layout-item{grid-template-columns:28px minmax(0,1fr)}
 .dashboard-layout-item-controls{grid-column:2;justify-content:flex-start}
 #dashboardMetrics.dashboard-width-half{grid-template-columns:1fr}
}


/* ===== v32.6.5 Dashboard Header + System Update Notifications ===== */
.version-pill{
 background:#e9f2fb!important;
 color:#15548D!important;
 padding:8px 12px!important;
 font-size:12px!important
}
.system-notification-wrap{position:relative}
.system-notification-bell{
 position:relative;
 width:39px;height:39px;
 display:grid;place-items:center;
 border:1px solid var(--line);
 border-radius:12px;
 background:#fff;
 color:var(--primary);
 cursor:pointer;
 box-shadow:0 4px 13px rgba(15,23,42,.05);
 transition:transform .16s ease,border-color .16s ease,background .16s ease
}
.system-notification-bell:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--primary) 35%,var(--line));background:#fbfcfe}
.system-notification-bell svg{
 width:20px;height:20px;
 fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round
}
.system-notification-bell.has-unread{
 background:color-mix(in srgb,var(--secondary) 9%,#fff);
 border-color:color-mix(in srgb,var(--secondary) 40%,var(--line))
}
.system-notification-badge{
 position:absolute;top:-6px;right:-6px;
 min-width:18px;height:18px;padding:0 5px;
 display:grid;place-items:center;
 border-radius:999px;
 background:var(--accent);
 color:#fff;
 border:2px solid var(--bg);
 font-size:8px;font-weight:900;
 line-height:1
}
.system-notification-panel{
 position:absolute;
 z-index:1500;
 right:0;
 top:47px;
 width:min(430px,calc(100vw - 34px));
 max-height:min(620px,75vh);
 overflow:auto;
 padding:13px;
 border:1px solid var(--line);
 border-radius:14px;
 background:#fff;
 box-shadow:0 22px 60px rgba(15,23,42,.18)
}
.system-notification-panel[hidden]{display:none!important}
.system-notification-panel-head{
 display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
 padding:3px 2px 11px;
 border-bottom:1px solid var(--line);
 margin-bottom:10px
}
.system-notification-panel-head strong,.system-notification-panel-head small{display:block}
.system-notification-panel-head strong{font-size:13px;color:var(--text)}
.system-notification-panel-head small{font-size:9px;color:var(--muted);margin-top:3px}
.system-notification-panel .system-update-list{display:grid;gap:9px}
.system-notification-panel .system-update-card{box-shadow:none}
.system-notification-panel .empty{padding:22px 10px}

.app-toast{
 position:fixed;
 z-index:2000;
 right:24px;
 bottom:24px;
 max-width:min(380px,calc(100vw - 32px));
 padding:10px 13px;
 border-radius:10px;
 background:#172033;
 color:#fff;
 box-shadow:0 14px 38px rgba(15,23,42,.22);
 font-size:11px;font-weight:800;
 opacity:0;
 transform:translateY(10px);
 pointer-events:none;
 transition:opacity .17s ease,transform .17s ease
}
.app-toast.show{opacity:1;transform:translateY(0)}

@media(max-width:700px){
 .topbar{align-items:flex-start}
 .top-actions{flex:0 0 auto}
 .system-notification-panel{position:fixed;right:16px;left:16px;top:78px;width:auto}
 .app-toast{right:16px;bottom:16px}
}


/* ===== v32.6.6 Invoice Branding — Professional Custom Theme Editor ===== */
.custom-branding-pro-editor{padding:20px}
.custom-branding-editor-head{align-items:flex-start}
.custom-branding-save-state.saved{background:#e7f7ee;color:#157347;border:1px solid #b8e3c8}
.custom-branding-save-state.unsaved{background:#fff4df;color:#8a5a00;border:1px solid #ecd39e}
.custom-branding-section-heading,.custom-typography-heading{
 display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin:4px 0 14px
}
.custom-branding-section-heading h4,.custom-typography-heading h4{margin:0 0 4px;font-size:16px}
.custom-branding-section-heading p,.custom-typography-heading p{margin:0;color:var(--muted);font-size:11px;line-height:1.5}

.custom-color-grid{
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px
}
.custom-color-control{
 border:1px solid var(--line);border-radius:12px;padding:10px;background:#fafbfd;
 transition:border-color .15s ease,box-shadow .15s ease
}
.custom-color-control>label{display:block;margin-bottom:6px;font-size:11px}
.custom-color-row{display:grid;grid-template-columns:58px minmax(0,1fr);gap:8px;align-items:center}
.custom-color-row input[type="color"]{
 width:58px;height:44px;padding:4px;border-radius:9px;cursor:pointer;background:#fff
}
.custom-color-row .custom-hex-input{
 height:44px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
 text-transform:uppercase;font-weight:850;letter-spacing:.025em
}
.custom-color-control.invalid{border-color:#e29ba2;box-shadow:0 0 0 3px rgba(189,45,56,.08)}
.custom-color-control.invalid .custom-hex-input{border-color:var(--danger)}
.custom-color-error{display:block;min-height:14px;margin-top:5px;color:var(--danger);font-size:8px;font-weight:750}

.custom-contrast-notice{
 display:flex;align-items:flex-start;gap:10px;margin-top:12px;padding:10px 12px;border-radius:10px;border:1px solid var(--line);
 font-size:10px;line-height:1.5
}
.custom-contrast-notice strong{flex:0 0 auto}
.custom-contrast-notice.good{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.custom-contrast-notice.warning{background:#fff8e8;border-color:#ecd39e;color:#8a5a00}

.custom-typography-heading{margin-top:22px}
.custom-typography-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.custom-type-panel{
 border:1px solid var(--line);border-radius:14px;padding:14px;background:#fafbfd;min-width:0
}
.custom-type-panel>h4{margin:0 0 12px;font-size:15px}
.custom-type-panel .field label{font-size:10px}
.custom-type-panel input,.custom-type-panel select{min-height:42px}
.custom-branding-preview-note{
 display:flex;align-items:flex-start;gap:10px;margin-top:14px;padding:11px 13px;
 border-radius:10px;background:color-mix(in srgb,var(--secondary) 8%,#fff);border-left:4px solid var(--secondary);
 font-size:10px;color:var(--muted);line-height:1.5
}
.custom-branding-preview-note strong{color:var(--primary)}

@media(max-width:900px){
 .custom-color-grid,.custom-typography-grid{grid-template-columns:1fr}
}
@media(max-width:560px){
 .custom-branding-pro-editor{padding:15px}
 .custom-branding-section-heading{flex-direction:column}
 .custom-color-row{grid-template-columns:52px minmax(0,1fr)}
 .custom-color-row input[type="color"]{width:52px}
 .custom-branding-preview-note{flex-direction:column}
}


/* ===== v32.6.6.1 Invoice Branding Layout Polish ===== */
.custom-branding-compact-editor{padding:14px 15px}
.custom-branding-compact-editor .card-title{margin-bottom:10px}
.custom-branding-head-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.custom-branding-save-shortcut{white-space:nowrap}

.custom-branding-split-layout{
 display:grid;
 grid-template-columns:minmax(0,1fr) minmax(0,1fr);
 gap:12px;
 align-items:start
}
.custom-branding-half{
 min-width:0;
 border:1px solid var(--line);
 border-radius:12px;
 background:#fbfcfe;
 padding:11px
}
.custom-branding-section-heading.compact,
.custom-typography-heading.compact{
 margin:0 0 8px;
 gap:8px;
 align-items:flex-start
}
.custom-branding-section-heading.compact h4,
.custom-typography-heading.compact h4{font-size:13px;margin:0 0 2px}
.custom-branding-section-heading.compact p,
.custom-typography-heading.compact p{font-size:9px;line-height:1.35}
.custom-branding-section-heading.compact .pill,
.custom-typography-heading.compact .pill{font-size:8px;padding:4px 7px}

.custom-color-grid.compact{
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:6px
}
.custom-branding-compact-editor .custom-color-control{
 padding:7px;
 border-radius:9px;
 background:#fff
}
.custom-branding-compact-editor .custom-color-control>label{
 margin-bottom:4px;
 font-size:9px;
 line-height:1.25
}
.custom-branding-compact-editor .custom-color-row{
 grid-template-columns:42px minmax(0,1fr);
 gap:5px
}
.custom-branding-compact-editor .custom-color-row input[type="color"]{
 width:42px;height:36px;padding:3px;border-radius:7px
}
.custom-branding-compact-editor .custom-color-row .custom-hex-input{
 height:36px;
 min-height:36px;
 padding:6px 8px;
 font-size:10px
}
.custom-branding-compact-editor .custom-color-error{
 min-height:10px;
 margin-top:2px;
 font-size:7px;
 line-height:1.25
}
.custom-branding-compact-editor .custom-contrast-notice{
 margin-top:7px;
 padding:7px 9px;
 gap:7px;
 font-size:8px;
 line-height:1.35
}

.custom-typography-stack{display:grid;gap:7px}
.custom-type-panel.compact{
 padding:9px;
 border-radius:10px;
 background:#fff
}
.custom-type-panel.compact>h4{
 margin:0 0 7px;
 font-size:11px
}
.custom-type-panel.compact .form-grid{gap:6px 7px}
.custom-type-panel.compact .field label{
 margin-bottom:3px;
 font-size:8px
}
.custom-type-panel.compact input,
.custom-type-panel.compact select{
 min-height:35px;
 height:35px;
 padding-top:5px;
 padding-bottom:5px;
 font-size:10px
}

.custom-branding-preview-note.compact{
 margin-top:9px;
 padding:8px 10px;
 gap:7px;
 font-size:8px;
 line-height:1.4
}

@media(max-width:1180px){
 .custom-branding-split-layout{grid-template-columns:1fr}
 .custom-branding-half{padding:10px}
 .custom-color-grid.compact{grid-template-columns:repeat(2,minmax(0,1fr))}
 .custom-typography-stack{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
 .custom-branding-head-actions{justify-content:flex-start}
 .custom-color-grid.compact,
 .custom-typography-stack{grid-template-columns:1fr}
}
@media(max-width:560px){
 .custom-branding-compact-editor{padding:11px}
 .custom-branding-half{padding:8px}
 .custom-branding-head-actions{width:100%}
 .custom-branding-save-shortcut{width:100%}
}


/* ===== v32.6.6.2 Invoice Defaults UI/UX Polish ===== */
.invoice-defaults-polished{
 padding:16px;
 display:flex;
 flex-direction:column;
 gap:0
}
.invoice-defaults-head{
 display:flex;
 align-items:flex-start;
 justify-content:space-between;
 gap:12px;
 margin-bottom:11px
}
.invoice-defaults-head h3{margin:0 0 3px}
.invoice-defaults-head .help{font-size:10px;line-height:1.45}

.invoice-defaults-fields{
 gap:9px;
 margin-bottom:11px
}
.invoice-defaults-fields .field{gap:4px}
.invoice-defaults-fields .field label{font-size:10px}
.invoice-defaults-fields input,
.invoice-defaults-fields select{
 min-height:39px;
 padding-top:7px;
 padding-bottom:7px
}

.invoice-defaults-workspace{
 display:grid;
 grid-template-columns:minmax(0,2.15fr) minmax(190px,.85fr);
 gap:10px;
 align-items:stretch
}

.payment-builder-polished{
 margin:0;
 border-radius:11px;
 background:#fff
}
.payment-builder-polished .payment-builder-head{
 padding:10px 11px;
 gap:9px;
 align-items:flex-start
}
.payment-builder-polished .payment-builder-head h4{
 margin:0 0 2px;
 font-size:12px
}
.payment-builder-polished .payment-builder-head .help{
 font-size:8px;
 line-height:1.4
}
.builder-status{
 display:inline-flex;
 align-items:center;
 justify-content:center;
 min-height:24px;
 border-radius:999px;
 padding:4px 8px;
 background:#eef2f6;
 color:#526075;
 border:1px solid #dde4ec;
 font-size:8px;
 line-height:1;
 font-weight:900;
 white-space:nowrap
}
.builder-status.saved{
 background:#e9f8ef;
 color:#157347;
 border-color:#c3e8d0
}
.builder-status.saving{
 background:#eef5fc;
 color:#15548D;
 border-color:#c9ddee
}
.builder-status.error{
 background:#fff0f1;
 color:#a12631;
 border-color:#efc2c7
}

.payment-tools-compact{
 display:grid;
 grid-template-columns:auto minmax(0,1fr);
 border-bottom:1px solid var(--line);
 background:#f7f9fc
}
.payment-builder-polished .rich-toolbar{
 min-height:40px;
 padding:5px 7px;
 border-bottom:0;
 background:transparent
}
.payment-builder-polished .formatting-toolbar{
 border-right:1px solid var(--line)
}
.payment-toolbar-label,
.payment-builder-polished .quick-block-label{
 color:var(--muted);
 font-size:7px;
 font-weight:900;
 text-transform:uppercase;
 letter-spacing:.04em;
 white-space:nowrap
}
.payment-builder-polished .toolbar-group{
 gap:3px;
 padding-right:0;
 margin-right:0;
 border-right:0
}
.payment-builder-polished .editor-tool{
 height:28px;
 min-width:28px;
 padding:0 6px;
 border-radius:6px;
 font-size:9px
}
.payment-builder-polished .editor-tool.wide{
 min-width:auto;
 white-space:nowrap
}
.payment-editor-polished{
 min-height:190px;
 max-height:300px;
 padding:11px;
 font-size:10px;
 line-height:1.5
}

.invoice-logo-card{
 min-width:0;
 border:1px solid var(--line);
 border-radius:11px;
 background:#fbfcfe;
 padding:10px;
 display:flex;
 flex-direction:column;
 gap:10px
}
.invoice-logo-card-head h4{
 margin:0 0 2px;
 font-size:12px
}
.invoice-logo-card-head .help{
 font-size:8px;
 line-height:1.4
}
.invoice-logo-current{
 display:flex;
 align-items:center;
 gap:9px;
 padding:8px;
 border:1px solid var(--line);
 border-radius:9px;
 background:#fff
}
.invoice-logo-current .logo-preview{
 width:58px;
 height:58px;
 flex:0 0 58px;
 border-radius:9px
}
.invoice-logo-current strong,
.invoice-logo-current small{display:block}
.invoice-logo-current strong{font-size:9px}
.invoice-logo-current small{
 margin-top:3px;
 color:var(--muted);
 font-size:7px;
 line-height:1.35
}

.invoice-logo-upload{
 display:flex;
 flex-direction:column;
 gap:6px;
 margin-top:auto
}
.invoice-logo-upload>label{
 font-size:8px;
 font-weight:850
}
.invoice-logo-file-input{
 min-height:37px;
 padding:4px 5px;
 font-size:8px;
 background:#fff
}
.invoice-logo-file-input::file-selector-button{
 margin-right:7px;
 border:0;
 border-radius:6px;
 padding:7px 9px;
 background:#e8edf3;
 color:#263346;
 font:inherit;
 font-weight:900;
 cursor:pointer
}
.invoice-logo-file-input::file-selector-button:hover{
 background:color-mix(in srgb,var(--secondary) 17%,#e8edf3)
}
.invoice-logo-upload-button{
 width:100%;
 padding:8px 10px;
 font-size:9px
}
.invoice-logo-card .logo-upload-message{
 max-width:none;
 min-height:12px;
 font-size:7px;
 line-height:1.35
}

.invoice-defaults-save-footer{
 display:flex;
 align-items:center;
 justify-content:space-between;
 gap:12px;
 margin-top:11px;
 padding-top:11px;
 border-top:1px solid var(--line)
}
.invoice-defaults-save-footer>span{
 color:var(--muted);
 font-size:8px;
 line-height:1.4
}
.invoice-defaults-save-footer .btn{
 flex:0 0 auto;
 font-weight:900;
 padding:9px 12px;
 font-size:9px
}

/* Old standalone Logo spacing is intentionally neutralized inside the polished card. */
.invoice-defaults-polished .branding-logo-block{margin:0;padding:0;border:0}

@media(max-width:1250px){
 .invoice-defaults-workspace{
  grid-template-columns:1fr
 }
 .invoice-logo-card{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:start
 }
 .invoice-logo-card-head{grid-column:1/-1}
 .invoice-logo-upload{margin-top:0}
}
@media(max-width:760px){
 .invoice-defaults-fields{grid-template-columns:1fr}
 .payment-tools-compact{grid-template-columns:1fr}
 .payment-builder-polished .formatting-toolbar{border-right:0;border-bottom:1px solid var(--line)}
 .invoice-logo-card{display:flex}
 .invoice-defaults-save-footer{
  align-items:stretch;
  flex-direction:column
 }
 .invoice-defaults-save-footer .btn{width:100%}
}


/* ===== v32.6.6.3 Invoice Branding Typography Consistency =====
   Agent / Company Information is the visual typography baseline.
   Spacing/layout remains compact; only text/form scale is normalized.
*/
#branding .custom-branding-section-heading.compact h4,
#branding .custom-typography-heading.compact h4,
#branding .payment-builder-polished .payment-builder-head h4,
#branding .invoice-logo-card-head h4{
  font-size:calc(var(--heading-size) - 12px);
  line-height:1.2
}

#branding .custom-type-panel.compact>h4{
  font-size:calc(var(--heading-size) - 14px);
  line-height:1.25
}

#branding .custom-branding-section-heading.compact p,
#branding .custom-typography-heading.compact p,
#branding .invoice-defaults-head .help,
#branding .payment-builder-polished .payment-builder-head .help,
#branding .invoice-logo-card-head .help{
  font-size:calc(var(--body-size) - 1px);
  line-height:1.45
}

#branding .custom-branding-compact-editor .custom-color-control>label,
#branding .custom-type-panel.compact .field label,
#branding .invoice-defaults-fields .field label,
#branding .invoice-logo-upload>label{
  font-size:calc(var(--body-size) - 1px);
  line-height:1.3
}

#branding .custom-branding-compact-editor .custom-color-row .custom-hex-input,
#branding .custom-type-panel.compact input,
#branding .custom-type-panel.compact select,
#branding .invoice-defaults-fields input,
#branding .invoice-defaults-fields select,
#branding .payment-editor-polished,
#branding .invoice-logo-file-input{
  font-size:var(--body-size)
}

#branding .custom-branding-section-heading.compact .pill,
#branding .custom-typography-heading.compact .pill,
#branding .builder-status{
  font-size:calc(var(--body-size) - 3px)
}

#branding .payment-toolbar-label,
#branding .payment-builder-polished .quick-block-label{
  font-size:calc(var(--body-size) - 3px)
}

#branding .payment-builder-polished .editor-tool{
  font-size:calc(var(--body-size) - 2px)
}

#branding .invoice-logo-current strong{
  font-size:calc(var(--body-size) - 1px)
}
#branding .invoice-logo-current small,
#branding .invoice-logo-card .logo-upload-message{
  font-size:calc(var(--body-size) - 3px);
  line-height:1.4
}

#branding .custom-branding-compact-editor .custom-color-error{
  font-size:calc(var(--body-size) - 4px)
}
#branding .custom-branding-compact-editor .custom-contrast-notice,
#branding .custom-branding-preview-note.compact{
  font-size:calc(var(--body-size) - 2px)
}

#branding .invoice-defaults-save-footer>span{
  font-size:calc(var(--body-size) - 1px)
}
#branding .invoice-defaults-save-footer .btn,
#branding .invoice-logo-upload-button{
  font-size:calc(var(--body-size) - 2px)
}

/* Maintain the compact v32.6.6.1 / v32.6.6.2 layouts while giving text
   the same comfortable readability as Agent / Company Information. */
#branding .custom-branding-compact-editor .custom-color-row .custom-hex-input{
  min-height:38px;
  height:38px
}
#branding .custom-type-panel.compact input,
#branding .custom-type-panel.compact select{
  min-height:38px;
  height:38px
}
#branding .payment-builder-polished .editor-tool{
  min-height:30px
}
#branding .invoice-logo-file-input{
  min-height:39px
}


/* ===== v32.7.0 Agent Category Requests & Admin Approval Workflow ===== */
.master-directory-card{overflow:visible}
.master-directory-metrics .metric strong{font-variant-numeric:tabular-nums}

.category-request-callout{
 display:grid;
 grid-template-columns:42px minmax(0,1fr) auto;
 gap:13px;
 align-items:center;
 margin-bottom:16px;
 padding:14px 15px;
 border:1px solid color-mix(in srgb,var(--secondary) 28%,var(--line));
 border-radius:13px;
 background:color-mix(in srgb,var(--secondary) 7%,#fff);
 box-shadow:0 5px 18px rgba(15,23,42,.035)
}
.category-request-callout-icon{
 width:38px;height:38px;border-radius:11px;
 display:grid;place-items:center;
 background:color-mix(in srgb,var(--secondary) 16%,#fff);
 color:var(--primary);
 font-size:23px;font-weight:700;line-height:1
}
.category-request-callout-copy h3{
 margin:0 0 3px;
 font-size:calc(var(--heading-size) - 10px)
}
.category-request-callout-copy p{
 margin:0;color:var(--muted);
 font-size:calc(var(--body-size) - 1px);line-height:1.45
}
.category-request-callout-actions{
 display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap
}

.community-category-legend{
 display:flex;align-items:center;gap:7px;
 margin-top:10px;padding:7px 2px 0;
 color:var(--muted);font-size:calc(var(--body-size) - 3px);line-height:1.4
}
.master-category-name{display:inline-flex;align-items:center;gap:5px}
.category-attribution-legend-icon{
 width:18px;height:18px;min-width:18px;border-radius:999px;
 display:inline-grid;place-items:center;
 background:color-mix(in srgb,var(--secondary) 10%,#fff);
 border:1px solid color-mix(in srgb,var(--secondary) 35%,var(--line));
 color:var(--primary);font-size:10px;font-weight:900;font-family:Arial,sans-serif
}
.category-attribution-icon{
 appearance:none;border:1px solid color-mix(in srgb,var(--secondary) 35%,var(--line));
 width:18px;height:18px;min-width:18px;padding:0;border-radius:999px;
 display:inline-grid;place-items:center;vertical-align:middle;
 background:color-mix(in srgb,var(--secondary) 10%,#fff);
 color:var(--primary);font-size:10px;font-weight:900;font-family:Arial,sans-serif;
 cursor:help
}
.category-attribution-icon:hover,
.category-attribution-icon:focus-visible{
 background:color-mix(in srgb,var(--secondary) 20%,#fff);
 outline:2px solid color-mix(in srgb,var(--secondary) 20%,transparent);
 outline-offset:1px
}

.category-request-admin-card{padding:16px}
.category-request-admin-head{margin-bottom:12px}
.category-request-admin-metrics{
 display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
 gap:8px;margin-bottom:11px
}
.category-request-metric{
 appearance:none;
 display:flex;align-items:center;justify-content:space-between;gap:10px;
 padding:10px 12px;
 border:1px solid var(--line);border-radius:10px;
 background:#f8fafc;color:var(--text);text-align:left;cursor:pointer
}
.category-request-metric:hover{border-color:color-mix(in srgb,var(--secondary) 45%,var(--line))}
.category-request-metric.active{
 border-color:color-mix(in srgb,var(--secondary) 58%,var(--line));
 background:color-mix(in srgb,var(--secondary) 10%,#fff);
 box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--secondary) 16%,transparent)
}
.category-request-metric small{color:var(--muted);font-weight:800}
.category-request-metric strong{font-size:19px;color:var(--primary)}
.category-request-admin-toolbar{
 display:grid;grid-template-columns:minmax(220px,1fr) 220px;
 gap:8px;margin-bottom:10px
}
.category-request-table td{vertical-align:middle}
.category-request-table td strong,
.category-request-table td small{display:block}
.category-request-table td small{margin-top:3px;color:var(--muted);font-size:9px}
.category-request-approved-as{color:#157347!important;font-weight:800}
.category-request-why-preview{display:block;max-width:280px;line-height:1.45}
.category-request-actions{white-space:nowrap}

.category-request-status,
.category-notification-status{
 display:inline-flex;align-items:center;justify-content:center;
 padding:5px 8px;border-radius:999px;
 font-size:9px;font-weight:900;line-height:1;white-space:nowrap
}
.category-request-status.pending{background:#fff4df;color:#8a5a00}
.category-request-status.approved{background:#e7f7ee;color:#157347}
.category-request-status.rejected{background:#fff0f1;color:#a12631}
.category-notification-status.sent{background:#e7f7ee;color:#157347}
.category-notification-status.failed{background:#fff0f1;color:#a12631}
.category-notification-status.not_sent{background:#eef2f6;color:#5f6d80}

/* Category Request modals */
.category-request-modal{
 position:fixed;inset:0;z-index:690;
 display:none;align-items:center;justify-content:center;
 padding:20px;background:rgba(15,23,42,.55);backdrop-filter:blur(4px)
}
.category-request-modal.open{display:flex}
.category-request-modal-card{
 width:min(660px,100%);max-height:min(88vh,820px);overflow:auto;
 background:#fff;border:1px solid color-mix(in srgb,var(--secondary) 30%,var(--line));
 border-radius:16px;box-shadow:0 28px 75px rgba(15,23,42,.24)
}
.category-request-history-card{width:min(760px,100%)}
.category-request-review-card{width:min(900px,100%)}
.category-request-modal-head{
 position:sticky;top:0;z-index:2;
 display:flex;align-items:flex-start;justify-content:space-between;gap:14px;
 padding:15px 16px;border-bottom:1px solid var(--line);background:#fff
}
.category-request-modal-head h3{margin:0 0 3px}
.category-request-modal-close{
 appearance:none;border:0;background:#eef2f6;color:#536173;
 width:31px;height:31px;border-radius:9px;font-size:21px;line-height:1;cursor:pointer
}
.category-request-modal-close:hover{background:#e1e7ee;color:#263346}
.category-request-modal-body{padding:15px 16px}
.category-request-modal-foot{
 position:sticky;bottom:0;z-index:2;
 display:flex;justify-content:flex-end;gap:8px;
 padding:11px 16px;border-top:1px solid var(--line);background:#fff
}
.category-request-guidance{
 display:grid;gap:2px;margin-bottom:12px;padding:10px 11px;
 border-radius:10px;background:color-mix(in srgb,var(--secondary) 8%,#fff);
 border-left:4px solid var(--secondary)
}
.category-request-guidance strong{font-size:11px;color:var(--primary)}
.category-request-guidance span{font-size:9px;line-height:1.45;color:var(--muted)}
.category-request-duplicate-hint{
 margin-top:10px;padding:9px 10px;border-radius:9px;
 background:#eef6ff;border:1px solid #cbdff1;color:#285b82;
 font-size:9px;line-height:1.45
}
.category-request-duplicate-hint.warning{
 background:#fff8e8;border-color:#ecd39e;color:#8a5a00
}

/* Agent request history */
.my-category-request-list{display:grid;gap:9px}
.my-category-request-item{
 border:1px solid var(--line);border-radius:11px;padding:11px;background:#fbfcfe
}
.my-category-request-head{
 display:flex;align-items:flex-start;justify-content:space-between;gap:12px
}
.my-category-request-head strong,
.my-category-request-head small{display:block}
.my-category-request-head strong{font-size:12px}
.my-category-request-head small{margin-top:3px;color:var(--muted);font-size:9px}
.my-category-request-detail{
 display:grid;grid-template-columns:110px minmax(0,1fr);
 gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid #edf1f5;
 font-size:9px
}
.my-category-request-detail small{color:var(--muted);font-weight:800}
.my-category-request-decision{
 display:grid;gap:2px;margin-top:8px;padding:8px 9px;border-radius:8px;
 font-size:9px;line-height:1.4
}
.my-category-request-decision.approved{background:#edf9f1;color:#166534}
.my-category-request-decision.rejected{background:#fff2f3;color:#991b1b}
.my-category-request-decision.pending{background:#fff8e8;color:#805400}
.my-category-request-decision strong{font-size:10px}
.category-request-empty{
 display:grid;place-items:center;text-align:center;gap:4px;min-height:170px;
 border:1px dashed #d5dde6;border-radius:12px;background:#fbfcfe;color:var(--muted)
}
.category-request-empty strong{color:var(--text);font-size:12px}
.category-request-empty span{font-size:9px}

/* Admin review modal */
.category-request-review-summary{
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:12px
}
.category-request-review-summary>div{
 padding:9px 10px;border:1px solid var(--line);border-radius:9px;background:#f8fafc
}
.category-request-review-summary .full{grid-column:1/-1}
.category-request-review-summary small,
.category-request-review-summary strong{display:block}
.category-request-review-summary small{
 margin-bottom:4px;color:var(--muted);font-size:8px;font-weight:900;text-transform:uppercase;letter-spacing:.03em
}
.category-request-review-summary strong{font-size:10px}
.category-request-review-summary p{margin:0;font-size:10px;line-height:1.5}
.category-request-review-panels{
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px
}
.category-request-review-panel{
 display:flex;flex-direction:column;gap:9px;
 padding:11px;border:1px solid var(--line);border-radius:11px;background:#fbfcfe
}
.category-request-review-panel.approve{border-top:3px solid #2e8b57}
.category-request-review-panel.reject{border-top:3px solid #b4232d}
.category-request-review-panel-head{
 display:grid;grid-template-columns:31px minmax(0,1fr);gap:8px;align-items:start
}
.category-request-decision-icon{
 width:29px;height:29px;border-radius:9px;display:grid;place-items:center;
 background:#eef2f6;color:var(--primary);font-weight:900
}
.category-request-review-panel.approve .category-request-decision-icon{background:#e7f7ee;color:#157347}
.category-request-review-panel.reject .category-request-decision-icon{background:#fff0f1;color:#a12631}
.category-request-review-panel-head h4{margin:0 0 2px;font-size:12px}
.category-request-review-panel-head p{margin:0;color:var(--muted);font-size:8px;line-height:1.4}
.category-request-review-panel .field{gap:4px}
.category-request-review-panel .field label{font-size:9px}
.category-request-review-panel input,
.category-request-review-panel select,
.category-request-review-panel textarea{font-size:10px}
.category-request-review-panel>.btn{margin-top:auto;width:100%}

@media(max-width:950px){
 .category-request-callout{grid-template-columns:42px minmax(0,1fr)}
 .category-request-callout-actions{grid-column:1/-1;justify-content:flex-start}
 .category-request-admin-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
 .category-request-review-panels{grid-template-columns:1fr}
}
@media(max-width:680px){
 .category-request-callout{grid-template-columns:1fr}
 .category-request-callout-icon{display:none}
 .category-request-callout-actions{display:grid;grid-template-columns:1fr}
 .category-request-callout-actions .btn{width:100%}
 .category-request-admin-toolbar{grid-template-columns:1fr}
 .category-request-admin-metrics{grid-template-columns:1fr 1fr}
 .category-request-modal{padding:10px}
 .category-request-modal-body{padding:12px}
 .category-request-review-summary{grid-template-columns:1fr}
 .category-request-review-summary .full{grid-column:auto}
 .my-category-request-detail{grid-template-columns:1fr}
}


.category-attribution-icon{position:relative}
.category-attribution-icon::after{
 content:attr(data-tooltip);
 position:absolute;left:50%;bottom:calc(100% + 8px);z-index:20;
 width:max-content;max-width:280px;transform:translateX(-50%) translateY(3px);
 padding:7px 9px;border-radius:8px;
 background:#1f2937;color:#fff;
 font-size:9px;font-weight:700;line-height:1.4;text-align:left;
 box-shadow:0 8px 22px rgba(15,23,42,.2);
 opacity:0;visibility:hidden;pointer-events:none;
 transition:opacity .15s ease,transform .15s ease,visibility .15s ease
}
.category-attribution-icon::before{
 content:"";position:absolute;left:50%;bottom:calc(100% + 3px);z-index:21;
 transform:translateX(-50%);
 border:5px solid transparent;border-top-color:#1f2937;
 opacity:0;visibility:hidden;transition:opacity .15s ease,visibility .15s ease
}
.category-attribution-icon:hover::after,
.category-attribution-icon:focus-visible::after{
 opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)
}
.category-attribution-icon:hover::before,
.category-attribution-icon:focus-visible::before{opacity:1;visibility:visible}

.community-category-strip{
 display:flex;align-items:flex-start;gap:9px;flex-wrap:wrap;
 margin:0 0 10px;padding:8px 10px;
 border:1px solid var(--line);border-radius:9px;background:#fbfcfe
}
.community-category-strip-label{
 flex:0 0 auto;padding-top:4px;
 color:var(--muted);font-size:9px;font-weight:900
}
.community-category-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.community-category-chip{
 display:inline-flex;align-items:center;gap:4px;
 padding:4px 7px;border-radius:999px;
 background:color-mix(in srgb,var(--secondary) 10%,#fff);
 border:1px solid color-mix(in srgb,var(--secondary) 20%,var(--line));
 color:var(--text);font-size:9px;font-weight:800
}
@media(max-width:680px){
 .community-category-strip{display:grid}
 .community-category-strip-label{padding-top:0}
}

.category-request-review-panel[hidden]{display:none!important}


/* ===== v32.7.1 My Referral Profiles UI/UX Polish ===== */
.partner-summary-grid{
 display:grid;
 grid-template-columns:repeat(4,minmax(0,1fr));
 gap:10px;
 margin-bottom:13px
}
.partner-summary-card{
 display:flex;align-items:center;gap:10px;
 min-width:0;padding:11px 12px;
 border:1px solid var(--line);border-radius:12px;
 background:#fff;box-shadow:0 4px 16px rgba(15,23,42,.035)
}
.partner-summary-icon{
 width:37px;height:37px;min-width:37px;
 display:grid;place-items:center;border-radius:10px;
 background:color-mix(in srgb,var(--secondary) 12%,#fff);
 color:var(--primary);font-size:12px;font-weight:900
}
.partner-summary-card small,
.partner-summary-card strong{display:block}
.partner-summary-card small{
 color:var(--muted);font-size:calc(var(--body-size) - 3px);font-weight:800
}
.partner-summary-card strong{
 margin-top:3px;color:var(--primary);
 font-size:calc(var(--heading-size) - 7px);line-height:1.1;
 font-variant-numeric:tabular-nums
}

.partner-profiles-workspace{
 display:grid;
 grid-template-columns:minmax(0,1fr) 390px;
 gap:14px;
 align-items:start
}
.partner-directory-card{min-width:0}
.partner-directory-head{
 display:flex;align-items:flex-start;justify-content:space-between;
 gap:12px;margin-bottom:12px
}
.partner-directory-head h3{margin:0 0 3px}
.partner-directory-head .help{max-width:690px}

.partner-directory-toolbar{
 display:grid;
 grid-template-columns:minmax(240px,1fr) 160px auto;
 gap:8px;align-items:center;
 margin-bottom:10px;padding:8px;
 border:1px solid var(--line);border-radius:10px;
 background:#f8fafc
}
.partner-search-wrap{position:relative;min-width:0}
.partner-search-icon{
 position:absolute;left:10px;top:50%;transform:translateY(-50%);
 color:#7a8797;font-size:15px;pointer-events:none
}
.partner-search-wrap input{
 width:100%;max-width:none;padding-left:31px
}
.partner-directory-toolbar select{width:100%;max-width:none}
.partner-result-count{
 justify-self:end;color:var(--muted);
 font-size:calc(var(--body-size) - 3px);font-weight:800;white-space:nowrap
}

.partner-table-wrap{border-radius:10px}
.partner-profile-table thead th{
 background:#f7f9fc;color:var(--muted);
 font-size:calc(var(--body-size) - 3px);
 font-weight:850;white-space:nowrap
}
.partner-profile-table tbody td{
 vertical-align:middle;
 font-size:calc(var(--body-size) - 1px)
}
.partner-profile-table tbody tr:hover{background:#fbfcfe}
.partner-row-archived{opacity:.74;background:#fafbfc}
.partner-primary-cell strong,
.partner-primary-cell small{display:block}
.partner-primary-cell strong{
 color:var(--text);font-size:calc(var(--body-size) + 1px);line-height:1.3
}
.partner-primary-cell small{
 margin-top:4px;color:var(--muted);
 font-size:calc(var(--body-size) - 3px);line-height:1.4
}
.partner-category-tag{
 display:inline-flex;align-items:center;gap:5px;
 max-width:220px;padding:5px 8px;
 border:1px solid color-mix(in srgb,var(--secondary) 20%,var(--line));
 border-radius:999px;
 background:color-mix(in srgb,var(--secondary) 8%,#fff);
 color:#354156;font-size:calc(var(--body-size) - 2px);
 font-weight:800;line-height:1.25
}
.partner-category-tag .category-attribution-icon{
 width:16px;height:16px;min-width:16px;font-size:8px
}
.partner-fee-badge{
 display:inline-flex;align-items:center;
 padding:5px 8px;border-radius:8px;
 background:#f1f4f8;color:#334155;
 font-weight:900;font-variant-numeric:tabular-nums;white-space:nowrap
}
.partner-numeric-cell{
 font-variant-numeric:tabular-nums;white-space:nowrap
}
.partner-outstanding-value{color:#a35c12}
.partner-row-actions{
 display:flex;align-items:center;gap:5px;flex-wrap:nowrap
}
.partner-row-actions .btn{white-space:nowrap}

.partner-empty-state{
 display:grid;place-items:center;text-align:center;gap:5px;
 min-height:230px;padding:25px
}
.partner-empty-icon{
 width:45px;height:45px;border-radius:13px;display:grid;place-items:center;
 background:color-mix(in srgb,var(--secondary) 12%,#fff);
 color:var(--primary);font-size:16px;font-weight:900;margin-bottom:3px
}
.partner-empty-state strong{font-size:13px;color:var(--text)}
.partner-empty-state span{
 max-width:430px;color:var(--muted);
 font-size:calc(var(--body-size) - 2px);line-height:1.5
}
.partner-empty-state .btn{margin-top:6px}

.partner-form-card{
 position:sticky;top:18px;
 padding:15px
}
.partner-form-head{
 display:flex;align-items:flex-start;justify-content:space-between;gap:10px;
 margin-bottom:11px;padding-bottom:10px;border-bottom:1px solid var(--line)
}
.partner-form-head h3{margin:0 0 3px}
.partner-form-head .help{font-size:calc(var(--body-size) - 2px)}

.partner-form-section{
 padding:10px 0;border-bottom:1px solid #edf1f5
}
.partner-form-section:first-of-type{padding-top:0}
.partner-form-section:last-of-type{border-bottom:0}
.partner-form-section-head{
 display:flex;align-items:baseline;justify-content:space-between;gap:8px;
 margin-bottom:8px
}
.partner-form-section-head h4{
 margin:0;color:var(--primary);
 font-size:calc(var(--heading-size) - 13px);line-height:1.25
}
.partner-form-section-head span{
 color:var(--muted);font-size:calc(var(--body-size) - 4px);
 line-height:1.35;text-align:right
}
.partner-form-grid{gap:8px}
.partner-form-grid .field{gap:4px}
.partner-form-grid label{font-size:calc(var(--body-size) - 1px)}
.partner-form-grid input,
.partner-form-grid select,
.partner-form-grid textarea{
 font-size:var(--body-size)
}
.partner-form-grid textarea{resize:vertical;min-height:74px}

.partner-fee-input-wrap{position:relative}
.partner-fee-input-wrap input{width:100%;padding-right:30px}
.partner-fee-input-wrap.fee-flat input{padding-left:30px;padding-right:10px}
.partner-fee-prefix{
 position:absolute;left:10px;top:50%;transform:translateY(-50%);
 color:var(--muted);font-size:calc(var(--body-size) - 1px);font-weight:900;
 pointer-events:none
}
.partner-fee-prefix.suffix{left:auto;right:10px}
.partner-fee-help{
 display:block;margin-top:4px;color:var(--muted);
 font-size:calc(var(--body-size) - 4px);line-height:1.4
}
.partner-form-actions{
 display:grid;grid-template-columns:minmax(0,1fr) auto;
 gap:7px;margin-top:11px;padding-top:11px;border-top:1px solid var(--line)
}
.partner-form-actions .btn{font-size:calc(var(--body-size) - 1px)}

@media(max-width:1180px){
 .partner-profiles-workspace{grid-template-columns:minmax(0,1fr) 350px}
 .partner-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:960px){
 .partner-profiles-workspace{grid-template-columns:1fr}
 .partner-form-card{position:static}
}
@media(max-width:720px){
 .partner-directory-head{flex-direction:column}
 .partner-directory-head .btn{width:100%}
 .partner-directory-toolbar{grid-template-columns:1fr}
 .partner-result-count{justify-self:start}
 .partner-summary-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:520px){
 .partner-summary-grid{grid-template-columns:1fr}
 .partner-form-section-head{display:block}
 .partner-form-section-head span{display:block;margin-top:3px;text-align:left}
 .partner-form-actions{grid-template-columns:1fr}
 .partner-form-actions .btn{width:100%}
}


/* ===== v32.7.2 Partner Profile Detail View ===== */
.partner-profile-detail-modal{
 position:fixed;inset:0;z-index:720;
 display:none;align-items:center;justify-content:center;
 padding:18px;
 background:rgba(15,23,42,.58);
 backdrop-filter:blur(5px)
}
.partner-profile-detail-modal.open{display:flex}
.partner-profile-detail-shell{
 width:min(1180px,96vw);
 max-height:92vh;
 display:grid;
 grid-template-rows:auto minmax(0,1fr) auto;
 overflow:hidden;
 border:1px solid color-mix(in srgb,var(--secondary) 28%,var(--line));
 border-radius:18px;
 background:#fff;
 box-shadow:0 30px 85px rgba(15,23,42,.30)
}
.partner-profile-detail-header{
 display:grid;
 grid-template-columns:58px minmax(0,1fr) 38px;
 gap:13px;align-items:center;
 padding:16px 18px;
 background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 70%,var(--secondary)));
 color:#fff
}
.partner-profile-detail-avatar{
 width:58px;height:58px;border-radius:15px;
 display:grid;place-items:center;
 background:color-mix(in srgb,#fff 22%,transparent);
 border:1px solid rgba(255,255,255,.18);
 color:#fff;font-size:23px;font-weight:900
}
.partner-profile-detail-identity{min-width:0}
.partner-profile-detail-identity h2{
 margin:0 0 5px;color:#fff;
 font-size:calc(var(--heading-size) + 2px);line-height:1.15
}
.partner-profile-detail-meta{
 display:flex;align-items:center;gap:6px;flex-wrap:wrap;
 color:rgba(255,255,255,.82);
 font-size:calc(var(--body-size) - 1px);
 font-weight:700;line-height:1.4
}
.partner-profile-meta-separator{opacity:.62}
.partner-profile-header-category{
 display:inline-flex;align-items:center;gap:4px
}
.partner-profile-detail-header .category-attribution-icon{
 background:rgba(255,255,255,.18);
 border-color:rgba(255,255,255,.35);
 color:#fff
}
.partner-profile-detail-close{
 appearance:none;border:0;
 width:38px;height:38px;border-radius:10px;
 display:grid;place-items:center;
 background:rgba(255,255,255,.16);
 color:#fff;font-size:25px;line-height:1;cursor:pointer
}
.partner-profile-detail-close:hover{background:rgba(255,255,255,.25)}

.partner-profile-detail-scroll{
 min-height:0;overflow:auto;
 padding:16px;
 background:#fff
}
.partner-profile-detail-loading{
 min-height:460px;
 display:flex;flex-direction:column;
 align-items:center;justify-content:center;
 gap:7px;text-align:center;color:var(--muted)
}
.partner-profile-detail-loading strong{color:var(--text);font-size:13px}
.partner-profile-detail-loading span{font-size:10px}
.partner-profile-detail-spinner{
 width:34px;height:34px;margin-bottom:6px;
 border-radius:999px;
 border:3px solid #e6ebf1;
 border-top-color:var(--secondary);
 animation:partner-profile-spin .75s linear infinite
}
@keyframes partner-profile-spin{to{transform:rotate(360deg)}}
.partner-profile-detail-error{
 min-height:300px;
 display:flex;flex-direction:column;
 justify-content:center;align-items:center;
 gap:5px;text-align:center;
 color:#991b1b
}
.partner-profile-detail-error strong{font-size:14px}
.partner-profile-detail-error span{max-width:600px;color:#6b2730;font-size:10px;line-height:1.5}

.partner-profile-performance-grid{
 display:grid;
 grid-template-columns:repeat(5,minmax(0,1fr));
 gap:9px;margin-bottom:12px
}
.partner-profile-performance-card{
 min-width:0;
 padding:11px 12px;
 border:1px solid var(--line);
 border-radius:11px;
 background:#f8fafc
}
.partner-profile-performance-card small,
.partner-profile-performance-card strong{display:block}
.partner-profile-performance-card small{
 color:var(--muted);
 font-size:calc(var(--body-size) - 3px);
 font-weight:800
}
.partner-profile-performance-card strong{
 margin-top:5px;
 color:var(--primary);
 font-size:calc(var(--heading-size) - 8px);
 line-height:1.15;
 font-variant-numeric:tabular-nums
}

.partner-profile-information-grid{
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:10px;margin-bottom:10px
}
.partner-profile-info-card{
 min-width:0;
 border:1px solid var(--line);
 border-radius:12px;
 background:#fff;
 padding:12px
}
.partner-profile-info-head{
 display:flex;align-items:center;justify-content:space-between;
 gap:8px;margin-bottom:8px
}
.partner-profile-info-head h3{
 margin:0;
 font-size:calc(var(--heading-size) - 10px)
}
.partner-profile-detail-lines{display:grid}
.partner-profile-detail-line{
 display:grid;
 grid-template-columns:150px minmax(0,1fr);
 gap:10px;align-items:center;
 min-height:39px;padding:7px 0;
 border-bottom:1px solid #edf1f5
}
.partner-profile-detail-line:last-child{border-bottom:0}
.partner-profile-detail-line>span{
 color:var(--muted);
 font-size:calc(var(--body-size) - 2px);
 font-weight:800
}
.partner-profile-detail-line>strong{
 min-width:0;color:var(--text);
 font-size:var(--body-size);
 line-height:1.4;overflow-wrap:anywhere
}
.partner-profile-detail-line a{
 color:var(--primary);
 text-decoration:none;
 border-bottom:1px solid color-mix(in srgb,var(--primary) 24%,transparent)
}
.partner-profile-detail-line a:hover{color:var(--secondary)}
.partner-profile-detail-line .partner-profile-header-category{
 display:inline-flex;align-items:center;gap:5px
}

.partner-profile-notes-card{margin-bottom:12px}
.partner-profile-notes-content{
 min-height:64px;padding:10px 11px;
 border-radius:9px;background:#f8fafc;
 color:#405069;font-size:var(--body-size);line-height:1.55;
 white-space:pre-wrap
}

.partner-profile-activity-section{
 margin-top:12px
}
.partner-profile-activity-head{
 display:flex;align-items:flex-end;justify-content:space-between;
 gap:10px;margin-bottom:7px
}
.partner-profile-activity-head h3{
 margin:0 0 2px;
 font-size:calc(var(--heading-size) - 10px)
}
.partner-profile-activity-head>div>span{
 color:var(--muted);
 font-size:calc(var(--body-size) - 3px)
}
.partner-profile-count-pill{
 display:inline-flex;align-items:center;justify-content:center;
 padding:5px 8px;border-radius:999px;
 background:color-mix(in srgb,var(--secondary) 11%,#fff);
 color:var(--primary);
 font-size:calc(var(--body-size) - 3px);
 font-weight:900;white-space:nowrap
}
.partner-profile-activity-table-wrap{border-radius:10px}
.partner-profile-activity-table{min-width:820px}
.partner-profile-activity-table th{
 background:#f7f9fc;color:var(--muted);
 font-size:calc(var(--body-size) - 3px);
 white-space:nowrap
}
.partner-profile-activity-table td{
 vertical-align:middle;
 font-size:calc(var(--body-size) - 2px)
}
.partner-profile-activity-table td strong{font-variant-numeric:tabular-nums}
.partner-profile-activity-table td small{
 display:block;margin-top:2px;
 color:var(--muted);font-size:calc(var(--body-size) - 4px)
}
.partner-profile-balance-due{color:#a35c12}
.partner-profile-payment-note{max-width:260px;line-height:1.4}

.partner-profile-detail-footer{
 display:flex;align-items:center;justify-content:space-between;
 gap:14px;
 padding:11px 16px;
 border-top:1px solid var(--line);
 background:#fff;
 box-shadow:0 -8px 24px rgba(15,23,42,.04)
}
.partner-profile-footer-context{
 max-width:570px;
 color:var(--muted);
 font-size:calc(var(--body-size) - 3px);
 line-height:1.4
}
.partner-profile-footer-actions{
 display:flex;align-items:center;justify-content:flex-end;
 gap:7px;flex-wrap:wrap
}
.partner-profile-footer-actions .btn{white-space:nowrap}

@media(max-width:1020px){
 .partner-profile-performance-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .partner-profile-information-grid{grid-template-columns:1fr}
}
@media(max-width:760px){
 .partner-profile-detail-modal{padding:0}
 .partner-profile-detail-shell{
  width:100vw;height:100vh;max-height:none;
  border:0;border-radius:0
 }
 .partner-profile-detail-header{
  grid-template-columns:48px minmax(0,1fr) 36px;
  padding:13px
 }
 .partner-profile-detail-avatar{width:48px;height:48px;border-radius:12px;font-size:19px}
 .partner-profile-detail-scroll{padding:12px}
 .partner-profile-performance-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .partner-profile-detail-footer{
  align-items:stretch;flex-direction:column;
  padding:10px 12px
 }
 .partner-profile-footer-actions{display:grid;grid-template-columns:1fr 1fr}
 .partner-profile-footer-actions .btn:last-child{grid-column:1/-1}
 .partner-profile-footer-actions .btn{width:100%}
}
@media(max-width:520px){
 .partner-profile-performance-grid{grid-template-columns:1fr}
 .partner-profile-detail-line{grid-template-columns:1fr;gap:3px}
 .partner-profile-activity-head{align-items:flex-start}
 .partner-profile-detail-meta{font-size:calc(var(--body-size) - 2px)}
}


/* ===== v32.7.3 Referral Form UI/UX Polish ===== */
.referral-form-notice{
 font-size:calc(var(--body-size) - 1px);
 line-height:1.5
}

.referral-money-input-wrap{
 position:relative;
 min-width:0
}
.referral-money-input-wrap input{
 width:100%
}
.referral-input-affix{
 position:absolute;
 top:50%;
 transform:translateY(-50%);
 z-index:1;
 color:var(--muted);
 font-size:var(--body-size);
 font-weight:900;
 pointer-events:none
}
.referral-input-affix.prefix{left:10px}
.referral-input-affix.suffix{right:10px}
.referral-input-with-prefix,
.referral-money-input-wrap.fee-flat #referralFeeValue{
 padding-left:30px
}
#referralFeeValueWrap:not(.fee-flat) #referralFeeValue{
 padding-right:30px
}
.referral-fee-field-help{
 display:block;
 margin-top:4px;
 color:var(--muted);
 font-size:calc(var(--body-size) - 4px);
 line-height:1.4
}

#referralSaveState.saving .draft-dot{
 background:var(--secondary);
 animation:referral-save-pulse 1s ease-in-out infinite
}
@keyframes referral-save-pulse{
 0%,100%{opacity:.45;transform:scale(.9)}
 50%{opacity:1;transform:scale(1.12)}
}

@media(max-width:680px){
 .referral-form-notice{padding:11px 12px}
}


/* ===== v32.7.4 Global Dialog UX & Referral Save Confirmation ===== */
body.dialog-open{overflow:hidden}

.app-dialog{
 z-index:30000;
 padding:18px;
 background:rgba(15,23,42,.48);
 backdrop-filter:blur(6px);
 animation:none
}
.app-dialog.open{display:flex}
.app-dialog-card{
 width:min(540px,100%);
 max-height:min(88vh,720px);
 display:grid;
 grid-template-rows:auto minmax(0,1fr) auto;
 overflow:hidden;
 border:1px solid #dce3eb;
 border-radius:16px;
 background:#fff;
 box-shadow:0 26px 80px rgba(15,23,42,.24);
 transform:translateY(8px) scale(.985);
 opacity:0;
 animation:app-dialog-in .18s ease forwards
}
@keyframes app-dialog-in{
 to{transform:translateY(0) scale(1);opacity:1}
}

.app-dialog-head,
.app-dialog-card.dialog-success .app-dialog-head,
.app-dialog-card.dialog-warning .app-dialog-head,
.app-dialog-card.dialog-danger .app-dialog-head,
.app-dialog-card.dialog-info .app-dialog-head,
.app-dialog-card.dialog-confirm .app-dialog-head,
.app-dialog-card.dialog-input .app-dialog-head{
 display:grid;
 grid-template-columns:42px minmax(0,1fr) 32px;
 align-items:center;
 gap:11px;
 padding:16px 17px 12px;
 background:#fff;
 color:var(--text);
 border-bottom:0
}
.app-dialog-icon{
 width:42px;height:42px;min-width:42px;
 display:grid;place-items:center;
 border-radius:12px;
 font-size:0;
 background:color-mix(in srgb,var(--secondary) 11%,#fff);
 color:var(--primary);
 border:1px solid color-mix(in srgb,var(--secondary) 18%,var(--line))
}
.app-dialog-icon svg{width:22px;height:22px}
.app-dialog-heading{min-width:0}
.app-dialog-head h3{
 margin:0;
 color:var(--text);
 font-size:calc(var(--heading-size) - 7px);
 line-height:1.2
}
.app-dialog-close{
 appearance:none;
 width:31px;height:31px;
 display:grid;place-items:center;
 border:0;border-radius:8px;
 background:#f1f4f7;
 color:#657187;
 font-size:20px;line-height:1;
 cursor:pointer
}
.app-dialog-close:hover{background:#e7ecf2;color:#263346}
.app-dialog-close[hidden]{display:none!important}

.app-dialog-card.dialog-success .app-dialog-icon{
 background:#e9f8ef;color:#177448;border-color:#c9ead4
}
.app-dialog-card.dialog-warning .app-dialog-icon{
 background:#fff6df;color:#9a6500;border-color:#efd8a1
}
.app-dialog-card.dialog-danger .app-dialog-icon{
 background:#fff0f1;color:#aa2733;border-color:#efc5ca
}
.app-dialog-card.dialog-confirm .app-dialog-icon,
.app-dialog-card.dialog-info .app-dialog-icon{
 background:color-mix(in srgb,var(--secondary) 11%,#fff);
 color:var(--primary);
 border-color:color-mix(in srgb,var(--secondary) 22%,var(--line))
}

.app-dialog-body{
 min-height:0;
 overflow:auto;
 padding:4px 17px 17px 70px
}
.app-dialog-reference{
 display:inline-flex;
 align-items:center;
 margin:0 0 7px;
 padding:4px 8px;
 border-radius:999px;
 background:#f1f5f9;
 color:var(--primary);
 font-size:calc(var(--body-size) - 2px);
 font-weight:900;
 letter-spacing:.01em
}
.app-dialog-reference[hidden]{display:none!important}
.app-dialog-message{
 margin:0;
 color:#526075;
 font-size:var(--body-size);
 line-height:1.6;
 white-space:pre-line
}

.app-dialog-actions{
 display:flex;
 justify-content:flex-end;
 align-items:center;
 gap:8px;
 flex-wrap:wrap;
 padding:11px 17px;
 border-top:1px solid #e7ecf1;
 background:#fafbfd
}
.app-dialog-actions .btn{
 min-width:90px;
 justify-content:center
}
.app-dialog-card.dialog-success .dialog-confirm-btn{
 background:var(--button-active-bg);
 color:var(--button-active-text)
}
.app-dialog-card.dialog-danger .dialog-confirm-btn{
 background:#b72f3b;
 color:#fff
}
.app-dialog-card.dialog-warning .dialog-confirm-btn{
 background:var(--button-active-bg);
 color:var(--button-active-text)
}
.app-dialog-card.dialog-info .dialog-confirm-btn,
.app-dialog-card.dialog-confirm .dialog-confirm-btn,
.app-dialog-card.dialog-input .dialog-confirm-btn{
 background:var(--button-active-bg);
 color:var(--button-active-text)
}
.app-dialog-actions .btn:hover{
 transform:translateY(-1px)
}

/* Referral Save → Records continuation */
.referral-row-highlight{
 position:relative;
 background:color-mix(in srgb,var(--secondary) 8%,#fff)!important;
 box-shadow:inset 3px 0 0 var(--secondary)
}
.referral-row-highlight-active{
 animation:referral-row-focus 2.1s ease
}
@keyframes referral-row-focus{
 0%,35%{background:color-mix(in srgb,var(--secondary) 20%,#fff)}
 100%{background:color-mix(in srgb,var(--secondary) 8%,#fff)}
}

@media(max-width:600px){
 .app-dialog{padding:12px}
 .app-dialog-card{width:100%;border-radius:14px}
 .app-dialog-head,
 .app-dialog-card.dialog-success .app-dialog-head,
 .app-dialog-card.dialog-warning .app-dialog-head,
 .app-dialog-card.dialog-danger .app-dialog-head,
 .app-dialog-card.dialog-info .app-dialog-head,
 .app-dialog-card.dialog-confirm .app-dialog-head,
 .app-dialog-card.dialog-input .app-dialog-head{
  grid-template-columns:38px minmax(0,1fr) 30px;
  padding:14px 14px 10px
 }
 .app-dialog-icon{width:38px;height:38px;min-width:38px}
 .app-dialog-icon svg{width:20px;height:20px}
 .app-dialog-body{padding:4px 14px 14px}
 .app-dialog-actions{
  display:grid;
  grid-template-columns:1fr;
  padding:10px 14px
 }
 .app-dialog-actions .btn{width:100%}
 .app-dialog-actions #dialogCancel{order:2}
 .app-dialog-actions #dialogConfirm{order:1}
}
@media(prefers-reduced-motion:reduce){
 .app-dialog-card,.referral-row-highlight-active{animation:none!important}
}


/* ===== v32.7.9 Reports Activation & Analytics ===== */
.reports-metric-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.report-date-field{display:grid;gap:4px;min-width:140px}
.report-date-field>span{font-size:8px;font-weight:900;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;padding-left:2px}
.report-date-field input{width:100%;min-width:140px}
.report-period-label{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.report-period-label strong{font-size:11px;color:var(--text)}
.report-period-label span{font-size:10px;color:var(--muted);font-weight:700}
#reportMessage.show{margin-top:10px}
.report-full-state{grid-column:1/-1}
.report-state{min-height:76px;display:grid;place-items:center;text-align:center;color:var(--muted);font-size:10px;line-height:1.55;padding:14px;border:1px dashed var(--line);border-radius:10px;background:#fafbfd}
.report-loading-card{opacity:.72}
.report-metric-card strong{font-variant-numeric:tabular-nums}
.report-bar-track i{min-width:0}.report-bar-track i.has-value{min-width:3px}
.trend-bars span i{min-width:0}.trend-bars span i.has-value{min-width:3px}
.trend-label{display:grid;gap:3px}.trend-label span{font-size:10px;font-weight:900;color:var(--text)}.trend-label small{font-size:8px;font-weight:700;color:var(--muted)}
#partnerReportBody small,#topReferralReportBody small,#overdueReportBody small,#paymentReportBody small{color:var(--muted);font-size:9px}
#partnerReportBody td,#topReferralReportBody td,#overdueReportBody td,#paymentReportBody td{vertical-align:middle}
@media(max-width:1250px){.reports-metric-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:900px){.reports-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.reports-metric-grid{grid-template-columns:1fr}.report-date-field,.report-date-field input{min-width:0;width:100%}}


/* ===== v32.8.0 Account Security Management ===== */
.security-current-session{display:flex;align-items:flex-start;gap:11px;padding:13px;border:1px solid var(--line);background:#f8fafc;border-radius:11px}
.security-session-icon{display:grid;place-items:center;width:28px;height:28px;flex:0 0 28px;border-radius:50%;background:#e8f7ef;color:#16794a;font-weight:950}
.security-current-session strong,.security-current-session small{display:block}.security-current-session strong{font-size:13px}.security-current-session small{margin-top:4px;color:var(--muted);font-size:11px;line-height:1.45}
.security-match-help.match{color:#16794a;font-weight:800}.security-match-help.mismatch{color:var(--danger);font-weight:800}
.security-activity-list{display:grid;gap:9px}
.security-activity-item{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:11px 12px;border:1px solid var(--line);border-radius:10px;background:#fafbfd}
.security-activity-item strong,.security-activity-item small{display:block}.security-activity-item strong{font-size:12px;text-transform:none}.security-activity-item small{margin-top:4px;color:var(--muted);font-size:10px;line-height:1.45}
.security-activity-item time{flex:0 0 auto;color:var(--muted);font-size:10px;text-align:right;white-space:nowrap}
#securityPasswordForm .actions,#security .security-settings-grid .actions{margin-top:14px}
@media(max-width:620px){.security-activity-item{display:block}.security-activity-item time{display:block;margin-top:7px;text-align:left;white-space:normal}}

/* ===== v32.8.1 Data Protection Center Activation & Recovery UX ===== */
#protection .protection-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
#protection .backup-history-actions{margin-top:0;justify-content:flex-end}
#protection .backup-history-note{margin-top:7px!important;padding-top:7px;border-top:1px dashed var(--line);line-height:1.45}
#protection .restore-vault-collapsible{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}
#protection .restore-vault-collapsible[hidden]{display:none!important}
#protection #restorePreviewSource span{display:block;margin-top:4px}
#protection .restore-preview-panel .storage-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
#protection #backupHistoryList>.empty{border:1px dashed var(--line);border-radius:11px;background:#fbfcfd}
#protection .backup-history-item .actions .btn{white-space:nowrap}
#protection #dataExportMessage.show{margin-top:12px}
@media(max-width:900px){
 #protection .restore-preview-panel .storage-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #protection .backup-history-actions{justify-content:flex-start}
}
@media(max-width:600px){
 #protection .restore-preview-panel .storage-grid{grid-template-columns:1fr}
}

/* ===== v32.8.2.2 Agent Access Hero Visibility Hotfix (v32.8.2.1 invite layout preserved) ===== */
#agents .agent-access-hero{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px 20px;border-radius:14px;background:var(--primary);background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 66%,var(--secondary)));color:#fff;box-shadow:0 10px 26px rgba(15,23,42,.09)}
#agents .agent-access-hero h2{margin:0 0 5px;font-size:22px;color:#fff}#agents .agent-access-hero p{margin:0;color:rgba(255,255,255,.86);font-size:12px}#agents .agent-access-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
#agents .agent-access-notice{margin-top:12px;border-left:4px solid var(--secondary)}
#agents .agent-access-top-grid{align-items:stretch}#agents .current-account-card{height:100%}
#agents .current-account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.current-account-item{padding:12px;border:1px solid var(--line);background:#f8fafc;border-radius:10px;min-width:0}.current-account-item small,.current-account-item strong{display:block}.current-account-item small{font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:800}.current-account-item strong{margin-top:5px;font-size:12px;overflow-wrap:anywhere}
#agents .welcome-invite-option{display:flex;align-items:flex-start;gap:11px;margin:13px 0;padding:13px 14px;border:1px solid #b9d7f2;background:#eef7ff;border-radius:11px;cursor:pointer;min-height:68px;text-align:left}
#agents .welcome-invite-option input[type="checkbox"]{width:16px!important;height:16px!important;min-width:16px!important;max-width:16px!important;flex:0 0 16px!important;margin:2px 0 0!important;padding:0!important;border-radius:3px;box-shadow:none}
#agents .welcome-invite-option>span{display:block;min-width:0;flex:1 1 auto;width:auto}
#agents .welcome-invite-option strong,#agents .welcome-invite-option small{display:block}
#agents .welcome-invite-option strong{font-size:11px;line-height:1.4;color:var(--text)}
#agents .welcome-invite-option small{margin-top:4px;color:var(--muted);font-size:9px;line-height:1.5}
#agents .agent-card-badges{display:flex;align-items:center;gap:7px;flex-wrap:wrap;justify-content:flex-end}
#agents .welcome-email-workspace{display:grid;grid-template-columns:minmax(390px,.9fr) minmax(400px,1.1fr);gap:18px;align-items:start}.welcome-email-editor{min-width:0}.welcome-email-preview-panel{min-width:0;position:sticky;top:18px}.welcome-variable-box{margin-top:12px}.welcome-test-row{display:grid;grid-template-columns:minmax(220px,340px) 1fr;gap:12px;align-items:end;margin-top:12px}.welcome-template-actions{margin-top:13px;flex-wrap:wrap}.welcome-template-actions .btn{white-space:nowrap}#welcomeEmailPreviewFrame{height:710px}
#agents .agent-access-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px}.agent-summary-card{padding:14px 15px;border:1px solid var(--line);background:#fff;border-radius:12px;box-shadow:0 5px 15px rgba(15,23,42,.035)}.agent-summary-card small,.agent-summary-card strong{display:block}.agent-summary-card small{font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:800}.agent-summary-card strong{margin-top:5px;font-size:22px;color:var(--primary)}
.welcome-status-pill{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:4px 8px;font-size:8px;font-weight:900;white-space:nowrap;border:1px solid transparent}.welcome-status-pill.not-requested{background:#f1f5f9;color:#64748b;border-color:#e2e8f0}.welcome-status-pill.scheduled{background:#eef7ff;color:#15548d;border-color:#bfd9ee}.welcome-status-pill.sent{background:#ecfdf3;color:#16794a;border-color:#bbf7d0}.welcome-status-pill.failed{background:#fef2f2;color:#b42318;border-color:#fecaca}
#agents .pending-invite-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap}#agents #pendingInvites .table-wrap{margin-top:4px}
.managed-welcome-box{padding:12px 13px;border:1px solid var(--line);background:#f8fafc;border-radius:10px}.managed-welcome-box>div{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:9px 12px}.managed-welcome-box strong{font-size:11px}.managed-welcome-box small{grid-column:2;color:var(--muted);font-size:9px}
@media(max-width:1050px){#agents .welcome-email-workspace{grid-template-columns:1fr}.welcome-email-preview-panel{position:static}#agents .agent-access-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){#agents .agent-access-hero{align-items:flex-start}#agents .current-account-grid{grid-template-columns:1fr}#agents .welcome-test-row{grid-template-columns:1fr}#agents .agent-access-summary-grid{grid-template-columns:1fr 1fr}}
@media(max-width:480px){#agents .agent-access-summary-grid{grid-template-columns:1fr}#agents .agent-card-badges{justify-content:flex-start}.managed-welcome-box>div{grid-template-columns:1fr}.managed-welcome-box small{grid-column:auto}}

/* ===== v32.8.3 Panel Settings Admin Control Center ===== */
#panelSettings .panel-settings-hero{
 display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 22px;border-radius:14px;
 background:var(--primary);background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 65%,var(--secondary)));
 color:#fff;box-shadow:0 10px 26px rgba(15,23,42,.09)
}
#panelSettings .panel-settings-hero h2{margin:0 0 5px;color:#fff;font-size:22px}
#panelSettings .panel-settings-hero p{margin:0;color:rgba(255,255,255,.84);font-size:12px;line-height:1.55;max-width:820px}
#panelSettings .panel-settings-hero .pill{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.25)}
#panelSettings .panel-settings-status-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
#panelSettings .panel-settings-status-card{padding:14px 15px;border:1px solid var(--line);border-radius:12px;background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.025)}
#panelSettings .panel-settings-status-card small,#panelSettings .panel-settings-status-card strong,#panelSettings .panel-settings-status-card span{display:block}
#panelSettings .panel-settings-status-card small{font-size:9px;text-transform:uppercase;letter-spacing:.055em;font-weight:900;color:var(--muted)}
#panelSettings .panel-settings-status-card strong{margin-top:7px;font-size:15px;color:var(--text)}
#panelSettings .panel-settings-status-card span{margin-top:4px;font-size:9px;line-height:1.4;color:var(--muted)}
#panelSettings .interface-density-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:12px}
#panelSettings .interface-density-option{position:relative;text-align:left;border:1px solid var(--line);border-radius:12px;background:#fff;padding:14px;cursor:pointer;color:var(--text);font:inherit;transition:.16s ease;min-height:148px}
#panelSettings .interface-density-option:hover{border-color:color-mix(in srgb,var(--primary) 42%,var(--line));box-shadow:0 7px 18px rgba(15,23,42,.055)}
#panelSettings .interface-density-option.active{border-color:var(--secondary);box-shadow:0 0 0 2px color-mix(in srgb,var(--secondary) 18%,transparent),0 7px 18px rgba(15,23,42,.05);background:color-mix(in srgb,var(--secondary) 3%,#fff)}
#panelSettings .interface-density-option strong,#panelSettings .interface-density-option small{display:block}
#panelSettings .interface-density-option strong{font-size:12px;margin-top:11px}
#panelSettings .interface-density-option small{font-size:9px;line-height:1.45;color:var(--muted);margin-top:4px}
#panelSettings .interface-density-option b{display:inline-block;margin-top:8px;padding:4px 7px;border-radius:999px;background:color-mix(in srgb,var(--secondary) 12%,#fff);color:var(--primary);font-size:8px}
#panelSettings .interface-density-preview{height:42px;border:1px solid #dbe3ec;border-radius:8px;padding:6px;display:grid;background:#f8fafc}
#panelSettings .interface-density-preview i{display:block;border-radius:3px;background:#dbe5ef}
#panelSettings .interface-density-preview.compact{gap:3px}.interface-density-preview.compact i{height:7px}
#panelSettings .interface-density-preview.classic{gap:5px}.interface-density-preview.classic i{height:8px}
#panelSettings .interface-density-preview.spacious{gap:7px}.interface-density-preview.spacious i{height:8px}
#panelSettings .email-delivery-summary{display:grid;grid-template-columns:1.25fr 1.1fr .8fr auto;gap:10px;align-items:stretch}
#panelSettings .email-delivery-summary>div{padding:12px 13px;border:1px solid var(--line);border-radius:10px;background:#f8fafc;min-width:0}
#panelSettings .email-delivery-summary small,#panelSettings .email-delivery-summary strong{display:block}
#panelSettings .email-delivery-summary small{font-size:8px;text-transform:uppercase;letter-spacing:.05em;font-weight:900;color:var(--muted)}
#panelSettings .email-delivery-summary strong{font-size:10px;line-height:1.45;margin-top:5px;overflow-wrap:anywhere}
#panelSettings .email-delivery-summary .email-delivery-summary-action{display:flex;align-items:center;justify-content:center;background:#fff}
#panelSettings .email-service-editor{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#fbfcfe}
#panelSettings .email-service-test-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,.9fr);gap:16px;align-items:center;margin-top:14px;padding:13px 14px;border:1px solid var(--line);border-radius:11px;background:#f8fafc}
#panelSettings .email-service-test-panel strong,#panelSettings .email-service-test-panel span{display:block}
#panelSettings .email-service-test-panel strong{font-size:11px}.email-service-test-panel span{font-size:9px;color:var(--muted);line-height:1.45;margin-top:3px}
#panelSettings .email-service-test-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
#panelSettings .dashboard-publish-summary{display:grid;grid-template-columns:1fr 1fr .8fr;gap:10px;margin-top:12px}
#panelSettings .dashboard-publish-summary>div{padding:12px 13px;border-radius:10px;background:#f8fafc;border:1px solid var(--line)}
#panelSettings .dashboard-publish-summary strong,#panelSettings .dashboard-publish-summary span{display:block}
#panelSettings .dashboard-publish-summary strong{font-size:10px}.dashboard-publish-summary span{font-size:9px;line-height:1.45;color:var(--muted);margin-top:3px}
#panelSettings .system-update-state-pill{display:inline-flex;align-items:center;padding:4px 7px;border-radius:999px;font-size:8px;font-weight:900;margin-left:7px;vertical-align:middle;background:#eef2f7;color:#566176}
#panelSettings .system-update-state-pill.live{background:#dcfce7;color:#166534}
#panelSettings .system-update-state-pill.scheduled{background:#dbeafe;color:#1d4ed8}
#panelSettings .system-update-state-pill.expired{background:#f1f5f9;color:#64748b}
#panelSettings .system-update-state-pill.inactive{background:#fef3c7;color:#92400e}
#panelSettings .system-update-state-pill.archived{background:#fee2e2;color:#991b1b}
@media(max-width:1000px){
 #panelSettings .panel-settings-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #panelSettings .email-delivery-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
 #panelSettings .email-service-test-panel{grid-template-columns:1fr}
}
@media(max-width:720px){
 #panelSettings .panel-settings-hero{align-items:flex-start;flex-direction:column}
 #panelSettings .interface-density-grid{grid-template-columns:1fr}
 #panelSettings .dashboard-publish-summary{grid-template-columns:1fr}
 #panelSettings .email-service-test-controls{grid-template-columns:1fr}
}
@media(max-width:520px){#panelSettings .panel-settings-status-grid,#panelSettings .email-delivery-summary{grid-template-columns:1fr}}


/* ===== v32.8.4 System Health & Integrity Center ===== */
.health-hero-secondary{
 background:rgba(255,255,255,.12)!important;color:#fff!important;border-color:rgba(255,255,255,.28)!important
}
.health-hero-secondary:hover{background:rgba(255,255,255,.2)!important}
.health-hero-secondary:disabled{opacity:.55;cursor:not-allowed}
.health-readonly-notice{border-color:color-mix(in srgb,var(--secondary) 36%,var(--line));background:color-mix(in srgb,var(--secondary) 7%,#fff)}
.health-summary-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.health-summary-grid .metric strong{font-size:21px;line-height:1.15}
.health-summary-grid .metric.health-good strong{color:#16794a}
.health-summary-grid .metric.health-warn strong{color:#9a6700}
.health-summary-grid .metric.health-bad strong{color:#b42318}
.health-recommended-card{border-color:#f2d9a4;background:linear-gradient(180deg,#fffdf8,#fff)}
.health-recommended-actions{display:grid;gap:9px}
.health-recommended-action{
 display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:11px;align-items:center;
 padding:11px 12px;border:1px solid var(--line);border-radius:11px;background:#fff
}
.health-recommended-action.warning{border-color:#f2d9a4}
.health-recommended-action.fail{border-color:#f2b8bd}
.health-recommended-action-icon{
 width:32px;height:32px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:900
}
.health-recommended-action.warning .health-recommended-action-icon{background:#fff4df;color:#8a5a00}
.health-recommended-action.fail .health-recommended-action-icon{background:#feecec;color:#b4232d}
.health-recommended-action strong,.health-recommended-action small{display:block}
.health-recommended-action strong{font-size:11px}.health-recommended-action small{margin-top:3px;color:var(--muted);font-size:9px;line-height:1.45}
.health-results-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.health-results-toolbar h3{margin:0 0 4px}
.health-view-toggle{display:flex;gap:6px;flex-wrap:wrap}
.health-view-toggle .btn.active{background:var(--primary);color:#fff;border-color:var(--primary)}
.health-result-meta{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin:12px 0 10px}
.health-empty-success{
 border:1px solid #bbf7d0;background:#ecfdf3;color:#166534;border-radius:12px;padding:16px;text-align:center;font-weight:800
}
.health-check-category-head{
 display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;background:#f8fafc;border-bottom:1px solid var(--line)
}
.health-check-category-head h4{padding:0!important;border:0!important;background:none!important}
.health-check-category-summary{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.health-category-count{font-size:8px;font-weight:900;border-radius:999px;padding:4px 7px;border:1px solid var(--line);background:#fff;color:var(--muted)}
.health-category-count.warning{background:#fff4df;color:#8a5a00;border-color:#ecd39e}
.health-category-count.fail{background:#feecec;color:#b4232d;border-color:#f4b9be}
.health-repair-card{overflow:hidden}
.health-repair-preview{margin-top:12px}
.health-repair-preview .table-wrap{margin-top:0}
.health-repair-preview table{min-width:700px}
.health-repair-preview td small{display:block;color:var(--muted);margin-top:3px}
.health-repair-password{max-width:520px}
.health-history-detail{border-color:color-mix(in srgb,var(--secondary) 32%,var(--line))}
.health-history-detail .health-check-category{box-shadow:none}
.health-history-view{white-space:nowrap}
.health-monitor-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.health-monitor-grid>div:last-child{grid-column:span 2}
.health-activity-item .health-activity-type{font-weight:800}
.health-status-dot{
 width:10px;height:10px;border-radius:50%;display:inline-block;margin-right:6px;vertical-align:middle;background:#94a3b8
}
.health-status-dot.pass{background:#22a06b}.health-status-dot.warning{background:#d69e2e}.health-status-dot.fail{background:#d64545}
@media(max-width:1250px){
 .health-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .health-monitor-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .health-monitor-grid>div:last-child{grid-column:auto}
}
@media(max-width:900px){
 .health-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .health-monitor-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .health-recommended-action{grid-template-columns:34px minmax(0,1fr)}
 .health-recommended-action .btn{grid-column:2;justify-self:start}
}
@media(max-width:650px){
 .health-summary-grid{grid-template-columns:1fr}
 .health-monitor-grid{grid-template-columns:1fr}
 .health-results-toolbar{flex-direction:column}
 .health-view-toggle,.health-view-toggle .btn{width:100%}
 .health-recommended-action{grid-template-columns:32px minmax(0,1fr)}
}

/* ===== v32.8.5 System Identity & Sidebar Branding ===== */
.brand-lockup{min-width:0}
.brand-lockup .brand-copy{min-width:0;flex:1 1 auto}
.brand-lockup strong{line-height:1.25;overflow-wrap:anywhere}
.brand-lockup small{display:block;margin-top:3px;line-height:1.3;overflow-wrap:anywhere}
.brand-lockup small[hidden]{display:none!important}
.brand-mark[data-mark-length="3"]{font-size:16px;letter-spacing:-.02em}
.brand-mark[data-mark-length="4"]{font-size:13px;letter-spacing:-.04em}

#panelSettings .panel-settings-status-grid{grid-template-columns:repeat(6,minmax(0,1fr))}
#panelSettings .panel-settings-status-card strong{overflow-wrap:anywhere}
#panelSettings .system-identity-workspace{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr);gap:18px;align-items:stretch;margin-top:12px}
#panelSettings .system-identity-fields{min-width:0}
#panelSettings .system-identity-preview-panel{min-width:0;padding:13px;border:1px solid var(--line);border-radius:12px;background:#f8fafc;display:flex;flex-direction:column}
#panelSettings .system-identity-preview-label{font-size:8px;font-weight:900;letter-spacing:.07em;color:var(--muted);margin-bottom:9px}
#panelSettings .system-identity-preview{display:flex;align-items:center;gap:13px;min-height:100px;padding:16px;border-radius:12px;background:var(--primary);background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--primary) 72%,#000));color:#fff;flex:1}
#panelSettings .system-identity-preview-mark{width:58px;height:58px;flex:0 0 58px;border-radius:15px;display:grid;place-items:center;background:var(--secondary);font-size:23px;font-weight:950;line-height:1}
#panelSettings .system-identity-preview-mark[data-mark-length="3"]{font-size:19px;letter-spacing:-.02em}
#panelSettings .system-identity-preview-mark[data-mark-length="4"]{font-size:15px;letter-spacing:-.04em}
#panelSettings .system-identity-preview-copy{min-width:0}
#panelSettings .system-identity-preview-copy strong,#panelSettings .system-identity-preview-copy small{display:block;overflow-wrap:anywhere}
#panelSettings .system-identity-preview-copy strong{font-size:17px;line-height:1.25;color:#fff}
#panelSettings .system-identity-preview-copy small{margin-top:6px;font-size:12px;line-height:1.3;color:rgba(255,255,255,.72)}
#panelSettings .system-identity-preview-copy small[hidden]{display:none!important}
#panelSettings .system-identity-scope-notice{border-left:4px solid var(--secondary)}
#panelSettings #systemIdentityMessage.show{margin-top:12px}
@media(max-width:1180px){#panelSettings .panel-settings-status-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:900px){#panelSettings .system-identity-workspace{grid-template-columns:1fr}#panelSettings .panel-settings-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){#panelSettings .panel-settings-status-grid{grid-template-columns:1fr}#panelSettings .system-identity-preview{align-items:flex-start}.brand-lockup strong{font-size:14px}}


/* ===== v32.8.7 Remote Update Agent / Deployment Visibility ===== */
#panelSettings .remote-update-card{overflow:hidden}
#panelSettings .remote-update-overview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px}
#panelSettings .remote-update-overview>div{padding:12px;border:1px solid var(--line);border-radius:10px;background:#f8fafc;min-width:0}
#panelSettings .remote-update-overview small,#panelSettings .remote-update-overview strong{display:block}
#panelSettings .remote-update-overview small{font-size:9px;text-transform:uppercase;letter-spacing:.05em;font-weight:900;color:var(--muted)}
#panelSettings .remote-update-overview strong{font-size:11px;margin-top:6px;color:var(--text);overflow-wrap:anywhere}
#panelSettings .remote-update-safety{line-height:1.55}
#panelSettings .remote-update-secret{margin-top:14px;padding:14px;border:1px solid #bbf7d0;background:#f0fdf4;border-radius:12px}
#panelSettings .remote-update-secret>div:first-child strong,#panelSettings .remote-update-secret>div:first-child span{display:block}
#panelSettings .remote-update-secret>div:first-child span{margin-top:4px;font-size:10px;color:#47615a;line-height:1.5}
#panelSettings .remote-update-secret-row{display:grid;grid-template-columns:1fr auto;gap:9px;margin-top:11px}
#panelSettings .remote-update-secret-row input{font-family:Consolas,monospace;font-size:11px;background:#fff}
#panelSettings .remote-update-actions{margin-top:14px;display:grid;grid-template-columns:minmax(260px,460px) 1fr;gap:14px;align-items:end}
#panelSettings .remote-update-actions .actions{justify-content:flex-end;margin:0}
#panelSettings .remote-update-password{margin:0}
@media(max-width:900px){#panelSettings .remote-update-overview{grid-template-columns:repeat(2,minmax(0,1fr))}#panelSettings .remote-update-actions{grid-template-columns:1fr}#panelSettings .remote-update-actions .actions{justify-content:flex-start}}
@media(max-width:520px){#panelSettings .remote-update-overview{grid-template-columns:1fr}#panelSettings .remote-update-secret-row{grid-template-columns:1fr}}

#panelSettings .remote-update-card .pill.remote-enabled{background:#ecfdf3;color:#166534;border-color:#bbf7d0}

/* ===== v32.9.1 Training Hub UX Refinement ===== */
.tutorial-top-button{position:relative;height:42px;padding:0 13px;border:1px solid #dbe4ee;border-radius:12px;background:#fff;color:var(--primary,#15548D);display:flex;align-items:center;gap:8px;font-weight:800;cursor:pointer;box-shadow:0 2px 8px rgba(15,23,42,.04)}.tutorial-top-button:hover{background:#f7fafc;border-color:#bfd0e2}.tutorial-top-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8}.tutorial-top-button b{position:absolute;right:-6px;top:-6px;min-width:19px;height:19px;padding:0 5px;border-radius:12px;background:#c2414a;color:#fff;font-size:10px;line-height:19px;text-align:center}.tutorial-eyebrow{display:inline-flex;text-transform:uppercase;letter-spacing:.08em;font-size:11px;font-weight:900;color:var(--primary,#15548D)}
.tutorial-hero,.tutorial-admin-hero{border-radius:18px;padding:26px 28px;background:linear-gradient(135deg,var(--primary,#15548D),var(--secondary,#468BCA));color:#fff;display:flex;align-items:center;justify-content:space-between;gap:24px;box-shadow:0 12px 30px rgba(21,84,141,.16)}.tutorial-hero .tutorial-eyebrow,.tutorial-admin-hero .tutorial-eyebrow{color:#dcecff}.tutorial-hero h2,.tutorial-admin-hero h2{font-size:30px;margin:5px 0 7px}.tutorial-hero p,.tutorial-admin-hero p{margin:0;opacity:.9;max-width:720px}.tutorial-progress-card{min-width:240px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.22);padding:15px 17px;border-radius:14px}.tutorial-progress-card span{font-size:11px;text-transform:uppercase;letter-spacing:.08em;opacity:.8}.tutorial-progress-card strong{display:block;margin:6px 0 10px}.tutorial-progress-track{height:7px;background:rgba(255,255,255,.22);border-radius:8px;overflow:hidden}.tutorial-progress-track i{display:block;height:100%;width:0;background:#fff;border-radius:8px;transition:width .25s}
.tutorial-toolbar{display:flex;align-items:center;gap:12px;justify-content:space-between;margin:18px 0}.tutorial-search{position:relative;flex:1;max-width:520px}.tutorial-search svg{position:absolute;left:13px;top:12px;width:18px;height:18px;fill:none;stroke:#708097;stroke-width:2}.tutorial-search input{padding-left:40px;height:43px}.tutorial-chips{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.tutorial-chip{border:1px solid #dce5ef;background:#fff;color:#4b5b70;border-radius:999px;padding:8px 12px;font-weight:800;font-size:12px;cursor:pointer}.tutorial-chip.active{background:var(--primary,#15548D);border-color:var(--primary,#15548D);color:#fff}.tutorial-section{margin-top:22px}.tutorial-section-head{display:flex;align-items:end;justify-content:space-between;margin-bottom:12px}.tutorial-section-head h3{margin:0 0 3px}.tutorial-section-head p{margin:0;color:#718096;font-size:13px}.tutorial-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.tutorial-card{background:#fff;border:1px solid #e0e7ef;border-radius:15px;overflow:hidden;box-shadow:0 4px 16px rgba(15,23,42,.04);cursor:pointer;transition:.18s transform,.18s box-shadow}.tutorial-card:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(15,23,42,.09)}.tutorial-thumb{aspect-ratio:16/9;background:linear-gradient(135deg,#e9f2fb,#dfe9f4);position:relative;display:flex;align-items:center;justify-content:center;background-size:cover;background-position:center}.tutorial-thumb-play{width:48px;height:48px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:rgba(21,84,141,.92);color:#fff;font-size:18px;box-shadow:0 6px 18px rgba(0,0,0,.18)}.tutorial-duration{position:absolute;right:9px;bottom:9px;background:rgba(17,24,39,.82);color:#fff;border-radius:6px;padding:4px 7px;font-size:11px;font-weight:800}.tutorial-badges{position:absolute;left:9px;top:9px;display:flex;gap:5px}.tutorial-badge{background:#fff;color:#15548D;border-radius:999px;padding:4px 7px;font-size:10px;font-weight:900;box-shadow:0 2px 8px rgba(0,0,0,.08)}.tutorial-card-body{padding:14px}.tutorial-card-meta{font-size:11px;font-weight:900;color:var(--primary,#15548D);text-transform:uppercase;letter-spacing:.05em}.tutorial-card h4{margin:5px 0 6px;font-size:16px;line-height:1.3}.tutorial-card p{margin:0;color:#6c788b;font-size:12px;line-height:1.5;min-height:36px}.tutorial-card-foot{display:flex;justify-content:space-between;align-items:center;margin-top:11px;padding-top:10px;border-top:1px solid #edf1f5;font-size:11px;color:#718096}.tutorial-status-completed{color:#16835b;font-weight:900}.tutorial-status-progress{color:#b06d12;font-weight:900}.tutorial-empty{text-align:center;padding:48px 20px;border:1px dashed #ccd8e5;background:#fff;border-radius:16px}.tutorial-empty-icon{width:58px;height:58px;border-radius:18px;background:#edf4fb;color:#15548D;display:grid;place-items:center;margin:0 auto 12px;font-size:20px}.tutorial-empty h3{margin:0 0 6px}.tutorial-empty p{margin:0;color:#718096}
.tutorial-viewer-modal,.tutorial-editor-modal{position:fixed;inset:0;background:rgba(10,18,29,.72);z-index:1300;display:none;align-items:center;justify-content:center;padding:22px}.tutorial-viewer-modal.open,.tutorial-editor-modal.open{display:flex}.tutorial-viewer-shell{width:min(1180px,96vw);max-height:92vh;background:#f6f8fb;border-radius:18px;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.28)}.tutorial-viewer-head,.tutorial-editor-head{padding:20px 22px;background:#fff;border-bottom:1px solid #e1e7ef;display:flex;justify-content:space-between;gap:20px}.tutorial-viewer-head h2,.tutorial-editor-head h2{margin:4px 0 4px}.tutorial-viewer-head p,.tutorial-editor-head p{margin:0;color:#68758a}.tutorial-viewer-close{border:0;background:#eef2f6;color:#39485d;width:36px;height:36px;border-radius:10px;font-size:24px;cursor:pointer}.tutorial-viewer-body{display:grid;grid-template-columns:minmax(0,1fr) 330px;max-height:calc(92vh - 100px);overflow:auto}.tutorial-player-column{padding:20px}.tutorial-player-frame{aspect-ratio:16/9;background:#0b1018;border-radius:14px;overflow:hidden;box-shadow:0 10px 25px rgba(0,0,0,.15)}.tutorial-player-frame iframe{width:100%;height:100%;border:0}.tutorial-learning-card{margin-top:15px;background:#fff;border:1px solid #e0e7ef;border-radius:14px;padding:16px}.tutorial-learning-head{display:flex;justify-content:space-between;align-items:center}.tutorial-learning-card h3{margin:0}.tutorial-learning-card ul{margin:12px 0 0;padding-left:20px;color:#536175;line-height:1.7}.tutorial-playlist{background:#fff;border-left:1px solid #e0e7ef}.tutorial-playlist-head{padding:16px;border-bottom:1px solid #e8edf3;display:flex;justify-content:space-between}.tutorial-playlist-item{padding:13px 15px;border-bottom:1px solid #edf1f5;cursor:pointer;display:flex;gap:10px}.tutorial-playlist-item:hover,.tutorial-playlist-item.active{background:#f0f6fc}.tutorial-playlist-num{width:26px;height:26px;border-radius:8px;background:#e8f1fa;color:#15548D;display:grid;place-items:center;font-size:11px;font-weight:900;flex:none}.tutorial-playlist-item strong{font-size:12px;display:block}.tutorial-playlist-item span{font-size:10px;color:#778398}.tutorial-editor-shell{width:min(900px,96vw);max-height:92vh;background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.28)}.tutorial-editor-body{padding:20px;overflow:auto;max-height:calc(92vh - 150px)}.tutorial-editor-foot{padding:14px 20px;border-top:1px solid #e1e7ef;display:flex;justify-content:flex-end;gap:9px}.tutorial-toggle-field{display:flex;align-items:center;gap:18px}.tutorial-toggle-field label{display:flex;gap:7px;align-items:center}.tutorial-toggle-field input{width:auto}.tutorial-thumbnail-upload{display:flex;gap:12px;align-items:center}.tutorial-thumbnail-preview{width:190px;aspect-ratio:16/9;background:#f0f4f8;border:1px dashed #bfcddd;border-radius:10px;display:grid;place-items:center;color:#728096;font-size:11px;background-size:cover;background-position:center}.tutorial-admin-grid{align-items:start}.tutorial-admin-list,.tutorial-category-admin-list{display:flex;flex-direction:column;gap:9px;margin-top:12px}.tutorial-admin-row,.tutorial-category-admin-row{border:1px solid #e2e8f0;border-radius:12px;padding:12px;display:flex;align-items:center;justify-content:space-between;gap:12px}.tutorial-admin-row-main strong,.tutorial-category-admin-row-main strong{display:block}.tutorial-admin-row-main span,.tutorial-category-admin-row-main span{font-size:11px;color:#728096}.tutorial-admin-actions{display:flex;gap:6px;flex-wrap:wrap}.tutorial-status-pill{padding:4px 7px;border-radius:999px;font-size:10px;font-weight:900;text-transform:uppercase;background:#edf2f7;color:#5d6877}.tutorial-status-pill.published{background:#e7f7ef;color:#157347}.tutorial-status-pill.draft{background:#fff5dd;color:#96620d}.tutorial-status-pill.archived{background:#f1f3f5;color:#7a828d}
@media(max-width:980px){.tutorial-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.tutorial-viewer-body{grid-template-columns:1fr}.tutorial-playlist{border-left:0;border-top:1px solid #e0e7ef}.tutorial-hero,.tutorial-admin-hero{align-items:flex-start}.tutorial-progress-card{min-width:210px}}@media(max-width:700px){.tutorial-top-button span{display:none}.tutorial-top-button{width:42px;padding:0;justify-content:center}.tutorial-hero,.tutorial-admin-hero{flex-direction:column;padding:20px}.tutorial-progress-card{width:100%}.tutorial-toolbar{align-items:stretch;flex-direction:column}.tutorial-chips{justify-content:flex-start;overflow:auto;flex-wrap:nowrap}.tutorial-grid{grid-template-columns:1fr}.tutorial-viewer-modal,.tutorial-editor-modal{padding:8px}.tutorial-player-column{padding:10px}.tutorial-viewer-head,.tutorial-editor-head{padding:15px}.tutorial-admin-row,.tutorial-category-admin-row{align-items:flex-start;flex-direction:column}}

/* ===== v32.9.2 Secure Partner Platform SSO Bridge ===== */
#panelSettings .sso-integration-card .pill.remote-enabled{background:#ecfdf3;color:#166534;border-color:#bbf7d0}.sso-toolbar{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:18px 0 12px}.sso-toolbar>div strong,.sso-toolbar>div span{display:block}.sso-toolbar>div span{font-size:12px;color:#718096;margin-top:3px}.sso-integration-list{display:flex;flex-direction:column;gap:10px}.sso-integration-row{border:1px solid #e0e7ef;background:#fff;border-radius:13px;padding:14px 15px;display:flex;justify-content:space-between;gap:18px;align-items:center}.sso-integration-main{min-width:0}.sso-integration-heading{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.sso-integration-main code{display:block;width:max-content;max-width:100%;margin:6px 0 5px;padding:3px 7px;border-radius:6px;background:#f1f5f9;color:#31465f;font-size:11px;overflow:hidden;text-overflow:ellipsis}.sso-integration-main>span,.sso-integration-main>small{display:block;color:#708096;font-size:11px;line-height:1.55}.sso-integration-actions{display:flex;gap:7px;flex:none}.sso-empty{border:1px dashed #cbd8e6;background:#f8fbfe;border-radius:13px;padding:25px;text-align:center}.sso-empty strong,.sso-empty span{display:block}.sso-empty span{margin-top:5px;color:#718096;font-size:12px}.sso-integration-editor{margin-top:18px;padding:18px;border:1px solid #d9e4ef;background:#f9fbfd;border-radius:14px}.sso-editor-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:15px}.sso-editor-head h4{margin:0 0 4px}.sso-checkbox-field{justify-content:center}.sso-checkbox-field label{display:flex;align-items:center;gap:8px;font-size:12px}.sso-checkbox-field input{width:auto}.sso-view-help{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:14px;padding-top:13px;border-top:1px solid #e1e8f0}.sso-view-help strong{font-size:11px;margin-right:4px}.sso-view-help code{font-size:10px;background:#edf3f8;border:1px solid #d9e4ef;border-radius:6px;padding:4px 6px;color:#3e536c}.sso-safety{background:#f5f9fd}.sso-integration-card .remote-update-secret{margin-top:14px}
@media(max-width:760px){.sso-toolbar,.sso-integration-row,.sso-editor-head{align-items:stretch;flex-direction:column}.sso-integration-actions{width:100%}.sso-integration-actions .btn{flex:1}}



/* ===== v32.9.3 Admin Impersonation & Support Access ===== */
.impersonation-banner{
 position:sticky;top:0;z-index:1200;display:flex;align-items:center;gap:14px;
 margin:-25px -25px 20px;padding:11px 18px;background:#172033;color:#fff;
 border-bottom:3px solid #d7a72e;box-shadow:0 8px 24px rgba(15,23,42,.18)
}
.impersonation-banner[hidden]{display:none!important}
.impersonation-banner-icon{display:grid;place-items:center;min-width:68px;height:34px;padding:0 9px;border:1px solid rgba(255,255,255,.28);border-radius:8px;background:rgba(255,255,255,.1);font-size:10px;font-weight:950;letter-spacing:.08em}
.impersonation-banner-copy{min-width:0;display:flex;flex-direction:column;gap:2px;flex:1}.impersonation-banner-copy strong{font-size:13px}.impersonation-banner-copy span{font-size:11px;color:rgba(255,255,255,.84)}.impersonation-banner-copy small{font-size:10px;color:rgba(255,255,255,.64);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.impersonation-banner-actions{display:flex;align-items:center;gap:10px}.impersonation-countdown{font-size:11px;font-weight:900;color:#fde68a;white-space:nowrap}.impersonation-banner .btn{background:#fff;color:#172033;border-color:#fff;white-space:nowrap}
body.impersonating-agent .version-pill{outline:2px solid #d7a72e;outline-offset:1px}
.support-access-section{border-color:#cbd5e1;background:linear-gradient(180deg,#fbfdff,#f8fafc)}
.support-session-limit{display:inline-flex;padding:5px 8px;border-radius:999px;background:#fff7ed;color:#9a3412;border:1px solid #fed7aa;font-size:10px;font-weight:900;white-space:nowrap}
.support-eligibility{margin:0 0 12px;padding:10px 12px;border:1px solid #dbe5ef;border-radius:10px;background:#fff;font-size:11px;line-height:1.55;color:var(--muted)}
.support-eligibility strong{color:var(--text)}.support-eligibility.warning{background:#fffbeb;border-color:#fde68a;color:#92400e}.support-eligibility.blocked{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.support-access-fields{align-items:end}.support-mode-actions{display:flex;gap:8px;align-items:flex-end;justify-content:flex-start;min-height:40px}
.support-mode-guide{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.support-mode-guide>div{padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:#fff}.support-mode-guide strong,.support-mode-guide span{display:block}.support-mode-guide strong{font-size:11px;margin-bottom:3px}.support-mode-guide span{font-size:10px;color:var(--muted);line-height:1.45}
.support-history-list{margin-top:12px;display:flex;flex-direction:column;gap:7px}.support-history-item{display:grid;grid-template-columns:110px minmax(160px,1fr) 100px;gap:10px;align-items:center;padding:9px 10px;border:1px solid var(--line);border-radius:9px;background:#fff}.support-history-item strong{font-size:10px}.support-history-item span,.support-history-item small{font-size:10px;color:var(--muted)}.support-history-item small{text-align:right}
.managed-activity-list{display:flex;flex-direction:column;gap:7px;max-height:360px;overflow:auto}.managed-activity-item{display:grid;grid-template-columns:130px minmax(0,1fr) 145px;gap:10px;padding:9px 10px;border:1px solid var(--line);border-radius:9px;background:#f8fafc}.managed-activity-item strong{font-size:10px}.managed-activity-item span{font-size:10px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.managed-activity-item small{font-size:10px;color:var(--muted);text-align:right}
body.impersonation-view-only .impersonation-banner{border-bottom-color:#f59e0b}
@media(max-width:850px){.impersonation-banner{margin:-11px -11px 14px;align-items:flex-start;flex-wrap:wrap}.impersonation-banner-copy{min-width:200px}.impersonation-banner-actions{width:100%;justify-content:space-between}.support-mode-guide{grid-template-columns:1fr}.support-history-item,.managed-activity-item{grid-template-columns:1fr}.support-history-item small,.managed-activity-item small{text-align:left}}
