/* ========================================================================== 
   Design tokens
   --------------------------------------------------------------------------
   Centralizing colors, spacing and shadows makes the visual language easy to
   evolve without hunting through component-specific rules.
   ========================================================================== */
:root {
  --color-navy-950: #0a1929;
  --color-navy-900: #102a43;
  --color-navy-800: #173f5f;
  --color-navy-800-rgb: 23 63 95;
  --color-blue-700: #0b6da8;
  --color-blue-600: #0f7dbd;
  --color-blue-100: #dff2ff;
  --color-sky-50: #f2f8fc;
  --color-slate-900: #192734;
  --color-slate-700: #526475;
  --color-slate-600: #687b8d;
  --color-slate-500: #8292a3;
  --color-slate-300: #cad5df;
  --color-slate-200: #dfe7ee;
  --color-slate-100: #edf2f6;
  --color-white: #ffffff;
  --color-green-700: #187554;
  --color-green-100: #def6e9;
  --color-amber-700: #90640d;
  --color-amber-100: #fff1c9;
  --color-red-600: #c63d4f;
  --color-accent-rgb: 15 125 189;
  --color-accent-shadow-rgb: 11 109 168;
  --color-accent-glow-rgb: 100 201 255;
  --color-accent-deep: #105d91;
  --color-accent-hover: #075e94;
  --color-navigation-panel: #12304b;
  --color-page-tint: #f8fbfd;
  --color-login-background: #e5edf4;

  --shadow-card: 0 1px 2px rgb(15 35 55 / 6%), 0 12px 32px rgb(15 35 55 / 5%);
  --shadow-header: 0 8px 28px rgb(8 28 44 / 12%);
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --page-max-width: 1680px;
  --header-height: 134px;
  --transition-fast: 160ms ease;
}

/*
 * Optional palettes override only semantic design tokens. Components continue
 * to consume the same variables, which keeps future screens theme-compatible
 * without duplicating their complete rules four times.
 */
:root[data-theme="red"] {
  --color-navy-950: #2b0b10;
  --color-navy-900: #4a141d;
  --color-navy-800: #6a1f2c;
  --color-navy-800-rgb: 106 31 44;
  --color-blue-700: #a82335;
  --color-blue-600: #c43b4f;
  --color-blue-100: #fde8eb;
  --color-sky-50: #fff7f8;
  --color-accent-rgb: 196 59 79;
  --color-accent-shadow-rgb: 168 35 53;
  --color-accent-glow-rgb: 255 159 173;
  --color-accent-deep: #8f2637;
  --color-accent-hover: #8d1e30;
  --color-navigation-panel: #541722;
  --color-page-tint: #fff8f9;
  --color-login-background: #f3e8ea;
}

:root[data-theme="green"] {
  --color-navy-950: #06251b;
  --color-navy-900: #0d3b2b;
  --color-navy-800: #14563f;
  --color-navy-800-rgb: 20 86 63;
  --color-blue-700: #147a55;
  --color-blue-600: #1b9367;
  --color-blue-100: #e1f7ed;
  --color-sky-50: #f4fbf7;
  --color-accent-rgb: 27 147 103;
  --color-accent-shadow-rgb: 20 122 85;
  --color-accent-glow-rgb: 120 224 180;
  --color-accent-deep: #116b4a;
  --color-accent-hover: #0f6848;
  --color-navigation-panel: #0f4331;
  --color-page-tint: #f5fbf8;
  --color-login-background: #e6f1ec;
}

:root[data-theme="pink"] {
  --color-navy-950: #4d1233;
  --color-navy-900: #8a275f;
  --color-navy-800: #b43779;
  --color-navy-800-rgb: 180 55 121;
  --color-blue-700: #c72f7a;
  --color-blue-600: #eb4fa0;
  --color-blue-100: #ffe1f0;
  --color-sky-50: #fff5fa;
  --color-accent-rgb: 235 79 160;
  --color-accent-shadow-rgb: 199 47 122;
  --color-accent-glow-rgb: 255 179 216;
  --color-accent-deep: #b82f76;
  --color-accent-hover: #c83482;
  --color-navigation-panel: #972c67;
  --color-page-tint: #fff8fc;
  --color-login-background: #f8e4ee;
}

/* ========================================================================== 
   Reset and global accessibility
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-sky-50);
  color: var(--color-slate-900);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding-top: var(--header-height);
  background:
    radial-gradient(circle at 100% 0%, rgb(var(--color-accent-rgb) / 8%), transparent 26rem),
    var(--color-sky-50);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* Button labels behave like application controls, not selectable document
   text. The vendor-prefixed rule keeps the behavior consistent on WebKit. */
button,
.button {
  -webkit-user-select: none;
  user-select: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgb(var(--color-accent-rgb) / 32%);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-navy-900);
  font-weight: 700;
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================================================== 
   Fixed application header and shared navigation partial
   ========================================================================== */
.app-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: var(--header-height);
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  background: var(--color-navy-900);
  box-shadow: var(--shadow-header);
  color: var(--color-white);
}

.app-header__identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--page-max-width);
  height: 70px;
  margin: 0 auto;
  padding: 0 28px;
  /* The complete identity strip is an application control surface. Preventing
     text selection avoids highlighting the brand or user name on rapid clicks. */
  -webkit-user-select: none;
  user-select: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--color-white);
  text-decoration: none;
}

.brand__symbol {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--color-blue-600), var(--color-accent-deep));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.045em;
}

.brand__text {
  display: grid;
  line-height: 1.1;
}

