/* ==========================================================================
   Layout: header, module navigation, launcher, global search, page frame, auth.
   Logical properties only (RTL-safe).
   ========================================================================== */

/* ---- Header ---------------------------------------------------------------- */
.app-header {
  position: sticky; inset-block-start: 0; z-index: var(--z-header);
  background: var(--surface);
  border-block-end: 1px solid var(--border);
}
.app-header__inner {
  height: var(--header-h);
  max-width: var(--page-max); margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex; align-items: center; gap: var(--sp-2);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: var(--fw-semibold); font-size: var(--fs-md);
  color: var(--text); letter-spacing: -0.01em; white-space: nowrap;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand__mark {
  width: 24px; height: 24px; border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-contrast);
  display: inline-grid; place-items: center; font-size: 0.8rem; font-weight: 700; flex: none;
  overflow: hidden;
}
.brand__mark img { width: 100%; height: 100%; object-fit: cover; }
/* An uploaded logo is shown exactly as it is: its own colours, its own proportions. No tinted tile, filter, mask, opacity or cropping. */
.brand__mark--logo { width: auto; height: 28px; max-width: 120px; border-radius: 0; background: none; color: inherit; overflow: visible; display: inline-flex; }
.brand__mark--logo img { width: auto; height: 100%; max-width: 100%; object-fit: contain; filter: none; opacity: 1; }
.brand__name { max-width: 140px; }
.header-module {
  color: var(--text-muted); display: inline-flex; align-items: center; gap: var(--sp-2);
  padding-inline-start: var(--sp-2); margin-inline-start: var(--sp-1);
  border-inline-start: 1px solid var(--border); white-space: nowrap;
}
.header-module i { color: var(--text-faint); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; }

.icon-btn {
  position: relative;
  width: var(--ctl-h); height: var(--ctl-h);
  display: inline-grid; place-items: center; flex: none;
  border: 0; background: transparent; color: var(--text-muted);
  border-radius: var(--r-md); font-size: 1rem; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.icon-btn .dot { position: absolute; inset-block-start: 6px; inset-inline-end: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft-strong); color: var(--accent-text);
  display: inline-grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  text-transform: uppercase; flex: none;
}
.user-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--ctl-h);
  padding-inline: var(--sp-1) var(--sp-2); border: 0; background: transparent; color: var(--text);
  border-radius: var(--r-md); cursor: pointer; font-size: var(--fs-sm);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-hover); }

/* ---- Module navigation (second bar, only when the module has pages) ------- */
.app-subnav { background: var(--surface); border-block-end: 1px solid var(--border); }
.app-subnav__inner {
  height: var(--subnav-h);
  max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter);
  display: flex; align-items: stretch; gap: var(--sp-1);
  overflow-x: auto; scrollbar-width: none;
}
.app-subnav__inner::-webkit-scrollbar { display: none; }
.subnav-link {
  display: inline-flex; align-items: center; padding-inline: var(--sp-3);
  color: var(--text-muted); font-weight: var(--fw-medium); white-space: nowrap;
  border-block-end: 2px solid transparent; margin-block-end: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.subnav-link:hover { color: var(--text); text-decoration: none; }
.subnav-link.active { color: var(--accent-text); border-block-end-color: var(--accent); }
button.subnav-link { background: none; border: 0; border-block-end: 2px solid transparent; font: inherit; font-weight: var(--fw-medium); cursor: pointer; }
button.subnav-link[aria-expanded="true"] { color: var(--text); }
button.subnav-link.active[aria-expanded="true"] { color: var(--accent-text); }
.subnav-group { display: flex; align-items: stretch; }
.subnav-link__caret { font-size: .6rem; margin-inline-start: 5px; opacity: .7; }

/* ---- Global search --------------------------------------------------------- */
.gsearch { position: relative; flex: 1 1 auto; max-width: 420px; margin-inline: var(--sp-3); }
.gsearch__icon { position: absolute; inset-inline-start: 9px; inset-block-start: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; font-size: .8rem; }
.gsearch__input {
  width: 100%; height: var(--ctl-h);
  padding-inline: 28px 40px; background: var(--surface-hover);
  border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--text); font: inherit;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.gsearch__input::placeholder { color: var(--text-faint); }
.gsearch__input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.gsearch__kbd {
  position: absolute; inset-inline-end: 7px; inset-block-start: 50%; transform: translateY(-50%);
  font: inherit; font-size: 0.6875rem; color: var(--text-faint); background: transparent; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 0 5px; line-height: 1.5; pointer-events: none;
}
.gsearch__results {
  position: absolute; inset-inline: 0; inset-block-start: calc(100% + 4px); z-index: var(--z-dropdown);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-menu);
  max-height: 60vh; overflow-y: auto; padding: var(--sp-1);
}
.gsearch__group { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: var(--sp-2) var(--sp-2) 2px; }
.gsearch__item { display: flex; align-items: center; gap: var(--sp-2); padding: 6px var(--sp-2); border-radius: var(--r-md); color: var(--text); }
.gsearch__item:hover, .gsearch__item.is-active { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.gsearch__item i { color: var(--text-faint); }
.gsearch__item small { color: var(--text-faint); margin-inline-start: auto; }
.gsearch__empty { padding: var(--sp-3); color: var(--text-muted); text-align: center; }
.search-toggle { display: none; }

/* ---- Page frame ------------------------------------------------------------ */
.page { padding-block: var(--sp-3) var(--sp-6); }
.page__inner { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter); }

