/* R56 reference system: glossy dark actions; yellow selected views; pale raised tabs.
   Scoped to the three application shells. No permissions, routes or form semantics change. */
body#crm-ui{--ref-action:linear-gradient(180deg,#394247 0%,#20272b 48%,#101719 51%,#0b1012 100%);--ref-tab:linear-gradient(180deg,#fff 0%,#f6fafb 48%,#e7f0f2 51%,#edf5f6 100%);--ref-selected:linear-gradient(180deg,#fff28a 0%,#ffe35c 48%,#ffd72c 51%,#f3c824 100%);--ref-shadow:inset 0 1px 0 #ffffff55,0 4px 8px #183a4326;--ref-ink:#193d43;font-family:Calibri,'Segoe UI',sans-serif;font-style:italic}
/* Explicit application roots outrank inherited release rules, including header actions. */
body#crm-ui :is(#main-content,#crm-topbar,#home,#editor,#workspace-home,dialog,.login-card) :is(button,a.button,a.secondary,a.btn,input[type=submit]),
body#crm-ui :is(.desk-top,.workflow-dialog-bar,.sticky-hanger,.chat-dock) :is(button,a.btn),
body#crm-ui #crm-topbar :is(.home-link,.personal-workspace-button,.bell-button,#module-launcher),
body#crm-ui #main-content :is(.head-actions>details>summary,.header-actions-menu>summary,.row-action-menu>summary,.saved-view-menu>summary,.note-overflow>summary){
 background:var(--ref-action)!important;background-image:var(--ref-action)!important;color:#fff!important;border:1px solid #465257!important;border-radius:11px!important;box-shadow:var(--ref-shadow)!important;text-shadow:0 1px 1px #0005!important;font-family:Calibri,'Segoe UI',sans-serif;font-style:italic;font-weight:600;line-height:1.25;min-height:34px;padding:7px 12px;max-width:100%;overflow-wrap:normal;word-break:normal;vertical-align:middle;
}
body#crm-ui #crm-topbar :is(.home-link,.personal-workspace-button,.bell-button){padding:6px 9px!important;min-width:34px}
body#crm-ui #crm-topbar #module-launcher{padding:7px 12px!important}
body#crm-ui #main-content :is(button,a.button,a.secondary):hover:not(:disabled):not([aria-disabled=true]),
body#crm-ui #crm-topbar :is(button,.home-link,.personal-workspace-button,.bell-button,#module-launcher):hover{filter:brightness(1.1)}
/* Consistent icon contrast on raised actions; preserve multi-colour module illustrations. */
body#crm-ui :is(#main-content,#crm-topbar,#home,#editor,dialog) :is(button,a.button,a.secondary,a.btn,.home-link,.personal-workspace-button,.bell-button,#module-launcher) :is(.crm-action-icon,.crm-line-icon,.crm-icon-accent,svg),
body#crm-ui #crm-topbar #module-launcher>svg{color:inherit!important;stroke:currentColor!important;opacity:1}
/* View navigation is visually distinct from actions. No yellow sidebar backgrounds. */
body#crm-ui #main-content :is(.header-nav,.tabs,.compact-tabs,.form-step-nav)>:is(a,button),
body#crm-ui .module-navigation :is(.module-view-tabs,.module-section-links)>a,
body#crm-ui #home .desk-overview>button,
body#crm-ui #editor #worksheet-tabs>button,
body#crm-ui #workspace-home .dh-banner .dh-link{
 background:var(--ref-tab)!important;background-image:var(--ref-tab)!important;color:var(--ref-ink)!important;border:1px solid #c9dce0!important;border-radius:22px!important;box-shadow:inset 0 1px #fff,0 3px 6px #1c495314!important;text-shadow:none!important;min-height:34px;padding:7px 13px;font-style:italic;font-weight:600;line-height:1.3;white-space:normal;overflow-wrap:normal;word-break:normal;
}
body#crm-ui #main-content :is(.header-nav,.tabs,.compact-tabs,.form-step-nav)>:is(.active,[aria-current=page],[aria-pressed=true],[aria-selected=true]),
body#crm-ui .module-navigation :is(.module-view-tabs,.module-section-links)>a.active,
body#crm-ui #home .desk-overview>button[aria-pressed=true],
body#crm-ui #editor #worksheet-tabs>button.active{
 background:var(--ref-selected)!important;background-image:var(--ref-selected)!important;color:#293538!important;border-color:#ddbd32!important;box-shadow:inset 0 1px #fff8b2,0 3px 7px #78621b21!important;text-shadow:none!important;
}
body#crm-ui #main-content :is(.header-nav,.tabs,.compact-tabs,.form-step-nav){gap:7px;padding:6px 0;margin:0 0 12px;min-width:0;flex-wrap:wrap}
body#crm-ui #main-content .header-nav>button{min-width:82px}
body#crm-ui .module-navigation :is(.module-view-tabs,.module-section-links)>a{padding:7px 9px!important;margin-bottom:4px;min-height:35px;font-size:12px}
body#crm-ui .module-navigation .module-nav-icon{background:transparent!important;color:inherit!important;padding:1px}
body#crm-ui .module-navigation .module-nav-icon .crm-icon-accent{stroke:currentColor!important}
body#crm-ui .module-nav-collapsed .module-navigation :is(.module-view-tabs,.module-section-links)>a{border-radius:11px!important;padding:7px!important}
/* Menu choices, editor tools, swatches and icon-only controls remain compact and quiet. */
body#crm-ui #main-content :is(.crm-action-popover,.row-action-menu>div,.saved-view-menu>div,.header-actions-menu>div,.head-actions details>div,.note-editor-toolbar,.note-format-toolbar,.pd-tools,.pd-shortcut-controls) :is(a,button),
body#crm-ui #home :is(.shortcut-menu,.workbook-actions)>div :is(a,button),
body#crm-ui #editor :is(.sheet-toolbar,.format-toolbar) button,
body#crm-ui #main-content :is(.note-actions,.note-bottom-actions) button,
body#crm-ui #main-content :is(button.link-button,button.icon-button,button.module-home-toggle),
body#crm-ui #crm-topbar :is(.module-filter-clear,.global-search button),
body#crm-ui #main-content .employee-picker-done{
 background:var(--ref-tab)!important;background-image:var(--ref-tab)!important;color:#244d54!important;border-color:#c9dce0!important;box-shadow:inset 0 1px #fff,0 2px 4px #1c49530f!important;text-shadow:none!important;border-radius:8px!important;
}
body#crm-ui #main-content :is(.crm-action-popover,.row-action-menu>div,.saved-view-menu>div,.header-actions-menu>div,.head-actions details>div) :is(a,button){display:flex;white-space:normal;min-height:32px;padding:6px 9px!important;text-align:left;justify-content:flex-start}
body#crm-ui #main-content .crm-action-popover :is(.crm-action-icon,.crm-icon-accent){color:inherit!important;stroke:currentColor!important}
body#crm-ui #main-content :is(.note-editor-toolbar,.note-format-toolbar,.pd-shortcut-controls) button{padding:4px 7px;min-height:28px}
/* Destructive choices retain their meaning, including inside popovers and headers. */
body#crm-ui :is(#main-content,#home,#editor,dialog) :is(button,a.button,a.secondary,a.btn):is(.danger,.reject,.delete,[data-danger],.destructive,[data-action=trash],[data-action=delete],[data-action=reject]){background:#fff0ee!important;background-image:none!important;color:#962e2e!important;border-color:#dfb5b1!important;box-shadow:inset 0 1px #fff,0 2px 4px #6e1d1710!important;text-shadow:none!important}
body#crm-ui :is(#main-content,#crm-topbar,#home,#editor,dialog) :is(button,a.button,a.secondary,a.btn):is(:disabled,[aria-disabled=true]){opacity:.48!important;filter:none!important;cursor:not-allowed!important;box-shadow:none!important;transform:none!important}
body#crm-ui :is(a,button,input,select,textarea,summary):focus-visible{outline:3px solid #23858b!important;outline-offset:3px!important}
body#crm-ui #crm-topbar :is(a,button,input,summary):focus-visible{outline-color:#fff3a4!important}
/* Do not let a table's word-breaking policy split an action label into letters. */
body#crm-ui #main-content :is(td,th):has(>.row-actions,>.crm-action-trigger,>.record-actions,>.row-action-menu,>a.button){min-width:100px}
body#crm-ui #main-content :is(.row-action-menu>summary,.crm-action-trigger,.row-actions>button,.row-actions>a.button,td>a.button.mini){white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important;width:auto;min-width:max-content;flex-shrink:0;font-size:12px}
body#crm-ui #main-content .actions-column{min-width:100px!important;width:110px}
/* Soft shared panels and genuine scoped metric pills, preserving dashboard order/settings. */
body#crm-ui #main-content :is(.panel,.editor-section){border-radius:14px;box-shadow:3px 5px 12px #163b4510,-2px -2px 7px #fff8}
body#crm-ui #main-content :is(.executive-header,.page-head){border-radius:18px!important;box-shadow:0 7px 18px #173b4022,inset 0 1px #ffffff20!important}
body#crm-ui #main-content .dashboard-summary>a,
body#crm-ui #personal-dashboard [data-widget=metrics] .pd-columns>a{
 background:var(--ref-selected)!important;color:#293538!important;border:1px solid #e1c33a!important;border-radius:28px!important;box-shadow:inset 0 1px #fff79c,0 4px 10px #71621d17!important;padding:12px 18px;min-width:0;
}
body#crm-ui #personal-dashboard [data-widget=metrics] .pd-columns{gap:10px;grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr))}
body#crm-ui #personal-dashboard [data-widget=metrics] .pd-columns strong{font-size:24px;line-height:1.15}
body#crm-ui #main-content .punch-card{display:flex!important;align-items:center;flex-wrap:wrap;gap:10px 16px;padding:14px!important}
body#crm-ui #main-content .punch-card>.punch-description{flex:1 1 235px;min-width:0}
body#crm-ui #main-content .punch-card h2{font-size:17px;margin:0 0 5px}
body#crm-ui #main-content .punch-card p{margin:4px 0;font-size:12px;line-height:1.4}
body#crm-ui #main-content .punch-card>.inline-facts{display:flex;flex:1 1 270px;gap:8px;margin:0;min-width:0}
body#crm-ui #main-content .punch-card .inline-facts>div{flex:1;min-width:0;padding:9px 10px;border-radius:10px;background:#edf4f4;box-shadow:inset 2px 2px 4px #163b4514,inset -2px -2px 4px #fff}
body#crm-ui #main-content .punch-card .inline-facts :is(dt,dd){margin:0;font-size:12px;line-height:1.5}
body#crm-ui #main-content .punch-card>form{display:flex;align-items:end;flex-wrap:wrap;gap:8px;max-width:100%;margin:0}
body#crm-ui #main-content .punch-card>form:has(input[type=file],video,[data-location]){flex-basis:100%}
/* Short forms keep their four-column layout; long interview prose expands on demand. */
body#crm-ui #main-content :is(.premium-form.module-form-interviews,.interview-editor) textarea{height:70px;min-height:70px!important;resize:vertical;max-height:none}
body#crm-ui #main-content .report-filters{padding:12px;display:flex;flex-wrap:wrap;align-items:end;gap:10px}
body#crm-ui #main-content .report-filters>.form-grid{flex:1 1 520px;display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:9px 12px}
body#crm-ui #main-content .report-filters .form-actions{padding:0;margin:0}
body#crm-ui #main-content .compact-report-chart{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:9px 16px;padding:14px}
body#crm-ui #main-content .compact-report-chart>h2{grid-column:1/-1;margin:0 0 3px;font-size:17px}
body#crm-ui #main-content .compact-report-chart .chart-line{display:grid;grid-template-columns:minmax(85px,1fr) minmax(70px,1fr) auto;align-items:center;gap:8px;padding:8px;border:1px solid #d7e5e5;border-radius:9px;min-width:0}
body#crm-ui #main-content .compact-report-chart meter{width:100%;min-width:0}
body#crm-ui #home .desk-overview>button{border-radius:18px!important;padding:12px 14px!important}
body#crm-ui #home .desk-panel{box-shadow:3px 5px 12px #163b4510,-2px -2px 7px #fff8}
body#crm-ui #home .desk-overview [data-desk-icon]{color:inherit;background:#ffffff66}
@media(prefers-reduced-motion:no-preference){body#crm-ui :is(button,a.button,a.secondary,.header-nav>a){transition:filter .16s,box-shadow .16s,translate .16s}body#crm-ui #main-content :is(button,a.button,a.secondary):active:not(:disabled){translate:0 1px}}
@media(prefers-reduced-motion:reduce){body#crm-ui *{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media(max-width:760px){body#crm-ui #main-content .report-filters>.form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}body#crm-ui #main-content .compact-report-chart{grid-template-columns:minmax(0,1fr)}body#crm-ui #main-content .punch-card>.inline-facts{flex-basis:100%}}
@media(max-width:460px){body#crm-ui #main-content .report-filters>.form-grid{grid-template-columns:minmax(0,1fr)}body#crm-ui #main-content .header-nav>button{min-width:70px}}
@media(pointer:coarse){body#crm-ui :is(#main-content,#crm-topbar,#home,#editor,#workspace-home) :is(button,a.button,a.secondary,a.btn,.header-nav>a,.dh-link){min-height:44px!important}}

/* Hanging paper notes and semantic colour swatches keep their own purpose. */
body#crm-ui.crm-unified .sticky-hanger .hanger-leaf,body#crm-ui #main-content .sticky-hanger .hanger-leaf{background:linear-gradient(140deg,#fffef8,var(--leaf,#cdebe0))!important;background-image:linear-gradient(140deg,#fffef8,var(--leaf,#cdebe0))!important;color:#173f48!important;border:0!important;border-radius:3px 3px 11px 3px!important;box-shadow:1px 3px 5px #163e4728!important;text-shadow:none!important}
body#crm-ui #editor #trash{background:#fff0ee!important;background-image:none!important;color:#962e2e!important;border-color:#dfb5b1!important;text-shadow:none!important}

body#crm-ui.secure-entry .access-shell{padding:24px;box-shadow:3px 8px 24px #173b401a}
body#crm-ui.secure-entry .access-form{gap:12px 18px}
body#crm-ui.secure-entry .access-form p{gap:5px}
body#crm-ui.secure-entry .access-shell h1{padding:16px 18px;background:linear-gradient(110deg,#123c46,#1b6570);color:#fff;border-radius:16px;font-size:24px;line-height:1.3}