.brand__text strong {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand__text small {
  margin-top: 4px;
  color: rgb(255 255 255 / 58%);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.user-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-summary__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -5px;
  padding: 5px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.user-summary__profile:hover {
  background: rgb(255 255 255 / 7%);
}

.user-summary__details {
  display: grid;
  text-align: right;
  line-height: 1.25;
}

.user-summary__details strong {
  font-size: 0.84rem;
  font-weight: 650;
}

.user-summary__details small {
  margin-top: 2px;
  color: rgb(255 255 255 / 52%);
  font-size: 0.7rem;
}

.user-summary__avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  background: rgb(255 255 255 / 9%);
  font-size: 0.75rem;
  font-weight: 750;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

/* Both the small header avatar and the larger account avatar use the same
   cropping rule, so uploaded portrait and landscape images remain circular or
   rounded without distorting their proportions. */
.profile-avatar__image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.user-summary__profile:hover .user-summary__avatar {
  border-color: rgb(var(--color-accent-glow-rgb) / 42%);
  background: rgb(var(--color-accent-rgb) / 28%);
}

.user-summary__logout {
  margin: 0;
}

.user-summary__logout button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 8px;
  background: transparent;
  color: rgb(255 255 255 / 72%);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.user-summary__logout-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.user-summary__logout button:hover {
  border-color: rgb(255 255 255 / 28%);
  background: rgb(255 255 255 / 8%);
  color: var(--color-white);
}

.primary-navigation {
  height: 64px;
  border-top: 1px solid rgb(255 255 255 / 8%);
  /* This band is intentionally a little lighter than the identity header.
     Its semantic token also keeps preset and personal themes consistent. */
  background: var(--color-navigation-panel);
  /* Navigation labels behave as application controls, consistently with the
     other buttons, and cannot be accidentally highlighted while clicking. */
  -webkit-user-select: none;
  user-select: none;
}

.primary-navigation__inner {
  position: relative;
  max-width: var(--page-max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.primary-navigation__scroll {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 6px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.primary-navigation__scroll::-webkit-scrollbar {
  display: none;
}

.primary-navigation__toggle {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 9px;
  background: rgb(255 255 255 / 7%);
  color: rgb(255 255 255 / 88%);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

.primary-navigation__toggle:hover,
.primary-navigation__toggle[aria-expanded="true"] {
  border-color: rgb(var(--color-accent-glow-rgb) / 34%);
  background: rgb(var(--color-accent-rgb) / 24%);
  color: var(--color-white);
}

.primary-navigation__toggle-icon {
  display: grid;
  width: 17px;
  gap: 4px;
}

.primary-navigation__toggle-icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentcolor;
  transform-origin: center;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.primary-navigation__toggle[aria-expanded="true"] .primary-navigation__toggle-icon span:first-child {
  transform: translateY(6px) rotate(45deg);
}

.primary-navigation__toggle[aria-expanded="true"] .primary-navigation__toggle-icon span:nth-child(2) {
  opacity: 0;
}

.primary-navigation__toggle[aria-expanded="true"] .primary-navigation__toggle-icon span:last-child {
  transform: translateY(-6px) rotate(-45deg);
}

/*
 * JavaScript adds this class only when the measured link row is wider than its
 * container. The popup overlays the page, so opening it never shifts content.
 */
.primary-navigation.is-collapsible .primary-navigation__inner {
  display: flex;
  align-items: center;
}

.primary-navigation.is-collapsible .primary-navigation__toggle {
  display: inline-flex;
}

.primary-navigation.is-collapsible .primary-navigation__scroll {
  position: absolute;
  top: calc(100% - 5px);
  left: 24px;
  z-index: 110;
  width: min(360px, calc(100% - 48px));
  height: auto;
  max-height: min(520px, calc(100vh - var(--header-height) - 12px));
  align-items: stretch;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 11px;
  background: var(--color-navigation-panel);
  box-shadow: 0 18px 42px rgb(4 17 28 / 34%);
  scrollbar-width: thin;
}

.primary-navigation.is-collapsible .primary-navigation__scroll[hidden] {
  display: none;
}

.primary-navigation.is-collapsible .primary-navigation__link {
  width: 100%;
}

.primary-navigation__link {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgb(255 255 255 / 72%);
  font-size: 0.83rem;
  font-weight: 650;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.primary-navigation__link:hover {
  border-color: rgb(255 255 255 / 11%);
  background: rgb(255 255 255 / 7%);
  color: var(--color-white);
  transform: translateY(-1px);
}

.primary-navigation__link.is-active {
  border-color: rgb(var(--color-accent-glow-rgb) / 28%);
  background: rgb(var(--color-accent-rgb) / 24%);
  color: var(--color-white);
}

.primary-navigation__marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(255 255 255 / 28%);
}

.primary-navigation__link:hover .primary-navigation__marker,
.primary-navigation__link.is-active .primary-navigation__marker {
  background: rgb(var(--color-accent-glow-rgb));
  box-shadow: 0 0 0 3px rgb(var(--color-accent-glow-rgb) / 12%);
}

/* ========================================================================== 
   Page shell, headings and shared controls
   ========================================================================== */
.page-shell {
  width: min(calc(100% - 48px), var(--page-max-width));
  min-height: calc(100vh - var(--header-height) - 70px);
  margin: 0 auto;
  padding: 32px 0 28px;
}

.page-shell--centered {
  display: grid;
  place-items: center;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--color-blue-700);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  color: var(--color-navy-950);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.page-heading__description {
  max-width: 680px;
  margin: 9px 0 0;
  color: var(--color-slate-600);
  font-size: 0.94rem;
}

.page-heading__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 3px;
}

.prototype-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid #f0d99f;
  border-radius: 999px;
  background: var(--color-amber-100);
  color: var(--color-amber-700);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--color-blue-700);
  box-shadow: 0 6px 16px rgb(var(--color-accent-shadow-rgb) / 18%);
  color: var(--color-white);
}

.button--primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 8px 20px rgb(var(--color-accent-shadow-rgb) / 24%);
}

.button--secondary {
  border-color: var(--color-slate-300);
  background: var(--color-white);
  color: var(--color-navy-800);
}

.button--secondary:hover,
.button--quiet:hover {
  border-color: #aebeca;
  background: var(--color-slate-100);
}

.button--quiet {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--color-slate-600);
}

/* ========================================================================== 
   Filter card and form
   ========================================================================== */
.filter-card,
.data-card {
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow-card);
}