.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); margin-block-end: var(--gap-section); min-height: var(--toolbar-h); }
.page-header__title { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-3); row-gap: 0; min-width: 0; flex: 1 1 auto; }
.page-header__title h1 { letter-spacing: var(--ls-title); }
.page-header__title p { margin: 0; color: var(--text-faint); font-size: var(--fs-xs); min-width: 0; }   /* context sits beside the title, not under it */
.page-header__title > nav { flex: 0 0 100%; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-block-end: var(--gap-section); }

/* One toolbar row: status tabs · search · filters · (view switch). Wraps the page's tab and filter regions, so the AJAX swaps still target each region. */
.m-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); margin-block-end: var(--gap-section); }
.m-toolbar > [data-region], .m-toolbar > * { min-width: 0; }
.m-toolbar .m-tabs { border-block-end: 0; margin-block-end: 0; overflow-x: auto; }
.m-toolbar .page-toolbar { margin-block-end: 0; flex: 1 1 auto; justify-content: flex-start; }
.m-toolbar > [data-region$="-filters"] { flex: 1 1 auto; }
.m-toolbar__end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--sp-2); }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 2px; padding: 0; list-style: none; font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.3; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs i { font-size: .65rem; }
.breadcrumbs [aria-current] { color: var(--text-muted); }

/* ---- Dashboard grid -------------------------------------------------------- */
.grid-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-2); }
.grid-dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-2); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }

/* ---- Settings-style two-column form layout --------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--form-gap) var(--sp-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-narrow { max-width: 960px; }
/* Forms with a split / line editor or a long field set: wider than a plain form, never full page width (fields stay scannable). */
.form-medium { max-width: 1160px; }

/* ---- Auth ------------------------------------------------------------------ */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth__bar { display: flex; justify-content: flex-end; gap: 2px; padding: var(--sp-3) var(--gutter); }
.auth__main { flex: 1; display: grid; place-items: start center; padding: 8vh var(--gutter) var(--sp-8); }
.auth__card { width: 100%; max-width: 380px; }
.auth__brand { display: flex; justify-content: center; margin-block-end: var(--sp-5); }
.auth__brand .brand { font-size: var(--fs-lg); }
.auth__brand .brand__mark { width: 30px; height: 30px; font-size: 1rem; }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 575.98px) {
  .grid-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .grid-dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
  :root { --gutter: 0.75rem; }
  .header-module, .brand__name.d-none-mobile { display: none; }
  .gsearch { display: none; position: static; margin: 0; max-width: none; }
  .search-toggle { display: inline-grid; }
  .app-header.search-open .gsearch {
    display: block; position: absolute; inset-inline: 0; inset-block-start: 100%;
    padding: var(--sp-2) var(--gutter); background: var(--surface); border-block-end: 1px solid var(--border);
  }
  .app-header.search-open .gsearch__icon { inset-inline-start: calc(var(--gutter) + 9px); }
  .app-header.search-open .gsearch__results { inset-inline: var(--gutter); }
  .gsearch__kbd { display: none; }
  .page { padding-block-start: var(--sp-3); }
  .form-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-header { align-items: center; }
  .page-header__actions { flex-wrap: wrap; }
}
@media (max-width: 479.98px) {
  .grid-metrics { gap: var(--sp-2); }
  .user-btn .user-name { display: none; }
  .app-header__inner { gap: var(--sp-1); }
}
@media (max-width: 399.98px) {   /* the logo mark stays; the written name makes way for the actions */
  .brand__name { display: none; }
}

