/* Shared finish layer: Héxagône identity, consistent controls and mobile ergonomics. */
:root {
  --hex-radius: 8px;
  --hex-radius-small: 6px;
  --hex-focus: color-mix(in srgb, var(--accent, #d39b3d) 22%, transparent);
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 6px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[data-theme='dark'] {
  --bg: #090b0e;
  --surface: #14171b;
  --surface-soft: #1a1e23;
  --surface-strong: #171b20;
  --surface-muted: #101318;
  --glass: #14171b;
  --glass-strong: #171b20;
  --glass-soft: rgba(255, 255, 255, .035);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --glass-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

body {
  background: #f1f3f5 !important;
}

html[data-theme='dark'] body {
  background: #090b0e !important;
}

body * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

:where(button, input, select, textarea, .primary-btn, .secondary-btn, .mini-btn, .icon-btn, .icon-action, .row-icon-btn) {
  border-radius: var(--hex-radius-small) !important;
  letter-spacing: 0;
}

button,
input,
select,
textarea,
.secondary-btn,
.mini-btn,
.icon-btn,
.icon-action,
.row-icon-btn {
  background: var(--surface-strong, #fff) !important;
  border-color: var(--line-strong, rgba(47, 49, 54, .22)) !important;
  box-shadow: none !important;
}

.primary-btn {
  background: var(--accent, #d39b3d) !important;
  border-color: color-mix(in srgb, var(--accent, #d39b3d) 78%, #2f3136 22%) !important;
  color: #20190d !important;
  box-shadow: none !important;
}

button:hover,
.portal-link:hover {
  border-color: color-mix(in srgb, var(--accent, #d39b3d) 62%, var(--line-strong, #555) 38%) !important;
}

:where(button, a, input, select, textarea) {
  touch-action: manipulation;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent, #d39b3d);
  outline-offset: 2px;
}

.topbar,
.toolbar,
.panel,
.card,
.table-panel,
.editor-panel,
.editor-card,
.modal-card,
.summary-grid article,
.kpi-grid article {
  border-radius: var(--hex-radius) !important;
  border-color: var(--line, rgba(47, 49, 54, .14)) !important;
  background: var(--surface-strong, #fff) !important;
  box-shadow: 0 3px 12px rgba(26, 28, 34, .055) !important;
}

html[data-theme='dark'] .topbar,
html[data-theme='dark'] .toolbar,
html[data-theme='dark'] .panel,
html[data-theme='dark'] .card,
html[data-theme='dark'] .table-panel,
html[data-theme='dark'] .editor-panel,
html[data-theme='dark'] .editor-card,
html[data-theme='dark'] .modal-card,
html[data-theme='dark'] .summary-grid article,
html[data-theme='dark'] .kpi-grid article {
  background: #14171b !important;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .3) !important;
}

.topbar::before,
.toolbar::before,
.panel::before,
.card::before,
.table-panel::before,
.editor-panel::before,
.editor-card::before,
.summary-grid article::before,
.kpi-grid article::before {
  display: none !important;
}

.summary-grid article,
.kpi-grid article {
  border-top: 2px solid color-mix(in srgb, var(--accent, #d39b3d) 72%, var(--line, transparent) 28%) !important;
}

.table-scroll,
.table-wrap,
.invoice-table,
table {
  border-radius: 6px !important;
}

th {
  background: var(--surface-muted, #f5f6f7) !important;
  letter-spacing: 0 !important;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent, #d39b3d) 7%, transparent) !important;
}

body.home-view-login .auth-home-card {
  max-width: 400px;
  border-top: 3px solid var(--accent, #d39b3d) !important;
  padding: 18px !important;
}

body.home-view-portals .home-shell {
  max-width: 1180px !important;
}

body.home-view-portals .hero-card,
body.home-view-portals .chooser-card {
  width: min(100%, 1100px) !important;
}

.portal-grid {
  gap: 8px !important;
}

.portal-link {
  min-height: 108px;
  align-items: flex-start !important;
  border-radius: 7px !important;
  border-left: 3px solid var(--accent, #d39b3d) !important;
  background: var(--surface-strong, #fff) !important;
  padding: 14px !important;
  box-shadow: none !important;
}

.portal-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(26, 28, 34, .08) !important;
}

.portal-icon {
  width: 42px !important;
  height: 42px !important;
  border-radius: 6px !important;
  background: color-mix(in srgb, var(--accent, #d39b3d) 13%, var(--surface-strong, #fff)) !important;
}

.portal-copy {
  gap: 5px !important;
}

.portal-copy strong {
  font-size: .96rem !important;
}

.portal-copy small {
  line-height: 1.4;
}

:where(.logo, .hero-logo) {
  object-fit: contain;
}

.hex-offline-banner {
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, #d39b3d 58%, transparent);
  border-radius: 6px;
  background: #1b1e23;
  color: #f4f4f5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .26);
  font: 600 .78rem/1.35 "SF Pro Display", "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  text-align: center;
}

@media (max-width: 760px) {
  .brand .logo {
    width: min(132px, 36vw);
    max-width: 132px;
    height: auto;
  }

  .brand .logo-dark { display: block !important; }
  .brand .logo-light { display: none !important; }
  html[data-theme='dark'] .brand .logo-dark { display: none !important; }
  html[data-theme='dark'] .brand .logo-light { display: block !important; }

  :where(button, input, select, textarea, .primary-btn, .secondary-btn, .mini-btn, .icon-btn, .icon-action, .row-icon-btn) {
    min-height: 44px;
  }

  :where(input, select, textarea) {
    font-size: 16px !important;
  }

  :where(.panel, .card, .table-panel, .editor-panel, .editor-card, .modal-card) {
    border-radius: 8px !important;
  }

  :where(.table-scroll, .table-wrap, .responsive-table) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  :where(.topbar, .toolbar, .panel, .card, .table-panel, .editor-panel, .editor-card, .modal-card) {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .portal-link {
    min-height: 88px;
    padding: 12px !important;
  }
}

/* Application chrome v4: independent navigation and stable content geometry. */
.workspace-sidebar {
  display: none;
  background: #15171b;
  color: #f4f5f6;
}

.workspace-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 18px;
  border-bottom: 1px solid #2c3036;
}

.workspace-sidebar-brand img {
  display: block;
  width: 142px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.workspace-sidebar .workspace-nav {
  margin: 0;
  padding: 16px 12px;
}

@media (min-width: 1024px) {
  body.hex-workspace-body {
    display: grid !important;
    grid-template-columns: 208px minmax(0, 1fr);
    align-items: start;
  }

  body.hex-workspace-body > .workspace-sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    grid-column: 1;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
    width: 208px;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid #2d3138;
  }

  body.hex-workspace-body > main,
  body.hex-workspace-body > footer,
  body.hex-workspace-body > .app-root {
    grid-column: 2;
    min-width: 0;
  }

  body.hex-workspace-body > .app-root {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 22px 34px !important;
  }

  body.hex-workspace-body .page-shell,
  body.hex-workspace-body .directory-shell,
  body.hex-workspace-body .app-shell,
  body.hex-workspace-body .invoice-shell,
  body.hex-workspace-body .finance-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 1540px !important;
    margin: 0 auto !important;
    padding: 18px 22px 34px !important;
    gap: 14px !important;
  }

  body.hex-workspace-body .page-shell > *,
  body.hex-workspace-body .directory-shell > *,
  body.hex-workspace-body .app-shell > * {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-width: 0;
  }

  body.hex-workspace-body .page-shell > .hero-card,
  body.hex-workspace-body .directory-shell > .hero-card,
  body.hex-workspace-body .app-shell > .hero {
    position: relative !important;
    top: auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 76px !important;
    height: auto !important;
    padding: 14px 18px !important;
    overflow: visible !important;
    border: 1px solid var(--line) !important;
    border-left: 4px solid var(--enterprise-gold) !important;
    border-radius: 3px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-copy,
  body.hex-workspace-body .directory-shell > .hero-card .hero-copy {
    order: 1 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-head,
  body.hex-workspace-body .directory-shell > .hero-card .hero-head {
    order: 2 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    gap: 8px !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-brand,
  body.hex-workspace-body .directory-shell > .hero-card .hero-brand,
  body.hex-workspace-body .app-shell > .hero .brand-wrap {
    display: none !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hex-history-nav,
  body.hex-workspace-body .directory-shell > .hero-card .hex-history-nav {
    order: 1;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-actions,
  body.hex-workspace-body .directory-shell > .hero-card .hero-actions {
    order: 2;
    margin: 0 !important;
  }

  body.hex-workspace-body .page-shell > .hero-card h1,
  body.hex-workspace-body .directory-shell > .hero-card h1 {
    color: var(--text) !important;
    font-size: 1.22rem !important;
  }

  body.hex-workspace-body .page-shell > .hero-card p,
  body.hex-workspace-body .directory-shell > .hero-card p {
    margin-top: 4px;
    color: var(--muted) !important;
    font-size: .72rem !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .icon-btn,
  body.hex-workspace-body .directory-shell > .hero-card .icon-btn {
    border-color: var(--line-strong) !important;
    background: var(--surface-soft) !important;
    color: var(--text) !important;
  }

  body.hex-workspace-body .app-shell > .hero {
    justify-content: space-between !important;
  }

  body.hex-workspace-body .app-shell > .hero .hero-top {
    order: 2 !important;
    display: flex !important;
    width: auto !important;
  }

  body.hex-workspace-body .app-shell > .hero .hero-subtitle {
    order: 1 !important;
    width: auto;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: var(--text) !important;
    font-size: 1.1rem !important;
    font-weight: 720;
  }

  body.hex-workspace-body .invoice-shell > .topbar,
  body.hex-workspace-body .finance-shell > .topbar {
    width: 100%;
  }

  body.hex-workspace-body .invoice-shell > .topbar {
    grid-template-columns: 220px minmax(0, 1fr) auto !important;
  }

  body.hex-workspace-body .finance-shell > .topbar {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }
}

body.hex-workspace-body .app-root > .app-header {
  min-height: 76px !important;
  padding: 12px 16px !important;
  border: 1px solid var(--line) !important;
  border-left: 4px solid var(--enterprise-gold) !important;
  border-top: 1px solid var(--line) !important;
  border-radius: 3px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

body.hex-workspace-body .app-root > .app-header .logo,
body.hex-workspace-body .app-root > .app-header .header-home-action-link {
  display: none !important;
}

.planning-context {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin-right: auto;
}

.planning-context strong {
  font-size: 1.12rem;
  font-weight: 740;
}

.planning-context span {
  color: var(--muted);
  font-size: .7rem;
}

/* Premium refinement pass: quieter hierarchy, thinner accents, fewer visual signals. */
:root {
  --enterprise-canvas: #f6f7f9;
  --enterprise-rule: #e3e6ea;
  --enterprise-gold: #c99a4a;
}

html[data-theme='dark'] {
  --enterprise-canvas: #0b0d10;
  --enterprise-rule: #292e35;
}

body {
  font-weight: 400;
}

h1,
h2,
h3,
h4,
.section-head h2,
.portal-copy strong,
.summary-grid strong,
.kpi-grid strong,
.stat-tile strong {
  font-weight: 650 !important;
}

button,
.primary-btn,
.secondary-btn,
.mini-btn,
.ghost-btn,
.action-btn {
  font-weight: 590 !important;
}

.workspace-sidebar {
  background: #17191d;
}

.workspace-sidebar-brand {
  min-height: 86px;
  padding: 17px 20px;
}

.workspace-sidebar-brand img {
  width: 128px;
}

.workspace-nav-link {
  min-height: 39px;
  padding: 0 12px;
  border-radius: 3px;
  color: #a9afb8;
  font-size: .76rem;
  font-weight: 530;
}

.workspace-nav-link::before {
  display: none !important;
}

.workspace-nav-link:hover {
  border-color: #30343a;
  background: #1e2126;
  color: #f6f7f8;
}

.workspace-nav-link.is-active {
  border-color: #363a41;
  background: #24272d;
  color: #ffffff;
  box-shadow: inset 2px 0 0 var(--enterprise-gold);
}

.card,
.panel,
.table-panel,
.editor-card,
.editor-panel,
.modal-card,
.controls-card,
.budget-card,
.stats-card,
.expenses-card,
.actions-card,
.app-card {
  border-color: var(--enterprise-rule) !important;
}

.section-head {
  border-bottom-color: var(--enterprise-rule) !important;
}

.section-head h2 {
  font-size: .9rem !important;
}

.summary-grid article,
.kpi-grid article,
.stat-tile {
  border-color: var(--enterprise-rule) !important;
}

.summary-grid article,
.kpi-grid article {
  min-height: 104px;
}

.summary-grid span,
.kpi-grid span,
.stat-tile p {
  font-weight: 560 !important;
}

body.home-view-portals .portal-link {
  border-left: 1px solid var(--line) !important;
}

body.home-view-portals .portal-link::after {
  height: 2px;
}

body.home-view-portals .portal-copy strong {
  font-weight: 620 !important;
}

body.home-view-portals .portal-icon {
  background: var(--surface) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar {
  border-color: var(--enterprise-rule) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar .brand,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar .brand {
  border-right-color: var(--enterprise-rule) !important;
  border-bottom-color: var(--enterprise-rule) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar h1,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar h1 {
  color: var(--text) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar p,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar p,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar label {
  color: var(--muted) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar .toolbar,
html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar .topbar-actions,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar .filters {
  background: var(--surface-soft) !important;
}

html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar input,
html:not([data-theme='dark']) body.hex-workspace-body .invoice-shell > .topbar select,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar input,
html:not([data-theme='dark']) body.hex-workspace-body .finance-shell > .topbar select {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

@media (min-width: 1024px) {
  body.hex-workspace-body {
    grid-template-columns: 216px minmax(0, 1fr);
  }

  body.hex-workspace-body > .workspace-sidebar {
    width: 216px;
  }

  body.hex-workspace-body .page-shell,
  body.hex-workspace-body .directory-shell,
  body.hex-workspace-body .app-shell,
  body.hex-workspace-body .invoice-shell,
  body.hex-workspace-body .finance-shell {
    padding: 18px 24px 36px !important;
  }

  body.hex-workspace-body .page-shell > .hero-card,
  body.hex-workspace-body .directory-shell > .hero-card,
  body.hex-workspace-body .app-shell > .hero,
  body.hex-workspace-body .app-root > .app-header {
    border-left-width: 2px !important;
  }

  body.hex-workspace-body .page-shell > .hero-card h1,
  body.hex-workspace-body .directory-shell > .hero-card h1 {
    font-size: 1.14rem !important;
    font-weight: 650 !important;
  }
}

body.hex-workspace-body .invoice-shell > .topbar .brand .logo,
body.hex-workspace-body .finance-shell > .topbar .brand .logo {
  display: none !important;
}

body.hex-workspace-body .invoice-shell > .topbar .brand,
body.hex-workspace-body .finance-shell > .topbar .brand {
  border-left: 4px solid var(--enterprise-gold);
}

body.hex-workspace-body .invoice-shell > .topbar h1,
body.hex-workspace-body .finance-shell > .topbar h1 {
  font-size: 1.08rem !important;
  white-space: nowrap;
}

@media (max-width: 1023px) {
  body.hex-workspace-body > .workspace-sidebar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    width: 100%;
    min-height: 62px;
    border-bottom: 1px solid #30343b;
  }

  body.hex-workspace-body button {
    min-height: 44px !important;
  }

  body.hex-workspace-body > .app-root {
    width: 100% !important;
    min-height: calc(100vh - 62px);
    padding: 10px !important;
  }

  body.hex-workspace-body .app-root > .app-header {
    min-height: 76px !important;
    padding: 10px 12px !important;
  }

  body.hex-workspace-body .app-root > .app-header button,
  body.hex-workspace-body .app-root > .app-header a {
    min-height: 44px !important;
  }

  .planning-context span {
    display: none;
  }

  .workspace-sidebar-brand {
    min-height: 62px;
    padding: 10px 12px;
    border: 0;
    border-right: 1px solid #30343b;
  }

  .workspace-sidebar-brand img {
    width: 88px;
  }

  .workspace-sidebar .workspace-nav {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    margin: 0;
    padding: 9px 10px;
    overflow-x: auto;
    border: 0;
  }

  .workspace-sidebar .workspace-nav-link {
    min-height: 40px;
  }

  body.hex-workspace-body .page-shell > .hero-card,
  body.hex-workspace-body .directory-shell > .hero-card,
  body.hex-workspace-body .app-shell > .hero {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 82px !important;
    padding: 13px 14px !important;
    border: 1px solid var(--line) !important;
    border-left: 4px solid var(--enterprise-gold) !important;
    border-top: 1px solid var(--line) !important;
    border-radius: 3px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: none !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-brand,
  body.hex-workspace-body .directory-shell > .hero-card .hero-brand,
  body.hex-workspace-body .app-shell > .hero .brand-wrap {
    display: none !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-copy,
  body.hex-workspace-body .directory-shell > .hero-card .hero-copy {
    order: 1 !important;
    width: auto !important;
    max-width: calc(100% - 132px);
    margin: 0 !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-head,
  body.hex-workspace-body .directory-shell > .hero-card .hero-head {
    order: 2 !important;
    display: flex !important;
    width: auto !important;
    gap: 6px !important;
  }

  body.hex-workspace-body .page-shell > .hero-card h1,
  body.hex-workspace-body .directory-shell > .hero-card h1 {
    color: var(--text) !important;
    font-size: 1.08rem !important;
  }

  body.hex-workspace-body .page-shell > .hero-card p,
  body.hex-workspace-body .directory-shell > .hero-card p {
    color: var(--muted) !important;
    font-size: .68rem !important;
    line-height: 1.35;
  }

  body.hex-workspace-body .page-shell > .hero-card .icon-btn,
  body.hex-workspace-body .directory-shell > .hero-card .icon-btn,
  body.hex-workspace-body .page-shell > .hero-card .hex-history-btn,
  body.hex-workspace-body .directory-shell > .hero-card .hex-history-btn {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-color: var(--line-strong) !important;
    background: var(--surface-soft) !important;
    color: var(--text) !important;
  }

  body.hex-workspace-body .app-shell > .hero .hero-subtitle {
    order: 1 !important;
    margin: 0 !important;
    color: var(--text) !important;
    font-size: 1rem !important;
    font-weight: 720;
  }

  body.hex-workspace-body .app-shell > .hero .hero-top {
    order: 2 !important;
    display: flex !important;
    width: auto !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .brand,
  body.hex-workspace-body .finance-shell > .topbar .brand {
    min-height: 76px;
    padding: 14px 16px;
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar .search-field,
  body.hex-workspace-body .invoice-shell > .topbar .toolbar .page-feedback {
    grid-column: 1 / -1 !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar .icon-text-btn span {
    display: inline !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: nowrap !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar .icon-text-btn {
    gap: 8px !important;
    padding-inline: 12px !important;
    font-size: .78rem !important;
    font-weight: 680 !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .topbar-actions {
    display: flex !important;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 14px 14px !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .topbar-actions .icon-btn,
  body.hex-workspace-body .finance-shell > .topbar .icon-btn {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  body.hex-workspace-body .finance-shell > .topbar .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  body.hex-workspace-body .finance-shell > .topbar .filters label {
    grid-column: span 2 !important;
  }

  body.hex-workspace-body .finance-shell > .topbar .filters label:has(#searchInput) {
    grid-column: 1 / -1 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.hexagone-app-loader {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  background: #f5f5f6;
  color: #2f3136;
  font-family: "Instrument Sans", "Avenir Next", sans-serif;
  transition: opacity 160ms ease, visibility 160ms ease;
}
html[data-theme='dark'] .hexagone-app-loader { background: #121519; color: #f4f5f6; }
.hexagone-app-loader.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.hexagone-app-loader strong { font-size: .92rem; letter-spacing: .08em; text-transform: uppercase; }
.hexagone-app-loader small { color: #6c717c; font-size: .76rem; }
html[data-theme='dark'] .hexagone-app-loader small { color: #a9afb8; }
.hexagone-loader-mark { width: 30px; height: 30px; border: 3px solid rgba(211, 155, 61, .24); border-top-color: #d39b3d; border-radius: 50%; animation: hexagone-loader-spin .75s linear infinite; }
@keyframes hexagone-loader-spin { to { transform: rotate(360deg); } }

/* 2026 professional workspace redesign */
:root {
  --bg: #eceef1;
  --surface: #ffffff;
  --surface-soft: #f7f8f9;
  --surface-strong: #ffffff;
  --surface-muted: #f2f4f6;
  --glass: #ffffff;
  --glass-strong: #ffffff;
  --glass-soft: #f5f6f7;
  --text: #202328;
  --muted: #626873;
  --line: #dfe2e6;
  --line-strong: #c9cdd3;
  --accent: #d39b3d;
  --accent-strong: #b77c1d;
  --accent-soft: rgba(211, 155, 61, .13);
  --shadow: 0 1px 2px rgba(20, 24, 31, .04), 0 8px 22px rgba(20, 24, 31, .055);
  --shadow-soft: 0 1px 3px rgba(20, 24, 31, .06);
  --radius-xl: 6px;
  --radius-lg: 6px;
  --radius-md: 5px;
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #090b0e;
  --surface: #12151a;
  --surface-soft: #171a1f;
  --surface-strong: #171a1f;
  --surface-muted: #1c2026;
  --glass: #12151a;
  --glass-strong: #171a1f;
  --glass-soft: #1c2026;
  --text: #f3f4f6;
  --muted: #aeb4bd;
  --line: #292e35;
  --line-strong: #3a414b;
  --accent: #d7a64f;
  --accent-strong: #e0b563;
  --accent-soft: rgba(215, 166, 79, .14);
  --danger: #ff9494;
  --success: #73d69b;
  --green: #73d69b;
  --red: #ff9494;
  --blue: #79b7ec;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, .32);
}

body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.page-shell,
.directory-shell,
.invoice-shell,
.finance-shell,
.app-shell {
  width: min(100%, 1380px) !important;
  max-width: 1380px !important;
  gap: 12px !important;
  padding: max(16px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom)) !important;
}

.card,
.panel,
.table-panel,
.editor-card,
.editor-panel,
.modal-card,
.controls-card,
.budget-card,
.stats-card,
.expenses-card,
.actions-card,
.app-card {
  overflow: visible;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-soft) !important;
}

.page-shell > .card:not(.hero-card),
.directory-shell > .card:not(.hero-card) {
  padding: 16px !important;
}

.page-shell > .hero-card,
.directory-shell > .hero-card,
.invoice-shell > .topbar,
.finance-shell > .topbar,
.app-shell > .hero,
.app-root > .app-header {
  min-height: 92px;
  border: 1px solid #343941 !important;
  border-top: 3px solid var(--accent) !important;
  border-radius: 6px !important;
  background: #202328 !important;
  color: #f7f7f8 !important;
  box-shadow: 0 8px 22px rgba(13, 16, 21, .16) !important;
}

@media (max-width: 1450px) {
  .finance-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .finance-shell > .topbar .filters {
    grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(4, 38px) !important;
  }
}

.page-shell > .hero-card,
.directory-shell > .hero-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  padding: 15px 18px !important;
}

.page-shell > .hero-card .hero-copy,
.directory-shell > .hero-card .hero-copy {
  order: 1;
  min-width: 0;
}

.page-shell > .hero-card .hero-head,
.directory-shell > .hero-card .hero-head {
  order: 2;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
}

.page-shell > .hero-card .hero-brand,
.directory-shell > .hero-card .hero-brand {
  display: flex !important;
  min-height: 0 !important;
}

.page-shell > .hero-card .hero-logo,
.directory-shell > .hero-card .hero-logo {
  width: 178px !important;
}

.page-shell > .hero-card .logo-dark,
.directory-shell > .hero-card .logo-dark {
  display: none !important;
}

.page-shell > .hero-card .logo-light,
.directory-shell > .hero-card .logo-light {
  display: block !important;
}

.page-shell > .hero-card h1,
.directory-shell > .hero-card h1,
.app-shell > .hero h1,
.invoice-shell > .topbar h1,
.finance-shell > .topbar h1 {
  color: #ffffff !important;
  font-size: 1.35rem !important;
  font-weight: 720 !important;
}

.page-shell > .hero-card p,
.directory-shell > .hero-card p,
.app-shell > .hero p,
.invoice-shell > .topbar p,
.finance-shell > .topbar p,
.finance-shell > .topbar label {
  color: #bfc4cb !important;
}

.page-shell > .hero-card .icon-btn,
.directory-shell > .hero-card .icon-btn,
.invoice-shell > .topbar .icon-btn,
.finance-shell > .topbar .icon-btn,
.app-shell > .hero .theme-toggle,
.app-shell > .hero .icon-link,
.app-root > .app-header button,
.app-root > .app-header a {
  border-color: #454b54 !important;
  background: #292d33 !important;
  color: #f7f7f8 !important;
}

.section-head {
  min-height: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: .96rem !important;
  font-weight: 720 !important;
}

.section-head small {
  color: var(--muted) !important;
}

button,
input,
select,
textarea,
.primary-btn,
.secondary-btn,
.mini-btn,
.ghost-btn,
.action-btn,
.category-menu-btn,
.messages-tab-btn,
.segmented-btn,
.dialog-menu-btn,
.icon-btn,
.icon-action,
.row-icon-btn,
.icon-text-btn {
  border-radius: 5px !important;
  color: var(--text) !important;
  opacity: 1;
}

input,
select,
textarea {
  min-height: 42px;
  border-color: var(--line-strong) !important;
  background: var(--surface-strong) !important;
  color: var(--text) !important;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent) !important;
}

.primary-btn,
button.primary,
.button-primary {
  border-color: #b67d22 !important;
  background: #d39b3d !important;
  color: #1d170d !important;
  font-weight: 720 !important;
}

.secondary-btn,
.mini-btn,
.ghost-btn,
.action-btn,
.icon-btn,
.icon-action,
.row-icon-btn,
.icon-text-btn {
  border-color: var(--line-strong) !important;
  background: var(--surface-strong) !important;
  color: var(--text) !important;
}

.danger-btn,
button.danger,
[data-action*='delete'] {
  border-color: color-mix(in srgb, var(--danger, #be3a3a) 48%, var(--line-strong)) !important;
  color: var(--danger, #be3a3a) !important;
}

html[data-theme='dark'] .danger-btn,
html[data-theme='dark'] button.danger,
html[data-theme='dark'] [data-action*='delete'] {
  background: #261719 !important;
  color: #ff9b9b !important;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: .72 !important;
  color: var(--muted) !important;
  -webkit-text-fill-color: var(--muted) !important;
}

html[data-theme='dark'] button:not(.primary-btn),
html[data-theme='dark'] .secondary-btn,
html[data-theme='dark'] .mini-btn,
html[data-theme='dark'] .ghost-btn,
html[data-theme='dark'] .action-btn,
html[data-theme='dark'] .category-menu-btn,
html[data-theme='dark'] .messages-tab-btn,
html[data-theme='dark'] .segmented-btn,
html[data-theme='dark'] .dialog-menu-btn {
  color: #f3f4f6 !important;
}

.category-menu-btn.is-active,
.messages-tab-btn.is-active,
.segmented-btn.is-active,
.dialog-menu-btn.is-active,
.view-tab.is-active,
.effectif-tab-btn.is-active {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--line-strong)) !important;
  background: var(--accent-soft) !important;
  color: var(--text) !important;
}

.summary-grid,
.kpi-grid,
.stats-grid {
  gap: 8px !important;
}

.summary-grid article,
.kpi-grid article,
.stat-tile {
  min-height: 104px;
  border: 1px solid var(--line) !important;
  border-top: 3px solid color-mix(in srgb, var(--accent) 78%, var(--line)) !important;
  border-radius: 5px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

.summary-grid strong,
.kpi-grid strong,
.stat-tile strong {
  font-variant-numeric: tabular-nums;
  font-weight: 740 !important;
}

.table-scroll,
.table-wrap,
.expenses-table-shell {
  border: 1px solid var(--line) !important;
  border-radius: 5px !important;
  background: var(--surface) !important;
}

table {
  border-collapse: collapse !important;
}

th {
  height: 38px;
  background: var(--surface-muted) !important;
  color: var(--muted) !important;
  font-size: .68rem !important;
  font-weight: 740 !important;
}

td {
  border-color: var(--line) !important;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-muted) 48%, transparent) !important;
}

body.home-view-login {
  background: #15181c !important;
}

body.home-view-login .auth-home-card {
  width: min(100%, 420px) !important;
  border: 1px solid #353b43 !important;
  border-top: 3px solid var(--accent) !important;
  background: #202328 !important;
  color: #f7f7f8 !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3) !important;
  padding: 24px !important;
}

body.home-view-login .auth-home-card .home-logo-dark {
  display: none !important;
}

body.home-view-login .auth-home-card .home-logo-light {
  display: block !important;
}

body.home-view-login .auth-home-card p,
body.home-view-login .auth-home-card label {
  color: #bfc4cb !important;
}

body.home-view-login .auth-home-card input,
body.home-view-login .auth-home-card .secondary-btn,
body.home-view-login .auth-home-card .theme-toggle {
  border-color: #454b54 !important;
  background: #292d33 !important;
  color: #ffffff !important;
}

body.home-view-login .legal-note {
  color: #888f99 !important;
}

body.home-view-portals .home-shell {
  max-width: 1220px !important;
  align-content: start;
  padding-inline: 20px;
}

body.home-view-portals .hero-card {
  width: 100% !important;
  min-height: 104px;
  border: 1px solid #343941 !important;
  border-top: 3px solid var(--accent) !important;
  background: #202328 !important;
  box-shadow: 0 8px 22px rgba(13, 16, 21, .16) !important;
}

body.home-view-portals .hero-card .home-logo-dark {
  display: none !important;
}

body.home-view-portals .hero-card .home-logo-light {
  display: block !important;
}

body.home-view-portals .hero-card .session-label {
  color: #bfc4cb !important;
}

body.home-view-portals .hero-card .hero-logo {
  width: min(34vw, 270px) !important;
  max-height: 72px;
  object-fit: contain;
}

body.home-view-portals .hero-card .icon-action,
body.home-view-portals .hero-card .theme-toggle {
  border-color: #454b54 !important;
  background: #292d33 !important;
  color: #ffffff !important;
}

body.home-view-portals .chooser-card {
  width: 100% !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 12px 0 0 !important;
}

body.home-view-portals .chooser-card > h2 {
  font-size: 1.35rem !important;
}

.portal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.portal-link {
  position: relative;
  min-height: 112px !important;
  border: 1px solid var(--line) !important;
  border-left: 0 !important;
  border-radius: 5px !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-soft) !important;
  padding: 16px 16px 16px 19px !important;
}

.portal-link::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}

.portal-link:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line)) !important;
  box-shadow: 0 10px 24px rgba(20, 24, 31, .09) !important;
}

.portal-icon {
  width: 44px !important;
  height: 44px !important;
  border: 0 !important;
  border-radius: 5px !important;
  background: var(--surface-muted) !important;
  color: color-mix(in srgb, var(--accent-strong) 76%, var(--text)) !important;
}

.portal-copy strong {
  font-size: .98rem !important;
  font-weight: 720 !important;
}

.portal-copy small {
  font-size: .78rem !important;
  line-height: 1.35;
}

.expenses-card .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.add-expense-btn {
  width: auto !important;
  min-height: 38px !important;
  padding-inline: 14px !important;
  white-space: nowrap;
}

.expense-source-pill,
.expense-locked {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}

.expense-source-pill.is-automatic {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent-strong) 72%, var(--text));
}

.expense-source-pill.is-manual {
  background: var(--surface-muted);
  color: var(--muted);
}

.expense-locked {
  border: 0;
  color: var(--muted);
}

.expense-row-automatic input:disabled,
.expense-row-automatic select:disabled {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  opacity: 1 !important;
}

.expense-col-source {
  width: 1%;
  white-space: nowrap;
}

html[data-theme='dark'] button.danger-btn,
html[data-theme='dark'] button[data-action*='delete'] {
  background: #261719 !important;
  color: #ff9b9b !important;
  -webkit-text-fill-color: #ff9b9b !important;
}

html[data-theme='dark'] button:disabled {
  color: #a4aab3 !important;
  -webkit-text-fill-color: #a4aab3 !important;
}

@media (max-width: 820px) {
  .page-shell,
  .directory-shell,
  .invoice-shell,
  .finance-shell,
  .app-shell {
    padding: max(10px, env(safe-area-inset-top)) 10px max(24px, env(safe-area-inset-bottom)) !important;
  }

  .page-shell > .hero-card,
  .directory-shell > .hero-card {
    min-height: 0;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 14px !important;
  }

  .page-shell > .hero-card .hero-head,
  .directory-shell > .hero-card .hero-head {
    order: 1;
    width: 100%;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .page-shell > .hero-card .hero-copy,
  .directory-shell > .hero-card .hero-copy {
    order: 2;
    width: 100%;
  }

  .page-shell > .hero-card .hero-brand,
  .directory-shell > .hero-card .hero-brand {
    flex: 0 0 auto;
  }

  .page-shell > .hero-card .hero-logo,
  .directory-shell > .hero-card .hero-logo {
    width: min(122px, 34vw) !important;
    flex: 0 0 auto;
  }

  .page-shell > .hero-card h1,
  .directory-shell > .hero-card h1 {
    font-size: 1.12rem !important;
  }

  .page-shell > .hero-card p,
  .directory-shell > .hero-card p {
    font-size: .74rem !important;
  }

  .portal-grid {
    grid-template-columns: 1fr !important;
  }

  .portal-link {
    min-height: 82px !important;
    padding: 12px 12px 12px 15px !important;
  }

  body.home-view-portals .home-shell {
    padding-inline: 10px;
  }

  .expenses-card .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .add-expense-btn {
    width: 100% !important;
  }

  .expenses-table-shell {
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
  }

  .expenses-table {
    min-width: 0 !important;
  }

  .expenses-table thead {
    display: none;
  }

  .expenses-table,
  .expenses-table tbody,
  .expenses-table tr,
  .expenses-table td {
    display: block;
    width: 100% !important;
  }

  .expenses-table tbody {
    display: grid;
    gap: 10px;
  }

  .expenses-table tr {
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 5px;
    background: var(--surface-soft) !important;
    padding: 10px;
  }

  .expenses-table td {
    min-width: 0 !important;
    border: 0 !important;
    background: transparent !important;
    padding: 5px 0 !important;
    text-align: left !important;
  }

  .expenses-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .66rem;
    font-weight: 740;
    text-transform: uppercase;
  }

  .expenses-table .expense-col-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .expenses-table .expense-col-actions::before {
    margin: 0 auto 0 0;
  }

  .expense-delete-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

@media (max-width: 720px) {
  .finance-shell > .topbar .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .finance-shell > .topbar .filters label {
    grid-column: 1 / -1 !important;
  }
}

/* Enterprise product system: strong application structure. */
:root {
  --enterprise-ink: #17191d;
  --enterprise-ink-soft: #202329;
  --enterprise-canvas: #f3f4f6;
  --enterprise-panel: #ffffff;
  --enterprise-rule: #d9dde2;
  --enterprise-gold: #d6a24a;
}

body {
  min-height: 100vh;
  background: var(--enterprise-canvas) !important;
  font-family: "Instrument Sans", "SF Pro Text", "Avenir Next", "Segoe UI", sans-serif !important;
}

html[data-theme='dark'] body {
  background: #0b0d10 !important;
}

.card,
.panel,
.table-panel,
.editor-card,
.editor-panel,
.modal-card,
.controls-card,
.budget-card,
.stats-card,
.expenses-card,
.actions-card,
.app-card {
  border-radius: 3px !important;
  box-shadow: none !important;
}

.workspace-nav {
  display: grid;
  gap: 3px;
  width: 100%;
  margin-top: 24px;
}

.workspace-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px 0 16px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #aeb4bd;
  font-size: .78rem;
  font-weight: 620;
  text-decoration: none;
}

.workspace-nav-link::before {
  content: '';
  position: absolute;
  left: 6px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #6f757e;
}

.workspace-nav-link:hover {
  border-color: #353a42;
  background: #23272d;
  color: #ffffff;
}

.workspace-nav-link.is-active {
  border-color: #4a4132;
  background: rgba(214, 162, 74, .12);
  color: #f4d397;
}

.workspace-nav-link.is-active::before {
  width: 3px;
  height: 18px;
  border-radius: 0;
  background: var(--enterprise-gold);
}

.field-label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-label-line small {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}

/* Portal: an application catalog, not a collection of decorative cards. */
body.home-view-portals .home-shell {
  width: min(calc(100% - 32px), 1540px) !important;
  max-width: 1540px !important;
  margin: 0 auto;
  padding: 16px !important;
  align-content: start;
}

body.home-view-portals .chooser-card {
  padding: 26px 28px 32px !important;
  border: 1px solid var(--line) !important;
  border-radius: 3px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

body.home-view-portals .chooser-card > h2 {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 1.42rem !important;
  font-weight: 720 !important;
}

body.home-view-portals .chooser-card > p {
  margin: 5px 0 22px !important;
  color: var(--muted) !important;
  font-size: .82rem !important;
}

body.home-view-portals .portal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

body.home-view-portals .portal-link {
  position: relative;
  min-height: 118px !important;
  align-items: center !important;
  gap: 15px !important;
  padding: 18px !important;
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-left: 1px solid var(--line) !important;
  border-radius: 3px !important;
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

body.home-view-portals .portal-link::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: transparent;
}

body.home-view-portals .portal-link:hover {
  transform: none !important;
  border-color: color-mix(in srgb, var(--enterprise-gold) 55%, var(--line)) !important;
  background: var(--surface) !important;
  box-shadow: 0 10px 24px rgba(21, 24, 29, .08) !important;
}

body.home-view-portals .portal-link:hover::after {
  background: var(--enterprise-gold);
}

body.home-view-portals .portal-icon {
  width: 48px !important;
  height: 48px !important;
  flex: 0 0 48px;
  border: 1px solid color-mix(in srgb, var(--enterprise-gold) 34%, var(--line)) !important;
  border-radius: 3px !important;
  background: color-mix(in srgb, var(--enterprise-gold) 9%, var(--surface)) !important;
  color: var(--accent-strong) !important;
}

body.home-view-portals .portal-icon svg {
  width: 27px !important;
  height: 27px !important;
}

body.home-view-portals .portal-copy strong {
  font-size: .94rem !important;
  font-weight: 720 !important;
}

body.home-view-portals .portal-copy small {
  color: var(--muted) !important;
  font-size: .74rem !important;
}

/* Financial and invoice workspaces use a full-width command header. */
.invoice-shell,
.finance-shell {
  width: min(calc(100% - 32px), 1660px) !important;
  max-width: 1660px !important;
  gap: 14px !important;
  padding: 16px !important;
}

.invoice-shell > .topbar,
.finance-shell > .topbar {
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid #30343b !important;
  border-top: 0 !important;
  border-radius: 3px !important;
  background: var(--enterprise-ink) !important;
  box-shadow: none !important;
}

.invoice-shell > .topbar {
  grid-template-columns: minmax(260px, .72fr) minmax(620px, 2fr) auto !important;
}

.finance-shell > .topbar {
  grid-template-columns: minmax(270px, .72fr) minmax(0, 2fr) !important;
}

.invoice-shell > .topbar .brand,
.finance-shell > .topbar .brand {
  min-height: 104px;
  padding: 12px 18px;
  border-left: 4px solid var(--enterprise-gold);
  border-right: 1px solid #30343b;
}

.invoice-shell > .topbar .toolbar,
.finance-shell > .topbar .filters {
  align-self: stretch;
  padding: 16px 18px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--enterprise-ink-soft) !important;
  box-shadow: none !important;
}

.invoice-shell > .topbar .topbar-actions {
  align-self: stretch;
  padding: 16px 16px 16px 0;
  background: var(--enterprise-ink-soft);
}

.invoice-shell > .topbar input,
.invoice-shell > .topbar select,
.finance-shell > .topbar input,
.finance-shell > .topbar select {
  border-color: #464c55 !important;
  background: #15181c !important;
  color: #ffffff !important;
}

.summary-grid,
.kpi-grid {
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}

.summary-grid article,
.kpi-grid article {
  min-height: 112px;
  border: 0 !important;
  border-right: 1px solid var(--line) !important;
  border-top: 0 !important;
  border-radius: 0 !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

.summary-grid article:last-child,
.kpi-grid article:last-child {
  border-right: 0 !important;
}

.finance-shell .kpi-grid .kpi-main {
  background: var(--enterprise-ink) !important;
  color: #ffffff !important;
}

.finance-shell .kpi-grid .kpi-main span,
.finance-shell .kpi-grid .kpi-main small {
  color: #b8bec7 !important;
}

.finance-shell .kpi-grid .kpi-main strong {
  color: #f0c575 !important;
}

.finance-shell .panel,
.invoice-shell .table-panel {
  border-radius: 3px !important;
}

.section-head {
  min-height: 48px !important;
  align-items: center !important;
  padding: 0 0 12px !important;
}

.section-head h2 {
  color: var(--text) !important;
  font-size: .92rem !important;
  font-weight: 740 !important;
}

th {
  height: 42px !important;
  border-bottom: 1px solid var(--line-strong) !important;
  background: var(--surface-muted) !important;
  color: var(--muted) !important;
  text-transform: uppercase;
}

td {
  min-height: 46px;
}

@media (min-width: 1024px) {
  .page-shell,
  .directory-shell,
  .app-shell {
    display: grid !important;
    grid-template-columns: 238px minmax(0, 1fr) !important;
    align-items: start !important;
    width: min(calc(100% - 32px), 1580px) !important;
    max-width: 1580px !important;
    margin: 0 auto !important;
    padding: 16px !important;
    gap: 14px !important;
  }

  .page-shell > .hero-card,
  .directory-shell > .hero-card,
  .app-shell > .hero {
    position: sticky !important;
    top: 16px;
    grid-column: 1 !important;
    grid-row: 1 / span 80 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0;
    min-height: calc(100vh - 32px) !important;
    padding: 22px 16px !important;
    overflow: auto !important;
    border: 1px solid #30343b !important;
    border-top: 0 !important;
    border-left: 4px solid var(--enterprise-gold) !important;
    border-radius: 3px !important;
    background: var(--enterprise-ink) !important;
    box-shadow: none !important;
  }

  .page-shell > :not(.hero-card),
  .directory-shell > :not(.hero-card),
  .app-shell > :not(.hero) {
    grid-column: 2 !important;
    min-width: 0;
  }

  .page-shell > .hero-card .hero-head,
  .directory-shell > .hero-card .hero-head,
  .app-shell > .hero .hero-top {
    order: 1 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    width: 100%;
    gap: 16px !important;
  }

  .page-shell > .hero-card .hero-brand,
  .directory-shell > .hero-card .hero-brand,
  .app-shell > .hero .brand-wrap {
    order: 1;
    width: 100% !important;
    min-width: 0;
  }

  .page-shell > .hero-card .hex-history-nav,
  .directory-shell > .hero-card .hex-history-nav,
  .app-shell > .hero .hex-history-nav {
    order: 2;
  }

  .page-shell > .hero-card .hero-copy,
  .directory-shell > .hero-card .hero-copy,
  .app-shell > .hero .hero-subtitle {
    order: 2 !important;
    width: 100%;
    margin-top: 26px !important;
    padding-top: 20px;
    border-top: 1px solid #30343b;
  }

  .page-shell > .hero-card .hero-actions,
  .directory-shell > .hero-card .hero-actions,
  .app-shell > .hero .hero-actions {
    order: 3;
    justify-content: flex-start !important;
    margin-left: auto;
  }

  .page-shell > .hero-card .hero-logo,
  .directory-shell > .hero-card .hero-logo,
  .app-shell > .hero .brand-logo {
    width: 166px !important;
    max-width: 100% !important;
  }

  .page-shell > .hero-card .workspace-nav,
  .directory-shell > .hero-card .workspace-nav,
  .app-shell > .hero .workspace-nav {
    order: 3 !important;
  }

  body.home-view-portals .home-shell {
    display: grid !important;
    grid-template-columns: 250px minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  body.home-view-portals .hero-card {
    position: sticky;
    top: 16px;
    align-self: start;
    width: 100% !important;
    min-height: calc(100vh - 32px) !important;
    padding: 22px 18px !important;
    border: 1px solid #30343b !important;
    border-left: 4px solid var(--enterprise-gold) !important;
    border-top: 0 !important;
    border-radius: 3px !important;
    background: var(--enterprise-ink) !important;
  }

  body.home-view-portals .hero-card .hero-logo {
    width: 178px !important;
    max-width: 100% !important;
    margin: 32px 0 14px !important;
  }

  body.home-view-portals .hero-card .session-label {
    max-width: 100%;
    text-align: left !important;
    line-height: 1.5;
  }

  body.home-view-portals .chooser-card {
    width: 100% !important;
    max-width: none !important;
  }
}

@media (max-width: 1260px) and (min-width: 1024px) {
  body.home-view-portals .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .invoice-shell > .topbar,
  .finance-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .invoice-shell > .topbar .brand,
  .finance-shell > .topbar .brand {
    min-height: 86px;
    border-right: 0;
    border-bottom: 1px solid #30343b;
  }
}

@media (max-width: 1023px) {
  .workspace-nav {
    display: flex;
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    overflow-x: auto;
    border-top: 1px solid #353a42;
    scrollbar-width: none;
  }

  .workspace-nav::-webkit-scrollbar {
    display: none;
  }

  .workspace-nav-link {
    flex: 0 0 auto;
    min-height: 36px;
    padding-inline: 14px;
    border-color: #353a42;
  }

  .workspace-nav-link::before {
    display: none;
  }

  .page-shell > .hero-card,
  .directory-shell > .hero-card,
  .app-shell > .hero {
    padding: 15px !important;
    border-left: 4px solid var(--enterprise-gold) !important;
  }

  .invoice-shell > .topbar,
  .finance-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .invoice-shell > .topbar .brand,
  .finance-shell > .topbar .brand {
    min-height: 82px;
    border-right: 0;
    border-bottom: 1px solid #30343b;
  }

  .invoice-shell > .topbar .topbar-actions {
    padding: 0 16px 16px;
  }
}

@media (max-width: 760px) {
  body.home-view-portals .home-shell,
  .invoice-shell,
  .finance-shell {
    width: 100% !important;
    padding: 10px !important;
  }

  body.home-view-portals .chooser-card {
    padding: 18px 14px 22px !important;
  }

  body.home-view-portals .portal-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.home-view-portals .portal-link {
    min-height: 92px !important;
    padding: 14px !important;
  }

  .summary-grid,
  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .summary-grid article,
  .kpi-grid article {
    min-height: 96px;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
  }

  .invoice-shell > .topbar .toolbar,
  .finance-shell > .topbar .filters {
    padding: 14px !important;
  }
}

/* Final product shell: one navigation, one visual hierarchy, one responsive model. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fa;
  --surface-strong: #ffffff;
  --surface-muted: #f2f3f5;
  --text: #1b1e23;
  --muted: #68707c;
  --line: #e2e5e9;
  --line-strong: #cfd4da;
  --accent: #c79543;
  --accent-strong: #aa7729;
  --accent-soft: rgba(199, 149, 67, .11);
  --danger: #b83b45;
  --success: #23764a;
  --product-sidebar: #17191d;
  --product-sidebar-soft: #202329;
  --product-radius: 6px;
  --product-shadow: 0 1px 2px rgba(18, 22, 28, .035), 0 8px 24px rgba(18, 22, 28, .045);
}

html[data-theme='dark'] {
  --bg: #0d0f12;
  --surface: #16191d;
  --surface-soft: #1a1e23;
  --surface-strong: #191c21;
  --surface-muted: #111419;
  --text: #f0f2f4;
  --muted: #9ca4af;
  --line: #292e35;
  --line-strong: #3a414b;
  --accent: #d0a052;
  --accent-strong: #e2b665;
  --accent-soft: rgba(208, 160, 82, .13);
  --danger: #ef737c;
  --success: #63c18c;
  --product-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 12px 28px rgba(0, 0, 0, .16);
}

body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: "Instrument Sans", "SF Pro Text", "Avenir Next", "Segoe UI", sans-serif !important;
  font-size: 14px;
  line-height: 1.45;
}

body::before,
body::after {
  display: none !important;
}

:where(.card, .panel, .table-panel, .editor-panel, .editor-card, .modal-card, .controls-card, .budget-card, .stats-card, .expenses-card, .actions-card, .app-card) {
  border: 1px solid var(--line) !important;
  border-radius: var(--product-radius) !important;
  background: var(--surface) !important;
  box-shadow: var(--product-shadow) !important;
}

:where(button, input, select, textarea, .primary-btn, .secondary-btn, .mini-btn, .icon-btn, .icon-action, .row-icon-btn) {
  border-radius: 5px !important;
  letter-spacing: 0 !important;
}

:where(input, select, textarea) {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

:where(input, textarea)::placeholder {
  color: var(--muted) !important;
  font-weight: 400 !important;
  opacity: .82;
}

:where(button, .secondary-btn, .mini-btn, .icon-btn, .icon-action, .row-icon-btn) {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

.primary-btn,
button[type='submit']:not(.secondary):not(.ghost-btn) {
  border-color: #a8772d !important;
  background: var(--accent) !important;
  color: #211a0e !important;
}

/* Global navigation */
.workspace-mobilebar,
.workspace-menu-backdrop {
  display: none;
}

.workspace-sidebar {
  background: var(--product-sidebar) !important;
  color: #f4f5f6;
}

.workspace-sidebar-head {
  display: flex;
  align-items: center;
  min-height: 96px;
  border-bottom: 1px solid #2c3036;
}

.workspace-sidebar-brand {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 96px;
  padding: 8px 18px;
  border: 0;
  justify-content: flex-start;
}

.workspace-sidebar-brand img {
  width: 158px;
  height: auto;
  max-height: none;
}

.workspace-menu-close {
  display: none;
}

.workspace-nav {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 14px 10px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3e45 transparent;
}

.workspace-nav-section {
  margin-top: 17px;
}

.workspace-nav-heading {
  margin: 0 10px 7px;
  color: #737a84;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.workspace-nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  margin: 2px 0;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #b5bbc4;
  font-size: 13px;
  font-weight: 520;
  text-decoration: none;
}

.workspace-nav-link::before,
.workspace-nav-link::after {
  display: none !important;
}

.workspace-nav-link:hover {
  border-color: #30343a !important;
  background: #1e2126 !important;
  color: #ffffff !important;
}

.workspace-nav-link.is-active {
  border-color: #363b42 !important;
  background: #24272d !important;
  color: #ffffff !important;
  box-shadow: inset 2px 0 0 var(--accent) !important;
}

.workspace-portal-link {
  min-height: 40px;
  color: #f2f3f5;
  font-weight: 620;
}

.workspace-sidebar-footer {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 12px 10px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #2c3036;
}

.workspace-user {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 6px 8px 10px;
}

.workspace-user-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #454a52;
  border-radius: 5px;
  background: #292d33;
  color: #f2cd89;
  font-size: 11px;
  font-weight: 700;
}

.workspace-user-copy {
  display: grid;
  min-width: 0;
}

.workspace-user-copy strong,
.workspace-user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-user-copy strong {
  color: #f1f2f4;
  font-size: 12px;
  font-weight: 620;
}

.workspace-user-copy small {
  color: #8f969f;
  font-size: 10px;
}

.workspace-footer-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #b6bcc5 !important;
  font-size: 12px;
  text-align: left;
}

.workspace-footer-action:hover {
  border-color: #343940 !important;
  background: #202329 !important;
  color: #ffffff !important;
}

.workspace-theme-value {
  color: #e7bd73;
  font-size: 11px;
  font-weight: 650;
}

.workspace-logout {
  justify-content: flex-start;
}

body.hex-workspace-body #themeToggle,
body.hex-workspace-body #theme-toggle,
body.hex-workspace-body #mobile-theme-toggle,
body.hex-workspace-body .hero-actions > a[href$='../index.html'],
body.hex-workspace-body .hero-actions > a[href$='/index.html'],
body.hex-workspace-body .header-home-action-link,
body.hex-workspace-body .mobile-home-action-link,
body.hex-workspace-body #logout-btn,
body.hex-workspace-body #mobile-logout-btn {
  display: none !important;
}

/* Desktop application frame */
@media (min-width: 1024px) {
  body.hex-workspace-body {
    display: grid !important;
    grid-template-columns: 224px minmax(0, 1fr) !important;
    align-items: start;
    min-height: 100dvh;
  }

  body.hex-workspace-body > .workspace-sidebar {
    position: sticky;
    top: 0;
    z-index: 200;
    grid-column: 1;
    grid-row: 1 / span 20;
    display: flex !important;
    flex-direction: column;
    width: 224px;
    height: 100dvh;
    overflow: hidden;
    border-right: 1px solid #292d33;
  }

  body.hex-workspace-body > main,
  body.hex-workspace-body > footer,
  body.hex-workspace-body > .app-root {
    grid-column: 2;
    min-width: 0;
  }

  body.hex-workspace-body .page-shell,
  body.hex-workspace-body .directory-shell,
  body.hex-workspace-body .app-shell,
  body.hex-workspace-body .invoice-shell,
  body.hex-workspace-body .finance-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 1540px !important;
    margin: 0 auto !important;
    padding: 22px 26px 36px !important;
    gap: 14px !important;
  }

  body.hex-workspace-body .page-shell > *,
  body.hex-workspace-body .directory-shell > *,
  body.hex-workspace-body .app-shell > * {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-width: 0;
  }

  body.hex-workspace-body .page-shell > .hero-card,
  body.hex-workspace-body .directory-shell > .hero-card,
  body.hex-workspace-body .app-shell > .hero {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 70px !important;
    height: auto !important;
    padding: 13px 17px !important;
    overflow: visible !important;
    border: 1px solid var(--line) !important;
    border-left: 2px solid var(--accent) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-head,
  body.hex-workspace-body .directory-shell > .hero-card .hero-head,
  body.hex-workspace-body .app-shell > .hero .hero-top {
    order: 2 !important;
    display: flex !important;
    width: auto !important;
    gap: 8px !important;
  }

  body.hex-workspace-body .page-shell > .hero-card .hero-copy,
  body.hex-workspace-body .directory-shell > .hero-card .hero-copy,
  body.hex-workspace-body .app-shell > .hero .hero-subtitle {
    order: 1 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
}

body.hex-workspace-body .hero-brand,
body.hex-workspace-body .brand-wrap,
body.hex-workspace-body .invoice-shell > .topbar .brand .logo,
body.hex-workspace-body .finance-shell > .topbar .brand .logo,
body.hex-workspace-body .app-root > .app-header .logo {
  display: none !important;
}

body.hex-workspace-body .hero-card h1,
body.hex-workspace-body .topbar h1,
body.hex-workspace-body .planning-context strong {
  color: var(--text) !important;
  font-size: 18px !important;
  font-weight: 650 !important;
  line-height: 1.25;
  letter-spacing: 0 !important;
}

body.hex-workspace-body .hero-card p,
body.hex-workspace-body .topbar .brand p,
body.hex-workspace-body .planning-context span {
  margin-top: 3px;
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 500;
}

body.hex-workspace-body .app-shell > .hero > .hex-history-nav-absolute {
  position: static !important;
  inset: auto !important;
  order: 2 !important;
  flex: 0 0 auto;
  margin: 0 0 0 auto !important;
  transform: none !important;
}

/* Financial workspaces */
body.hex-workspace-body .invoice-shell > .topbar,
body.hex-workspace-body .finance-shell > .topbar {
  min-height: 76px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--line) !important;
  border-top: 1px solid var(--line) !important;
  border-radius: var(--product-radius) !important;
  background: var(--surface) !important;
  box-shadow: var(--product-shadow) !important;
}

body.hex-workspace-body .invoice-shell > .topbar {
  grid-template-columns: 230px minmax(500px, 1fr) auto !important;
}

body.hex-workspace-body .finance-shell > .topbar {
  grid-template-columns: 235px minmax(0, 1fr) !important;
}

body.hex-workspace-body .invoice-shell > .topbar .brand,
body.hex-workspace-body .finance-shell > .topbar .brand {
  min-height: 76px;
  padding: 14px 17px;
  border: 0;
  border-left: 2px solid var(--accent);
  border-right: 1px solid var(--line);
  background: var(--surface) !important;
}

body.hex-workspace-body .invoice-shell > .topbar .toolbar,
body.hex-workspace-body .finance-shell > .topbar .filters {
  align-self: stretch;
  padding: 11px 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--surface-soft) !important;
  box-shadow: none !important;
}

body.hex-workspace-body .invoice-shell > .topbar .topbar-actions {
  align-self: stretch;
  padding: 11px 12px 11px 0;
  background: var(--surface-soft) !important;
}

body.hex-workspace-body .invoice-shell > .topbar input,
body.hex-workspace-body .invoice-shell > .topbar select,
body.hex-workspace-body .finance-shell > .topbar input,
body.hex-workspace-body .finance-shell > .topbar select {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

.summary-grid,
.kpi-grid {
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-radius: var(--product-radius) !important;
  background: var(--surface) !important;
  box-shadow: var(--product-shadow) !important;
}

.summary-grid article,
.kpi-grid article {
  min-height: 100px !important;
  border: 0 !important;
  border-right: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

.summary-grid article:last-child,
.kpi-grid article:last-child {
  border-right: 0 !important;
}

.finance-shell .kpi-grid .kpi-main {
  background: #1c1f24 !important;
  color: #ffffff !important;
}

.finance-shell .kpi-grid .kpi-main strong {
  color: #e6bc73 !important;
}

.section-head {
  min-height: 44px !important;
  padding: 0 0 10px !important;
  border-bottom: 1px solid var(--line) !important;
}

.section-head h2 {
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 650 !important;
}

th {
  height: 40px !important;
  border-bottom: 1px solid var(--line-strong) !important;
  background: var(--surface-muted) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase;
}

td {
  border-bottom-color: var(--line) !important;
}

/* Planning fits the same product shell without losing its specialist controls. */
body.hex-workspace-body > .app-root {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 22px 26px 34px !important;
}

body.hex-workspace-body .app-root > .app-header {
  min-height: 70px !important;
  padding: 11px 14px !important;
  border: 1px solid var(--line) !important;
  border-left: 2px solid var(--accent) !important;
  border-radius: var(--product-radius) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: var(--product-shadow) !important;
}

body.hex-workspace-body .app-root > .app-header .header-left {
  display: none !important;
}

body.hex-workspace-body .app-root > .app-header .header-right {
  margin-left: auto;
}

body.hex-workspace-body .app-root > .app-header .planning-context {
  margin: 0 auto 0 0 !important;
  text-align: left;
}

/* Portal */
body.home-view-portals .home-shell {
  display: grid !important;
  grid-template-columns: 236px minmax(0, 1fr) !important;
  align-items: start;
  width: min(calc(100% - 32px), 1500px) !important;
  max-width: 1500px !important;
  margin: 0 auto;
  padding: 16px !important;
  gap: 14px !important;
}

body.home-view-portals .hero-card {
  position: sticky;
  top: 16px;
  align-self: start;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start !important;
  justify-content: flex-start;
  width: 100% !important;
  min-height: calc(100dvh - 32px) !important;
  padding: 20px 18px !important;
  border: 1px solid #2e3238 !important;
  border-radius: var(--product-radius) !important;
  background: var(--product-sidebar) !important;
  color: #f4f5f6 !important;
  box-shadow: none !important;
}

body.home-view-portals .hero-card .hero-logo {
  width: 132px !important;
  margin: 38px 0 16px !important;
}

body.home-view-portals .hero-card .session-label {
  color: #9ca3ad !important;
  font-size: 12px !important;
  line-height: 1.5;
  text-align: left !important;
}

body.home-view-portals .hero-card .hero-topbar {
  width: 100%;
}

body.home-view-portals .hero-card .icon-action,
body.home-view-portals .hero-card .theme-toggle {
  border-color: #3b4048 !important;
  background: #22262b !important;
  color: #f4f5f6 !important;
}

body.home-view-portals .chooser-card {
  width: 100% !important;
  padding: 18px 20px 26px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.home-view-portals .chooser-card > h2 {
  font-size: 22px !important;
  font-weight: 650 !important;
}

body.home-view-portals .chooser-card > p {
  margin: 5px 0 20px !important;
  font-size: 13px !important;
}

body.home-view-portals .portal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

body.home-view-portals .portal-link {
  min-height: 102px !important;
  align-items: center !important;
  gap: 13px !important;
  padding: 15px !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--product-radius) !important;
  background: var(--surface) !important;
  box-shadow: 0 1px 2px rgba(18, 22, 28, .025) !important;
}

body.home-view-portals .portal-link:hover {
  transform: none !important;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
  box-shadow: var(--product-shadow) !important;
}

body.home-view-portals .portal-icon {
  width: 42px !important;
  height: 42px !important;
  flex: 0 0 42px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)) !important;
  border-radius: 5px !important;
  background: var(--accent-soft) !important;
}

/* Mobile application frame and real navigation drawer. */
@media (max-width: 1023px) {
  body.hex-workspace-body {
    display: block !important;
    min-width: 0;
    padding-top: 60px !important;
  }

  body.hex-workspace-body.workspace-menu-open {
    overflow: hidden !important;
  }

  .workspace-mobilebar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 320;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    height: 60px;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    border-bottom: 1px solid #30343a;
    background: #17191d;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  }

  .workspace-menu-trigger {
    display: grid;
    width: 44px;
    height: 44px;
    min-height: 44px;
    place-content: center;
    gap: 4px;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
  }

  .workspace-menu-trigger span {
    display: block;
    width: 18px;
    height: 1.5px;
    border-radius: 1px;
    background: #f4f5f6;
  }

  .workspace-mobile-brand {
    justify-self: center;
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .workspace-mobile-brand img {
    display: block;
    width: 142px;
    height: 44px;
    max-height: 44px;
    object-fit: contain;
  }

  .workspace-mobilebar > strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body.hex-workspace-body > .workspace-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 350;
    display: flex !important;
    flex-direction: column;
    width: min(86vw, 330px);
    height: 100dvh;
    overflow: hidden;
    border-right: 1px solid #30343a;
    transform: translateX(-102%);
    transition: transform 190ms ease;
  }

  body.workspace-menu-open > .workspace-sidebar {
    transform: translateX(0);
  }

  .workspace-sidebar-head {
    min-height: 78px;
  }

  .workspace-sidebar-brand {
    min-height: 78px;
    padding: 4px 16px;
  }

  .workspace-sidebar-brand img {
    width: 142px;
    height: auto;
    max-height: none;
  }

  .workspace-menu-close {
    display: grid;
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin-right: 10px;
    place-items: center;
    padding: 0;
    border: 1px solid #363b42 !important;
    background: #202329 !important;
    color: #e4e6e9 !important;
    font-size: 24px;
    font-weight: 300 !important;
    line-height: 1;
  }

  .workspace-nav {
    display: block !important;
    margin: 0 !important;
    padding: 11px 10px 18px !important;
    overflow-y: auto !important;
    border: 0 !important;
  }

  .workspace-nav-section {
    margin-top: 14px;
  }

  .workspace-nav-link {
    min-height: 44px;
    padding-inline: 12px;
    border-color: transparent !important;
  }

  .workspace-sidebar-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .workspace-footer-action {
    min-height: 44px;
    font-size: 13px !important;
  }

  .workspace-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 340;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(5, 7, 10, .58) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 190ms ease;
  }

  body.workspace-menu-open > .workspace-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.hex-workspace-body .page-shell,
  body.hex-workspace-body .directory-shell,
  body.hex-workspace-body .app-shell,
  body.hex-workspace-body .invoice-shell,
  body.hex-workspace-body .finance-shell,
  body.hex-workspace-body > .app-root {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: calc(100dvh - 60px) !important;
    margin: 0 !important;
    padding: 12px 12px 26px !important;
    gap: 12px !important;
    overflow: visible !important;
  }

  body.hex-workspace-body .page-shell > .hero-card,
  body.hex-workspace-body .directory-shell > .hero-card,
  body.hex-workspace-body .app-shell > .hero,
  body.hex-workspace-body .app-root > .app-header {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 62px !important;
    height: auto !important;
    padding: 11px 13px !important;
    overflow: visible !important;
    border: 1px solid var(--line) !important;
    border-left: 2px solid var(--accent) !important;
    border-radius: var(--product-radius) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: var(--product-shadow) !important;
  }

  body.hex-workspace-body .hero-head {
    width: auto !important;
  }

  body.hex-workspace-body .hero-copy {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  body.hex-workspace-body .hero-card h1,
  body.hex-workspace-body .topbar h1,
  body.hex-workspace-body .planning-context strong {
    font-size: 16px !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar,
  body.hex-workspace-body .finance-shell > .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .brand,
  body.hex-workspace-body .finance-shell > .topbar .brand {
    min-height: 62px;
    padding: 11px 13px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body.hex-workspace-body .invoice-shell > .topbar .toolbar,
  body.hex-workspace-body .finance-shell > .topbar .filters {
    padding: 12px !important;
  }

  body.hex-workspace-body .invoice-shell > .topbar .topbar-actions {
    padding: 0 12px 12px;
  }

  .summary-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .summary-grid article,
  .kpi-grid article {
    min-height: 92px !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
  }

  body.home-view-portals .home-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    padding: 10px !important;
  }

  body.home-view-portals .hero-card {
    position: static;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 92px !important;
    padding: 14px !important;
  }

  body.home-view-portals .hero-card .hero-logo {
    width: 124px !important;
    margin: 4px 0 8px !important;
  }

  body.home-view-portals .hero-card .hero-topbar {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  body.home-view-portals .chooser-card {
    padding: 12px 4px 20px !important;
  }

  body.home-view-portals .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .workspace-mobilebar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  body.home-view-portals .portal-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.home-view-portals .portal-link {
    min-height: 88px !important;
  }

  .finance-shell > .topbar .filters,
  .invoice-shell > .topbar .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .finance-shell > .topbar .filters label:last-of-type,
  .invoice-shell > .topbar .toolbar label:first-child {
    grid-column: 1 / -1 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-sidebar,
  .workspace-menu-backdrop {
    transition: none !important;
  }
}