.filter-card {
  margin-bottom: 20px;
  overflow: hidden;
}

.filter-card__header,
.data-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}

.filter-card__header {
  border-bottom: 1px solid var(--color-slate-100);
}

.filter-card__header h2,
.data-card__header h2 {
  margin: 0;
  color: var(--color-navy-900);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.filter-card__toggle svg {
  transition: transform var(--transition-fast);
}

.filter-card.is-collapsed .filter-card__toggle svg {
  transform: rotate(-90deg);
}

.filter-card.is-collapsed .filter-form {
  display: none;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 17px 16px;
  padding: 20px;
}

.field {
  display: grid;
  grid-column: span 3;
  align-content: start;
  gap: 6px;
}

.field--wide {
  grid-column: span 4;
}

.field--compact {
  grid-column: span 2;
}

.field label {
  color: var(--color-slate-700);
  font-size: 0.72rem;
  font-weight: 700;
}

/* The preference state is an actual button so mouse and keyboard users can
   decide independently which selector values should survive a refresh. */
.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field__memory-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-blue-700);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.field__memory-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.field__memory-toggle.is-disabled {
  color: var(--color-slate-500);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--color-slate-300);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-slate-900);
  font-size: 0.82rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.field input::placeholder {
  color: #9aa9b6;
}

.field input:hover,
.field select:hover {
  border-color: #aabac7;
}

.field input:focus,
.field select:focus {
  border-color: var(--color-blue-600);
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / 12%);
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  top: 50%;
  left: 11px;
  color: var(--color-slate-500);
  pointer-events: none;
  transform: translateY(-50%);
}

.input-with-icon input {
  padding-left: 37px;
}

.filter-form__actions {
  display: flex;
  grid-column: span 3;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

/* ========================================================================== 
   Tiers table
   ========================================================================== */
.data-card {
  position: relative;
  overflow: hidden;
}

/* The old rows stay visible under a light veil while the replacement HTML is
   requested. This avoids layout jumps and makes rapid local searches feel
   immediate without pretending that the operation is synchronous. */
.data-card.is-loading {
  cursor: progress;
  pointer-events: none;
}

.data-card.is-loading::before {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgb(var(--color-accent-rgb) / 20%);
  border-top-color: var(--color-blue-600);
  border-radius: 50%;
  content: "";
  animation: tier-results-spin 650ms linear infinite;
}

.data-card.is-loading::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: rgb(255 255 255 / 68%);
  content: "";
}

@keyframes tier-results-spin {
  to {
    transform: rotate(360deg);
  }
}

.data-card__header {
  border-bottom: 1px solid var(--color-slate-200);
}

.result-summary {
  margin: 0;
  color: var(--color-slate-600);
  font-size: 0.8rem;
}

.result-summary strong {
  color: var(--color-navy-900);
  font-size: 1rem;
}

.result-summary span {
  color: var(--color-slate-500);
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
}

.table-scroll:focus-visible {
  outline-offset: -3px;
}

.tiers-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--color-slate-700);
  font-size: 0.78rem;
}

.tiers-table th,
.tiers-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--color-slate-100);
  text-align: left;
  vertical-align: middle;
}

.tiers-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f7fafc;
  color: var(--color-slate-600);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tiers-table tbody tr {
  position: relative;
  background: var(--color-white);
  transition:
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.tiers-table tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.tiers-table tbody tr:hover,
.tiers-table tbody tr:focus,
.tiers-table tbody tr.is-selected {
  z-index: 1;
  outline: none;
  background: #eff8fe;
  box-shadow: inset 3px 0 0 var(--color-blue-600);
}

.tiers-table tbody tr:last-child td {
  border-bottom: 0;
}

.company-label {
  color: var(--color-navy-800);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.tier-name,
.address {
  display: block;
  color: var(--color-slate-900);
  font-weight: 700;
}

.tier-contact,
.address__city {
  display: block;
  margin-top: 2px;
  color: var(--color-slate-500);
  font-size: 0.7rem;
}

.table-link {
  color: var(--color-blue-700);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.table-link:hover {
  text-decoration: underline;
}

.type-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--color-blue-100);
  color: var(--color-blue-700);
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.type-badge--prospect {
  background: var(--color-amber-100);
  color: var(--color-amber-700);
}

.type-badge--ancien-client {
  background: var(--color-slate-100);
  color: var(--color-slate-600);
}

.type-badge--partenaire {
  background: #eae5ff;
  color: #6147a9;
}

.boolean-pill {
  display: inline-flex;
  min-width: 50px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 750;
}

.boolean-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.boolean-pill.is-positive {
  background: var(--color-green-100);
  color: var(--color-green-700);
}

.boolean-pill.is-positive .boolean-pill__dot {
  background: #2aa975;
}

.boolean-pill.is-neutral {
  background: var(--color-slate-100);
  color: var(--color-slate-600);
}

.boolean-pill.is-neutral .boolean-pill__dot {
  background: #9aabb9;
}

.cell--center {
  text-align: center !important;
}

.cell--actions {
  width: 58px;
  text-align: right !important;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--color-slate-200);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-blue-700);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.icon-button:hover {
  border-color: var(--color-blue-600);
  background: var(--color-blue-100);
  transform: translateX(1px);
}

.button:disabled {
  cursor: progress;
  opacity: 0.68;
  transform: none;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 60px 24px 66px;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-blue-100);
  color: var(--color-blue-700);
}