/* Utilities that replace repeated inline styles */
.form-grid--even { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.form-grid--wide-first { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-3); }
.pre-line { white-space: pre-line; }
.pre-line-any { white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 767.98px) { .form-grid--even, .form-grid--wide-first { grid-template-columns: minmax(0, 1fr); } }

/* repeater rows (services links, budget lines, debt schedule): fixed-shape grids instead of inline styles */
.form-grid--link { grid-template-columns: 1fr 2fr auto; }
.form-grid--budget { grid-template-columns: 2fr 1fr auto; }
.form-grid--even-auto { grid-template-columns: 1fr 1fr auto; }
.form-grid.span-all, .span-all { grid-column: 1 / -1; }
.border-soft { border-color: var(--border) !important; }
.qt-sum--wide { min-width: 260px; }
@media (max-width: 575.98px) { .form-grid--link, .form-grid--budget, .form-grid--even-auto { grid-template-columns: minmax(0, 1fr) auto; } .form-grid--link > :first-child, .form-grid--budget > :first-child { grid-column: 1 / -1; } }

/* ---- App Launcher page (the entry point: simple tiles, not stat cards) ------------------------------------ */

/* ---- Header app switcher (popover from the grid icon) ---------------------------------------------------------------- */
.launcher-menu { --bs-dropdown-min-width: 0; width: 304px; max-width: calc(100vw - 16px); padding: var(--sp-3) !important; z-index: var(--z-launcher); }
.launcher-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-1); }
.launcher-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--sp-2) 4px; border-radius: var(--r-lg); color: var(--text); text-align: center; text-decoration: none; min-height: 78px; transition: background var(--t-fast); }
.launcher-tile:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.launcher-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface-hover); }
.launcher-tile.is-current { background: var(--accent-soft); }
.launcher-tile__icon { width: 36px; height: 36px; border-radius: var(--r-lg); display: grid; place-items: center; font-size: 1.1rem; background: var(--accent-soft); color: var(--accent-text); }
.launcher-tile.is-current .launcher-tile__icon { background: var(--surface); }
.launcher-tile__name { font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 1.2; overflow-wrap: anywhere; }
.launcher-foot { border-block-start: 1px solid var(--border); margin: var(--sp-2) calc(var(--sp-3) * -1) calc(var(--sp-3) * -1); padding: 0; }
.launcher-foot a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.launcher-foot a:hover, .launcher-foot a:focus-visible { color: var(--accent-text); background: var(--surface-hover); text-decoration: none; }
@media (max-width: 575.98px) { .launcher-menu { position: fixed !important; inset-inline: 8px !important; inset-block-start: calc(var(--header-h) + 4px) !important; transform: none !important; width: auto; } }

/* ---- App Launcher background (Settings → Appearance). Same rules for the real page and the settings preview, so what you see is what you get ---- */
.page--launcher, .lb-stage { position: relative; isolation: isolate; }
.page--launcher.has-bg, .lb-stage.has-bg { background-color: var(--bg); background-image: var(--lb-image); background-repeat: no-repeat; background-position: var(--lb-pos, center); background-size: var(--lb-size, cover); }
.page--launcher.has-bg::before, .lb-stage.has-bg::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: color-mix(in srgb, var(--bg) var(--lb-overlay, 40%), transparent); }
.page--launcher.has-bg { min-height: calc(100vh - var(--header-h, 48px)); }
.has-bg .app-tile__name, .has-bg .apps__empty { text-shadow: 0 0 6px var(--bg), 0 0 2px var(--bg); }
.has-bg .app-tile:hover { background: color-mix(in srgb, var(--surface-hover) 80%, transparent); }

.auth__brand .brand__mark.brand__mark--logo { width: auto; height: 44px; max-width: 180px; }   /* login page: larger, same proportions */

