/* =============================================================================
   Temia — common stylesheet
   -----------------------------------------------------------------------------
   Everything shared by every screen: the design tokens, the type ramp, the icon
   set, the application shell (sidebar, topbar, breadcrumb, footer) and every
   reusable component — buttons, badges, cards, KPI tiles, tables and their
   toolbars, form controls, modals, the multi-step wizard and the Bootstrap
   overrides that keep vendor components on-brand.

   Every page links this file first. A screen that needs anything beyond these
   components links its own sheet from css/pages/ afterwards, so screen-specific
   rules always win the cascade without raising specificity.

   Nothing in this file is tied to one screen. If a rule only ever applies to a
   single page, it belongs in that page's sheet instead.

   CONTENTS
     1.  Fonts                    11.  Table
     2.  Design tokens            12.  Footer
     3.  Base + typography        12b. Data-view toolbar
     4.  Icon system              12c. Table extras
     5.  App shell                12d. View toggle
     6.  Buttons, chips, badges   12e. Client card
     7.  Cards                    12f. Alert banner
     8.  KPI cards                12g. Form controls
                                  12h. Modal
     13. Bootstrap integration    12i. Entity header
     16. Multi-step wizard        12j. Progress bar
     18. Shared utilities         12k. Table aggregate footer
     14. Responsive overrides
   ============================================================================ */

/* =============================================================================
   1. Fonts — self-hosted, no external requests
   ============================================================================ */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-400-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-400-normal.woff") format("woff");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-500-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-500-normal.woff") format("woff");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-600-normal.woff") format("woff");
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/urbanist-latin-500-normal.woff2") format("woff2"),
       url("../assets/fonts/urbanist-latin-500-normal.woff") format("woff");
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/urbanist-latin-700-normal.woff2") format("woff2"),
       url("../assets/fonts/urbanist-latin-700-normal.woff") format("woff");
}


/* =============================================================================
   2. Design tokens — the Figma variable collection, plus type and spacing
   ============================================================================ */
:root {
  /* ---------------------------------------------------------------------------
     COLOUR — the Figma variable collection, verbatim.
     Each token carries the Figma variable it mirrors, so a change in the design
     file has exactly one place to land here.
     ------------------------------------------------------------------------ */

  /* Primary — Figma `Primary/Primary…` */
  --color-primary-100: #0B4CC5;
  --color-primary-80:  #3C70D1;
  --color-primary-60:  #6D94DC;
  --color-primary-40:  #9DB7E8;
  --color-primary-20:  #CEDBF3;
  --color-primary-10:  #E7EDF9;
  --color-primary-5:   #F3F6FC;

  /* Secondary — Figma `Secondary/Secondary…` */
  --color-secondary-100: #0D306F;
  --color-secondary-80:  #3D598C;
  --color-secondary-60:  #6E83A9;
  --color-secondary-40:  #9EACC5;
  --color-secondary-20:  #CFD6E2;
  --color-secondary-10:  #E7EAF1;
  --color-secondary-5:   #F3F5F8;

  /* Shade — Figma `Shade/Shade…` */
  --color-shade-100: #0F1419;
  --color-shade-80:  #3F4347;
  --color-shade-60:  #6F7275;
  --color-shade-40:  #9FA1A3;
  --color-shade-20:  #CFD0D1;
  --color-shade-10:  #E7E7E8;
  --color-shade-5:   #F3F3F3;

  /* Tertiary — Figma `Tertiary/Tertiary…` */
  --color-tertiary-100: #F4B000;
  --color-tertiary-60:  #F8D066;
  --color-tertiary-10:  #FEF7E5;

  /* Indicators — Figma `indicate/…` */
  --color-green:  #008368;
  --color-red:    #CB2B00;
  --color-lime:   #06B6D4;
  --color-purple: #5746AF;

  /* Figma `White` */
  --color-white: #FFFFFF;

  /* ---------------------------------------------------------------------------
     TYPOGRAPHY
     Poppins carries the interface; Urbanist is the display face used by the
     figures on the KPI cards and by Figma's `material-theme/label/…` styles.
     ------------------------------------------------------------------------ */
  --font-family-base: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto,
                      "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-family-display: "Urbanist", var(--font-family-base);

  --font-size-3xs: 10px;
  --font-size-2xs: 11px;
  --font-size-xs:  12px;
  --font-size-sm:  13px;   /* the interface default */
  --font-size-md:  14px;
  --font-size-lg:  16px;
  --font-size-xl:  18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 26px;
  --font-size-5xl: 32px;
  --font-size-6xl: 48px;

  --line-height-3xs: 12px;
  --line-height-2xs: 16px;
  --line-height-xs:  18px;
  --line-height-sm:  20px;
  --line-height-md:  22px;
  --line-height-lg:  24px;
  --line-height-xl:  28px;
  --line-height-2xl: 32px;
  --line-height-3xl: 36px;
  --line-height-4xl: 40px;
  --line-height-5xl: 56px;

  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  --letter-spacing-tight:  .1px;
  --letter-spacing-normal: .2px;
  --letter-spacing-wide:   .4px;
  --letter-spacing-wider:  .5px;

  /* ---------------------------------------------------------------------------
     RADII — Figma `Corner/…`, plus the 4px the controls are drawn with
     ------------------------------------------------------------------------ */
  --radius-sm:   4px;
  --radius-xs:   8px;    /* Figma `Corner/Xs`  */
  --radius-md:   6px;
  --radius-xxm:  20px;   /* Figma `Corner/Xxm` */
  --radius-pill: 48px;
  --radius-full: 1000px;

  /* ---------------------------------------------------------------------------
     SPACING — the 4px step the layouts are set on
     ------------------------------------------------------------------------ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ---------------------------------------------------------------------------
     LAYOUT
     ------------------------------------------------------------------------ */
  --sidebar-width: 256px;
  --sidebar-width-rail: 76px;   /* the collapsed rail */
  --topbar-height: 50px;

  /* Reused by the icon system and by Bootstrap's dropdown caret */
  --chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");

  /* ---------------------------------------------------------------------------
     BOOTSTRAP — vendor components pointed at the tokens above, so Bootstrap's
     own source file is never edited.
     ------------------------------------------------------------------------ */
  --bs-body-font-family: var(--font-family-base);
  --bs-body-font-size: 0.8125rem;   /* 13px */
  --bs-body-color: var(--color-shade-100);
  --bs-body-bg: var(--color-secondary-5);
  --bs-border-color: var(--color-shade-10);
  --bs-border-radius: var(--radius-sm);
  --bs-link-color: var(--color-primary-80);
  --bs-link-hover-color: var(--color-primary-100);
}


/* =============================================================================
   3. Base + typography helpers
   ============================================================================ */
body {
  line-height: 1.54;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* Type ramp taken from the design's text styles */
.tm-title    { font-size: var(--font-size-md); line-height: var(--line-height-lg); font-weight: var(--font-weight-medium); letter-spacing: .15px; color: var(--color-shade-100); margin: 0; }
.tm-subtitle { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); letter-spacing: var(--letter-spacing-wider);  color: var(--color-shade-60);  margin: 0; }
.tm-heading  { font-size: var(--font-size-md); line-height: var(--line-height-lg); font-weight: var(--font-weight-medium); letter-spacing: var(--letter-spacing-wider);  color: var(--color-secondary-100); margin: 0; }

/* Semantic text colours */
.tm-text-positive { color: var(--color-green); }
.tm-text-negative { color: var(--color-red); }
.tm-text-muted    { color: var(--color-shade-60); }

/* Thin vertical rule used between toolbar groups */
.tm-divider-y {
  width: 1px;
  height: 24px;
  flex: 0 0 auto;
  background: var(--color-shade-20);
}


/* =============================================================================
   4. Icon system
   -----------------------------------------------------------------------------
   Every icon is a standalone file in /assets/icons. It is applied as a CSS mask
   so a single file can be tinted with `currentColor`, inherits hover states and
   stays cacheable — no inline SVG, no duplicated markup.

     <span class="tm-icon tm-icon--search" aria-hidden="true"></span>
   ============================================================================ */
.tm-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: var(--icon-image) center / contain no-repeat;
          mask: var(--icon-image) center / contain no-repeat;
}

/* Size modifiers */
.tm-icon--sm { width: 12px; height: 12px; }
.tm-icon--md { width: 20px; height: 20px; }
.tm-icon--lg { width: 24px; height: 24px; }
.tm-icon--xl { width: 36px; height: 36px; }

/* Glyph modifiers.
   The originals live in assets/icons/ as editable .svg files; they are embedded
   here as URL-encoded data: URIs so the page needs no build step and works when
   opened straight from disk (browsers block mask files loaded over file://).
   To change an icon, edit its .svg and paste the encoded markup into its rule. */