.empty-state h3 {
  margin: 0;
  color: var(--color-navy-900);
  font-size: 1rem;
}

.empty-state p {
  max-width: 460px;
  margin: 7px 0 18px;
  color: var(--color-slate-600);
  font-size: 0.84rem;
}

/* ========================================================================== 
   Personal account
   ========================================================================== */
.account-page {
  padding-bottom: 42px;
}

.account-identity,
.account-card {
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 96%);
  box-shadow: var(--shadow-card);
}

.account-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 20px;
  padding: 24px;
}

.account-identity__avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--color-blue-600), var(--color-navy-800));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
  color: var(--color-white);
  font-size: 1.1rem;
  font-weight: 800;
}

.account-avatar-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  font: inherit;
  transition:
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.account-avatar-button:hover {
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 20%),
    0 0 0 4px rgb(var(--color-accent-rgb) / 14%);
  transform: translateY(-1px);
}

.account-avatar-button__badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid var(--color-white);
  border-radius: 50%;
  background: var(--color-navy-900);
  box-shadow: 0 2px 7px rgb(15 35 55 / 18%);
  color: var(--color-white);
}

.account-avatar-button__badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.account-avatar-editor {
  display: grid;
  flex: 1 0 100%;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr);
  gap: 12px 20px;
  margin-top: 2px;
  padding: 16px;
  border: 1px solid var(--color-slate-200);
  border-radius: 11px;
  background: var(--color-page-tint);
  animation: account-editor-reveal 160ms ease-out;
}

.account-avatar-editor[hidden] {
  display: none;
}

.account-avatar-editor__field {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.account-avatar-editor.is-webcam-active .account-avatar-editor__field {
  grid-column: auto;
}

.account-avatar-dropzone {
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  border: 1.5px dashed var(--color-slate-300);
  border-radius: 12px;
  background:
    linear-gradient(rgb(var(--color-accent-rgb) / 3%), rgb(var(--color-accent-rgb) / 3%)),
    var(--color-white);
  color: var(--color-slate-600);
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.account-avatar-dropzone:hover,
.account-avatar-dropzone:focus-visible,
.account-avatar-dropzone.is-dragging {
  border-color: var(--color-blue-600);
  outline: none;
  background: var(--color-blue-100);
  box-shadow: 0 0 0 4px rgb(var(--color-accent-rgb) / 10%);
  transform: translateY(-1px);
}

.account-avatar-dropzone.is-dragging {
  border-style: solid;
}

.account-avatar-dropzone > svg {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--color-blue-100);
  color: var(--color-blue-700);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.account-avatar-dropzone > span {
  display: grid;
  gap: 3px;
}

.account-avatar-dropzone strong {
  color: var(--color-navy-900);
  font-size: 0.8rem;
}

.account-avatar-dropzone small {
  color: var(--color-slate-500);
  font-size: 0.7rem;
  font-weight: 550;
}

.account-avatar-editor__field > small {
  color: var(--color-slate-500);
  font-size: 0.67rem;
}

.account-avatar-editor__source-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-avatar-editor__source-row > span {
  min-width: 0;
  overflow: hidden;
  color: var(--color-slate-600);
  font-size: 0.7rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-avatar-editor__webcam-button {
  flex: 0 0 auto;
  min-height: 34px;
  gap: 7px;
  padding: 0 11px;
  font-size: 0.7rem;
}

.account-avatar-editor__webcam-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.account-avatar-editor__support-note {
  margin: 0;
  color: var(--color-slate-500);
  font-size: 0.67rem;
  line-height: 1.4;
}

.account-avatar-webcam {
  display: grid;
  align-content: start;
  gap: 9px;
}

.account-avatar-webcam[hidden] {
  display: none;
}

.account-avatar-webcam__preview {
  position: relative;
  display: grid;
  min-height: 170px;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background: var(--color-navy-950);
  color: rgb(255 255 255 / 72%);
  font-size: 0.7rem;
}

.account-avatar-webcam video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.account-avatar-webcam__preview span {
  z-index: 1;
}

.account-avatar-webcam__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.account-avatar-webcam__actions .button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.7rem;
}

.account-avatar-editor > .account-inline-editor__feedback {
  grid-column: 1 / -1;
}

.account-avatar-editor__actions {
  grid-column: 1 / -1;
}

.account-avatar-editor.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.account-identity__main {
  min-width: 0;
}

.account-identity__main h2 {
  margin: 1px 0 1px;
  overflow: hidden;
  color: var(--color-navy-950);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity__username {
  color: var(--color-slate-500);
  font-size: 0.76rem;
}

.account-access-badge {
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid rgb(var(--color-accent-rgb) / 18%);
  border-radius: 999px;
  background: var(--color-blue-100);
  color: var(--color-blue-700);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.account-card {
  padding: 24px;
}

.account-card__header {
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--color-slate-100);
}

.account-card h2 {
  margin: 1px 0 0;
  color: var(--color-navy-900);
  font-size: 1rem;
  letter-spacing: -0.015em;
}

body:has(.account-functions-dialog[open]) {
  overflow: hidden;
}

.account-functions-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--color-slate-900);
  box-shadow: 0 28px 90px rgb(5 22 38 / 34%);
}

.account-functions-dialog::backdrop {
  background: rgb(5 20 34 / 58%);
  backdrop-filter: blur(3px);
}

.account-functions-dialog[open] {
  animation: account-dialog-reveal 180ms ease-out;
}

@keyframes account-dialog-reveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.account-functions-dialog__surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border: 1px solid rgb(var(--color-accent-rgb) / 16%);
  border-radius: inherit;
  background: var(--color-white);
}