/* Logo in dark mode: a dedicated dark logo when one was uploaded; otherwise the main logo on a white rounded backing so it never disappears. */
.brand__mark .logo-dark { display: none; }
[data-theme="dark"] .brand__mark:not([data-no-dark-logo]) .logo-light { display: none; }
[data-theme="dark"] .brand__mark:not([data-no-dark-logo]) .logo-dark { display: block; }
[data-theme="dark"] .brand__mark--logo[data-no-dark-logo] { background: #fff; padding: 3px 6px; border-radius: 8px; }

/* Live figures beside a page title (Invoices: outstanding / overdue / collected) */
.page-header__context { min-width: 0; font-size: var(--fs-xs); color: var(--text-muted); }
/* A page's own search + filter in the header (replaces the global search, e.g. project Tasks) */
.gsearch--page { display: flex; align-items: center; max-width: 620px; }
.gsearch--page .tb-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.gsearch--page .tb-top .pj-search, .gsearch--page .tb-top .pj-tools { flex: 1 1 auto; min-width: 0; }
.gsearch--page .tb-top .pj-tools { display: flex; align-items: center; gap: 8px; }
.gsearch--page .tb-top .pj-tools .pj-search { flex: 1 1 auto; }
.gsearch--page .tb-counts, .gsearch--page .pj-tasks__counts { white-space: nowrap; flex: none; }

/* Sign-in page: centred card, roomier fields, password toggle */
.auth__main { place-items: center; padding-block: var(--sp-6); }
.auth__card { max-width: 400px; }
.auth__brand { margin-block-end: var(--sp-6); }
.auth__brand .brand { font-size: var(--fs-xl); }
.auth-login { padding: var(--sp-2); }
.auth-login__title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); margin: 0 0 4px; }
.auth-login__sub { color: var(--text-muted); margin: 0 0 var(--sp-5); }
.auth-login .m-input { height: 42px; }
.auth-pass { position: relative; }
.auth-pass .m-input { padding-inline-end: 42px; }
.auth-pass__btn { position: absolute; inset-inline-end: 4px; inset-block-end: 4px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); border-radius: var(--r-sm); cursor: pointer; }
.auth-pass__btn:hover { color: var(--text); background: var(--surface-hover); }
.auth-caps { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; font-size: var(--fs-sm); color: var(--warning); }
.auth-caps[hidden] { display: none; }