.tm-icon--check { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 12.5 5 5 10-11'/%3E%3C/svg%3E"); }
.tm-icon--close { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6 18 18M18 6 6 18'/%3E%3C/svg%3E"); }
.tm-icon--download { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5v10.5'/%3E%3Cpath d='m7.8 10 4.2 4.2 4.2-4.2'/%3E%3Cpath d='M4 16v2.5A2.5 2.5 0 0 0 6.5 21h11a2.5 2.5 0 0 0 2.5-2.5V16'/%3E%3C/svg%3E"); }
.tm-icon--edit { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18.5 3.5a2.12 2.12 0 0 1 3 3L12 16l-4 1 1-4Z'/%3E%3Cpath d='M20 13.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.5'/%3E%3C/svg%3E"); }
.tm-icon--user-add { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9.5' cy='8' r='3.5'/%3E%3Cpath d='M3 20a6.5 6.5 0 0 1 13 0'/%3E%3Cpath d='M18.5 6.5v6M15.5 9.5h6'/%3E%3C/svg%3E"); }
.tm-icon--view-grid { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Crect x='3.5' y='3.5' width='7' height='7' rx='1.5'/%3E%3Crect x='13.5' y='3.5' width='7' height='7' rx='1.5'/%3E%3Crect x='3.5' y='13.5' width='7' height='7' rx='1.5'/%3E%3Crect x='13.5' y='13.5' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.tm-icon--view-list { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M4 6.5h16M4 12h16M4 17.5h16'/%3E%3C/svg%3E"); }
.tm-icon--warning { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.6 3.9a1.6 1.6 0 0 1 2.8 0l7.4 13.3a1.6 1.6 0 0 1-1.4 2.4H4.6a1.6 1.6 0 0 1-1.4-2.4Z'/%3E%3Cpath d='M12 9v4.2M12 16.5h.01'/%3E%3C/svg%3E"); }
.tm-icon--building { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v16'/%3E%3Cpath d='M15 9h3a2 2 0 0 1 2 2v10'/%3E%3Cpath d='M2.5 21h19'/%3E%3Cpath d='M7.5 7h4M7.5 11h4M7.5 15h4'/%3E%3C/svg%3E"); }
.tm-icon--id-card { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='19' height='14' rx='2.5'/%3E%3Ccircle cx='8.5' cy='11' r='2.2'/%3E%3Cpath d='M5.2 16.2a3.6 3.6 0 0 1 6.6 0'/%3E%3Cpath d='M14.5 10h4.2M14.5 13.5h4.2'/%3E%3C/svg%3E"); }
.tm-icon--image-plus { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12.5V6.5A2.5 2.5 0 0 0 17.5 4h-11A2.5 2.5 0 0 0 4 6.5v11A2.5 2.5 0 0 0 6.5 20h6'/%3E%3Ccircle cx='9' cy='9.5' r='1.6'/%3E%3Cpath d='m4.5 16.5 4-4 3.5 3.5'/%3E%3Cpath d='M18 15.5v6M15 18.5h6'/%3E%3C/svg%3E"); }
.tm-icon--map-pin { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21.5s7-6.1 7-11.2a7 7 0 1 0-14 0C5 15.4 12 21.5 12 21.5Z'/%3E%3Ccircle cx='12' cy='10' r='2.8'/%3E%3C/svg%3E"); }
.tm-icon--trash { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 6.5h17'/%3E%3Cpath d='M9 6.5V4.8A1.3 1.3 0 0 1 10.3 3.5h3.4A1.3 1.3 0 0 1 15 4.8v1.7'/%3E%3Cpath d='M5.8 6.5 6.8 19a2 2 0 0 0 2 1.9h6.4a2 2 0 0 0 2-1.9l1-12.5'/%3E%3Cpath d='M10 10.5v6M14 10.5v6'/%3E%3C/svg%3E"); }
.tm-icon--user { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.8'/%3E%3Cpath d='M4.5 20.5a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E"); }
.tm-icon--verified { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='%23000'/%3E%3Cpath d='m7.8 12.3 2.9 2.9 5.5-6' fill='none' stroke='%23fff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.tm-icon--mail { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.8' y='5' width='18.4' height='14' rx='2.5'/%3E%3Cpath d='m3.6 7.2 7.3 5.1a2 2 0 0 0 2.2 0l7.3-5.1'/%3E%3C/svg%3E"); }
.tm-icon--send { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 3.2 10.5 13.5'/%3E%3Cpath d='M20.8 3.2 14.3 21a.6.6 0 0 1-1.1 0l-2.7-7.5-7.5-2.7a.6.6 0 0 1 0-1.1Z'/%3E%3C/svg%3E"); }
.tm-icon--arrow-right { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15'/%3E%3Cpath d='m13.5 6.5 6 5.5-6 5.5'/%3E%3C/svg%3E"); }
.tm-icon--bell { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5a6 6 0 0 1 12 0c0 4 1.2 5.4 1.8 6 .3.3.1.9-.4.9H4.6c-.5 0-.7-.6-.4-.9.6-.6 1.8-2 1.8-6Z'/%3E %3Cpath d='M9.8 19.6a2.4 2.4 0 0 0 4.4 0'/%3E%3C/svg%3E"); }
.tm-icon--briefcase { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7.5' width='18' height='12.5' rx='2.5'/%3E%3Cpath d='M8.5 7.5V6a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v1.5'/%3E%3Cpath d='M3 12.5h18'/%3E%3C/svg%3E"); }
.tm-icon--calendar { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.2' y='5' width='17.6' height='16' rx='2.5'/%3E%3Cpath d='M8 3v4M16 3v4M3.2 10h17.6'/%3E%3C/svg%3E"); }
.tm-icon--chart { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E"); }
.tm-icon--chevron-down { --icon-image: var(--chevron-down); }
.tm-icon--chevron-left { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m14.5 6-6 6 6 6'/%3E%3C/svg%3E"); }
.tm-icon--chevron-right { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9.5 6 6 6-6 6'/%3E%3C/svg%3E"); }
.tm-icon--clock-log { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7.6'/%3E%3Cpath d='M11 6.8V11l3 1.8'/%3E%3Cpath d='M17.5 17.5 21 21'/%3E%3C/svg%3E"); }
.tm-icon--clock { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5.2l3.2 1.9'/%3E%3C/svg%3E"); }
.tm-icon--coins { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='9' cy='6.5' rx='6' ry='2.8'/%3E%3Cpath d='M3 6.5v4.2c0 1.5 2.7 2.8 6 2.8s6-1.3 6-2.8V6.5'/%3E %3Cpath d='M3 10.7v4.2c0 1.5 2.7 2.8 6 2.8 1 0 2-.1 2.8-.3'/%3E %3Ccircle cx='17' cy='16.5' r='4.5'/%3E%3Cpath d='M15.4 14.8 17 16.6l1.6-1.8M17 16.6v3.1M15.6 17.9h2.8'/%3E%3C/svg%3E"); }
.tm-icon--dashboard { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='3' y='14' width='8' height='7' rx='2'/%3E %3Crect x='14' y='12' width='7' height='9' rx='2'/%3E%3Ccircle cx='17.5' cy='6' r='3.2'/%3E%3C/svg%3E"); }
.tm-icon--doc-alert { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h7.5L18 7.5V15'/%3E%3Cpath d='M6 3v18h6'/%3E%3Cpath d='M13.5 3v4.5H18'/%3E%3Cpath d='M9 11h6M9 14.5h3'/%3E %3Ccircle cx='17.5' cy='18' r='3.5'/%3E%3Cpath d='M17.5 16.4v1.6M17.5 19.6h.01'/%3E%3C/svg%3E"); }
.tm-icon--eye { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12S6 5.8 12 5.8 21.5 12 21.5 12 18 18.2 12 18.2 2.5 12 2.5 12Z'/%3E%3Ccircle cx='12' cy='12' r='2.9'/%3E%3C/svg%3E"); }
.tm-icon--filter { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M4 7h16M7 12h10M10 17h4'/%3E%3C/svg%3E"); }
.tm-icon--folder-plus { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7.5A2.5 2.5 0 0 1 5.5 5h3.2l2 2.5h7.8A2.5 2.5 0 0 1 21 10v7.5A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5Z'/%3E %3Cpath d='M12 11.5v5M9.5 14h5'/%3E%3C/svg%3E"); }
.tm-icon--gauge-user { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='10' r='2.6'/%3E%3Cpath d='M7.2 18.2a5.2 5.2 0 0 1 9.6 0'/%3E%3C/svg%3E"); }
.tm-icon--help { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.6 9.3a2.5 2.5 0 1 1 3.3 2.4c-.6.2-.9.8-.9 1.4v.4'/%3E%3Cpath d='M12 16.8h.01'/%3E%3C/svg%3E"); }
.tm-icon--invoice { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 12h6M9 16h4'/%3E%3C/svg%3E"); }
.tm-icon--logo { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h13'/%3E%3Cpath d='M10.5 5v14'/%3E%3Ccircle cx='18.4' cy='9.6' r='2.2' fill='%23000' stroke='none'/%3E%3C/svg%3E"); }
.tm-icon--info { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.2'/%3E%3Cpath d='M12 11v5.4'/%3E%3Ccircle cx='12' cy='7.9' r='.9' fill='%23000' stroke='none'/%3E%3C/svg%3E"); }
.tm-icon--chevrons { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M12 4.6 7.8 9.6h8.4L12 4.6Z'/%3E%3Cpath d='M12 19.4 7.8 14.4h8.4L12 19.4Z'/%3E%3C/svg%3E"); }
.tm-icon--shield { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.8 4.6 5.8v5.4c0 4.4 3 8.4 7.4 10 4.4-1.6 7.4-5.6 7.4-10V5.8L12 2.8Z'/%3E%3C/svg%3E"); }
.tm-icon--globe { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.2'/%3E%3Cpath d='M2.9 12h18.2'/%3E%3Cpath d='M12 2.8c2.3 2.5 3.6 5.8 3.6 9.2s-1.3 6.7-3.6 9.2c-2.3-2.5-3.6-5.8-3.6-9.2S9.7 5.3 12 2.8Z'/%3E%3C/svg%3E"); }
.tm-icon--bank { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 9.4 12 4.4l8.8 5'/%3E%3Cpath d='M4.6 19.6h14.8'/%3E%3Cpath d='M6.6 9.9v9.7M10.6 9.9v9.7M13.4 9.9v9.7M17.4 9.9v9.7'/%3E%3C/svg%3E"); }
.tm-icon--sliders { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7.4h9M17.4 7.4H20M4 16.6h4.2M12.6 16.6H20'/%3E%3Ccircle cx='15.2' cy='7.4' r='2.2'/%3E%3Ccircle cx='10.4' cy='16.6' r='2.2'/%3E%3C/svg%3E"); }
.tm-icon--logout { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4.6h3.5A2.5 2.5 0 0 1 20 7.1v9.8a2.5 2.5 0 0 1-2.5 2.5H14'/%3E%3Cpath d='M10.2 8.2 14 12l-3.8 3.8'/%3E%3Cpath d='M14 12H4'/%3E%3C/svg%3E"); }
.tm-icon--upload { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15.4V4.6'/%3E%3Cpath d='M8.2 8.4 12 4.6l3.8 3.8'/%3E%3Crect x='3.6' y='15.4' width='16.8' height='4' rx='2'/%3E%3C/svg%3E"); }
.tm-icon--timer { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='13.6' r='7.8'/%3E%3Cpath d='M12 10v3.6l2.4 1.6'/%3E%3Cpath d='M9.4 2.6h5.2'/%3E%3Cpath d='M18.6 7 20 5.6'/%3E%3C/svg%3E"); }
.tm-icon--play { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10.2 8.6 15.4 12l-5.2 3.4z' fill='%23000'/%3E%3C/svg%3E"); }
.tm-icon--stop { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='3.6' fill='%23000' stroke='none'/%3E%3C/svg%3E"); }
.tm-icon--calendar-days { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.4' y='5' width='17.2' height='15.6' rx='2.4'/%3E%3Cpath d='M3.4 9.8h17.2M8 3.4v3.2M16 3.4v3.2'/%3E%3Cpath d='M7.6 13.4h2M11 13.4h2M14.4 13.4h2M7.6 16.8h2M11 16.8h2'/%3E%3C/svg%3E"); }
.tm-icon--minus { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.tm-icon--share { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5.6' r='2.6'/%3E%3Ccircle cx='6' cy='12' r='2.6'/%3E%3Ccircle cx='18' cy='18.4' r='2.6'/%3E%3Cpath d='m8.3 10.7 7.4-3.8M8.3 13.3l7.4 3.8'/%3E%3C/svg%3E"); }
.tm-icon--lock { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.2' y='10.2' width='15.6' height='10.3' rx='2.3'/%3E%3Cpath d='M7.8 10.2V7.6a4.2 4.2 0 0 1 8.4 0v2.6'/%3E%3Cpath d='M12 14.2v2.4'/%3E%3C/svg%3E"); }
.tm-icon--eye-off { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.1 8.4C2.9 9.9 2.5 12 2.5 12s3.5 6.2 9.5 6.2c1.4 0 2.7-.3 3.8-.8'/%3E%3Cpath d='M18.6 15.3c1.9-1.6 2.9-3.3 2.9-3.3S18 5.8 12 5.8c-.9 0-1.7.1-2.5.4'/%3E%3Cpath d='M9.9 9.9a2.9 2.9 0 0 0 4.1 4.1'/%3E%3Cpath d='M4 4l16 16'/%3E%3C/svg%3E"); }
.tm-icon--menu { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E"); }
.tm-icon--party { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 21 4.2-11.4a1.4 1.4 0 0 1 2.3-.5l6.4 6.4a1.4 1.4 0 0 1-.5 2.3Z'/%3E %3Cpath d='M14 3.2c.8 1 .8 2.3 0 3.3M18.4 2.6l-.9 1.6M21.4 7.2l-1.8.5M17.5 9.7c1.2-.6 2.6-.2 3.3.9'/%3E%3C/svg%3E"); }
.tm-icon--plus { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.tm-icon--search { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.8' cy='10.8' r='6.8'/%3E%3Cpath d='M15.8 15.8 20 20'/%3E%3C/svg%3E"); }
.tm-icon--settings { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E %3Cpath d='M19.4 14.5a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1Z'/%3E%3C/svg%3E"); }
.tm-icon--users { --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.2'/%3E%3Cpath d='M3.5 19.5a5.5 5.5 0 0 1 11 0'/%3E%3Cpath d='M16 5.6a3.2 3.2 0 0 1 0 6.2'/%3E%3Cpath d='M17.2 14.6a5.5 5.5 0 0 1 3.3 4.9'/%3E%3C/svg%3E"); }


/* =============================================================================
   5. App shell
   ============================================================================ */

/* ---- 5.1 Sidebar ---------------------------------------------------------- */
.tm-sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 100%;
  height: 100%;
  background: var(--color-secondary-100);
  color: var(--color-white);
}

/* The shell carries Bootstrap's `.offcanvas-lg`: a docked column from `lg` up,
   a slide-in drawer below it. One set of markup covers both. */
.tm-sidebar-shell {
  --bs-offcanvas-width: var(--sidebar-width);
  --bs-offcanvas-bg: var(--color-secondary-100);
  --bs-offcanvas-border-width: 0;
}

@media (min-width: 992px) {
  /* Bootstrap makes `.offcanvas-lg` static and transparent at this width;
     these rules re-dock it as the fixed rail the design calls for. */
  .tm-sidebar-shell {
    position: fixed;
    inset: 0 auto 0 0;
    overflow: visible;
    z-index: 1030;
    width: var(--sidebar-width);
    background-color: var(--color-secondary-100) !important;
    transition: width .18s ease;
  }
  .tm-sidebar { overflow-y: auto; transition: width .18s ease; }
  .tm-main { margin-left: var(--sidebar-width); transition: margin-left .18s ease; }
}

.tm-sidebar::-webkit-scrollbar { width: 6px; }
.tm-sidebar::-webkit-scrollbar-thumb { background: rgb(255 255 255 / 18%); border-radius: 6px; }

/* ---- 5.1a Logo -------------------------------------------------------------
   One lockup, used at every size: the Temia logo as a single image, mark and
   wordmark drawn together (assets/img/logo-temia-on-dark.svg). It is white with
   the Tertiary100 accent, so it sits on the dark grounds the app puts it on.
   -------------------------------------------------------------------------- */
.tm-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: inherit;
}

.tm-logo__img { display: block; flex: 0 0 auto; width: auto; height: 24px; }

.tm-logo--on-dark  { color: var(--color-white); }
.tm-logo--on-light { color: var(--color-secondary-100); }

.tm-logo--lg .tm-logo__img { height: 32px; }

/* ---- 5.1b Brand block ----------------------------------------------------- */
.tm-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-secondary-80);
}

.tm-brand__close { position: absolute; top: 18px; right: 18px; }

.tm-brand__tagline {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-secondary-40);
}

.tm-nav__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px 12px 20px;
  border-left: 4px solid transparent;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-secondary-20);
  transition: background-color .15s ease, color .15s ease;
}
.tm-nav__item:hover,
.tm-nav__item:focus-visible {
  background: rgb(110 131 169 / 14%);
  color: var(--color-white);
}
.tm-nav__item.active {
  background: rgb(110 131 169 / 20%);
  border-left-color: var(--color-tertiary-100);
  color: var(--color-white);
  font-weight: var(--font-weight-medium);
}

.tm-nav__label { flex: 1 1 auto; min-width: 0; }

.tm-nav__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 44px;
  background: var(--color-red);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
}

/* The panel is a full-height column: the list of destinations sits at the top,
   and whatever is in `.tm-nav__foot` is pushed to the bottom. */
.tm-nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: var(--space-2);
}

.tm-nav__foot {
  margin-top: auto;
  padding: var(--space-2) 0;
  border-top: 1px solid rgb(255 255 255 / 12%);
}

.tm-nav__divider {
  height: 1px;
  margin: 11px 24px;
  border: 0;
  opacity: 1;
  background: rgb(255 255 255 / 12%);
}

/* ---- 5.1c Collapse / expand ------------------------------------------------
   The rail button rides the sidebar's right edge, as in the design. Collapsing
   swaps the panel for a 76px icon rail: labels, badges and the tagline drop
   out, the marks stay, and `title` keeps every destination named for anyone
   hovering or using a screen reader.
   -------------------------------------------------------------------------- */
.tm-railtoggle {
  position: absolute;
  top: 108px;
  right: -12px;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-secondary-80);
  border-radius: 50%;
  background: var(--color-secondary-100);
  color: var(--color-white);
  transition: background-color .15s ease;
}
.tm-railtoggle:hover { background: var(--color-secondary-80); }
.tm-railtoggle:focus-visible { outline: 2px solid var(--color-tertiary-100); outline-offset: 2px; }

@media (min-width: 992px) {
  .tm-railtoggle { display: inline-flex; }
}

/* The collapsed state applies only where the panel is docked. Below `lg` it is
   a drawer that has just been opened on purpose, so it always shows its
   labels. */
@media (min-width: 992px) {
  body.is-rail .tm-brand__tagline,
  body.is-rail .tm-nav__label,
  body.is-rail .tm-nav__badge { display: none; }

  body.is-rail .tm-brand { align-items: center; padding-left: 0; padding-right: 0; }
  body.is-rail .tm-logo { gap: 0; }
  /* the collapsed rail has room for the mark only: the image is cropped to its left-hand mark */
  body.is-rail .tm-logo__img { width: 26px; object-fit: cover; object-position: left center; }

  body.is-rail .tm-nav__item {
    justify-content: center;
    padding-right: var(--space-4);
    padding-left: calc(var(--space-4) - 4px);
  }

  body.is-rail .tm-nav__divider { margin-left: var(--space-4); margin-right: var(--space-4); }
  body.is-rail .tm-railtoggle .tm-icon { transform: rotate(180deg); }

  body.is-rail .tm-sidebar-shell,
  body.is-rail .tm-sidebar { width: var(--sidebar-width-rail); }
  body.is-rail .tm-main { margin-left: var(--sidebar-width-rail); }
}

/* ---- 5.2 Topbar ----------------------------------------------------------- */
.tm-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 50px;
  padding: 9px 24px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-shade-10);
}

.tm-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-shade-100);
}
.tm-breadcrumb .tm-icon { flex: 0 0 auto; color: var(--color-secondary-100); }

.tm-breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-2); }

/* Ancestors are links; the page you are on is not */
.tm-breadcrumb a { color: var(--color-shade-60); font-weight: var(--font-weight-regular); }
.tm-breadcrumb a:hover { color: var(--color-secondary-100); text-decoration: underline; }

.tm-breadcrumb__sep { flex: 0 0 auto; color: var(--color-shade-40); }
.tm-breadcrumb__current { color: var(--color-shade-100); font-weight: var(--font-weight-medium); }

@media (max-width: 575.98px) {
  /* On a phone only the current page is worth the width */
  .tm-breadcrumb li:not(:last-child) { display: none; }
}

/* Search field — shared by the topbar and the invoice table toolbar */
.tm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.tm-search .tm-icon { color: var(--color-shade-40); }
.tm-search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-100);
}
.tm-search__input:focus { outline: 0; }
.tm-search__input::placeholder { color: var(--color-shade-40); }
.tm-search:focus-within { border-color: var(--color-primary-80); }

/* Topbar search keeps the design's fixed 320px width on wide screens */
.tm-search--topbar { width: 320px; max-width: 100%; }

/* Toolbar search inside a data-view panel */
.tm-search--wide { width: 280px; max-width: 100%; height: 32px; padding: 8px 12px; }

/* Invoice-table search matches the toolbar height of the buttons beside it */
.tm-panel__head .tm-search { width: 280px; max-width: 100%; height: 32px; padding: 8px 12px; }

.tm-lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
}
.tm-lang__btn {
  padding: 4px 8px;
  border: 0;
  border-radius: 3.75px;
  background: transparent;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-shade-60);
}
.btn-check:checked + .tm-lang__btn { background: var(--color-secondary-80); color: var(--color-white); }

.tm-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.tm-account__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.tm-account__name {
  font-size: var(--font-size-md);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-medium);
  color: var(--color-secondary-100);
  white-space: nowrap;
}

/* ---- 5.3 Main ------------------------------------------------------------- */
.tm-content { padding: 24px 20px 20px; }

.tm-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-shade-80);
}


/* =============================================================================
   6. Buttons, chips and badges
   ============================================================================ */
.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 8px 12px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-shade-80);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.tm-btn:hover { background: var(--color-secondary-5); color: var(--color-shade-80); }
.tm-btn .tm-icon { color: var(--color-shade-60); }

.tm-btn--primary {
  gap: 8px;
  background: var(--color-secondary-80);
  border-color: var(--color-secondary-80);
  color: var(--color-white);
}
.tm-btn--primary:hover {
  background: var(--color-secondary-100);
  border-color: var(--color-secondary-100);
  color: var(--color-white);
}
.tm-btn--primary .tm-icon { color: currentColor; }

.tm-btn--soft {
  gap: 8px;
  background: var(--color-primary-10);
  border-color: var(--color-primary-10);
  color: var(--color-primary-100);
}
.tm-btn--soft:hover { background: #dae5f7; color: var(--color-primary-100); }
.tm-btn--soft .tm-icon { color: currentColor; }

/* Compact variant used for the "View %" card control */
.tm-btn--compact {
  padding: 8px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-shade-100);
}

/* Bare icon button (pagination arrows, journey arrows, row actions) */
.tm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-shade-60);
  transition: color .15s ease;
}
.tm-icon-btn:hover:not(:disabled) { color: var(--color-primary-100); }
.tm-icon-btn:disabled { opacity: .45; }

/* Status badge */
.tm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}
.tm-badge--sm { padding: 2px 6px; font-size: var(--font-size-2xs); }

.tm-badge--paid    { background: rgb(0 131 104 / 10%);  color: var(--color-green); }
.tm-badge--sent    { background: rgb(60 112 209 / 10%); color: var(--color-primary-80); }
.tm-badge--overdue { background: rgb(203 43 0 / 10%);   color: var(--color-red); }
.tm-badge--draft   { background: rgb(63 67 71 / 10%);   color: var(--color-shade-80); }
.tm-badge--pending { background: rgb(244 176 0 / 18%);  color: #7a5800; }

/* Semantic aliases so screens name the state, not the colour */
.tm-badge--active,
.tm-badge--billable    { background: rgb(0 131 104 / 10%);  color: var(--color-green); }
.tm-badge--complete,
.tm-badge--done        { background: rgb(60 112 209 / 10%); color: var(--color-primary-80); }
.tm-badge--onhold,
.tm-badge--nonbillable { background: rgb(63 67 71 / 10%);   color: var(--color-shade-80); }

/* A role reads as a quiet pill rather than a status */
.tm-badge--role { background: var(--color-primary-10); color: var(--color-secondary-100); }

/* A time entry's own lifecycle: waiting on a manager, then kept or refused */
.tm-badge--approved { background: rgb(0 131 104 / 10%);  color: var(--color-green); }
.tm-badge--declined { background: rgb(203 43 0 / 10%);   color: var(--color-red); }

/* Project / case tag */
.tm-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
  color: var(--color-secondary-100);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  white-space: nowrap;
}


/* =============================================================================
   7. Cards
   ============================================================================ */
.tm-card {
  height: 100%;
  background: var(--color-white);
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
}

.tm-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tm-card__head > *:first-child { flex: 1 1 auto; min-width: 0; }
.tm-card__head > *:last-child  { flex: 0 0 auto; }

/* ---- Empty-state banner --------------------------------------------------- */
.tm-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 24px;
  background: rgb(87 70 175 / 10%);
  color: var(--color-purple);
}
.tm-banner__title {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-100);
}
.tm-banner__text {
  margin: 4px 0 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  letter-spacing: .25px;
  color: var(--color-shade-60);
}


/* =============================================================================
   8. KPI cards
   ============================================================================ */
.tm-kpi__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-xs);
}
.tm-kpi__icon--green { background: rgb(0 131 104 / 10%); color: var(--color-green); }
.tm-kpi__icon--navy  { background: var(--color-secondary-10); color: var(--color-secondary-100); }
.tm-kpi__icon--lime  { background: rgb(6 182 212 / 10%);  color: var(--color-lime); }
.tm-kpi__icon--slate { background: var(--color-secondary-10); color: var(--color-secondary-80); }

.tm-kpi__label { font-size: var(--font-size-sm); line-height: var(--line-height-sm); letter-spacing: var(--letter-spacing-tight); color: var(--color-shade-100); }
.tm-kpi__value { font-size: var(--font-size-2xl); line-height: var(--line-height-xl); font-weight: var(--font-weight-semibold); color: var(--color-secondary-100); }
.tm-kpi__delta { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); letter-spacing: var(--letter-spacing-tight); }


/* =============================================================================
   11. Invoice table
   ============================================================================ */
.tm-panel {
  background: var(--color-white);
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.tm-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 24px;
  border-bottom: 1px solid var(--color-shade-10);
}
.tm-panel__body { padding: 24px; }
.tm-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 24px 24px;
}

.tm-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-80);
}
.tm-link:hover { color: var(--color-primary-100); }

/* The wrapper carries the outer border so the table itself stays borderless */
.tm-table-scroll {
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.tm-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--color-shade-80);
  --bs-table-border-color: var(--color-shade-10);
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  margin-bottom: 0;
}

.tm-table thead th {
  padding: 18px 16px;
  background: var(--color-secondary-5);
  border-right: 1px solid var(--color-shade-10);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-shade-60);
  white-space: nowrap;
  vertical-align: middle;
}
.tm-table thead th:last-child { border-right: 0; }
.tm-table thead .tm-icon { margin-left: 8px; }

.tm-table tbody td {
  height: 60px;
  padding: 6px 16px;
  border-right: 1px solid var(--color-shade-10);
  border-bottom: 1px solid var(--color-shade-10);
  vertical-align: middle;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-80);
}
.tm-table tbody td:last-child { border-right: 0; }
.tm-table tbody tr:last-child td { border-bottom: 0; }
.tm-table tbody tr:hover td { background: #fafbfd; }

/* Column widths carried over from the design */
.tm-table .col-id      { width: 160px; }
.tm-table .col-client  { width: 240px; }
.tm-table .col-date    { width: 200px; white-space: nowrap; }
.tm-table .col-amount  { width: 180px; white-space: nowrap; }
.tm-table .col-status  { width: 120px; }
.tm-table .col-action  { width: 90px; }

/* ---- Time Log columns (Figma widths, 1576 total) -------------------------- */
.tm-table--timelog { min-width: 1576px; }
.tm-table--timelog .col-select  { width: 130px; }
.tm-table--timelog .col-member  { width: 140px; white-space: nowrap; }
.tm-table--timelog .col-client  { width: 200px; }
.tm-table--timelog .col-project { width: 210px; }
.tm-table--timelog .col-task    { width: 226px; }
.tm-table--timelog .col-date    { width: 200px; }
.tm-table--timelog .col-hours   { width: 100px; font-weight: var(--font-weight-medium); color: var(--color-shade-100); }
.tm-table--timelog .col-amount  { width: 110px; font-weight: var(--font-weight-medium); color: var(--color-secondary-100); }
.tm-table--timelog .col-status  { width: 130px; }
.tm-table--timelog .col-action  { width: 130px; }

/* ---- Client list columns --------------------------------------------------- */
.tm-table--clients { min-width: 1180px; }
.tm-table--clients .col-client   { width: 220px; }
.tm-table--clients .col-industry { width: 150px; white-space: nowrap; }
.tm-table--clients .col-contact  { width: 160px; white-space: nowrap; }
.tm-table--clients .col-ratio    { width: 120px; }
.tm-table--clients .col-hours    { width: 130px; white-space: nowrap; }
.tm-table--clients .col-billed   { width: 140px; white-space: nowrap; }
.tm-table--clients .col-unpaid   { width: 130px; white-space: nowrap; }
.tm-table--clients .col-since    { width: 130px; white-space: nowrap; }
.tm-table--clients .col-action   { width: 110px; }

/* ---- Two-line cell (name over description) --------------------------------- */
.tm-cell__title { display: block; font-size: var(--font-size-sm); line-height: var(--line-height-2xs); font-weight: var(--font-weight-medium); color: var(--color-shade-100); }
.tm-cell__sub   { display: block; margin-top: 4px; font-size: var(--font-size-xs); line-height: var(--line-height-2xs); color: var(--color-shade-60); }
.tm-muted-dash  { color: var(--color-shade-40); }

/* ---- Projects / cases columns (Figma widths, 1576 total) ------------------- */
.tm-table--cases { min-width: 1576px; }
.tm-table--cases .col-code   { width: 126px; }
.tm-table--cases .col-name   { width: 289px; }
.tm-table--cases .col-status { width: 133px; }
.tm-table--cases .col-budget { width: 177px; }
.tm-table--cases .col-hours  { width: 126px; white-space: nowrap; }
.tm-table--cases .col-rate   { width: 133px; white-space: nowrap; }
.tm-table--cases .col-billed { width: 149px; white-space: nowrap; }
.tm-table--cases .col-paid   { width: 149px; white-space: nowrap; }
.tm-table--cases .col-unpaid { width: 151px; white-space: nowrap; }
.tm-table--cases .col-action { width: 140px; }

/* ---- Staff breakdown columns ---------------------------------------------- */
.tm-table--staff { min-width: 1400px; }
.tm-table--staff .col-associate { width: 220px; }
.tm-table--staff .col-role      { width: 165px; white-space: nowrap; }
.tm-table--staff .col-dept      { width: 165px; white-space: nowrap; }
.tm-table--staff .col-status    { width: 130px; }
.tm-table--staff .col-tasks     { width: 110px; }
.tm-table--staff .col-hours     { width: 120px; white-space: nowrap; }
.tm-table--staff .col-billable  { width: 120px; white-space: nowrap; }
.tm-table--staff .col-rate      { width: 130px; white-space: nowrap; }
.tm-table--staff .col-amount    { width: 130px; white-space: nowrap; }
.tm-table--staff .col-action    { width: 130px; }

/* ---- Invoice list columns ---------------------------------------------------
   Fits the page (client request): compact fixed columns, and the client and
   project columns share the rest and wrap instead of pushing the table wider.
   Only below 860px (tablet / phone) does the table scroll sideways. */
.tm-table--invoices { min-width: 860px; table-layout: fixed; }
.tm-table--invoices thead th { padding: 14px 12px; white-space: normal; overflow-wrap: anywhere; letter-spacing: normal; }
.tm-table--invoices thead .tm-sort { white-space: normal; text-align: left; }
.tm-table--invoices thead .tm-icon { margin-left: 4px; }
.tm-table--invoices tbody td { padding: 8px 12px; }
.tm-table--invoices .col-id      { width: 116px; }
.tm-table--invoices .col-client,
.tm-table--invoices .col-project { width: auto; }
.tm-table--invoices .col-date    { width: 108px; white-space: nowrap; }
.tm-table--invoices .col-amount  { width: 116px; white-space: nowrap; }
.tm-table--invoices .col-status  { width: 102px; }
.tm-table--invoices .col-action  { width: 128px; }
.tm-table--invoices .tm-table__client { display: flex; min-width: 0; }
.tm-table--invoices .tm-table__name { white-space: normal; overflow-wrap: break-word; min-width: 0; }
.tm-table--invoices .tm-avatar { flex-shrink: 0; }
.tm-table--invoices .tm-table__tags { flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.tm-table--invoices .tm-table__tags .tm-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.tm-table--invoices .tm-rowactions { gap: 8px; }
/* Laptop widths: the initials badge gives its room to the client name. */
@media (max-width: 1499.98px) {
  .tm-table--invoices .tm-table__client .tm-avatar { display: none; }
}
/* Small laptops: the client name keeps priority; project tags shorten (full name on hover). */
@media (max-width: 1365.98px) {
  .tm-table--invoices .col-project { width: 10%; }
}

/* ---- Invoice card (grid view) ---------------------------------------------
   Reuses the client card's stat and footer parts; only the head differs. */
.tm-clientcard--invoice .tm-clientcard__head { align-items: center; }
.tm-clientcard--invoice .tm-clientcard__code {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-60);
}
.tm-clientcard--invoice .tm-clientcard__name { margin-top: 4px; }

.tm-table__id     { font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); color: var(--color-secondary-100); white-space: nowrap; }
.tm-table__amount { font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); color: var(--color-secondary-100); }
.tm-table__client { display: inline-flex; align-items: center; gap: 8px; }
.tm-table__name   { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); color: var(--color-shade-100); white-space: nowrap; }
.tm-table__tags   { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

.tm-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-secondary-80);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
}

/* ---- Pagination ----------------------------------------------------------- */
.tm-pagination__summary {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-80);
}
.tm-pagination__page {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-primary-100);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-primary-100);
  font-family: "Urbanist", var(--bs-body-font-family);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
}
.tm-pagination__size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-100);
}


/* =============================================================================
   12. Footer
   ============================================================================ */
.tm-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--color-shade-10);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-lg);
  color: var(--color-shade-60);
  text-align: center;
}


/* =============================================================================
   12b. Data-view toolbar
   -----------------------------------------------------------------------------
   The band that sits above a data table: status tabs on the left, search /
   filter / export on the right, an optional active-filter row underneath and an
   optional bulk-selection bar. Shared by Time Log and any future list screen.
   ============================================================================ */
.tm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 24px 0 8px;
  background: var(--color-white);
}

.tm-toolbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---- Status tabs ---------------------------------------------------------- */
.tm-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.tm-tab {
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-80);
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.tm-tab:hover { background: var(--color-secondary-5); }
.tm-tab.active {
  background: var(--color-primary-10);
  color: var(--color-secondary-80);
  font-weight: var(--font-weight-medium);
}

/* ---- Filter button, active state ------------------------------------------ */
.tm-btn--filter.is-on {
  background: var(--color-secondary-80);
  border-color: var(--color-secondary-80);
  color: var(--color-white);
}
.tm-btn--filter.is-on .tm-icon { color: currentColor; }

/* ---- Active-filter chip row ----------------------------------------------- */
.tm-filters {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 0 16px 12px;
  border-top: 1px solid var(--color-shade-10);
}
.tm-filters__label {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-80);
}
.tm-filters__list { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-secondary-20);
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-80);
  white-space: nowrap;
}
.tm-chip__op    { color: var(--color-shade-60); }
.tm-chip__value { color: var(--color-secondary-100); }
.tm-chip__remove {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-shade-60);
}
.tm-chip__remove:hover { color: var(--color-red); }

/* ---- Add-filter popover ----------------------------------------------------- */
.tm-filters__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ---- Bulk-selection bar ---------------------------------------------------- */
.tm-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 32px;
}
.tm-bulkbar__count {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-80);
}
.tm-bulkbar__clear {
  margin-left: 8px;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-80);
  background: none;
  border: 0;
  padding: 0;
}
.tm-bulkbar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Text-and-icon action used in the bulk bar and in table row actions */
.tm-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-80);
  white-space: nowrap;
}
.tm-action:hover { background: var(--color-secondary-5); }
.tm-action .tm-icon { color: var(--color-shade-60); }
.tm-action--approve:hover { color: var(--color-green); }
.tm-action--approve:hover .tm-icon { color: var(--color-green); }
.tm-action--decline:hover { color: var(--color-red); }
.tm-action--decline:hover .tm-icon { color: var(--color-red); }