.account-functions-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--color-slate-100);
  background: var(--color-page-tint);
}

.account-functions-dialog__header h2 {
  margin: 2px 0 0;
  color: var(--color-navy-900);
  font-size: 1.08rem;
}

.account-functions-dialog__header p:not(.section-kicker) {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--color-slate-600);
  font-size: 0.76rem;
}

.account-functions-dialog__close {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--color-slate-200);
  border-radius: 9px;
  background: var(--color-white);
  color: var(--color-slate-700);
  cursor: pointer;
}

.account-functions-dialog__close:hover {
  border-color: var(--color-blue-600);
  background: var(--color-blue-100);
  color: var(--color-blue-700);
}

.account-functions-dialog__close:focus-visible {
  outline: 3px solid rgb(var(--color-accent-rgb) / 28%);
  outline-offset: 2px;
}

.account-functions-dialog__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.account-functions-dialog__body {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  overscroll-behavior: contain;
}

.account-functions-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--color-slate-100);
  background: var(--color-page-tint);
}

.account-functions-card > .account-card__header p:not(.section-kicker) {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--color-slate-600);
  font-size: 0.78rem;
}

.account-functions-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--color-slate-300);
  border-radius: 10px;
  color: var(--color-slate-600);
  font-size: 0.8rem;
  text-align: center;
}

.account-company-functions-list {
  display: grid;
  gap: 18px;
}

.account-company-functions {
  overflow: hidden;
  border: 1px solid var(--color-slate-200);
  border-radius: 12px;
  background: var(--color-white);
}

.account-company-functions__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--color-slate-100);
  background: var(--color-sky-50);
}

.account-company-functions__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.account-company-functions__header h3 {
  margin: 0;
  color: var(--color-navy-900);
  font-size: 0.92rem;
}

.account-company-functions__header p {
  margin: 4px 0 0;
  color: var(--color-slate-600);
  font-size: 0.72rem;
}

.account-company-functions__header > strong,
.account-company-functions__primary {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--color-blue-100);
  color: var(--color-blue-700);
  font-size: 0.66rem;
  font-weight: 750;
  white-space: nowrap;
}

.account-company-functions__primary {
  padding: 3px 7px;
}

.account-company-functions__form {
  padding: 18px;
}

.account-function-categories {
  display: grid;
  gap: 20px;
}

.account-function-category {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

.account-function-category legend {
  width: 100%;
  margin-bottom: 9px;
  color: var(--color-navy-900);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-function-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.account-function-option {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--color-slate-200);
  border-radius: 9px;
  background: var(--color-white);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.account-function-option:hover {
  border-color: var(--color-slate-300);
  background: var(--color-sky-50);
}

.account-function-option:has(input:checked) {
  border-color: var(--color-blue-600);
  background: var(--color-blue-100);
  box-shadow: 0 0 0 2px rgb(var(--color-accent-rgb) / 8%);
}

.account-function-option input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--color-blue-600);
}

.account-function-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-function-option strong {
  color: var(--color-slate-900);
  font-size: 0.73rem;
}

.account-function-option small {
  color: var(--color-slate-600);
  font-size: 0.65rem;
  line-height: 1.35;
}

.account-company-functions__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-slate-100);
}

.account-company-functions__footer .account-inline-editor__feedback {
  flex: 1 1 auto;
  min-height: 0;
}

.account-company-functions__form.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.account-details {
  display: grid;
  gap: 0;
  margin: 0;
}

.account-details > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) minmax(0, 1.4fr);
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-slate-100);
}

.account-details > div:first-child {
  padding-top: 0;
}

.account-details > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.account-details dt {
  color: var(--color-slate-500);
  font-size: 0.72rem;
  font-weight: 700;
}

.account-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-slate-900);
  font-size: 0.8rem;
  font-weight: 650;
}

.account-editable-detail {
  display: grid;
  gap: 8px;
}

.account-editable-detail__value-row {
  display: flex;
  min-height: 26px;
  align-items: center;
  gap: 8px;
}

.account-edit-link {
  display: inline-grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--color-slate-200);
  border-radius: 7px;
  background: var(--color-white);
  color: var(--color-blue-700);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.account-edit-link:hover {
  border-color: var(--color-blue-600);
  background: var(--color-blue-100);
  transform: translateY(-1px);
}

.account-edit-link[aria-expanded="true"] {
  border-color: var(--color-blue-600);
  background: var(--color-blue-100);
}

.account-inline-editor {
  display: grid;
  gap: 8px;
  max-width: 430px;
  margin: 3px 0 3px 34px;
  padding: 12px;
  border: 1px solid var(--color-slate-200);
  border-radius: 10px;
  background: var(--color-page-tint);
  animation: account-editor-reveal 160ms ease-out;
}

.account-inline-editor[hidden] {
  display: none;
}

@keyframes account-editor-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.account-inline-editor input[type="email"],
.account-inline-editor input[type="tel"],
.account-address-editor input[type="text"],
.account-identity-editor input[type="text"],
.account-password-editor .password-input input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--color-slate-300);
  border-radius: 8px;
  background: var(--color-white);
  font-size: 0.8rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.account-inline-editor > small {
  color: var(--color-slate-500);
  font-size: 0.68rem;
  font-weight: 550;
  line-height: 1.45;
}

.account-address-editor {
  max-width: 560px;
}

.account-address-editor > label {
  color: var(--color-slate-700);
  font-size: 0.68rem;
  font-weight: 700;
}

.account-address-editor__combobox {
  position: relative;
}

.account-address-suggestions {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 230px;
  padding: 5px;
  border: 1px solid var(--color-slate-300);
  border-radius: 9px;
  margin: 0;
  overflow-y: auto;
  background: var(--color-white);
  box-shadow: 0 12px 30px rgb(var(--color-navy-800-rgb) / 14%);
  list-style: none;
}