/* ---- Sign-in, split design: navy panel with a wave edge on the left, the form card on the right ------------------------------------------------- */
.auth--split { --navy: #123071; --navy-2: #1b4290; flex-direction: row; direction: ltr; background: var(--bg); }
[dir="rtl"] .auth--split > * { direction: rtl; }
.auth--split .auth__col { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.auth--split .auth__brand { margin-block-end: var(--sp-5); }
.auth--split .auth__brand .brand { flex-direction: column; gap: 6px; font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.auth--split .auth__brand .brand__mark { background: none; border: 0; box-shadow: none; }
.auth--split .auth__brand .brand__mark--logo { width: 76px; height: 76px; padding: 8px; border: 2px solid var(--text); border-radius: 18px; display: grid; place-items: center; }
.auth--split .auth__brand .brand__mark--logo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.auth--split .auth__brand .brand__mark:not(.brand__mark--logo) { width: 72px; height: 72px; font-size: 1.8rem; border-radius: 18px; background: var(--accent); color: var(--accent-contrast); display: inline-grid; place-items: center; }
[data-theme="dark"] .auth--split .auth__brand .brand__mark--logo[data-no-dark-logo] { background: #fff; border-color: #fff; }
.auth--split .auth__main { place-items: center; }
.auth--split .auth__card { max-width: 440px; background: var(--surface); border-radius: 24px; padding: var(--sp-7, 40px) var(--sp-6, 32px); box-shadow: 0 20px 50px -24px rgb(18 48 113 / .28); }
.auth--split .auth__card > .m-card { border: 0; box-shadow: none; background: none; padding: 0; }
.auth--split .auth-login__title { text-align: center; font-size: 1.6rem; }
.auth--split .auth-login__sub { text-align: center; }
.auth-field { position: relative; }
.auth-field > i { position: absolute; inset-inline-start: 14px; inset-block-end: 13px; font-size: 1.05rem; color: var(--text-muted); pointer-events: none; z-index: 1; }
.auth-field .m-input { padding-inline-start: 42px; border-radius: 12px; background: var(--surface-2); }
.auth--split .auth-pass .m-input { padding-inline-end: 44px; }
.auth--split .m-btn--primary { background: linear-gradient(90deg, #2563eb, #1d4ed8); border-radius: 12px; height: 48px; }

.auth__side { display: none; }
@media (min-width: 992px) {
  .auth--split .auth__side { display: flex; flex: 0 0 48%; position: relative; align-items: center; justify-content: center; background: radial-gradient(120% 90% at 20% 0%, var(--navy-2), var(--navy) 60%); color: #fff; padding: var(--sp-8, 48px); overflow: hidden; }
  .auth--split .auth__side::after { content: ""; position: absolute; inset-block: 0; right: -1px; width: 150px; background: var(--bg); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 1000' preserveAspectRatio='none'%3E%3Cpath d='M150 0H60C110 220 -10 430 70 620S30 900 60 1000H150Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 1000' preserveAspectRatio='none'%3E%3Cpath d='M150 0H60C110 220 -10 430 70 620S30 900 60 1000H150Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
  .auth--split .auth__brand { display: none; }
}
@media (min-width: 992px) { .auth--split .auth__brand { display: block; } }
.auth__side-in { position: relative; z-index: 1; width: 100%; max-width: 520px; text-align: center; padding-right: 60px; }
.auth__side-brand { display: inline-flex; align-items: center; gap: 14px; font-size: 2.2rem; font-weight: var(--fw-bold); margin-block-end: var(--sp-6, 32px); }
.auth__side-brand img { height: 56px; width: auto; }
img[data-mono] { filter: brightness(0) invert(1); }
.auth__side-title { font-size: 1.7rem; font-weight: var(--fw-bold); margin: 0 0 var(--sp-3); }
.auth__side-text { color: rgb(255 255 255 / .8); margin: 0 auto var(--sp-6, 32px); max-width: 420px; line-height: 1.8; }
.auth__art { position: relative; height: 300px; }
.auth__chip { position: absolute; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgb(255 255 255 / .14); border: 1px solid rgb(255 255 255 / .22); font-size: 1.4rem; }
.auth__chip--a { inset-inline-start: 14%; inset-block-start: 16%; } .auth__chip--b { inset-inline-start: 42%; inset-block-start: 0; } .auth__chip--c { inset-inline-end: 12%; inset-block-start: 14%; } .auth__chip--d { inset-inline-start: 2%; inset-block-start: 40%; }
.auth__laptop { position: absolute; inset-inline: 12% 18%; inset-block-start: 76px; height: 190px; background: #e8eefc; border-radius: 12px 12px 4px 4px; padding: 8px; box-shadow: 0 20px 40px -12px rgb(0 0 0 / .5); }
.auth__laptop::after { content: ""; position: absolute; inset-inline: -6%; inset-block-end: -10px; height: 10px; background: #cfd8ee; border-radius: 0 0 14px 14px; }
.auth__screen { position: relative; height: 100%; background: #fff; border-radius: 6px; padding: 10px; display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: 12px 34px 1fr; gap: 8px; }
.auth__screen-bar { grid-column: 1 / -1; background: #e5ebf8; border-radius: 4px; }
.auth__screen-row { grid-column: 1 / -1; display: flex; gap: 6px; } .auth__screen-row i { flex: 1; background: #dbe6fb; border-radius: 4px; }
.auth__screen-chart { display: flex; align-items: flex-end; gap: 5px; } .auth__screen-chart b { flex: 1; background: #3b82f6; border-radius: 3px 3px 0 0; }
.auth__screen-donut { align-self: center; justify-self: center; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(#3b82f6 0 62%, #dbe6fb 0); -webkit-mask: radial-gradient(circle 20px, transparent 98%, #000 100%); mask: radial-gradient(circle 20px, transparent 98%, #000 100%); }
.auth__phone { position: absolute; inset-inline-end: 8%; inset-block-end: 0; width: 70px; height: 138px; border-radius: 14px; background: var(--navy-2); border: 3px solid #e8eefc; display: grid; place-items: center; box-shadow: 0 16px 30px -10px rgb(0 0 0 / .5); }
.auth__phone img { width: 30px; height: auto; }
@media (max-width: 991.98px) { .auth--split { flex-direction: column; } }
.auth__side, .auth__side h2, .auth__side-brand { color: #fff; }
.auth__art { direction: ltr; }
.auth--split .auth__brand { display: flex; justify-content: center; }
.auth--split .auth__brand .brand { align-items: center; }
.auth__chip { z-index: 2; } .auth__chip--a { inset-block-start: 8%; }

/* ---- Home / App Launcher (Odoo-style): a calm stage, a pill search, and a grid of big coloured app icons with their names underneath ---- */
.page--launcher:not(.has-bg) { background: var(--bg); }
.page--launcher { min-height: calc(100vh - var(--header-h, 48px)); }
.apps { max-width: 1080px; margin-inline: auto; padding-block: var(--sp-6) var(--sp-8, 48px); display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); }
.apps__search { position: relative; width: 100%; max-width: 420px; }
.apps__search .bi { position: absolute; inset-inline-start: 16px; inset-block-start: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.apps__search .m-input { width: 100%; height: 44px; padding-inline-start: 42px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-md); }
.apps__grid { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--sp-5) var(--sp-3); justify-items: center; }
.apps__grid > li { width: 100%; max-width: 156px; }
.apps__grid > li[hidden] { display: none; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: var(--sp-3) var(--sp-2); border-radius: 18px; color: var(--text); text-align: center; text-decoration: none; transition: transform var(--t-fast), background var(--t-fast); }
.app-tile:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); text-decoration: none; }
.app-tile:hover .app-tile__icon, .app-tile:focus-visible .app-tile__icon { transform: translateY(-3px); box-shadow: 0 10px 22px color-mix(in srgb, var(--ts, #64748b) 45%, transparent); }
.app-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-tile__icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; font-size: 2.2rem; background: var(--ts, #64748b); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--ts, #64748b) 30%, transparent); transition: transform var(--t-fast), box-shadow var(--t-fast); }
.app-tile__name { font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: 1.25; overflow-wrap: anywhere; }
.apps__grid .sortable-ghost, .apps__grid .is-ghost { opacity: .35; }
.apps__grid .sortable-chosen .app-tile { background: var(--surface-hover); }
.apps__empty { text-align: center; color: var(--text-muted); margin: 0; }
.apps__empty[hidden], .apps__foot[hidden] { display: none; }
.apps__foot { display: flex; justify-content: center; }
/* each app keeps its own colour */
.apps__grid [data-app="dashboard"] { --ts: #3b82f6; } .apps__grid [data-app="contacts"] { --ts: #6d5bd0; } .apps__grid [data-app="crm"] { --ts: #e0559a; }
.apps__grid [data-app="projects"] { --ts: #5b5bd6; } .apps__grid [data-app="tasks"] { --ts: #9b4fd0; } .apps__grid [data-app="timesheets"] { --ts: #14a38b; }
.apps__grid [data-app="vault"] { --ts: #7c5cc4; } .apps__grid [data-app="sales"] { --ts: #3aa65b; } .apps__grid [data-app="finance"] { --ts: #0f9d8a; }
.apps__grid [data-app="personal"] { --ts: #c0508f; } .apps__grid [data-app="subscriptions"] { --ts: #4f46e5; } .apps__grid [data-app="services"] { --ts: #d9822b; }
.apps__grid [data-app="reports"] { --ts: #1f9d9d; } .apps__grid [data-app="settings"] { --ts: #64748b; }
.has-bg .app-tile__name, .has-bg .apps__empty { text-shadow: 0 0 6px var(--bg), 0 0 2px var(--bg); }
@media (max-width: 767.98px) {
  .apps { padding-block: var(--sp-4); gap: var(--sp-4); }
  .apps__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3) 2px; }
  .app-tile { padding: 6px 2px; gap: 8px; }
  .app-tile__icon { width: 60px; height: 60px; border-radius: 18px; font-size: 1.75rem; }
  .app-tile__name { font-size: var(--fs-sm); }
}


/* Module pages menu (replaces the tab row under the header) */
button.header-module { background: none; border-block: 0; border-inline-end: 0; font: inherit; cursor: pointer; height: 30px; padding-inline-end: var(--sp-2); border-radius: 6px; }
button.header-module:hover, button.header-module[aria-expanded="true"] { color: var(--text); background: var(--surface-hover); }
.header-module__caret { font-size: .6rem; opacity: .7; }
.header-module-menu .app-subnav { min-width: 13rem; height: auto; background: var(--surface); }
.header-module-menu .subnav-link.active { color: var(--accent-text); font-weight: var(--fw-medium); }
.header-module-menu .dropdown-header.subnav-group { display: block; }

/* ===== Create / edit pages: header tile, sectioned card, roomy inputs, side preview + tips, primary action first ===== */
.page-header--form { display: flex; align-items: center; gap: 18px; margin-block-end: var(--sp-5); }
.page-header--form .page-header__title { flex: 1; min-width: 0; }
.page-header--form h1 { font-size: 1.7rem; font-weight: var(--fw-semibold); margin: 0; }
.page-header--form p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-md); }
.page-header__tile { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 18px; font-size: 1.9rem; color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
main .form-narrow, main .form-split { max-width: 1480px; }
main .form-narrow .m-card, main .form-split .m-card { border-radius: 16px; background: color-mix(in srgb, var(--surface) 92%, #000); }
main .form-narrow .m-input, main .form-narrow .m-select, main .form-split .m-input, main .form-split .m-select { height: 44px; border-radius: 10px; background: var(--surface-2, var(--surface)); }
main .form-narrow .m-textarea, main .form-split .m-textarea { border-radius: 10px; min-height: 84px; }
main .form-narrow .m-field__label, main .form-split .m-field__label { font-weight: var(--fw-semibold); font-size: var(--fs-md); margin-block-end: 6px; }
main .form-narrow .m-field__label .m-field__opt, main .form-split .m-field__label small { font-weight: var(--fw-regular); }
.m-input-icon { position: relative; display: block; }
.m-input-icon > .bi { position: absolute; inset-inline-start: 14px; inset-block-start: 22px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 1.05rem; }
.m-input-icon .m-input, .m-input-icon .m-textarea { padding-inline-start: 44px; }
.m-input-icon--area > .bi { inset-block-start: 22px; }
.form-split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.form-split__main { display: grid; gap: 22px; } .form-split__side { display: grid; gap: 18px; position: sticky; inset-block-start: 72px; }
.form-sec + .form-sec { margin-block-start: 26px; padding-block-start: 22px; border-block-start: 1px solid var(--border); }
.form-sec__t { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 1.1rem; font-weight: var(--fw-semibold); }
.form-sec__t .bi { font-size: 1.3rem; color: var(--text-muted); }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
main .form-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-start; }
main .form-actions .m-btn { height: 44px; padding-inline: 20px; font-weight: var(--fw-medium); }
main .form-actions .m-btn--primary { order: -1; }
.acc-prev { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.acc-prev__tile { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; font-size: 1.5rem; background: color-mix(in srgb, var(--accent) 25%, var(--surface)); color: var(--accent-text, var(--accent)); }
.acc-prev__body { flex: 1; min-width: 0; display: flex; flex-direction: column; } .acc-prev__body strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .acc-prev__body small { color: var(--text-muted); }
.acc-prev__chip { padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: var(--fs-sm); white-space: nowrap; }
.form-tips { margin: 0; padding-inline-start: 18px; display: grid; gap: 10px; color: var(--text); }
@media (max-width: 1199.98px) { .form-split { grid-template-columns: 1fr; } .form-split__side { position: static; } .form-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .form-grid--three { grid-template-columns: 1fr; } .page-header__tile { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; } .page-header--form h1 { font-size: 1.3rem; } }
.page-header--form .page-header__title { display: block; }
main .form-actions { justify-content: flex-start !important; }
main .form-narrow .m-pick, main .form-split .m-pick, main .form-narrow .m-select-btn, main .form-split .m-select-btn { min-height: 44px; border-radius: 10px; }
main .form-narrow .m-cs__trigger, main .form-split .m-cs__trigger { height: 44px; min-height: 44px; border-radius: 10px; background: var(--surface-2, var(--surface)); padding-inline-start: 14px; }

/* every create / edit page (anything with the form header) gets the same field look, not only forms built on .form-narrow */
main:has(.page-header--form) .m-card:not(.m-card--flush) { border-radius: 16px; }
main:has(.page-header--form) .m-input:not([type=checkbox]):not([type=radio]):not([type=file]), main:has(.page-header--form) .m-cs__trigger { min-height: 44px; border-radius: 10px; background: var(--surface-2, var(--surface)); }
main:has(.page-header--form) .m-field__label { font-weight: var(--fw-semibold); font-size: var(--fs-md); margin-block-end: 6px; }
main:has(.page-header--form) .m-card__title { font-size: 1.1rem; font-weight: var(--fw-semibold); }
main:has(.page-header--form) .m-card__head { padding-block: 16px; }
main:has(.page-header--form) .m-input.m-input--sm, main:has(.page-header--form) table .m-input, main:has(.page-header--form) table .m-cs__trigger { min-height: 34px; height: 34px; border-radius: 8px; }