/* =============================================================================
   12c. Table extras — selection, row actions, inline edit
   ============================================================================ */

/* Checkbox column: the checkbox and the id share one cell */
.tm-table .col-select { width: 130px; }
.tm-table__select {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.tm-table .form-check-input {
  width: 20px;
  height: 20px;
  margin: 0;
  border-color: var(--color-shade-20);
  flex: 0 0 auto;
}
.tm-table .form-check-input:checked,
.tm-table .form-check-input:indeterminate {
  background-color: var(--color-primary-100);
  border-color: var(--color-primary-100);
}
/* Selection is signalled by the checkbox alone, as in the design — no row tint. */
.tm-table tbody tr.is-selected td { background: var(--color-white); }

/* Row action icons appear on hover, or whenever the row needs a decision */
.tm-rowactions { display: inline-flex; align-items: center; gap: 12px; }
.tm-rowactions--onhover { visibility: hidden; }
tr:hover .tm-rowactions--onhover,
tr:focus-within .tm-rowactions--onhover { visibility: visible; }

.tm-rowaction {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-shade-60);
}
.tm-rowaction:hover { color: var(--color-primary-100); }
.tm-rowaction--approve:hover { color: var(--color-green); }
.tm-rowaction--decline:hover { color: var(--color-red); }

/* Inline edit: the read view and the edit view swap places */
tr .tm-edit-only { display: none; }
tr.is-editing .tm-edit-only { display: inline-flex; }
tr.is-editing .tm-read-only { display: none; }