.account-address-suggestions[hidden] {
  display: none;
}

.account-address-suggestions button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-slate-800);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.account-address-suggestions button:hover,
.account-address-suggestions button:focus-visible {
  outline: none;
  background: var(--color-blue-100);
  color: var(--color-navy-900);
}

.account-identity-editor__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.account-identity-editor__fields label {
  display: grid;
  gap: 4px;
  color: var(--color-slate-700);
  font-size: 0.68rem;
  font-weight: 700;
}

.account-inline-editor input:focus,
.account-password-editor input:focus {
  border-color: var(--color-blue-600);
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / 12%);
}

.account-inline-editor input.is-valid,
.account-password-editor input.is-valid {
  border-color: rgb(24 117 84 / 42%);
}

.account-inline-editor input.is-invalid,
.account-password-editor input.is-invalid {
  border-color: rgb(198 61 79 / 52%);
  box-shadow: 0 0 0 3px rgb(198 61 79 / 8%);
}

.account-inline-editor__feedback {
  min-height: 18px;
  margin: 0;
  color: var(--color-slate-500);
  font-size: 0.7rem;
  font-weight: 650;
}

.account-inline-editor__feedback.is-checking {
  color: var(--color-blue-700);
}

.account-inline-editor__feedback.is-valid {
  color: var(--color-green-700);
}

.account-inline-editor__feedback.is-invalid {
  color: var(--color-red-600);
}

.account-inline-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.account-inline-editor__actions .button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.72rem;
}

.account-inline-editor.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.page-notification {
  margin: -6px 0 20px;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 650;
}

.page-notification.is-success {
  border: 1px solid rgb(24 117 84 / 20%);
  background: var(--color-green-100);
  color: var(--color-green-700);
}

.page-notification.is-error {
  border: 1px solid rgb(198 61 79 / 22%);
  background: rgb(198 61 79 / 8%);
  color: #9e2638;
}

.account-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
}

.account-status.is-positive {
  background: var(--color-green-100);
  color: var(--color-green-700);
}

.account-status.is-attention {
  background: var(--color-amber-100);
  color: var(--color-amber-700);
}

.account-password-action {
  width: 100%;
  margin-top: 20px;
}

.account-password-editor {
  display: grid;
  gap: 11px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--color-slate-200);
  border-radius: 10px;
  background: var(--color-page-tint);
  animation: account-editor-reveal 160ms ease-out;
}

.account-password-editor[hidden] {
  display: none;
}

.account-password-field {
  display: grid;
  gap: 5px;
}

.account-password-field label {
  color: var(--color-slate-700);
  font-size: 0.7rem;
  font-weight: 700;
}

.account-password-rule {
  margin: 0;
  color: var(--color-slate-500);
  font-size: 0.67rem;
  line-height: 1.45;
}

.account-password-editor.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

/*
 * Shared password wrapper. Its button is part of the field visually but stays
 * a real button for keyboard and assistive-technology users.
 */
.password-input {
  position: relative;
  width: 100%;
}

.password-input input {
  padding-right: 46px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-slate-500);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.password-visibility-toggle:hover {
  background: var(--color-blue-100);
  color: var(--color-blue-700);
}

.password-visibility-toggle:focus-visible {
  outline: 2px solid var(--color-blue-600);
  outline-offset: 1px;
}

.password-visibility-toggle__icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.password-visibility-toggle__icon--hide,
.password-visibility-toggle[aria-pressed="true"] .password-visibility-toggle__icon--show {
  display: none;
}

.password-visibility-toggle[aria-pressed="true"] .password-visibility-toggle__icon--hide {
  display: block;
}

.account-card--wide {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.account-card--wide > div > p:not(.section-kicker) {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--color-slate-600);
  font-size: 0.82rem;
}

.account-card--wide .button {
  flex: 0 0 auto;
}

.account-theme-card__content,
.account-theme-form {
  width: 100%;
}

.account-theme-form {
  margin-top: 18px;
}

.account-theme-form fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.theme-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.theme-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.theme-option__surface {
  display: grid;
  min-height: 82px;
  align-content: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--color-slate-200);
  border-radius: 10px;
  background: var(--color-white);
  color: var(--color-slate-700);
  font-size: 0.74rem;
  text-align: center;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.theme-option:hover .theme-option__surface {
  transform: translateY(-1px);
  border-color: var(--color-slate-300);
}

.theme-option input:checked + .theme-option__surface {
  border-color: var(--color-blue-600);
  box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / 12%);
  color: var(--color-navy-900);
}

.theme-option input:focus-visible + .theme-option__surface {
  outline: 3px solid rgb(var(--color-accent-rgb) / 28%);
  outline-offset: 2px;
}

.theme-option__swatches {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.8fr;
  width: min(88px, 100%);
  height: 24px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgb(15 35 55 / 8%);
}

.theme-option__swatches span:nth-child(1) {
  background: var(--theme-swatch-dark);
}

.theme-option__swatches span:nth-child(2) {
  background: var(--theme-swatch-accent);
}

.theme-option__swatches span:nth-child(3) {
  background: var(--theme-swatch-light);
}

.theme-option--default {
  --theme-swatch-dark: #102a43;
  --theme-swatch-accent: #0f7dbd;
  --theme-swatch-light: #dff2ff;
}

.theme-option--red {
  --theme-swatch-dark: #4a141d;
  --theme-swatch-accent: #c43b4f;
  --theme-swatch-light: #fde8eb;
}

.theme-option--green {
  --theme-swatch-dark: #0d3b2b;
  --theme-swatch-accent: #1b9367;
  --theme-swatch-light: #e1f7ed;
}

