/* H-Control v11.3.0 — common workspace layout and controls.
   Loaded last to reconcile earlier theme layers. Keep specialised widgets local. */
:root{
  --hc-gap:16px; --hc-radius:14px; --hc-control:42px;
  --hc-page-padding:clamp(16px,2vw,28px);
  --hc-focus:color-mix(in srgb,var(--ui-accent) 26%,transparent);
  --hc-placeholder:#a39b94;
  --hc-table-head:#211e1e;
  --hc-row-hover:#242120;
}
html[data-scheme="dark"]{color-scheme:dark}
html[data-scheme="light"]{
  color-scheme:light;
  --hc-placeholder:#70675f;
  --hc-table-head:#eeeae6;
  --hc-row-hover:#f0ece7;
}
/* The topbar and body use the same content edges in all workspaces. */
.lc-layout:is(.lc-width-standard,.lc-width-wide,.lc-width-fluid){--lc-page-max:1680px}
.lc-layout .lc-topbar{padding-inline:var(--hc-page-padding)!important}
.lc-layout .lc-top-inner{max-width:calc(var(--lc-page-max) - var(--hc-page-padding) - var(--hc-page-padding))}
.lc-layout .lc-main>.page{box-sizing:border-box;min-width:0;padding-inline:var(--hc-page-padding)!important}
#page .rv{max-width:100%;min-width:0;margin-inline:0}
#page :is(.crm-dx,.rv-grid2,.cc-two-col,.form-grid) > *{min-width:0}
#page :is(.hero,.cc-page-head,.export-hero,.review-stats-hero,.info-simple-hero,.page-head):not(.dashboard-hero){padding:0!important;margin:0 0 var(--hc-gap)!important;gap:12px 16px;align-items:flex-end}
#page .rv-head{gap:12px 16px}
#page :is(.hero,.cc-page-head,.export-hero,.review-stats-hero,.info-simple-hero,.page-head) h2,#page .rv-head h1{
  font-size:clamp(22px,2.2vw,28px)!important;line-height:1.25!important;letter-spacing:-.015em!important;font-weight:700!important;overflow-wrap:anywhere;
}
#page :is(.hero,.cc-page-head,.export-hero,.review-stats-hero,.info-simple-hero,.page-head) p,#page .rv-head p{font-size:14px!important;line-height:1.55!important;margin-top:6px!important}
#page :is(.card,.cc-panel,.rv-card){border-radius:var(--hc-radius)!important;min-width:0}
#page :is(.card-head,.cc-panel-head,.rv-card>header){gap:10px 16px;flex-wrap:wrap}
#page :is(.card-head,.cc-panel-head) > div{min-width:0}
#page :is(.card-head,.cc-panel-head) h3,#page .rv-card>header :is(h2,h3){font-size:16px!important;line-height:1.4!important;overflow-wrap:anywhere}
#page :is(.card,.cc-panel)+:is(.card,.cc-panel){margin-top:var(--hc-gap)}
#page :is(.grid.cards,.cc-stat-grid){margin-bottom:var(--hc-gap)!important}
/* Form controls. Explicitly exclude checkboxes, radios, file pickers and colour swatches. */
html[data-scheme] :is(#page,.modal) :is(input.input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden]),select,.textarea,textarea){
  box-sizing:border-box;min-width:0;max-width:100%;min-height:var(--hc-control);
  background:var(--ui-field)!important;color:var(--ui-text)!important;border:1px solid var(--ui-field-line)!important;
  border-radius:10px!important;font-family:var(--lc-font)!important;font-size:14px!important;line-height:1.5!important;
}
html[data-scheme] :is(#page,.modal) :is(input.input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden]),select){padding:8px 12px!important}
html[data-scheme] :is(#page,.modal) :is(textarea,.textarea){padding:11px 13px!important;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;min-height:88px;line-height:1.65!important}
html[data-scheme] :is(#page,.modal) :is(input.input,textarea)::placeholder{color:var(--hc-placeholder)!important;opacity:1}
html[data-scheme] :is(#page,.modal) :is(input.input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden]),select,textarea):focus{
  border-color:var(--ui-accent)!important;box-shadow:0 0 0 3px var(--hc-focus)!important;outline:none!important;
}
:is(#page,.modal) :is(input[type=checkbox],input[type=radio]){accent-color:var(--ui-accent);flex-shrink:0}
:is(#page,.modal) .field{min-width:0;gap:6px}
:is(#page,.modal) .field>label{line-height:1.4;margin-bottom:0}
:is(#page,.modal) .form-grid{gap:12px 16px}
:is(#page,.modal) .form-grid>.field{margin-bottom:4px}
:is(#page,.modal) :is(.field,.form-grid)[hidden]{display:none!important}
/* Keep compact actions compact; only unify standard buttons. */
:is(#page,.modal) .btn:not(.small):not(.xs){min-height:var(--hc-control);line-height:1.35}
:is(#page,.modal) .btn:disabled{cursor:not-allowed}
#page .rv-tabs button{border-radius:10px;min-height:36px}
#page :is(.cc-head-actions,.rv-head-act,.card-head .actions,.modal-actions){max-width:100%;flex-wrap:wrap;gap:8px}
/* Dense tables retain their natural minimum width and scroll inside the panel. */
#page .table-wrap,.modal .table-wrap{max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-inline:contain;border-radius:10px;scrollbar-width:thin}
html[data-scheme] :is(#page,.modal) .table th{background:var(--hc-table-head)!important;color:var(--ui-muted)!important;font-size:12px!important;line-height:1.4}
:is(#page,.modal) .table td{line-height:1.45;vertical-align:middle}
:is(#page,.modal) .table :is(th,td){border-color:var(--ui-line)!important}
html[data-scheme] :is(#page,.modal) .table tbody tr:hover>td{background-color:var(--hc-row-hover)}
#page .hc-month-table th:nth-last-child(2),#page .hc-month-table th:nth-last-child(3),#page .hc-month-table th:nth-last-child(4),#page .hc-month-table td.hc-num{text-align:right}
:is(#page,.modal) :is(.cc-empty,.rv-empty){line-height:1.55;overflow-wrap:anywhere}
/* Dialogs: consistent outer chrome, without overriding specialized dossier sizes. */
.modal-backdrop .modal{max-width:100%;max-height:calc(100dvh - 32px);overscroll-behavior:contain}
.modal-head h3{line-height:1.35;overflow-wrap:anywhere}
.modal-actions{flex-wrap:wrap;gap:8px}
.modal-actions.split>div{flex-wrap:wrap;min-width:0}
@media(max-width:760px){
  :root{--hc-gap:12px;--hc-page-padding:12px}
  #page :is(.hero,.cc-page-head,.export-hero,.review-stats-hero,.info-simple-hero,.page-head):not(.dashboard-hero)>div:first-child{flex:0 1 auto;width:100%}
  #page :is(.hero,.cc-page-head,.export-hero,.review-stats-hero,.info-simple-hero,.page-head):not(.dashboard-hero){align-items:flex-start}
  #page .rv-grid2{grid-template-columns:minmax(0,1fr)}
  :is(#page,.modal) .form-grid{grid-template-columns:minmax(0,1fr)}
  :is(#page,.modal) .form-grid>.span-2{grid-column:1/-1}
  html[data-scheme] :is(#page,.modal) :is(input.input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden]),select,textarea){font-size:16px!important}
  .modal-backdrop .modal{max-height:calc(100dvh - 16px)}
  #page .crm-workspace .crm-filters .input{min-width:0;width:100%;max-width:none}
}
@media(max-width:380px){
  #page .crm-workspace .crm-advanced{grid-template-columns:minmax(0,1fr)}
}

/* v12.0.1 — user management: scoped layout, no global button overrides. */
#page .pj-users-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin:0 0 18px}
#page .pj-users-toolbar .pj-users-tabs{margin:0}
#page .pj-users-toolbar .btn{flex:none}
#page .pj-users-filters{display:grid;grid-template-columns:minmax(180px,1.15fr) minmax(145px,.8fr) minmax(200px,1fr) auto auto;align-items:center;gap:12px;margin-bottom:20px}
#page .pj-users-filters :is(.input,.select){width:100%;max-width:none;min-width:0}
#page .pj-users-filters .pj-seg{justify-self:start}
#page .pj-users-panel .pj-person{padding:14px 16px;gap:14px}
#page .pj-users-panel .pj-person-roles{gap:8px}
#page .pj-users-panel .pj-person-main small{white-space:normal;overflow-wrap:anywhere;line-height:1.45}
#page .pj-users-panel .pj-person-roles em{white-space:normal;line-height:1.4;overflow-wrap:anywhere}
#page .pj-users-panel .pj-person-roles em i{flex:none}
#page .pj-identity-panel #identityStatus{font-size:13px;line-height:1.5;color:var(--ui-muted);margin:0 0 16px}
#page .pj-identity-panel #identityContent{display:flex;flex-direction:column;gap:18px;min-width:0}
#page .pj-identity-panel .cc-stat-grid{margin:0!important}
#page .pj-identity-panel .pj-identity-note{max-width:none;margin:0;line-height:1.65}
#page .pj-identity-actions,#page .pj-identity-filter,#page .pj-identity-search,#page .pj-identity-pagination{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
#page .pj-identity-filter{border-top:1px solid var(--ui-line);padding-top:18px;justify-content:space-between}
#page .pj-identity-search{flex:1 1 340px;justify-content:flex-end;margin:0}
#page .pj-identity-search .input{flex:1 1 160px;width:auto;min-width:0;max-width:420px}
#page .pj-identity-pagination{justify-content:flex-end}
#page .pj-identity-pagination span{margin-right:auto;color:var(--ui-muted);font-size:13px}
#page .pj-identity-panel .pj-people{gap:16px}
#page .pj-identity-panel .pj-people>.cc-panel{margin:0!important}
.modal.pj-account-v12{width:min(100%,1000px);padding:24px!important}
.pj-account-v12 .pj-account-title{display:flex;align-items:center;gap:14px;padding-bottom:18px;margin:0 0 18px;border-bottom:1px solid var(--ui-line)}
.pj-account-v12 .pj-account-title .pj-person-av{width:54px;height:54px;font-size:20px;flex:none}
.pj-account-v12 .pj-account-title>div{flex:1;min-width:0}
.pj-account-v12 .pj-account-title h3{font-size:24px!important;margin:4px 0 8px}
.pj-account-v12 .pj-account-title .icon-btn{align-self:flex-start;flex:none;margin-left:auto}
.pj-account-v12 #pjAccSecret:empty{display:none}
.pj-account-v12 .pj-account-meta{display:flex;flex-wrap:wrap;align-items:flex-start;gap:16px 28px;padding:16px 18px;background:var(--ui-card);border:1px solid var(--ui-line);border-radius:12px;margin-bottom:22px}
.pj-account-v12 .pj-account-meta>div{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere}
.pj-account-v12 .pj-account-meta small{color:var(--ui-muted);font-size:12px}
.pj-account-v12 .pj-account-security{margin-left:auto;max-width:100%;min-width:0}
.pj-account-v12 .pj-account-security summary{cursor:pointer;font-size:13px;padding:6px 0;color:var(--ui-text-2);font-weight:600}
.pj-account-v12 .pj-account-security>div{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.pj-account-v12 .pj-account-sections{display:grid;gap:16px}
.pj-account-v12 .pj-account-section{border:1px solid var(--ui-line);border-radius:14px;padding:16px;background:var(--ui-card);min-width:0;display:grid;gap:12px}
.pj-account-v12 .pj-account-section>header{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.pj-account-v12 .pj-account-section h4{margin:0;font-size:15px;font-weight:700;line-height:1.4}
.pj-account-v12 .pj-section-count{font-size:12px;color:var(--ui-muted);min-width:24px;text-align:center;border:1px solid var(--ui-line-2);border-radius:8px;padding:3px 7px;font-variant-numeric:tabular-nums}
.pj-account-v12 .pj-account-empty{margin:0;color:var(--ui-muted);font-size:13px;padding:2px 0 4px}
.pj-account-v12 .pj-assignment{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:14px;background:var(--ui-panel);border:1px solid var(--ui-line);border-radius:10px}
.pj-account-v12 .pj-assignment.is-off{opacity:1;border-style:dashed}
.pj-account-v12 .pj-assignment-info{display:grid;gap:6px;min-width:0;overflow-wrap:anywhere}
.pj-account-v12 .pj-assignment-info strong{font-size:14px;font-weight:600;line-height:1.4}
.pj-account-v12 .pj-assignment-info .pj-mem-srv{flex-wrap:wrap;gap:8px;font-size:12px;color:var(--ui-muted)}
.pj-account-v12 .pj-assignment-actions,.pj-account-v12 .pj-assignment-edit-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end;align-items:center}
.pj-account-v12 .pj-assignment-edit{grid-column:1/-1;display:grid;gap:10px;padding-top:14px;border-top:1px solid var(--ui-line)}
.pj-account-v12 .pj-assignment-edit[hidden],.pj-account-v12 [data-acc-save][hidden]{display:none!important}
.pj-account-v12 .pj-assignment-edit label{font-size:12px;color:var(--ui-muted)}
.pj-account-v12 .pj-assignment-edit .pj-mem-role{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:12px}
.pj-account-v12 .pj-assignment-edit .select{width:100%;min-width:0}
.pj-account-v12 .pj-assignment-edit [data-acc-org-wrap]:empty{display:none}
.pj-account-v12 .pj-special-assignment{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.pj-account-v12 .pj-special-assignment>div{display:grid;gap:6px;min-width:0;overflow-wrap:anywhere}
.pj-account-v12 .pj-account-history{margin-top:16px}
.pj-account-v12 [data-acc-history]:empty{display:none}
.pj-account-v12 .pj-account-footer{display:flex;justify-content:space-between;gap:12px;padding-top:18px;margin:22px 0 0;border-top:1px solid var(--ui-line)}
.modal.pj-grant-modal #pjGrantForm{gap:16px 20px}
.modal.pj-grant-modal #pjGrantForm [data-grant-org]:empty{display:none}
.modal.pj-grant-modal .pj-grant-status{padding:14px;background:var(--ui-card);border:1px solid var(--ui-line);border-radius:10px;line-height:1.5;min-height:50px}
.modal.pj-grant-modal .pj-grant-actions{gap:12px;flex-wrap:wrap;justify-content:flex-end;margin-top:8px}
@media(max-width:1400px){#page .pj-users-filters{grid-template-columns:repeat(3,minmax(0,1fr))}#page .pj-users-filters .pj-seg{grid-column:1/3}#page .pj-users-filters>.muted{justify-self:end}}
@media(max-width:760px){#page .pj-users-filters{grid-template-columns:minmax(0,1fr)}#page .pj-users-filters .pj-seg{grid-column:auto;justify-self:stretch;flex-wrap:wrap}#page .pj-users-filters>.muted{justify-self:start}#page .pj-identity-filter,#page .pj-identity-search{justify-content:flex-start;width:100%}#page .pj-identity-search{flex-basis:auto}#page .pj-identity-search .input{max-width:none} .modal.pj-account-v12{padding:16px!important}.pj-account-v12 .pj-account-title h3{font-size:20px!important}.pj-account-v12 .pj-account-meta{padding:12px;gap:12px 20px}.pj-account-v12 .pj-account-security{margin-left:0;width:100%}.pj-account-v12 .pj-assignment{grid-template-columns:1fr;padding:12px}.pj-account-v12 .pj-assignment-actions{justify-content:flex-start}.pj-account-v12 .pj-account-section{padding:12px}.pj-account-v12 .pj-account-footer .btn{flex:1 1 auto}}

/* 12.0.2 — explicit identity review */
#page #idLinkPanel{margin:16px 0;padding:18px;display:grid;gap:14px}
#page #idLinkPanel h3,#page #idLinkPanel h4{margin:0}
#page #idLinkForm{display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px}
#page #idLinkForm label{flex:1 1 180px;display:grid;gap:6px}
#page #idLinkPreview{display:grid;gap:12px;min-width:0}
#page #idLinkPreview:empty{display:none}
#page #idLinkPreview label{display:grid;gap:6px}
#page #idLinkPreview textarea{width:100%;min-height:88px}
#page #idLinkError{color:var(--danger,#e77979)}

/* v12.0.5 — contain account history and identity dialogs */
.modal.pj-account-v12{min-width:0;max-width:100%;overflow-x:hidden}
.pj-account-v12 .pj-account-section,.pj-account-v12 .pj-account-sections,.pj-person-v12 [data-person-content]{grid-template-columns:minmax(0,1fr);min-width:0;max-width:100%}
.pj-account-v12 [data-acc-history]{min-width:0;max-width:100%}
.pj-account-v12 .pj-account-history-table .table{min-width:0;width:100%;table-layout:fixed}
.pj-account-v12 .pj-account-history-table :is(th,td){white-space:normal!important;overflow-wrap:anywhere}
.pj-account-v12 .pj-account-history-table th:first-child{width:16%}
.pj-account-v12 .pj-account-history-table th:last-child{width:30%}
.pj-person-v12 [data-person-content]{display:grid;gap:14px}
.pj-person-v12 .pj-identity-card{margin:0}
.pj-person-v12 .pj-person-summary h4{font-size:20px;color:var(--accent)}
.pj-person-v12 .pj-person-note{margin:0;max-width:none;width:auto;font-size:13px;color:var(--ui-muted);line-height:1.55;overflow-wrap:anywhere}
.pj-person-v12 .pj-person-current{margin:0;font-weight:600;overflow-wrap:anywhere}
.pj-person-v12 [data-display-name-form]{min-width:0;grid-template-columns:minmax(0,1fr);gap:12px}
.pj-person-v12 [data-display-name-form][hidden]{display:none!important}
.pj-person-v12 [data-display-name-form] .field{min-width:0}
.pj-person-v12 [data-display-name-form] :is(input,textarea){width:100%;min-width:0;max-width:100%}
.pj-person-v12 [data-display-error]:empty{display:none}
.pj-person-v12 .pj-identity-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:12px}
.pj-person-v12 .pj-identity-card-row{min-width:0}
@media(max-width:600px){.pj-account-v12 .pj-account-history-table .table{min-width:520px}.pj-account-v12 .pj-account-history-table{overflow-x:auto}.pj-person-v12 .pj-identity-card-row{align-items:flex-start}}

/* Personnel Center v12.1.0 */
.pj-personnel-tabs{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 16px;min-width:0}
.pj-personnel-tabs .btn{flex:1 1 auto;min-width:0}
.pj-personnel-overview[hidden],.pj-personnel-content[hidden]{display:none!important}
.pj-personnel-content,.pj-personnel-overview{min-width:0;max-width:100%;overflow-wrap:anywhere}
.pj-personnel-term{display:grid;gap:6px;min-width:0;border:1px solid var(--border, #373331);border-radius:10px;padding:12px;margin-top:10px}
.pj-personnel-term-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.pj-personnel-term-head>div{display:grid;gap:4px;min-width:0}
.pj-personnel-term small{display:block}
.pj-personnel-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.pj-personnel-metrics>div{display:grid;gap:6px;padding:12px;border:1px solid var(--border,#373331);border-radius:10px}
.pj-personnel-metrics b{font-size:22px}

/* v12.1.2: personal career, scoped responsive controls. */
.pj-self-personnel .pj-self-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0;}
.pj-self-personnel .pj-self-filters[hidden]{display:none!important;}
.pj-self-personnel .pj-self-filters label{display:grid;gap:6px;min-width:0;}
.pj-self-personnel .pj-self-filters select{min-width:0;width:100%;}
.pj-self-personnel .pj-self-actions{flex-wrap:wrap;gap:10px;}
.sc-account-modal .modal-actions{flex-wrap:wrap;gap:10px;}
@media(max-width:550px){.pj-self-personnel .pj-self-filters{grid-template-columns:1fr;}.pj-self-personnel .pj-self-actions>*{max-width:100%;white-space:normal;}}