/* Inline-edit fields use the same control style as the modal forms —
   see section 12g. */
.tm-control--hours { width: 72px; min-width: 0; }
.tm-control--status { width: 110px; min-width: 0; }


/* =============================================================================
   12d. View toggle (list / grid)
   ============================================================================ */
.tm-viewtoggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
}
.tm-viewtoggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 3.75px;
  background: transparent;
  color: var(--color-shade-60);
}
.btn-check:checked + .tm-viewtoggle__btn {
  background: var(--color-secondary-80);
  color: var(--color-white);
}


/* =============================================================================
   12e. Client card (grid view)
   ============================================================================ */
.tm-clientcard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.tm-clientcard__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.tm-clientcard__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tm-clientcard__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-80);
  color: var(--color-white);
  font-size: var(--font-size-md);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
}
.tm-clientcard__name { font-size: var(--font-size-md); line-height: var(--line-height-sm); font-weight: var(--font-weight-medium); color: var(--color-shade-80); }
.tm-clientcard__meta { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); color: var(--color-shade-60); }
.tm-clientcard__tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tm-clientcard__stats {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.tm-clientcard__stat { flex: 1 1 0; min-width: 0; }
.tm-stat__label {
  display: block;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  text-transform: uppercase;
  color: var(--color-shade-60);
}
.tm-stat__value { display: block; margin-top: 4px; font-size: var(--font-size-md); line-height: var(--line-height-sm); font-weight: var(--font-weight-medium); color: var(--color-shade-80); }
.tm-stat__value--billed { color: var(--color-secondary-100); }
.tm-stat__value--unpaid { color: var(--color-red); }

.tm-clientcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--color-shade-10);
  margin-top: auto;
}
.tm-clientcard__since { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); color: var(--color-shade-60); }