.theme-option--pink {
  --theme-swatch-dark: #8a275f;
  --theme-swatch-accent: #eb4fa0;
  --theme-swatch-light: #ffe1f0;
}

.theme-option--custom {
  --theme-custom-dark-color: #393078;
  --theme-custom-color: #6d5ce7;
  --theme-custom-light-color: #e4e1fb;
  --theme-swatch-dark: var(--theme-custom-dark-color);
  --theme-swatch-accent: var(--theme-custom-color);
  --theme-swatch-light: var(--theme-custom-light-color);
}

.account-custom-theme {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--color-slate-200);
  border-radius: 10px;
  background: var(--color-sky-50);
}

.account-custom-theme[hidden] {
  display: none;
}

.account-custom-theme__introduction strong,
.account-custom-theme label {
  color: var(--color-navy-900);
  font-size: 0.78rem;
  font-weight: 750;
}

.account-custom-theme__introduction p {
  margin: 3px 0 0;
  color: var(--color-slate-600);
  font-size: 0.72rem;
}

.account-custom-theme__palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-custom-theme__color {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-slate-200);
  border-radius: 9px;
  background: var(--color-white);
}

.account-custom-theme__color-heading {
  display: grid;
  gap: 1px;
}

.account-custom-theme__color-heading span {
  color: var(--color-slate-600);
  font-size: 0.67rem;
}

.account-custom-theme__controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-custom-theme__picker {
  width: 52px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--color-slate-300);
  border-radius: 8px;
  background: var(--color-white);
  cursor: pointer;
}

.account-custom-theme__hex {
  width: 100%;
  min-height: 42px;
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-theme-form__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 12px;
}

.account-theme-form__footer .account-inline-editor__feedback {
  flex: 1 1 auto;
  min-height: 0;
}

.account-theme-form.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

/* ========================================================================== 
   Login, placeholder pages, toast and footer
   ========================================================================== */
.login-page,
.standalone-page {
  padding-top: 0;
}

.login-page {
  --login-pointer-x: 50vw;
  --login-pointer-y: 38vh;
  --login-ambient-x: 0px;
  --login-ambient-y: 0px;
  --login-card-rotate-x: 0deg;
  --login-card-rotate-y: 0deg;

  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgb(var(--color-accent-rgb) / 17%), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgb(var(--color-navy-800-rgb) / 14%), transparent 32rem),
    var(--color-login-background);
  isolation: isolate;
}

/*
 * These two decorative layers sit behind the form and are driven by CSS
 * variables. The dedicated login script updates the variables, keeping all
 * visual styling here and all pointer orchestration in JavaScript.
 */
.login-page::before,
.login-page::after {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  content: "";
}

.login-page::before {
  inset: 0;
  background:
    radial-gradient(
      circle 190px at var(--login-pointer-x) var(--login-pointer-y),
      rgb(var(--color-accent-glow-rgb) / 23%),
      rgb(var(--color-accent-glow-rgb) / 8%) 48%,
      transparent 74%
    ),
    radial-gradient(
      circle 510px at var(--login-pointer-x) var(--login-pointer-y),
      rgb(var(--color-accent-rgb) / 10%),
      transparent 72%
    );
}

.login-page::after {
  inset: -18%;
  background:
    radial-gradient(circle at 26% 28%, rgb(255 255 255 / 44%), transparent 22rem),
    radial-gradient(circle at 74% 68%, rgb(var(--color-accent-shadow-rgb) / 9%), transparent 27rem);
  filter: blur(8px);
  opacity: 0.78;
  transform: translate3d(var(--login-ambient-x), var(--login-ambient-y), 0);
}

.login-page .login-shell,
.login-page .app-footer {
  position: relative;
  z-index: 1;
}

.login-shell {
  display: grid;
  width: min(calc(100% - 32px), 430px);
  min-height: calc(100vh - 54px);
  margin: 0 auto;
  padding: 46px 0;
  place-items: center;
}

.login-card {
  width: 100%;
  padding: 38px;
  border: 1px solid var(--color-slate-200);
  border-radius: 20px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 22px 60px rgb(15 35 55 / 12%);
}

/* Added only on fine-pointer devices by login-effects.js. The rotation is
   deliberately restrained so fields never feel as though they are moving. */
.login-page.is-pointer-enhanced .login-card {
  transform: perspective(1100px)
    rotateX(var(--login-card-rotate-x))
    rotateY(var(--login-card-rotate-y));
  transform-style: preserve-3d;
  will-change: transform;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: var(--color-navy-900);
}

.login-brand .brand__symbol {
  color: var(--color-white);
}

.login-brand strong {
  font-size: 1rem;
}

.login-card__heading h1 {
  margin: 0 0 26px;
  color: var(--color-navy-950);
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.form-alert {
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid rgb(198 61 79 / 24%);
  border-radius: 8px;
  background: rgb(198 61 79 / 8%);
  color: #9e2638;
  font-size: 0.78rem;
  font-weight: 650;
}

.form-alert[hidden] {
  display: none;
}

.login-form {
  display: grid;
  gap: 17px;
}

.login-form.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field label {
  color: var(--color-slate-700);
  font-size: 0.74rem;
  font-weight: 750;
}

.login-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-slate-300);
  border-radius: 9px;
  background: var(--color-white);
  font-size: 0.88rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.login-field .password-input input {
  padding-right: 46px;
}

.login-field input:focus {
  border-color: var(--color-blue-600);
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / 12%);
}

.login-form__submit {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
}

.login-form__password-reset {
  justify-self: center;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--color-slate-500);
  cursor: not-allowed;
  font-size: 0.74rem;
  font-weight: 650;
  opacity: 0.75;
}

