/* Screen-only finish for the authenticated management workspace.
   Load after the feature styles. Layout, user density and document typography
   remain owned by their workspaces; print/PDF and the employee PWA are excluded. */
@media screen {
  .workspace-shell {
    --ui-ink: #20334d;
    --ui-muted: #596c83;
    --ui-line: #d9e2ee;
    --ui-blue: #0752a9;
    --ui-soft: #eef4fc;
    --ui-surface: #fff;
    --ui-canvas: #eef2f7;
    --ui-radius: 10px;
    --ui-shadow: 0 1px 2px #17355408, 0 5px 16px #17355406;
    --ui-popover-shadow: 0 3px 8px #102a4b12, 0 16px 44px #102a4b1c;
    --muted: var(--ui-muted);
    --line: var(--ui-line);
    background: var(--ui-canvas);
    color: var(--ui-ink);
  }

  /* Navigation: a deliberate icon rail, with a quieter secondary level. */
  .workspace-shell > .area-rail {
    background: #e9eff7;
    border-right-color: #cfdbe9;
    box-shadow: inset -1px 0 #ffffff80;
  }
  .workspace-shell > .secondary-nav {
    background: #fbfcfe;
    border-right-color: #d7e0ec;
  }
  .workspace-shell .rail-brand {
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dce5ef;
    box-shadow: 0 1px 3px #17355408;
  }
  .workspace-shell .area-button { --area-ink: #285490; --area-wash: #e2eaf8; color: #516782; }
  .workspace-shell .area-button[data-area="Contactos"] { --area-ink: #41639b; --area-wash: #e4ebf8; }
  .workspace-shell .area-button[data-area="CRM"] { --area-ink: #165ab0; --area-wash: #dfeafa; }
  .workspace-shell .area-button[data-area="Obras"] { --area-ink: #27686b; --area-wash: #dfeded; }
  .workspace-shell .area-button[data-area="Compras"] { --area-ink: #88632c; --area-wash: #f1e9da; }
  .workspace-shell .area-button[data-area="Recursos Humanos"] { --area-ink: #63598c; --area-wash: #eae6f3; }
  .workspace-shell .area-button[data-area="Financeiro"] { --area-ink: #236b60; --area-wash: #deede7; }
  .workspace-shell .area-button[data-area="Contabilidade"] { --area-ink: #41627b; --area-wash: #e0eaf0; }
  .workspace-shell .area-button[data-area="E-mail"] { --area-ink: #325e97; --area-wash: #e1eaf7; }
  .workspace-shell .area-button[data-area="Configurações"] { --area-ink: #59677d; --area-wash: #e2e7ef; }
  .workspace-shell .area-button > svg {
    color: var(--area-ink);
    background: var(--area-wash);
    border-radius: 7px;
    padding: 4px;
    box-sizing: content-box;
    stroke-width: 1.8;
  }
  .workspace-shell .area-button.selected {
    background: #fff;
    color: #164d8b;
    box-shadow: inset 3px 0 #0752a9, 0 2px 5px #1735540d;
  }
  .workspace-shell .area-button:hover:not(.selected) { background: #dde6f2; color: #214f89; }
  .workspace-shell .section-links a { color: #52667e; }
  .workspace-shell .section-links a > svg { color: #6b83a0; }
  .workspace-shell .section-links a.active {
    background: #e7f0fd;
    color: #124d98;
    box-shadow: inset 0 0 0 1px #d4e3f7;
  }
  .workspace-shell .section-links a:hover:not(.active) { background: #eef3f9; }
  .workspace-shell .nav-search { background: #fff; border-color: #d9e2ec; }
  .workspace-shell .workspace-area-title > svg { stroke-width: 1.75; color: #275f9f; }
  .workspace-shell .nav-foot { background: #f4f7fb; border-color: #e0e7f0; }
  .workspace-shell .nav-foot small { color: #63768d; }
  .workspace-shell .rail-user { box-shadow: 0 0 0 3px #fff, 0 2px 6px #213b5922; }

  .workspace-shell .topbar {
    background: #fff;
    border-bottom-color: #d8e2ee;
    box-shadow: 0 1px 4px #16375605;
  }
  .workspace-shell .workspace-breadcrumb { color: #64768e; }
  .workspace-shell .workspace-breadcrumb strong { color: #264366; }
  .workspace-shell .topbar select { border-color: #cedbec; background: #f5f8fd; }
  .workspace-shell .notice:not(.demo) { background: #e8eff9; color: #486687; border-color: #dce6f3; }

  /* Consistent elevation, without changing each module's grid or padding. */
  .workspace-shell :is(.panel, .stat, .integration, .deal-workspace, .deal-surface,
    .inquiry-context, .dossier-hero, .fh-panel, .fh-metric, .project-metrics,
    .crm-summary, .crm-toolbar, .cw-panel, .access-form-panel) {
    border-color: var(--ui-line);
    box-shadow: var(--ui-shadow);
  }
  .workspace-shell .project-panel { box-shadow: var(--ui-shadow) !important; }
  .workspace-shell :is(.panel-head, .deal-section-heading, .fh-panel-head) {
    background: #f8fafd;
    border-bottom-color: #e0e7f0;
  }
  .workspace-shell .project-panel > .panel-head { background: #f8fafd; }
  .workspace-shell :is(.page-head h1, .project-heading h1, .deal-title-row h1) { color: #1b3555; }
  .workspace-shell :is(.panel-head h2, .deal-section-heading h2, .fh-panel-head h2) {
    color: #294566;
    letter-spacing: -.12px;
  }
  .workspace-shell :is(.stat strong, .deal-value, .project-metrics strong, .fh-metric strong,
    .fin-number, .crm-number, .project-number, .cw-number, .rcw-card-amount) {
    font-variant-numeric: tabular-nums;
  }
  .workspace-shell .dossier-hero { border-left: 3px solid #2764a6; }
  .workspace-shell .dossier-card .panel-head { background: #f5f8fd; }
  .workspace-shell .document-item { background: #fcfdff; border-color: #dbe4ef; }
  .workspace-shell .document-item[open] { background: #fff; box-shadow: 0 2px 7px #17355408; }

  /* Forms retain their natural sizing, including compact and comfortable modes. */
  .workspace-shell :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
    border-color: #cbd7e6;
    color: #233e5f;
  }
  .workspace-shell :is(input, textarea)::placeholder { color: #74849a; opacity: 1; }
  .workspace-shell :is(input, select, textarea):focus-visible {
    border-color: #3978be;
    outline: 2px solid #87b4e7;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #0752a90a;
  }
  .workspace-shell :is(input[readonly], textarea[readonly]) { background: #f2f5f9; color: #4b627c; }
  .workspace-shell :is(input:disabled, select:disabled, textarea:disabled) { background: #f1f4f8; cursor: not-allowed; }
  .workspace-shell :is(input[type="checkbox"], input[type="radio"], progress) { accent-color: #0752a9; }
  .workspace-shell :is(button, .button, .button-link):focus-visible {
    outline: 2px solid #2870be;
    outline-offset: 3px;
  }
  .workspace-shell :is(button, .button, .button-link) {
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
  }
  .workspace-shell :is(button, .button, .button-link):disabled { cursor: not-allowed; }
  .workspace-shell button[aria-busy="true"] { cursor: progress; }
  .workspace-shell :is(button.primary, a.button.primary, a.button-link.primary) {
    color: #fff;
    background: #0752a9;
    border-color: #074992;
    box-shadow: inset 0 1px #ffffff16, 0 2px 4px #064b9c18;
  }
  .workspace-shell :is(button.primary, a.button.primary, a.button-link.primary):hover:not(:disabled) {
    background: #06458d;
    border-color: #053e83;
    box-shadow: 0 3px 7px #064b9c24;
  }
  .workspace-shell :is(.actions, .form-actions, .sticky-actions) > button:not(.primary):not(.link):hover:not(:disabled) {
    background: #eef4fc;
    border-color: #afc6e3;
  }
  .workspace-shell .sticky-actions { border-color: #cedceb; box-shadow: 0 -3px 16px #1735540a; }
  .workspace-shell .callout { background: #edf4ff; border-left-color: #3973b3; color: #395b83; }

  /* Tables: information carries the emphasis, rather than oversized containers. */
  .workspace-shell :is(.table-wrap, .project-table, .fh-table-wrap, .cw-table, .deal-quotes-table) th {
    color: #526986;
    background: #f2f6fb;
    border-bottom-color: #d6e1ee;
    font-weight: 600;
  }
  .workspace-shell :is(.table-wrap, .project-table, .fh-table-wrap, .cw-table, .deal-quotes-table) td {
    border-bottom-color: #e6ecf3;
  }
  .workspace-shell :is(.table-wrap, .fh-table-wrap, .cw-table-scroll, .project-gantt-scroll,
    .crm-board, .section-links) { scrollbar-color: #9aadbf #e9eef5; }
  .workspace-shell .project-table th { color: #526986; }
  .workspace-shell .project-table td small { color: #61758e; }
  .workspace-shell .project-table tr:hover td { background: #f3f7fd; }
  .workspace-shell .project-gantt-heading,
  .workspace-shell .project-gantt-heading > .project-gantt-label { background: #edf3fa; }
  .workspace-shell :is(.project-gantt-month, .project-gantt-tick) { color: #58718f; }
  .workspace-shell .project-gantt-label small { color: #667d97; }
  .workspace-shell .project-gantt-bar { box-shadow: 0 1px 3px #234a7317; }

  /* Commercial content and histories stay compact and readable. */
  .workspace-shell .crm-board .crm-lane { background: #e9eff7; border-right-color: #d6e1ed; border-left-color: #d6e1ed; }
  .workspace-shell .crm-lane > header { background: #e9eff7; }
  .workspace-shell .crm-card { box-shadow: 0 1px 2px #1635540a, 0 3px 7px #16355406; border-color: #d3deeb; }
  .workspace-shell .crm-card:hover { border-color: #9ebcde; box-shadow: 0 3px 9px #16355412; }
  .workspace-shell .deal-body { background: #f0f4f9; }
  .workspace-shell :is(.deal-context dt, .inquiry-context dt, .deal-item-meta, .crm-source-caption) { color: #64778f; }
  .workspace-shell .deal-title-meta { color: #586e89; }
  .workspace-shell .deal-activity-symbol { background: #e6effb; color: #35679f; border: 1px solid #d4e3f6; }
  .workspace-shell .deal-activity-symbol.done { background: #e6f2ec; border-color: #d0e5d9; color: #3e755a; }
  .workspace-shell .crm-source-label { background: #edf3fa; color: #4e6888; }
  .workspace-shell :is(.context-navigation, .project-tabs, .people-tabs, .fin-tabs) { border-bottom-color: #d0deed; }
  .workspace-shell :is(.context-navigation a[aria-current="page"], .project-tabs a[aria-current="page"]) {
    background: #eaf2fd;
    border-bottom-color: #0752a9;
    color: #12569e;
  }

  /* Rich text: an editor surface with visible boundaries and an explicit caret. */
  .workspace-shell .rich-editor.rich-editor-pro { border-color: #c4d4e7; box-shadow: 0 1px 3px #183b5c07; }
  .workspace-shell .rich-editor-pro .rich-toolbar { background: #f5f8fc; border-bottom-color: #dce5ef; }
  .workspace-shell .rich-editor-pro .rich-tool { color: #45617f; }
  .workspace-shell .rich-editor-pro .rich-tool:hover { background: #e3edf9; color: #164f95; }
  .workspace-shell .rich-editor-pro .rich-tool[aria-pressed="true"] { background: #dfeafb; color: #074c9d; }
  .workspace-shell .rich-editor-pro .rich-content { color: #263b53; caret-color: #0752a9; }
  .workspace-shell .rich-editor-pro .rich-meta { background: #fafcff; border-top-color: #e3ebf4; color: #677b93; }
  .workspace-shell .rich-editor-pro:focus-within { border-color: #3978be; box-shadow: 0 0 0 3px #0752a910; }

  /* Semantic financial accents remain amber/red/green, not arbitrary decoration. */
  .workspace-shell .finance-hub { --fh-muted: #5d737f; --fh-line: #d8e2e9; --fh-teal: #216f66; }
  .workspace-shell .fh-metric small { color: #5d7482; }
  .workspace-shell .fh-metric.attention { background: #fffdf8; border-top-color: #c3913e; }
  .workspace-shell .fh-metric.attention strong { color: #91621e; }
  .workspace-shell .fh-metric.positive { background: #fcfefd; }
  .workspace-shell .fh-filters { border-color: #d6e1eb; box-shadow: 0 1px 3px #17355405; }
  .workspace-shell .fh-panel-head { background: #f5f9fb; }
  .workspace-shell .fh-reconciliation-summary { background: #f6fafb; }
  .workspace-shell .rcw-match-card { border-color: #b5d6cb; box-shadow: 0 2px 6px #20534b08; }
  .workspace-shell .rcw-queue-item:hover { background: #f1f6fc; }
  .workspace-shell .rcw-queue-item.active { box-shadow: inset 3px 0 #0752a9; }
  .workspace-shell :is(.badge.warn, .crm-tag.hot, .project-status.blocked) { box-shadow: inset 0 0 0 1px #9a631512; }

  /* Only existing popovers receive depth; this sheet invents no hover content. */
  .workspace-shell .project-tools nav { border-color: #cedbeb; border-radius: 9px; box-shadow: var(--ui-popover-shadow); }
  .workspace-shell .project-tools summary:hover { background: #edf4fd; border-color: #b1c8e4; }
  .workspace-shell .project-tools[open] summary { background: #e9f2ff; color: #1c5698; }
  .workspace-shell .project-tools nav a:hover { background: #edf3fc; }
  .workspace-shell .mail-workspace { border-color: #d2deeb; box-shadow: var(--ui-shadow); }
  .workspace-shell .mail-list-item.selected { box-shadow: inset 3px 0 #0752a9; }
  .workspace-shell .mail-attachment { background: #f5f9ff; border-color: #d7e3f2; }
  .workspace-shell .mail-compose { border-color: #bfd2e9; box-shadow: 0 5px 18px #17355410; }

  /* These portals are appended to body; the :has guard excludes public pages. */
  body:has(.workspace-shell) .pp-menu { border-color: #ccdbea; box-shadow: 0 3px 8px #102a4b12, 0 16px 44px #102a4b1c; }
  body:has(.workspace-shell) .pp-menu-identity { background: #f4f8fd; border-radius: 7px 7px 0 0; }
  body:has(.workspace-shell) .pp-dialog { box-shadow: 0 20px 70px #0d2c5140; border-color: #c8d8ec; }
  body:has(.workspace-shell) .native-assistant .na-launcher {
    background: #0752a9;
    border-color: #074992;
    box-shadow: 0 3px 7px #123c6920, 0 10px 28px #123c6926;
  }
  body:has(.workspace-shell) .native-assistant .na-launcher:hover { background: #06458d; box-shadow: 0 5px 10px #123c6924, 0 12px 30px #123c692b; }
  body:has(.workspace-shell) .na-panel { border-color: #bdcfe5; box-shadow: 0 6px 18px #0f315523, 0 20px 60px #0f31552b; }
  body:has(.workspace-shell) .na-head { background: #12375f; }
  body:has(.workspace-shell) .na-scroll { background: #f1f5fa; }
  body:has(.workspace-shell) .na-message { box-shadow: 0 1px 3px #17355406; border-color: #d7e2ef; }
  body:has(.workspace-shell) .na-message-user { background: #e6f0ff; border-color: #cbdff6; }
  body:has(.workspace-shell) .na-message header { color: #667c95; }
  body:has(.workspace-shell) .na-composer { box-shadow: 0 -2px 9px #17355404; }
  body:has(.workspace-shell) .native-assistant textarea { border-color: #bfcfe3; color: #233e5f; caret-color: #0752a9; }
  body:has(.workspace-shell) .native-assistant textarea:focus-visible { border-color: #3978be; outline-color: #87b4e7; }
  body:has(.workspace-shell) :is(.na-confirm, .na-budget, .na-message-label) { color: #56708d; }
  body:has(.workspace-shell) .na-action { background: #fff; border-color: #cbdcf0; border-left-color: #437ab5; }
}

@media screen and (max-height: 780px) {
  .workspace-shell .area-button > svg { padding: 3px; border-radius: 6px; }
}
@media screen and (max-width: 720px) {
  .workspace-shell .topbar { box-shadow: 0 2px 7px #1735540a; }
  .workspace-shell.nav-mobile-open > .secondary-nav { box-shadow: 14px 0 38px #15335124; }
  .workspace-shell .nav-mobile { border: 1px solid #dae4ef; background: #f5f8fc; border-radius: 7px; }
  .workspace-shell .crm-card { box-shadow: 0 1px 3px #1635540a; }
  .workspace-shell :is(.project-tabs, .context-navigation, .deal-tabs, .people-tabs) { scrollbar-width: thin; }
  body:has(.workspace-shell) .native-assistant .na-launcher { box-shadow: 0 4px 16px #123c6930; }
}
@media screen and (pointer: coarse) {
  .workspace-shell :is(.rich-tool, .nav-mobile, .nav-expand, .nav-collapse) { min-height: 36px; min-width: 36px; }
  .workspace-shell .rich-editor-pro .rich-toolbar { row-gap: 5px; }
  body:has(.workspace-shell) .native-assistant .na-head button { min-height: 36px; min-width: 36px; }
}
@media screen and (prefers-reduced-motion: reduce) {
  .workspace-shell :is(button, .button, .button-link) { transition: none; }
}
@media screen and (forced-colors: active) {
  .workspace-shell { --ui-line: CanvasText; --ui-muted: CanvasText; --ui-shadow: none; --ui-popover-shadow: none; }
  .workspace-shell :is(.area-button.selected, .section-links a.active, .crm-card, .panel, .fh-panel, .fh-metric) { border: 1px solid CanvasText; box-shadow: none; }
  .workspace-shell .area-button > svg { background: Canvas; color: CanvasText; }
  body:has(.workspace-shell) :is(.na-panel, .na-launcher, .pp-menu) { border: 1px solid CanvasText; box-shadow: none; }
}

@media screen {
 .workspace-shell .finance-hub{grid-template-columns:minmax(0,1fr)}
 .workspace-shell .finance-hub>*,.workspace-shell .fh-body>*{min-width:0}
 @media(max-width:720px){
  .workspace-shell .management-pwa .mpwa-install>span{display:none}
  .workspace-shell .management-pwa .mpwa-install{padding:7px}
  .workspace-shell .fh-sync{flex-wrap:wrap}
 }
}