/* Count chips used in both the card and the list view */
.tm-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}
.tm-count--active  { background: rgb(0 131 104 / 10%); color: var(--color-green); }
.tm-count--neutral { background: var(--color-shade-10);   color: var(--color-shade-80); }
.tm-count--ratio   { background: rgb(0 131 104 / 10%); color: var(--color-green); }


/* =============================================================================
   12f. Alert banner
   -----------------------------------------------------------------------------
   The Overview banner has two variants driven by the same markup: a neutral
   "all clear" state and a warning state carrying a call to action.
   ============================================================================ */
.tm-alert {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.tm-alert__text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-100);
}

.tm-alert--warning {
  border-color: rgb(244 176 0 / 40%);
  background: rgb(244 176 0 / 8%);
}
.tm-alert--warning .tm-alert__icon { color: var(--color-tertiary-100); }

/* The alert's call to action reads as a link-coloured button */
.tm-alert .tm-btn { color: var(--color-secondary-100); font-weight: var(--font-weight-medium); }
.tm-alert .tm-btn .tm-icon { color: currentColor; }


/* =============================================================================
   12g. Form controls
   -----------------------------------------------------------------------------
   One field style shared by the modals and by inline table editing.
   ============================================================================ */
.tm-field { display: flex; flex-direction: column; gap: 8px; }
.tm-field--row { flex-direction: row; gap: 20px; }
.tm-field--row > .tm-field { flex: 1 1 0; min-width: 0; }