.placeholder-card {
  position: relative;
  width: min(100%, 620px);
  padding: 54px;
  overflow: hidden;
  border: 1px solid var(--color-slate-200);
  border-radius: 20px;
  background: var(--color-white);
  box-shadow: var(--shadow-card);
}

.placeholder-card__index {
  position: absolute;
  top: -28px;
  right: 18px;
  color: var(--color-slate-100);
  font-size: 7rem;
  font-weight: 850;
  line-height: 1;
}

.placeholder-card h1 {
  position: relative;
  margin: 4px 0 12px;
  color: var(--color-navy-900);
  font-size: 2.4rem;
  letter-spacing: -0.04em;
}

.placeholder-card p:not(.eyebrow) {
  position: relative;
  max-width: 500px;
  margin: 0 0 24px;
  color: var(--color-slate-600);
}

.toast {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  display: flex;
  max-width: min(420px, calc(100% - 48px));
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 11px;
  background: var(--color-navy-900);
  box-shadow: 0 16px 44px rgb(9 28 43 / 24%);
  color: var(--color-white);
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: rgb(var(--color-accent-glow-rgb));
  box-shadow: 0 0 0 4px rgb(var(--color-accent-glow-rgb) / 12%);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 12px 24px;
  color: var(--color-slate-500);
  font-size: 0.72rem;
}

/* ========================================================================== 
   Responsive adaptations
   --------------------------------------------------------------------------
   The desktop table remains intentionally dense and familiar. When horizontal
   room becomes scarce, the Tiers table keeps only its three identity columns;
   the complete business detail remains available on wider screens.
   ========================================================================== */
@media (max-width: 1180px) {
  .field,
  .field--wide {
    grid-column: span 4;
  }

  .field--compact {
    grid-column: span 2;
  }

  .filter-form__actions {
    grid-column: span 6;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 126px;
  }

  .app-header__identity {
    height: 64px;
    padding: 0 18px;
  }

  .primary-navigation {
    height: 62px;
  }

  .primary-navigation__inner {
    padding: 0 14px;
  }

  .primary-navigation.is-collapsible .primary-navigation__scroll {
    left: 14px;
    width: min(360px, calc(100% - 28px));
  }

  .user-summary__details {
    display: none;
  }

  .user-summary__logout button {
    width: 34px;
    padding: 0;
  }

  /* The icon retains the button's accessible label while the visible text no
     longer consumes precious header space on narrow windows. */
  .user-summary__logout-label {
    display: none;
  }

  .page-shell {
    width: min(calc(100% - 28px), var(--page-max-width));
    padding-top: 24px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading__actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .field,
  .field--wide,
  .field--compact {
    grid-column: span 6;
  }

  .filter-form__actions {
    grid-column: span 12;
  }

  /* Société, Type and Nom are the stable identity of a tier. Hiding the
     explicitly marked secondary cells avoids a cramped horizontal table while
     preserving semantic table markup for both responsive presentations. */
  .tiers-table {
    min-width: 0;
    table-layout: fixed;
  }

  .tiers-table__wide-only {
    display: none;
  }

  .tiers-table th:nth-child(1) {
    width: 28%;
  }

  .tiers-table th:nth-child(2) {
    width: 27%;
  }

  .tiers-table th:nth-child(3) {
    width: 45%;
  }

  .company-label,
  .tier-name,
  .tier-contact {
    overflow-wrap: anywhere;
  }

  .type-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-card--wide {
    grid-column: auto;
  }

  .theme-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-function-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .brand__text small,
  .prototype-badge {
    display: none;
  }

  .primary-navigation__link {
    min-height: 38px;
    padding: 0 12px;
  }

  .tiers-table th,
  .tiers-table td {
    padding: 10px 8px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .page-heading__actions {
    width: 100%;
    align-items: stretch;
  }

  .page-heading__actions .button {
    width: 100%;
  }

  .filter-card__header,
  .data-card__header {
    align-items: flex-start;
    padding: 16px;
  }

  .filter-card__toggle {
    width: 38px;
    padding: 0;
  }

  .filter-card__toggle span {
    display: none;
  }

  .filter-form {
    padding: 16px;
  }

  .field,
  .field--wide,
  .field--compact {
    grid-column: span 12;
  }

  .filter-form__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .result-summary {
    text-align: right;
  }

  .placeholder-card {
    padding: 36px 26px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
  }

  .login-shell {
    padding: 20px 0;
  }

  .login-card {
    padding: 28px 24px;
  }

  .account-identity {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .account-access-badge {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .account-details > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .account-inline-editor {
    margin-left: 0;
  }

  .account-avatar-editor,
  .account-identity-editor__fields {
    grid-template-columns: 1fr;
  }

  .account-avatar-editor__actions {
    grid-column: auto;
  }

  .account-avatar-editor__source-row,
  .account-avatar-webcam__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-avatar-editor__webcam-button,
  .account-avatar-webcam__actions .button {
    width: 100%;
  }

  .account-card--wide {
    align-items: stretch;
    flex-direction: column;
  }

  .account-functions-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }

  .account-functions-dialog__surface {
    max-height: calc(100dvh - 16px);
  }

  .account-functions-dialog__header {
    gap: 12px;
    padding: 17px 16px 14px;
  }

  .account-functions-dialog__body {
    padding: 14px 12px;
  }

  .account-functions-dialog__footer {
    padding: 12px 16px;
  }

  .account-company-functions__header,
  .account-company-functions__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .account-company-functions__header > strong {
    align-self: flex-start;
  }

  .account-function-options {
    grid-template-columns: 1fr;
  }

  .account-theme-form__footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .account-theme-form__footer .button {
    width: 100%;
  }

  .account-custom-theme {
    gap: 10px;
  }

  .account-custom-theme__palette {
    grid-template-columns: 1fr;
  }
}

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