.tm-label {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-80);
}
.tm-label__required { color: var(--color-red); }

.tm-control {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--color-shade-20);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-shade-100);
}
.tm-control:focus { outline: 0; border-color: var(--color-primary-80); }
.tm-control::placeholder { color: var(--color-shade-40); }

textarea.tm-control { height: 60px; resize: vertical; }
textarea.tm-control.tm-control--tall { height: 76px; }

/* Native select keeps the design's chevron */
select.tm-control {
  appearance: none;
  padding-right: 36px;
  background-image: var(--chevron-down);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

/* Section heading inside a form */
.tm-formsection {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid var(--color-shade-10);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-shade-80);
}
.tm-formsection .tm-icon { color: var(--color-shade-60); }

/* Logo / avatar upload tile */
.tm-upload { display: flex; align-items: center; gap: 16px; width: 100%; }
.tm-upload__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border: 1px dashed var(--color-secondary-20);
  border-radius: 10px;
  background: var(--color-secondary-80);
  color: var(--color-white);
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
}
.tm-upload__tile--empty {
  background: var(--color-secondary-5);
  color: var(--color-secondary-80);
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-size-3xs);
  letter-spacing: var(--letter-spacing-wider);
}
.tm-upload__action { font-size: var(--font-size-sm); line-height: var(--line-height-sm); font-weight: var(--font-weight-medium); letter-spacing: var(--letter-spacing-tight); color: var(--color-secondary-80); }
.tm-upload__hint   { margin: 4px 0 0; font-size: var(--font-size-2xs); line-height: var(--line-height-2xs); color: var(--color-shade-60); }

/* Inline note / callout under a field */
.tm-note {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-60);
}
.tm-note b { color: var(--color-shade-80); font-weight: var(--font-weight-medium); }


/* --- Toggle switch ----------------------------------------------------------
   Bootstrap's own switch, resized to the design's 38 x 20 and recoloured. Used
   wherever a setting is simply on or off. */
.tm-switch { display: flex; align-items: center; margin: 0; min-height: 0; padding: 0; }

.tm-switch .form-check-input {
  width: 38px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  background-color: var(--color-shade-20);
  border-color: var(--color-shade-20);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.tm-switch .form-check-input:checked {
  background-color: var(--color-primary-100);
  border-color: var(--color-primary-100);
}

.tm-switch .form-check-input:focus {
  border-color: var(--color-shade-20);
  box-shadow: none;
}
.tm-switch .form-check-input:checked:focus { border-color: var(--color-primary-100); }
.tm-switch .form-check-input:focus-visible { outline: 2px solid var(--color-primary-80); outline-offset: 2px; }

/* A field the user cannot type into — shown filled rather than disabled-grey */
.tm-control[readonly] { background: var(--color-secondary-5); }

/* =============================================================================
   12h. Modal
   -----------------------------------------------------------------------------
   Bootstrap's modal supplies the dialog behaviour, backdrop and focus trap;
   these rules dress it in the design's chrome.
   ============================================================================ */
.tm-modal {
  --bs-modal-bg: var(--color-white);
  --bs-modal-border-width: 0;
}
.tm-modal .modal-dialog { max-width: 620px; }
.tm-modal--sm .modal-dialog { max-width: 480px; }

.tm-modal .modal-content {
  border: 0;
  border-radius: 2px;
  box-shadow: 0 4px 8px rgb(0 0 0 / 15%);
}
.tm-modal .modal-backdrop,
.modal-backdrop.show { --bs-backdrop-opacity: .6; }

.tm-modal .modal-header {
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-shade-10);
  border-radius: 2px 2px 0 0;
}
.tm-modal__title {
  margin: 0;
  font-size: var(--font-size-md);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-shade-100);
}
.tm-modal__title em {
  font-style: normal;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  color: var(--color-primary-80);
}

.tm-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px;
  max-height: min(78vh, 700px);
  overflow-y: auto;
}

.tm-modal .modal-footer {
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--color-shade-10);
}
.tm-modal .modal-footer > * { margin: 0; }

/* Discard reads as the destructive-but-quiet option */
.tm-btn--discard { color: var(--color-red); }
.tm-btn--discard:hover { color: var(--color-red); border-color: var(--color-red); }


/* =============================================================================
   12i. Setting row
   -----------------------------------------------------------------------------
   A setting stated as a title and one line of explanation, with its control
   pushed to the right edge of the column. The control is a switch, a select or
   a button — the row does not care which.
   ============================================================================ */
.tm-setrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tm-setrow__text { flex: 1 1 auto; min-width: 0; }

.tm-setrow__title {
  display: block;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-shade-80);
}

.tm-setrow__note {
  display: block;
  margin-top: 8px;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-60);
}

.tm-setrow__control { flex: 0 0 auto; }
.tm-setrow__control .tm-control { width: auto; min-width: 88px; }

/* The destructive row at the foot of the security pane */
.tm-setrow--danger .tm-setrow__title { color: var(--color-red); }

.tm-btn--danger {
  border-color: rgb(203 43 0 / 40%);
  color: var(--color-red);
}
.tm-btn--danger:hover { background: rgb(203 43 0 / 5%); border-color: var(--color-red); color: var(--color-red); }
.tm-btn--danger .tm-icon { color: var(--color-red); }


/* =============================================================================
   12i. Entity header
   -----------------------------------------------------------------------------
   The card that introduces a record. Used by the client detail page and the
   project overview; the project variant simply omits the avatar.
   ============================================================================ */
.tm-entity {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--color-shade-10);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.tm-entity__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tm-entity__id { display: flex; align-items: center; gap: 16px; min-width: 0; }

.tm-entity__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-80);
  color: var(--color-white);
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-medium);
}

.tm-entity__name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-regular);
  color: var(--color-shade-100);
}
.tm-entity__name .tm-icon { color: var(--color-primary-80); }

/* Meta row: icon + value pairs */
.tm-entity__meta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.tm-entity__meta li { display: inline-flex; align-items: center; gap: 4px; }
.tm-entity__meta .tm-icon { color: var(--color-shade-60); }
.tm-entity__meta span { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); color: var(--color-shade-60); }

.tm-entity__desc {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-shade-80);
}

/* Divider under the top row, used on the project variant */
.tm-entity--split .tm-entity__top { padding-bottom: 16px; border-bottom: 1px solid var(--color-shade-10); }
.tm-entity__eyebrow { display: flex; align-items: center; gap: 8px; }
.tm-entity__code { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); font-weight: var(--font-weight-medium); color: var(--color-shade-60); }


/* =============================================================================
   12j. Progress bar (budget used)
   ============================================================================ */
.tm-progress { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.tm-progress__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-100);
}
.tm-progress__amount { font-weight: var(--font-weight-medium); }
.tm-progress__track {
  height: 6px;
  border-radius: 40px;
  background: var(--color-shade-10);
  overflow: hidden;
}
.tm-progress__bar { height: 6px; border-radius: 40px; background: var(--color-green); }
.tm-progress__bar--warn { background: var(--color-tertiary-100); }
.tm-progress__bar--full { background: var(--color-tertiary-100); }


/* =============================================================================
   12k. Table aggregate footer
   -----------------------------------------------------------------------------
   The summary strip beneath a table: an add button plus a per-column roll-up.
   ============================================================================ */
.tm-table tfoot td {
  height: 60px;
  padding: 6px 16px;
  border-right: 1px solid var(--color-shade-10);
  border-top: 1px solid var(--color-shade-10);
  background: var(--color-secondary-5);
  vertical-align: middle;
}
.tm-table tfoot td:last-child { border-right: 0; }

.tm-aggregate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-shade-60);
  white-space: nowrap;
}
.tm-aggregate--value { color: var(--color-shade-100); }
.tm-aggregate .tm-icon { color: var(--color-shade-60); }

.tm-addrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-shade-60);
}
.tm-addrow:hover { background: var(--color-secondary-10); color: var(--color-secondary-100); }


/* =============================================================================
   13. Bootstrap integration
   -----------------------------------------------------------------------------
   Small bridges so Bootstrap's components adopt the design language instead of
   being restyled from scratch. Bootstrap's own file is never edited.
   ============================================================================ */

/* ---- 13.1 Dropdown caret -------------------------------------------------
   Swap Bootstrap's triangle for the chevron used throughout the design. */
.tm-btn.dropdown-toggle::after,
.tm-account.dropdown-toggle::after,
.tm-pagination__size.dropdown-toggle::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 0;
  vertical-align: middle;
  background-color: var(--color-shade-60);
  -webkit-mask: var(--chevron-down) center / contain no-repeat;
          mask: var(--chevron-down) center / contain no-repeat;
}
.tm-btn--primary.dropdown-toggle::after { background-color: currentColor; }

.dropdown-menu {
  --bs-dropdown-bg: var(--color-white);
  --bs-dropdown-font-size: var(--font-size-sm);
  --bs-dropdown-color: var(--color-shade-80);
  --bs-dropdown-border-color: var(--color-shade-10);
  --bs-dropdown-border-radius: var(--radius-sm);
  --bs-dropdown-link-active-bg: var(--color-secondary-5);
  --bs-dropdown-link-active-color: var(--color-secondary-100);
  --bs-dropdown-link-hover-bg: var(--color-secondary-5);
  --bs-dropdown-header-color: var(--color-shade-60);
  box-shadow: 0 8px 24px rgb(15 20 25 / 10%);
}

/* Filter menu rows are labels wrapping a radio, so they stay clickable */
.tm-filter-menu .dropdown-item {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.tm-filter-menu .form-check-input:checked {
  background-color: var(--color-primary-100);
  border-color: var(--color-primary-100);
}

/* ---- 13.2 Sortable table headers ----------------------------------------- */
.tm-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.tm-sort:hover { color: var(--color-secondary-100); }
.tm-sort .tm-icon { transition: transform .15s ease; }

th[aria-sort="ascending"]  .tm-sort,
th[aria-sort="descending"] .tm-sort { color: var(--color-primary-100); }
th[aria-sort="ascending"]  .tm-sort .tm-icon { transform: rotate(180deg); }

/* ---- 13.3 Empty result state --------------------------------------------- */
.tm-table-empty {
  margin: 0;
  padding: 32px 16px;
  border: 1px solid var(--color-shade-10);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-shade-60);
}


/* =============================================================================
   16. Multi-step wizard  (New Invoice)
   -----------------------------------------------------------------------------
   Five steps live inside one Bootstrap modal: the dialog chrome, header, body
   and footer are the components from section 12h, so only the pieces the
   wizard adds are defined here — the progress rail, the entry picker, the
   line-item sheet, the document preview, the issue summary and the confirmation
   dialog. Everything is namespaced `.tm-wz-` (or `.tm-done-` for the receipt),
   so no application screen is affected.

   The pattern is deliberately generic: any future wizard reuses these classes
   plus the `data-tm-wizard` contract in js/app.js.
   ============================================================================ */

.tm-modal--lg .modal-dialog { max-width: 900px; }
.tm-modal--done .modal-content { border-radius: 6px; }

/* --- 16a. Progress rail --------------------------------------------------- */
.tm-wz-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 74px;
  background: var(--color-secondary-5);
  border-bottom: 1px solid var(--color-shade-10);
}

.tm-wz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 24px;
  flex: 0 0 auto;
}

.tm-wz-step__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 44px;
  background: var(--color-secondary-20);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
}

.tm-wz-step__check { display: none; }

.tm-wz-step__label {
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-shade-60);
  white-space: nowrap;
}

/* Reached (current) and completed steps both take the navy; a completed step
   swaps its number for a tick. */
.tm-wz-step.is-current .tm-wz-step__dot,
.tm-wz-step.is-done .tm-wz-step__dot { background: var(--color-secondary-80); }

.tm-wz-step.is-current .tm-wz-step__label,
.tm-wz-step.is-done .tm-wz-step__label { color: var(--color-secondary-80); }

.tm-wz-step.is-done .tm-wz-step__num { display: none; }
.tm-wz-step.is-done .tm-wz-step__check { display: block; }

.tm-wz-line { flex: 1 1 0; min-width: 0; padding: 11px 0; }
.tm-wz-line > span { display: block; height: 2px; background: var(--color-shade-10); }
.tm-wz-line.is-done > span { background: var(--color-secondary-80); }

@media (max-width: 767.98px) {
  .tm-wz-steps { padding: 12px 16px; }
  .tm-wz-step__label { display: none; }
}

/* --- 16b. Step panel + section heading ------------------------------------ */
.tm-wz-panel { display: flex; flex-direction: column; gap: 20px; }

.tm-wz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-shade-10);
}

.tm-wz-head__title {
  margin: 0 0 8px;
  font-size: var(--font-size-md);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  text-transform: uppercase;
  color: var(--color-shade-80);
}

.tm-wz-head__text {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-60);
}

/* Field rows inside a step wrap rather than squeeze */
.tm-wz-panel .tm-field--row { flex-wrap: wrap; }
.tm-wz-panel .tm-field--row > .tm-field { flex: 1 1 160px; }

@media (max-width: 575.98px) {
  .tm-wz-panel .tm-field--row > .tm-field { flex-basis: 100%; }
}

.tm-wz-records { font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-shade-80); }

/* --- 16c. Notes ------------------------------------------------------------
   Two weights: an informational note in the secondary palette, and a blocking
   one in the red. Both sit at the foot of a step. */
.tm-wz-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border: 1px solid var(--color-secondary-40);
  border-radius: var(--radius-sm);
  background: var(--color-secondary-5);
  color: var(--color-secondary-80);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-tight);
}

.tm-wz-note--danger {
  padding: 14px 12px;
  border-color: rgb(203 43 0 / 40%);
  background: rgb(203 43 0 / 5%);
  color: var(--color-red);
}

.tm-wz-note__body { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.tm-wz-note .tm-icon { color: currentColor; }

button.tm-wz-note { width: 100%; text-align: left; }

.tm-wz-notes { display: flex; flex-direction: column; gap: 12px; }

a.tm-wz-note--danger:hover, button.tm-wz-note--danger:hover { background: rgb(203 43 0 / 9%); color: var(--color-red); }

/* --- 16d. Segmented tabs --------------------------------------------------- */
.tm-wz-seg {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-10);
}

.tm-wz-seg__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-shade-80);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.btn-check:checked + .tm-wz-seg__btn {
  background: var(--color-white);
  border-color: var(--color-shade-20);
  color: var(--color-shade-100);
}

.btn-check:focus-visible + .tm-wz-seg__btn { outline: 2px solid var(--color-primary-80); outline-offset: 1px; }

/* --- 16e. Entry picker ----------------------------------------------------- */
.tm-wz-group {
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
  overflow: hidden;
}

.tm-wz-group__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--color-secondary-5);
}

.tm-wz-group__name,
.tm-wz-group__meta {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-shade-60);
}
.tm-wz-group__name { flex: 1 1 0; min-width: 0; }
.tm-wz-group__meta { white-space: nowrap; }

.tm-wz-entry {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--color-shade-10);
}

.tm-wz-entry__main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 60px;
  padding: 6px 16px;
}

.tm-wz-entry__title {
  display: block;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-shade-80);
}

.tm-wz-entry__sub {
  display: block;
  margin-top: 6px;
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-shade-60);
}

.tm-wz-entry__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: 140px;
  padding: 6px 16px;
  text-align: right;
}

.tm-wz-entry__hours { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); font-weight: var(--font-weight-medium); color: var(--color-secondary-80); }
.tm-wz-entry__amount { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); color: var(--color-shade-80); }

.tm-wz-empty {
  padding: 40px 16px;
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
  text-align: center;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--color-shade-60);
}

/* The picker's checkboxes are Bootstrap's, sized and coloured to the design */
.tm-wz-check {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  border-color: var(--color-shade-20);
  border-radius: 3px;
}
.tm-wz-check:checked,
.tm-wz-check:indeterminate {
  background-color: var(--color-primary-80);
  border-color: var(--color-primary-80);
}

/* --- 16f. Running tally ---------------------------------------------------- */
.tm-wz-tally {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-shade-80);
  color: var(--color-white);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  letter-spacing: var(--letter-spacing-tight);
}

.tm-wz-tally__clear {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-primary-60);
}
.tm-wz-tally__clear:hover { color: var(--color-white); text-decoration: underline; }

.tm-wz-tally__figures { display: flex; align-items: center; gap: 8px; }

.tm-wz-tally__value {
  padding: 6px 8px;
  font-size: var(--font-size-md);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
}

.tm-wz-tally__sep { width: 1px; height: 24px; background: rgb(255 255 255 / 30%); }

/* --- 16g. Line-item sheet -------------------------------------------------- */
.tm-wz-sheet {
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
  overflow: hidden;
}

.tm-wz-table { width: 100%; margin: 0; border-collapse: collapse; }

.tm-wz-table th {
  padding: 16px;
  background: var(--color-secondary-5);
  border-right: 1px solid var(--color-shade-10);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-shade-60);
  white-space: nowrap;
}

.tm-wz-table td {
  height: 60px;
  padding: 6px 16px;
  border-top: 1px solid var(--color-shade-10);
  border-right: 1px solid var(--color-shade-10);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  color: var(--color-shade-100);
  vertical-align: middle;
}

.tm-wz-table th:last-child,
.tm-wz-table td:last-child { border-right: 0; }

.tm-wz-table td.tm-wz-cell--field { padding: 6px; }
.tm-wz-table .tm-wz-desc { font-weight: var(--font-weight-medium); letter-spacing: var(--letter-spacing-wider); color: var(--color-shade-80); }
.tm-wz-table .tm-wz-amount {
  text-align: right;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-secondary-100);
  white-space: nowrap;
}
.tm-wz-table .tm-wz-col--num { width: 120px; }
.tm-wz-table .tm-wz-col--amount { width: 120px; text-align: right; }
.tm-wz-table .tm-wz-col--act { width: 52px; }

/* A field that fills its cell — the design's inline editors */
.tm-wz-field {
  height: 100%;
  padding: 12px;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wider);
}

/* Number field with its own stepper, since the value carries a unit ("7.5 h") */
.tm-spin { position: relative; height: 100%; }
.tm-spin .tm-control { height: 100%; padding-right: 34px; }
.tm-spin__icon {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  color: var(--color-shade-60);
  pointer-events: none;
}
.tm-spin__btn {
  position: absolute;
  right: 4px;
  width: 28px;
  height: 50%;
  padding: 0;
  border: 0;
  background: transparent;
}
.tm-spin__btn--up { top: 0; }
.tm-spin__btn--down { bottom: 0; }
.tm-spin__btn:focus-visible { outline: 2px solid var(--color-primary-80); outline-offset: -2px; }

/* --- 16h. Totals block ------------------------------------------------------ */
.tm-wz-totals {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 16px 16px;
  background: var(--color-secondary-5);
}

.tm-wz-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tm-wz-total__label { font-size: var(--font-size-xs); line-height: var(--line-height-2xs); letter-spacing: var(--letter-spacing-tight); color: var(--color-shade-80); }
.tm-wz-total__value { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); text-align: right; color: var(--color-shade-100); }
.tm-wz-total__value--negative { color: var(--color-red); }

.tm-wz-total--grand .tm-wz-total__label {
  font-size: var(--font-size-md);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-shade-100);
}
.tm-wz-total--grand .tm-wz-total__value {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-medium);
  color: var(--color-secondary-100);
}

/* --- 16i. Invoice document preview ----------------------------------------- */
.tm-wz-doc {
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
  overflow: hidden;
}

.tm-wz-doc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--color-shade-80);
  color: var(--color-white);
}

.tm-wz-doc__title { margin: 0; font-size: var(--font-size-lg); line-height: var(--line-height-lg); font-weight: var(--font-weight-medium); }
.tm-wz-doc__sub { margin: 0; font-size: var(--font-size-xs); line-height: var(--line-height-sm); color: rgb(255 255 255 / 75%); }
.tm-wz-doc__id { font-size: var(--font-size-sm); line-height: var(--line-height-sm); white-space: nowrap; }
.tm-wz-doc__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* The status pill sits on the dark header, so it inverts */
.tm-wz-doc__badge { background: var(--color-white); color: var(--color-shade-80); }

.tm-wz-doc__meta { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--color-shade-10); }

.tm-wz-doc__cell {
  flex: 1 1 180px;
  min-width: 0;
  padding: 12px 16px;
  border-right: 1px solid var(--color-shade-10);
}
.tm-wz-doc__cell:last-child { border-right: 0; }

.tm-wz-doc__label { display: block; font-size: var(--font-size-xs); line-height: var(--line-height-2xs); color: var(--color-shade-60); }
.tm-wz-doc__value { display: block; margin-top: 4px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-shade-100); }
.tm-wz-doc__value--client { font-weight: var(--font-weight-medium); color: var(--color-secondary-80); }

/* --- 16j. Issue summary ----------------------------------------------------- */
.tm-wz-summary {
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
  overflow: hidden;
}

.tm-wz-summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--color-shade-80);
  color: var(--color-white);
}
.tm-wz-summary__title { margin: 0; font-size: var(--font-size-lg); line-height: var(--line-height-lg); font-weight: var(--font-weight-medium); }
.tm-wz-summary__id { font-size: var(--font-size-sm); line-height: var(--line-height-sm); white-space: nowrap; }

.tm-wz-summary__list { margin: 0; }

.tm-wz-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--color-shade-10);
}

.tm-wz-summary__row dt {
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-2xs);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-shade-60);
}

.tm-wz-summary__row dd {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-2xs);
  text-align: right;
  color: var(--color-shade-100);
}

.tm-wz-summary__row dd.is-link { color: var(--color-secondary-80); }
.tm-wz-summary__row dd.is-negative { color: var(--color-red); }
.tm-wz-summary__row dd.is-grand { font-weight: var(--font-weight-medium); color: var(--color-secondary-100); }

/* --- 16k. Confirmation dialog ----------------------------------------------- */
.tm-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 32px 24px;
  text-align: center;
}

.tm-done__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 1000px;
  background: rgb(0 131 104 / 20%);
  color: var(--color-green);
}

.tm-done__title {
  margin: 0;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-shade-80);
}

.tm-done__text { margin: 8px 0 0; font-size: var(--font-size-sm); line-height: var(--line-height-2xs); color: var(--color-shade-60); }
.tm-done__text a { font-weight: var(--font-weight-medium); color: var(--color-secondary-80); text-decoration: underline; }

.tm-done__stats {
  display: flex;
  width: 100%;
  border: 1px solid var(--color-shade-10);
  border-radius: 6px;
}

.tm-done__stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  padding: 17px 16px;
  border-right: 1px solid var(--color-shade-10);
}
.tm-done__stat:last-child { border-right: 0; }

.tm-done__stat-label {
  font-size: var(--font-size-2xs);
  line-height: var(--line-height-2xs);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-shade-60);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-done__stat-value { font-size: var(--font-size-sm); line-height: var(--line-height-2xs); font-weight: var(--font-weight-medium); letter-spacing: var(--letter-spacing-wider); }
.tm-done__stat-value--id { color: var(--color-secondary-80); }
.tm-done__stat-value--muted { color: var(--color-shade-80); }

.tm-done__actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* --- 16l. Wizard responsiveness --------------------------------------------- */
@media (max-width: 575.98px) {
  .tm-wz-entry { flex-wrap: wrap; }
  .tm-wz-entry__side { width: 100%; align-items: flex-start; text-align: left; padding-top: 0; }
  .tm-done { padding: 24px 20px; }
  .tm-done__stats { flex-direction: column; }
  .tm-done__stat { border-right: 0; border-bottom: 1px solid var(--color-shade-10); }
  .tm-done__stat:last-child { border-bottom: 0; }
}


/* =============================================================================
   18. Shared form and layout utilities
   -----------------------------------------------------------------------------
   Small pieces that more than one screen needs: a text field with a leading
   icon and/or a trailing action, a full-width button, and a horizontal rule
   in the design's border colour.
   ============================================================================ */

/* Leading icon + trailing reveal button inside a `.tm-control` */
.tm-inputgroup { position: relative; display: flex; }

.tm-inputgroup__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--color-shade-40);
  pointer-events: none;
}

.tm-control--lead { padding-left: 38px; }
.tm-control--trail { padding-right: 40px; }

.tm-inputgroup__action {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-shade-60);
}

.tm-inputgroup__action:hover { background: var(--color-secondary-5); color: var(--color-secondary-100); }
.tm-inputgroup__action:focus-visible { outline: 2px solid var(--color-primary-80); outline-offset: 1px; }

/* A button that fills its container — used by dialogs, drawers and the sign-in
   form, where the action is the only thing on its row. */
.tm-btn--block { width: 100%; height: auto; padding: 11px 12px; gap: 8px; }
.tm-btn--block .tm-icon { width: 20px; height: 20px; }

/* A rule between blocks of content */
.tm-divider-x {
  height: 1px;
  border: 0;
  opacity: 1;
  background: var(--color-shade-10);
}


/* =============================================================================
   14. Responsive overrides
   -----------------------------------------------------------------------------
   Bootstrap's grid handles the column reflow; these rules cover the pieces the
   grid cannot express.
   ============================================================================ */

/* The invoice journey adapts via a container query (section 10) rather than a
   media query, because its width depends on the grid column it lands in. */

/* Below `lg` the sidebar becomes an offcanvas drawer */
@media (max-width: 991.98px) {
  .tm-content { padding: 16px 12px; }
  .tm-topbar  { padding: 8px 12px; }
  .tm-panel__head,
  .tm-panel__foot { padding-left: 16px; padding-right: 16px; }
  .tm-panel__body { padding: 16px; }
}

/* Mobile */
@media (max-width: 575.98px) {
  .tm-account__name { display: none; }

  /* NFR-08: a tap target is at least 44px on a phone (Start Timer, Save, the
     hamburger menu, the language toggle, the billable switch...). */
  .tm-btn { min-height: 44px; }
  .tm-burger { width: 44px; height: 44px; }
  .tm-lang__btn { min-height: 44px; display: inline-flex; align-items: center; }
  .tm-switch .form-check-input { width: 44px; height: 24px; }
}

/* The offcanvas drawer reuses the sidebar markup verbatim */
.offcanvas.tm-offcanvas {
  width: var(--sidebar-width);
  background: var(--color-secondary-100);
}
.offcanvas.tm-offcanvas .tm-sidebar { width: 100%; height: 100%; }

/* A firm can keep billing values from associates (Settings > Time Rules). */
.tm-no-amounts .col-amount { display: none; }
