/* =====================================================================
   iLovePaghe admin — design tokens
   Neutral, quiet surfaces; ink for primary actions; the iLovePaghe blue
   is reserved for selection, focus, links and "live" signals.
   ===================================================================== */
:root{
  /* Safe-area insets, still referenced by inline styles of the section scripts. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  color-scheme: light;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale (14px UI base) */
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-28: 28px;
  --fs-36: 36px;
  --fs-48: 48px;
  --lh-tight: 1.2;
  --lh: 1.45;

  /* Neutrals */
  --bg: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-subtle: #f7f7f8;
  --bg-muted: #f0f0f1;
  --bg-active: #ececee;
  --bg-hover: rgba(13, 13, 13, .045);
  --bg-press: rgba(13, 13, 13, .075);
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-inset: #f7f7f8;
  --border: #e5e5e7;
  --border-strong: #d1d1d6;
  --divider: #efeff1;

  --text: #0d0d0d;
  --text-2: #5c5c62;
  /* #6e6e73: secondary text at ≥ 4.5:1 on white and on the sidebar grey (WCAG AA); was #8d8d93 (3.3:1). */
  --text-3: #6e6e73;
  --text-disabled: #b4b4b9;

  --inverse: #0d0d0d;
  --inverse-hover: #2a2a2c;
  --on-inverse: #ffffff;

  /* Brand */
  --brand: #1c6fe6;
  --brand-hover: #165cc4;
  --brand-text: #145cc6;
  --brand-soft: rgba(28, 111, 230, .08);
  --brand-soft-2: rgba(28, 111, 230, .14);
  --brand-line: rgba(28, 111, 230, .32);

  /* Status */
  --success: #0c8062; /* ≥ 4.5:1 on white for small status text; was #0e8a68 */
  --success-solid: #10a37f;
  --success-soft: rgba(16, 163, 127, .11);
  --warning: #a35a06;
  --warning-solid: #e08a12;
  --warning-soft: rgba(224, 138, 18, .13);
  --danger: #c8261b;
  --danger-solid: #e0382c;
  --danger-soft: rgba(224, 56, 44, .09);
  --info-soft: var(--brand-soft);

  /* Data colours (charts, avatars) — balanced for both themes */
  --data-1: #1c6fe6;
  --data-2: #10a37f;
  --data-3: #8a5cf5;
  --data-4: #e08a12;
  --data-5: #e0457b;
  --data-6: #0ea5b7;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(13, 13, 13, .05);
  --shadow-sm: 0 1px 2px rgba(13, 13, 13, .04), 0 2px 8px rgba(13, 13, 13, .04);
  --shadow-pop: 0 0 0 1px rgba(13, 13, 13, .06), 0 12px 32px rgba(13, 13, 13, .10), 0 2px 6px rgba(13, 13, 13, .05);
  --shadow-modal: 0 0 0 1px rgba(13, 13, 13, .06), 0 28px 80px rgba(13, 13, 13, .18), 0 6px 18px rgba(13, 13, 13, .06);
  --scrim: rgba(13, 13, 13, .38);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(28, 111, 230, .55);

  /* Shape */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 264px;
  --topbar-h: 56px;
  --page-max: 1320px;
  --page-pad-x: 40px;
  --page-pad-top: 32px;
  --ctl-h: 36px;
  --ctl-h-sm: 30px;
  --ctl-h-lg: 44px;
  --row-h: 56px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: .16s;
}

:root[data-theme="dark"]{
  color-scheme: dark;

  /* Near-black, as on openai.com: the page is OpenAI ink (#0d0d0d, the text colour of the light
     theme), the sidebar is black, cards rise by lightness and a hairline rather than by shadow. */
  --bg: #0d0d0d;
  --bg-sidebar: #000000;
  --bg-subtle: #171717;
  --bg-muted: #1c1c1c;
  --bg-active: #242424;
  --bg-hover: rgba(255, 255, 255, .05);
  --bg-press: rgba(255, 255, 255, .085);
  --surface: #161617;
  --surface-raised: #1c1c1e;
  --surface-inset: #0a0a0a;
  --border: #262628;
  --border-strong: #3a3a3d;
  --divider: #1f1f21;

  --text: #ececec;
  --text-2: #b2b2b6;
  --text-3: #8a8a8f;
  --text-disabled: #5e5e63;

  --inverse: #ececec;
  --inverse-hover: #ffffff;
  --on-inverse: #0d0d0d;

  --brand: #3d87f5;
  --brand-hover: #5a99f7;
  --brand-text: #82b2ff;
  --brand-soft: rgba(61, 135, 245, .15);
  --brand-soft-2: rgba(61, 135, 245, .24);
  --brand-line: rgba(130, 178, 255, .42);

  --success: #3ccf9f;
  --success-solid: #19b087;
  --success-soft: rgba(25, 176, 135, .16);
  --warning: #f2b25c;
  --warning-solid: #e5962a;
  --warning-soft: rgba(229, 150, 42, .17);
  --danger: #ff8379;
  --danger-solid: #ef4d40;
  --danger-soft: rgba(239, 77, 64, .16);

  --data-1: #4f93f6;
  --data-2: #25c193;
  --data-3: #a17cf8;
  --data-4: #f0a23c;
  --data-5: #f0679a;
  --data-6: #35c3d3;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .08), 0 16px 40px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .5);
  --shadow-modal: 0 0 0 1px rgba(255, 255, 255, .09), 0 28px 80px rgba(0, 0, 0, .8);
  --scrim: rgba(0, 0, 0, .66);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(98, 156, 248, .7);
}

@media (max-width: 1100px){
  :root{ --page-pad-x: 28px; --page-pad-top: 24px; }
}
@media (max-width: 860px){
  :root{ --page-pad-x: 16px; --page-pad-top: 16px; --row-h: 52px; }
}
/* ===================== Base ===================== */
*,
*::before,
*::after{ box-sizing: border-box; }

html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  height: 100%;
}

body{
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh);
  font-weight: 400;
  letter-spacing: -.003em;
  font-feature-settings: "ss01" 0, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:root.ilpThemeSwitching *,
:root.ilpThemeSwitching *::before,
:root.ilpThemeSwitching *::after{
  transition: background-color .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease), fill .22s var(--ease), stroke .22s var(--ease) !important;
}

h1, h2, h3, h4, h5, h6{ margin: 0; font-weight: 600; letter-spacing: -.012em; line-height: var(--lh-tight); color: var(--text); }
p{ margin: 0; }
a{ color: var(--brand-text); text-decoration: none; }
a:hover{ text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
img, svg{ vertical-align: middle; }
b, strong{ font-weight: 600; }
small{ font-size: var(--fs-12); }
code, kbd, samp{ font-family: var(--font-mono); font-size: .92em; }
hr{ border: 0; border-top: 1px solid var(--divider); margin: 16px 0; }

button, input, select, textarea{
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button{ cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled{ cursor: not-allowed; }
input, select, textarea{ background: transparent; }
table{ border-collapse: collapse; border-spacing: 0; }
[hidden]{ display: none !important; }

::selection{ background: var(--brand-soft-2); }

:focus{ outline: none; }
:focus-visible{ outline: none; box-shadow: var(--focus-ring); }
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible{ border-radius: var(--r-sm); }

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

/* Scrollbars */
*{ scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-thumb{ background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover{ background-color: var(--text-3); }
::-webkit-scrollbar-track{ background: transparent; }

.num, .tabular{ font-variant-numeric: tabular-nums; }
.mono{ font-family: var(--font-mono); font-size: .94em; letter-spacing: 0; }

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

/* ---------- Buttons ---------- */
.uiBtn{
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: transparent;
  --btn-bg-hover: var(--bg-hover);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ctl-h);
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-14);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.uiBtn:hover{ background: var(--btn-bg-hover); text-decoration: none; }
.uiBtn:active{ filter: brightness(.97); }
.uiBtn:disabled,
.uiBtn[aria-disabled="true"]{ opacity: .45; pointer-events: none; }
.uiBtn svg{ width: 16px; height: 16px; flex: 0 0 auto; }
.uiBtn--primary{ --btn-bg: var(--inverse); --btn-fg: var(--on-inverse); --btn-bg-hover: var(--inverse-hover); }
.uiBtn--brand{ --btn-bg: var(--brand); --btn-fg: #fff; --btn-bg-hover: var(--brand-hover); }
.uiBtn--secondary{ --btn-bg: var(--surface); --btn-bd: var(--border); --btn-bg-hover: var(--bg-subtle); }
.uiBtn--ghost{ --btn-bg: transparent; --btn-bg-hover: var(--bg-hover); }
.uiBtn--danger{ --btn-bg: var(--surface); --btn-fg: var(--danger); --btn-bd: var(--border); --btn-bg-hover: var(--danger-soft); }
.uiBtn--dangerSolid{ --btn-bg: var(--danger-solid); --btn-fg: #fff; --btn-bg-hover: var(--danger); }
.uiBtn--sm{ height: var(--ctl-h-sm); padding: 0 12px; font-size: var(--fs-13); gap: 6px; }
.uiBtn--lg{ height: var(--ctl-h-lg); padding: 0 20px; font-size: var(--fs-15); }
.uiBtn--icon{ width: var(--ctl-h); padding: 0; }
.uiBtn--icon.uiBtn--sm{ width: var(--ctl-h-sm); }
.uiBtn--block{ width: 100%; }

/* ---------- Text inputs ---------- */
.uiInput,
.uiSelect,
.uiTextarea{
  width: 100%;
  min-height: var(--ctl-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.uiTextarea{ padding: 10px 12px; line-height: 1.5; resize: vertical; }
.uiInput::placeholder,
.uiTextarea::placeholder{ color: var(--text-3); }
.uiInput:hover,
.uiSelect:hover,
.uiTextarea:hover{ border-color: var(--border-strong); }
.uiInput:focus,
.uiSelect:focus,
.uiTextarea:focus{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); outline: none; }
.uiInput:disabled,
.uiSelect:disabled,
.uiTextarea:disabled{ background: var(--bg-subtle); color: var(--text-3); cursor: not-allowed; }

.uiSearch{
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.uiSearch > svg{
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

/* ---------- Native controls theming ---------- */
input[type="checkbox"],
input[type="radio"]{ accent-color: var(--brand); }
input[type="month"],
input[type="date"],
input[type="time"]{ color-scheme: inherit; }
/* With the dark color-scheme Chromium already draws a light calendar icon; inverting it again
   made the icon almost invisible on dark fields, so no filter here. */
select{ color-scheme: inherit; }

/* ---------- Checkbox (table selection) ---------- */
.uiCheck{
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-grid;
  place-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color .12s var(--ease), border-color .12s var(--ease);
}
.uiCheck:hover{ border-color: var(--text-3); }
.uiCheck:checked,
.uiCheck:indeterminate{ background: var(--brand); border-color: var(--brand); }
.uiCheck::after{
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .12s var(--ease);
}
.uiCheck:checked::after{ transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.uiCheck:indeterminate::after{ width: 8px; height: 0; border-left: 0; border-bottom: 2px solid #fff; transform: none; }
.uiCheck:focus-visible{ box-shadow: var(--focus-ring); }

/* ---------- Switch (shared .ilpSwitch markup) ---------- */
.ilpSwitch{
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 22px;
  cursor: pointer;
  vertical-align: middle;
}
.ilpSwitch input{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
  z-index: 1;
}
.ilpSwitchTrack{
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background-color .18s var(--ease);
}
.ilpSwitchTrack::after{
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .2s var(--ease-out);
}
.ilpSwitch input:checked + .ilpSwitchTrack{ background: var(--success-solid); }
.ilpSwitch input:checked + .ilpSwitchTrack::after{ transform: translateX(14px); }
.ilpSwitch input:focus-visible + .ilpSwitchTrack{ box-shadow: var(--focus-ring); }
.ilpSwitch input:disabled{ cursor: not-allowed; }
.ilpSwitch input:disabled + .ilpSwitchTrack{ opacity: .45; }
.ilpSwitch:hover input:not(:disabled):not(:checked) + .ilpSwitchTrack{ background: var(--text-3); }
.ilpSwitch--lg{ width: 40px; height: 24px; }
.ilpSwitch--lg .ilpSwitchTrack::after{ width: 18px; height: 18px; }
.ilpSwitch--lg input:checked + .ilpSwitchTrack::after{ transform: translateX(16px); }
:root[data-theme="dark"] .ilpSwitchTrack{ background: #3e3e42; }
:root[data-theme="dark"] .ilpSwitch input:checked + .ilpSwitchTrack{ background: var(--success-solid); }

/* ---------- Badges / status pills ---------- */
.uiBadge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.uiBadge::before{ content: none; }
.uiBadge--dot::before{ content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.uiBadge--brand{ background: var(--brand-soft); color: var(--brand-text); }
.uiBadge--success{ background: var(--success-soft); color: var(--success); }
.uiBadge--warning{ background: var(--warning-soft); color: var(--warning); }
.uiBadge--danger{ background: var(--danger-soft); color: var(--danger); }

/* ---------- Segmented control ---------- */
.uiSegmented{
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--bg-muted);
}
.uiSegmented button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.uiSegmented button:hover{ color: var(--text); }
.uiSegmented button[aria-pressed="true"],
.uiSegmented button[aria-selected="true"]{
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--border);
}
:root[data-theme="dark"] .uiSegmented button[aria-pressed="true"],
:root[data-theme="dark"] .uiSegmented button[aria-selected="true"]{ background: var(--bg-active); box-shadow: none; }
.uiSegmented svg{ width: 15px; height: 15px; }

/* ---------- Avatar ---------- */
.uiAvatar{
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: .01em;
  overflow: hidden;
}

/* ---------- Kbd ---------- */
.uiKbd{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

/* ---------- Spinner ---------- */
@keyframes uiSpin{ to{ transform: rotate(360deg); } }
.uiSpinner,
.pageLoadSpinner,
.pdfLoadingSpinner{
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  animation: uiSpin .7s linear infinite;
}

/* ---------- Skeleton ---------- */
@keyframes uiShimmer{ 0%{ background-position: -240px 0; } 100%{ background-position: 240px 0; } }
.uiSkeleton{
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-muted) 0, var(--bg-subtle) 60px, var(--bg-muted) 120px) var(--bg-muted);
  background-size: 480px 100%;
  animation: uiShimmer 1.3s linear infinite;
}

/* ---------- Empty state ---------- */
.uiEmpty{
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-2);
}
.uiEmpty strong{ color: var(--text); font-size: var(--fs-15); font-weight: 600; }
.uiEmpty p{ max-width: 46ch; font-size: var(--fs-13); }

/* ---------- Notices (inline) ---------- */
.uiNotice{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-13);
}
.uiNotice--warn{ background: var(--warning-soft); color: var(--warning); }
.uiNotice--error{ background: var(--danger-soft); color: var(--danger); }
.uiNotice--ok{ background: var(--success-soft); color: var(--success); }

/* ---------- Popover / menu ---------- */
.uiPopover{
  position: fixed;
  z-index: 1200;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(440px, calc(100vh - 32px));
  overflow: auto;
  padding: 6px;
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  transform-origin: top left;
  animation: uiPopIn .14s var(--ease-out);
}
@keyframes uiPopIn{ from{ opacity: 0; transform: translateY(-4px) scale(.98); } to{ opacity: 1; transform: none; } }
.uiMenuLabel{
  padding: 8px 10px 4px;
  color: var(--text-3);
  font-size: var(--fs-12);
  font-weight: 500;
}
.uiMenuItem{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-14);
  text-align: left;
  text-decoration: none;
}
.uiMenuItem:hover,
.uiMenuItem[data-active="true"]{ background: var(--bg-hover); text-decoration: none; }
.uiMenuItem svg{ width: 16px; height: 16px; color: var(--text-2); flex: 0 0 auto; }
.uiMenuItem .uiMenuMeta{ margin-left: auto; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.uiMenuItem--danger{ color: var(--danger); }
.uiMenuItem--danger svg{ color: currentColor; }
.uiMenuSep{ height: 1px; margin: 6px 4px; background: var(--divider); }
.uiMenuCheck{
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-14);
}
.uiMenuCheck:hover{ background: var(--bg-hover); }
.uiMenuCheck .uiMenuMeta{ margin-left: auto; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
.uiToastHost{
  position: fixed;
  z-index: 3000;
  left: 50%;
  bottom: 24px;
  display: grid;
  gap: 8px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.uiToast{
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-14);
  font-weight: 500;
  pointer-events: auto;
  animation: uiToastIn .22s var(--ease-out);
}
.uiToast[data-leaving]{ animation: uiToastOut .18s var(--ease) forwards; }
@keyframes uiToastIn{ from{ opacity: 0; transform: translateY(8px); } to{ opacity: 1; transform: none; } }
@keyframes uiToastOut{ to{ opacity: 0; transform: translateY(6px); } }

/* ---------- Tooltip (title replacement for icon buttons) ---------- */
.uiTip{
  position: fixed;
  z-index: 3100;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--inverse);
  color: var(--on-inverse);
  font-size: var(--fs-12);
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
}
/* ===================== App shell ===================== */
html, body{ height: 100%; }
body{ overflow: hidden; }

#adminShellRoot{ display: contents; }

.pageShell{
  position: relative;
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background: var(--bg);
}

/* Content column: every section scrolls inside its own view so the sidebar stays put. */
#adminContentRoot{
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
#adminContentRoot > main,
#adminContentRoot > section,
#adminContentRoot > div[id$="View"],
#adminContentRoot > [data-ilp-view]{
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 16px;
}

/* ---------- Sidebar ---------- */
.sideNav{
  position: relative;
  z-index: 40;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 12px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--divider);
  overflow: hidden;
}
:root[data-theme="dark"] .sideNav{ border-right-color: transparent; }

.sideTop{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 40px;
  padding: 0 6px 0 8px;
}
.sideBrand{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: var(--fs-15);
  font-weight: 600;
  letter-spacing: -.015em;
  text-decoration: none;
}
.sideBrand:hover{ text-decoration: none; }
.sideBrand img{ width: 26px; height: 26px; border-radius: 7px; }
.sideBrand span b{ font-weight: 600; color: var(--brand-text); }

/* Company switcher row */
.sideCompanyPanel{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 6px 0 2px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}
:root[data-theme="dark"] .sideCompanyPanel{ background: var(--bg-subtle); border-color: var(--divider); }
.sideCompanyPanel[data-switchable="true"]{ cursor: pointer; }
.sideCompanyPanel[data-switchable="true"]:hover{ background: var(--bg-subtle); }
.sideCompanyAvatar,
.sideCompanyIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.sideCompanyText{ min-width: 0; flex: 1 1 auto; display: grid; gap: 1px; }
.sideCompanyName{
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sideAccountEmail{
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-12);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sideCompanyChevron{ width: 16px; height: 16px; color: var(--text-3); flex: 0 0 auto; }

/* Search / command trigger */
.sideSearch{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  margin: 6px 0 4px;
  padding: 0 8px 0 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-14);
  text-align: left;
}
.sideSearch:hover{ background: var(--bg-hover); color: var(--text); }
.sideSearch svg{ width: 18px; height: 18px; flex: 0 0 auto; }
.sideSearch .uiKbd{ margin-left: auto; }

/* Menu */
.sideMenu{
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px 8px;
}
.sideGroupLabel{
  margin: 14px 0 4px;
  padding: 0 10px;
  color: var(--text-3);
  font-size: var(--fs-12);
  font-weight: 500;
}
.navItem{
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-14);
  font-weight: 450;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.navItem:hover{ background: var(--bg-hover); color: var(--text); text-decoration: none; }
.navItem .navIcon{ width: 18px; height: 18px; flex: 0 0 auto; color: var(--text-3); transition: color var(--dur) var(--ease); }
.navItem:hover .navIcon{ color: var(--text-2); }
.navItem .navLabel{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navItem .navBadge{
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.navItem.navItemActive,
.navItem[aria-current="page"]{
  background: var(--bg-active);
  color: var(--text);
  font-weight: 550;
}
.navItem.navItemActive .navIcon,
.navItem[aria-current="page"] .navIcon{ color: var(--brand); }
.navItem .navExternal{ width: 14px; height: 14px; margin-left: auto; color: var(--text-3); opacity: 0; transition: opacity var(--dur) var(--ease); }
.navItem:hover .navExternal{ opacity: 1; }

.sideSpacer{ flex: 1 1 auto; min-height: 8px; }

/* Footer: theme + account */
.sideFooter{
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}
.sideThemeRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 4px 10px;
}
.sideThemeRow > span{ color: var(--text-2); font-size: var(--fs-13); }
.sideThemeRow .uiSegmented button{ width: 32px; height: 26px; padding: 0; }

.sideAccountBtn{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  text-align: left;
}
.sideAccountBtn:hover,
.sideAccountBtn[aria-expanded="true"]{ background: var(--bg-hover); }
.sideAccountBtn .uiAvatar{ width: 28px; height: 28px; font-size: 11px; background: var(--bg-active); color: var(--text); }
.sideAccountMeta{ display: grid; min-width: 0; flex: 1 1 auto; }
.sideAccountMeta b{ overflow: hidden; color: var(--text); font-size: var(--fs-13); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.sideAccountMeta span{ overflow: hidden; color: var(--text-3); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.sideAccountBtn > svg{ width: 16px; height: 16px; color: var(--text-3); flex: 0 0 auto; }

.sideBack{
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-13);
  text-decoration: none;
}
.sideBack:hover{ background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sideBack .navIcon{ width: 16px; height: 16px; color: var(--text-3); }

/* ---------- Mobile top bar ---------- */
.adminTopbar{ display: none; }

@media (max-width: 960px){
  /* The top bar is a sibling of the shell: reserve its height inside the viewport. */
  .pageShell{
    flex-direction: column;
    height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
    height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  }
  .adminTopbar{
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 8px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
  }
  .adminTopbarTitle{
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: var(--fs-16);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .adminTopbarBtn{
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    color: var(--text);
  }
  .adminTopbarBtn:hover{ background: var(--bg-hover); }
  .adminTopbarBtn svg{ width: 20px; height: 20px; }

  .sideNav{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-right: 1px solid var(--divider);
    box-shadow: var(--shadow-modal);
    transform: translateX(-104%);
    transition: transform .26s var(--ease-out), visibility 0s linear .26s;
    visibility: hidden;
  }
  body.ilpSideOpen .sideNav{
    transform: none;
    visibility: visible;
    transition: transform .26s var(--ease-out), visibility 0s;
  }
  body::after{
    content: "";
    position: fixed;
    inset: 0;
    z-index: 35;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s var(--ease);
  }
  body.ilpSideOpen::after{ opacity: 1; pointer-events: auto; }
  #adminContentRoot{ flex: 1 1 auto; }
}

/* ---------- Page header (inside each view) ---------- */
.uiPage{
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--page-pad-top) var(--page-pad-x) 64px;
}
.uiPageHead{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.uiPageHead h1,
.paTitle{
  margin: 0;
  color: var(--text);
  font-size: var(--fs-28);
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.15;
}
.uiPageSub{
  margin-top: 6px;
  color: var(--text-2);
  font-size: var(--fs-14);
}
.uiPageActions{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.paEyebrow{ display: none !important; }

/* ---------- Full-page loader ---------- */
.pageLoadOverlay{
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity .22s var(--ease), visibility 0s linear .22s;
}
.pageLoadOverlay[aria-hidden="true"],
.pageLoadOverlay.isHidden{ opacity: 0; visibility: hidden; pointer-events: none; }
.pageLoadOverlay .pageLoadSpinner{ width: 26px; height: 26px; }
.pageLoadOverlay::before{
  content: "";
  position: absolute;
  top: calc(50% - 64px);
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 9px;
  background: url("/logoilovepquadrataagheblu.png") center / cover no-repeat;
  opacity: .95;
}
.adminLoadError{
  position: relative;
  width: min(420px, calc(100vw - 40px));
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-modal);
}
.adminLoadError h2{ font-size: var(--fs-18); margin-bottom: 8px; }
.adminLoadError p{ color: var(--text-2); margin-bottom: 18px; }
.adminLoadError button{
  display: inline-flex;
  align-items: center;
  height: var(--ctl-h);
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  font-weight: 500;
}

/* Section switch loader: a thin progress line, never a blocking veil. */
.sectionLoadOverlay{
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  z-index: 60;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.sectionLoadOverlay[aria-hidden="false"],
.sectionLoadOverlay.isOn{ opacity: 1; }
.sectionLoadOverlay .pageLoadSpinner{
  width: 40%;
  height: 2px;
  border: 0;
  border-radius: 0;
  background: var(--brand);
  animation: uiLoadBar 1s var(--ease) infinite;
}
@keyframes uiLoadBar{ from{ transform: translateX(-100%); } to{ transform: translateX(260%); } }
@media (max-width: 960px){ .sectionLoadOverlay{ left: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); } }
/* ===================== Data tables ===================== */

/* Frame: one quiet bordered surface; the header stays visible while scrolling. */
.uiTableFrame,
.empTableFrame,
.timeTableFrame,
.paTableFrame{
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
/* Continue the sticky heading through the scrollbar gutter, inside the rounded frame. */
:is(.empTableFrame, .timeTableFrame, .paTableFrame)::before{
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 40px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  pointer-events: none;
}
:root[data-theme="dark"] :is(.empTableFrame, .timeTableFrame, .paTableFrame)::before{ background: #1b1b1c; }
.uiTableScroll,
.empScroller{
  position: relative;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: auto;
}

/* Modal tables scroll inside their frame: paint the heading behind native scrollbar gutters.
   A scroll-attached background stays at the top without covering cells or pointer targets. */
:where(.empDocTableWrap, .docsTableWrap, .comResultsWrap, .crsTableWrap .uiTableScroll){
  --modal-table-head-height: 38px;
  --modal-table-head-bg: var(--bg-subtle);
  background-image: linear-gradient(to bottom, var(--modal-table-head-bg) calc(var(--modal-table-head-height) - 1px), var(--border) 0);
  background-size: 100% var(--modal-table-head-height);
  background-position: left top;
  background-repeat: no-repeat;
  background-attachment: scroll;
}
.empDocTableWrap:has(.timeDayTable){ --modal-table-head-height: 70px; }
.comResultsWrap{ --modal-table-head-height: 36px; }
.crsTableWrap .uiTableScroll{ --modal-table-head-height: 40px; }
:root[data-theme="dark"] :is(.empDocTableWrap, .docsTableWrap){ --modal-table-head-bg: #1d1d1f; }
:root[data-theme="dark"] .crsTableWrap .uiTableScroll{ --modal-table-head-bg: #1b1b1c; }

/* A finite flex area lets the list scroll instead of swallowing page wheel gestures. */
:is(#employeesView, #timbratureView, #absencesView) > .uiPage{
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
:is(#employeesView, #timbratureView, #absencesView) > .uiPage > *{ flex-shrink: 0; }
:is(#employeesView, #timbratureView, #absencesView) :is(.empTableFrame, .timeTableFrame, .paTableFrame){
  display: flex;
  flex-direction: column;
  flex: 1 0 220px;
  min-height: 220px;
  min-width: 0;
}
:is(.empTableFrame, .timeTableFrame, .paTableFrame) > .empScroller{
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  scrollbar-gutter: stable;
}

.uiTable,
.payrollMatchTable{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: var(--fs-14);
}
.uiTable thead th,
.payrollMatchTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}
:root[data-theme="dark"] .uiTable thead th,
:root[data-theme="dark"] .payrollMatchTable thead th{ background: #1b1b1c; }
.uiTable tbody td,
.payrollMatchTable tbody td{
  height: var(--row-h);
  padding: 8px 16px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  vertical-align: middle;
}
.uiTable tbody tr:last-child td,
.payrollMatchTable tbody tr:last-child td{ border-bottom: 0; }
.uiTable tbody tr,
.payrollMatchTable tbody tr{ transition: background-color .1s var(--ease); }
.uiTable tbody tr:hover td,
.payrollMatchTable tbody tr:hover td{ background: var(--bg-subtle); }
:root[data-theme="dark"] .uiTable tbody tr:hover td,
:root[data-theme="dark"] .payrollMatchTable tbody tr:hover td{ background: rgba(255, 255, 255, .03); }
.uiTable tbody tr[data-ui-selected="true"] td,
.payrollMatchTable tbody tr[data-ui-selected="true"] td{ background: var(--brand-soft); }
/* Continue row backgrounds through the transparent native scrollbar track.
   Outer shadows paint no hit targets and do not add horizontal scroll space. */
:where(.uiTable, .payrollMatchTable, .empDocTable, .docsTable) > tbody > tr{
  --ui-row-edge: transparent;
  box-shadow: 32px 0 0 var(--ui-row-edge);
}
.uiTable tbody tr:hover,
.payrollMatchTable tbody tr:hover,
.empDocTable tbody tr:hover,
.docsTable tbody tr:hover{ --ui-row-edge: var(--bg-subtle); }
:root[data-theme="dark"] .uiTable tbody tr:hover,
:root[data-theme="dark"] .payrollMatchTable tbody tr:hover{ --ui-row-edge: rgba(255, 255, 255, .03); }
.uiTable tbody tr[data-ui-selected="true"],
.payrollMatchTable tbody tr[data-ui-selected="true"]{ --ui-row-edge: var(--brand-soft); }
.empDocRow.isActive{ --ui-row-edge: var(--brand-soft) !important; }
.timeDayTable tr.timeDayWeekend{ --ui-row-edge: var(--surface-inset); }
.timeDayTable tr.timeDayRowError{ --ui-row-edge: var(--warning-soft); }
.crsRow.isChecked,
.crsRow:has(.crsRowCheck:checked){ --ui-row-edge: var(--brand-soft); }

/* Keep the whole sticky heading above row shadows, including its gutter.
   A group shadow also works when the last column is hidden or a cell spans two rows. */
:where(.uiTable, .payrollMatchTable, .empDocTable, .docsTable) > thead{
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: 32px 0 0 var(--ui-table-head-bg, var(--bg-subtle));
}
:root[data-theme="dark"] :where(.uiTable, .payrollMatchTable){ --ui-table-head-bg: #1b1b1c; }
:root[data-theme="dark"] :where(.empDocTable, .docsTable){ --ui-table-head-bg: #1d1d1f; }

.uiTable tbody tr:focus-visible,
.payrollMatchTable tbody tr:focus-visible{ outline: 2px solid var(--brand-line); outline-offset: -2px; box-shadow: none; }

/* Selection column (added by the table toolkit) */
.uiSelCell{
  width: 48px;
  min-width: 48px;
  padding: 0 0 0 16px !important;
  text-align: left;
}
thead .uiSelCell{ z-index: 3; }

/* Sortable headers */
th[data-ui-sort]{
  cursor: pointer;
  user-select: none;
}
th[data-ui-sort]:hover{ color: var(--text); }
th[data-ui-sort] .uiSortIcon{
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  vertical-align: -1px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity .12s var(--ease), transform .12s var(--ease);
}
th[data-ui-sort]:hover .uiSortIcon{ opacity: .7; }
th[aria-sort="ascending"] .uiSortIcon,
th[aria-sort="descending"] .uiSortIcon{ opacity: 1; color: var(--text); }
th[aria-sort="descending"] .uiSortIcon{ transform: rotate(180deg); }

/* Column visibility (toolkit) */
[data-ui-col-hidden="true"]{ display: none !important; }

/* Density */
[data-ui-density="compact"]{ --row-h: 44px; }
[data-ui-density="compact"] tbody td{ padding-top: 4px !important; padding-bottom: 4px !important; }
[data-ui-density="compact"] .nameIcon{ width: 26px !important; height: 26px !important; font-size: 10px !important; }

/* Rows hidden by toolkit filters */
tr[data-ui-filtered="true"]{ display: none !important; }

/* Empty / no-results row */
.uiNoResults td{
  height: auto !important;
  padding: 48px 16px !important;
  color: var(--text-2);
  text-align: center;
}
.uiNoResults strong{ display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }
.uiNoResults button{ margin-top: 12px; }

/* ---------- Toolbar ---------- */
.uiToolbar{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 52px;
  margin-bottom: 12px;
}
.uiToolbar .uiSearch{ flex: 1 1 260px; max-width: 360px; }
.uiToolbarSpacer{ flex: 1 1 auto; }
.uiToolbar .uiSearchInput,
.uiSearchInput{
  width: 100%;
  height: var(--ctl-h);
  padding: 0 34px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.uiSearchInput::placeholder{ color: var(--text-3); }
.uiSearchInput:hover{ border-color: var(--border-strong); }
.uiSearchInput:focus{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.uiSearchInput::-webkit-search-cancel-button{ display: none; }

.uiFilterBtn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl-h);
  padding: 0 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.uiFilterBtn:hover{ background: var(--bg-hover); color: var(--text); }
.uiFilterBtn svg{ width: 14px; height: 14px; }
.uiFilterBtn[data-active="true"]{
  border-style: solid;
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-text);
}
.uiFilterBtn .uiFilterValue{ color: var(--text); font-weight: 550; }
.uiFilterBtn[data-active="true"] .uiFilterValue{ color: inherit; }
.uiFilterBtn .uiFilterSep{ width: 1px; height: 14px; background: currentColor; opacity: .3; }

.uiToolbarMeta{
  color: var(--text-3);
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Bulk action bar: floats above the table when rows are selected. */
.uiBulkBar{
  position: sticky;
  bottom: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 16px auto 0;
  padding: 6px 6px 6px 16px;
  border-radius: var(--r-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  box-shadow: var(--shadow-pop);
  animation: uiBulkIn .2s var(--ease-out);
}
@keyframes uiBulkIn{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: none; } }
.uiBulkBar .uiBulkCount{ margin-right: 6px; font-size: var(--fs-14); font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uiBulkBar .uiBulkSep{ width: 1px; height: 20px; margin: 0 4px; background: currentColor; opacity: .2; }
.uiBulkBar button{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  color: inherit;
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.uiBulkBar button:hover{ background: rgba(255, 255, 255, .14); }
:root[data-theme="dark"] .uiBulkBar button:hover{ background: rgba(0, 0, 0, .08); }
.uiBulkBar button svg{ width: 15px; height: 15px; }
.uiBulkBar button:disabled{ opacity: .45; }
.uiBulkBar .uiBulkClose{ width: 32px; padding: 0; justify-content: center; }
@media (max-width: 720px){
  /* Leave room for the support launcher so it cannot cover selection actions. */
  .uiBulkBar{ bottom: calc(80px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; border-radius: var(--r-xl); width: auto; margin-left: 0; margin-right: 0; max-width: 100%; }
}

/* Footer below the table */
.uiTableFoot{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: var(--fs-12);
}

/* Shared cell pieces */
.cfCell,
.uiMonoCell{
  font-family: var(--font-mono);
  font-size: 12.5px !important;
  color: var(--text-2) !important;
  letter-spacing: .01em;
  white-space: nowrap;
}
.nameWrap{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.nameIcon{
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 auto;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%) !important;
  color: #fff !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  letter-spacing: .02em;
  overflow: hidden;
  box-shadow: none !important;
}
.nameIcon svg{ display: none; }
.nameIcon::after{ content: attr(data-init); }
.nameText{
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small screens: keep the columns that identify the row and its main status. */
@media (max-width: 720px){
  .empTable{ min-width: 0; }
  .empTable tr > :nth-child(2),
  .empTable tr > :nth-child(3),
  .empTable tr > :nth-child(5),
  .empTable col.colCF, .empTable col.colSent, .empTable col.colLastSent{ display: none; }
  .timeTable{ min-width: 0; }
  .timeTable tr > :nth-child(2),
  .timeTable tr > :nth-child(4),
  .timeTable tr > :nth-child(6),
  .timeTable col.colCF, .timeTable col.colGps, .timeTable col.colErrors{ display: none; }
  .timeLastAddress{ display: none; }
  .paMatchTable{ min-width: 0; }
  .paMatchTable tr > :nth-child(3),
  .paMatchTable col.colKind{ display: none; }
  .actionsBtn span{ display: none; }
  .actionsBtn{ padding: 0 6px; }
  .payrollMatchTable tbody td{ padding-left: 10px; padding-right: 10px; }
  .payrollMatchTable thead th{ padding-left: 10px; padding-right: 10px; }
  tr.empEmptyRow > td{ display: table-cell !important; }
}
@media (max-width: 520px){
  /* The email stays editable from the employee sheet. */
  .empTable tr > :nth-child(4),
  .empTable col.colEmail{ display: none; }
  /* Clocking mode stays available through the Modalità filter and the detail sheet. */
  .timeTable tr > :nth-child(3),
  .timeTable col.colStatus{ display: none; }
}

/* Mobile absence rows use cards; keep their enclosing header sticky too. */
@media (max-width: 560px){
  .paMatchTable thead{ position: sticky; top: 0; z-index: 3; }
  /* Card rows paint their state on the row instead of the cells. */
  #paTableBody tr[data-pa-id]:hover{ --ui-row-edge: var(--bg-subtle); }
  #paTableBody tr[data-pa-id][data-ui-selected="true"]{ --ui-row-edge: var(--brand-soft); }
}
/* ===================== Overlays, dialogs, sheets ===================== */

/* Shared scrim for every overlay family that toggles aria-hidden. */
.empModalOverlay,
.hrGateOverlay,
#manualEmployeeOverlay,
#timeSettingsOverlay,
#timeQrOverlay,
#docsDetailOverlay,
#docsUploadOverlay,
#docsUploadPreviewOverlay,
#docsUploadProgressOverlay,
#docsUploadWarnOverlay,
#coursesDetailOverlay{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.empModalOverlay[aria-hidden="false"],
.hrGateOverlay[aria-hidden="false"],
#manualEmployeeOverlay[aria-hidden="false"],
#timeSettingsOverlay[aria-hidden="false"],
#timeQrOverlay[aria-hidden="false"],
#docsDetailOverlay[aria-hidden="false"],
#docsUploadOverlay[aria-hidden="false"],
#docsUploadPreviewOverlay[aria-hidden="false"],
#docsUploadProgressOverlay[aria-hidden="false"],
#docsUploadWarnOverlay[aria-hidden="false"],
#coursesDetailOverlay[aria-hidden="false"]{
  display: flex;
  animation: uiFadeIn .16s var(--ease);
}
@keyframes uiFadeIn{ from{ opacity: 0; } to{ opacity: 1; } }
@keyframes uiDialogIn{ from{ opacity: 0; transform: translateY(8px) scale(.985); } to{ opacity: 1; transform: none; } }
@keyframes uiSheetIn{ from{ transform: translateX(28px); opacity: 0; } to{ transform: none; opacity: 1; } }

/* Dialog surface */
.uiDialog,
.empModal,
.hrGateCard,
.comDialog{
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(860px, calc(100dvh - 48px));
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: uiDialogIn .2s var(--ease-out);
}

.uiDialogHead,
.adminDialogHeader,
.empModalListHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 64px;
  padding: 16px 16px 12px 24px;
  border-bottom: 0;
  background: transparent;
}
.uiDialogHead h2,
.empModalListTitle{
  margin: 0;
  color: var(--text);
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.3;
}
.uiDialogBody{ flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 24px 24px; }
.uiDialogFoot{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  padding: 16px 24px;
  border-top: 1px solid var(--divider);
}

/* Close buttons (all families) */
.uiClose,
.empModalClose,
.comClose,
.irClose,
#btnTimeSettingsClose,
#btnTimeQrClose,
#manualEmployeeClose,
#docsUploadClose,
#docsUploadPreviewClose,
#docsDetailClose,
#coursesDetailClose{
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  font-size: 0 !important;
  line-height: 0;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.uiClose::before,
.empModalClose::before,
.comClose::before,
.irClose::before,
#btnTimeSettingsClose::before,
#btnTimeQrClose::before,
#manualEmployeeClose::before,
#docsUploadClose::before,
#docsUploadPreviewClose::before,
#docsDetailClose::before,
#coursesDetailClose::before{
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.uiClose > *,
.empModalClose > *,
.comClose > *,
.irClose > *,
#btnTimeSettingsClose > *,
#btnTimeQrClose > *,
#manualEmployeeClose > *,
#docsUploadClose > *,
#docsUploadPreviewClose > *,
#docsDetailClose > *,
#coursesDetailClose > *{ display: none !important; }
.uiClose:hover,
.empModalClose:hover,
.comClose:hover,
.irClose:hover,
#btnTimeSettingsClose:hover,
#btnTimeQrClose:hover,
#manualEmployeeClose:hover,
#docsUploadClose:hover,
#docsUploadPreviewClose:hover,
#docsDetailClose:hover,
#coursesDetailClose:hover{ background: var(--bg-hover); color: var(--text); }

/* Native <dialog> elements */
dialog{ color: var(--text); }
dialog:not([open]){ display: none !important; }
dialog::backdrop{ background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog[open]{ animation: uiDialogIn .2s var(--ease-out); }

/* ---------- Side sheet variant (used for detail views) ---------- */
.uiSheetOverlay{
  justify-content: flex-end !important;
  align-items: stretch !important;
  padding: 12px !important;
}
.uiSheetOverlay > [role="dialog"]{
  width: min(1040px, 100%) !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  border-radius: var(--r-xl) !important;
  animation: uiSheetIn .26s var(--ease-out) !important;
}

@media (max-width: 720px){
  .empModalOverlay,
  .hrGateOverlay,
  #manualEmployeeOverlay,
  #timeSettingsOverlay,
  #timeQrOverlay,
  #docsDetailOverlay,
  #docsUploadOverlay,
  #docsUploadPreviewOverlay,
  #coursesDetailOverlay,
  .uiSheetOverlay{
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .uiDialog,
  .empModal,
  .hrGateCard,
  .uiSheetOverlay > [role="dialog"]{
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(100dvh - 24px) !important;
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    animation: uiSheetUp .26s var(--ease-out) !important;
  }
  .uiDialogFoot{ padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes uiSheetUp{ from{ transform: translateY(24px); opacity: 0; } to{ transform: none; opacity: 1; } }

/* Form fields inside dialogs */
.uiField{ display: grid; gap: 6px; }
.uiField + .uiField{ margin-top: 16px; }
.uiLabel{
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
}
.uiHint{ color: var(--text-3); font-size: var(--fs-12); }
.uiHint[data-tone="error"]{ color: var(--danger); }
.uiHint[data-tone="ok"]{ color: var(--success); }

/* Company access / migration dialog (styles injected by cedoly-migration.mjs are re-themed here) */
:root .ilpMigrationDialog{
  border: 0;
  border-radius: var(--r-xl);
  padding: 28px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  font: 400 var(--fs-14)/1.5 var(--font-sans);
}
:root .ilpMigrationDialog::backdrop{ background: var(--scrim); }
:root .ilpMigrationDialog h2,
:root .ilpMigrationHead h2{ color: var(--text); font-size: var(--fs-20); font-weight: 600; letter-spacing: -.015em; }
:root .ilpMigrationClose{ background: var(--bg-muted); color: var(--text-2); }
:root .ilpMigrationIntro,
:root .ilpMigrationStatus,
:root .ilpMigrationDialog [data-description]{ color: var(--text-2); }
:root .ilpMigrationHint{ color: var(--text-3); }
:root .ilpMigrationLabel{ color: var(--text-2); font-weight: 500; }
:root .ilpMigrationSelect,
:root .ilpMigrationCode{ border-color: var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); }
:root .ilpMigrationCompany{ color: var(--text); font-weight: 600; }
:root .ilpMigrationPrimary,
:root .ilpMigrationSecondary{ min-height: var(--ctl-h-lg); border-radius: var(--r-pill); font-weight: 500; }
:root .ilpMigrationPrimary{ background: var(--inverse); color: var(--on-inverse); }
:root .ilpMigrationSecondary{ background: var(--surface); border-color: var(--border); color: var(--text); }
:root .ilpMigrationDialog :focus-visible{ outline: none; box-shadow: var(--focus-ring); }
/* ===================== Interface layer: palette, toolbars, stat strip, notices ===================== */

/* Defensive sizing for icons drawn without explicit dimensions. */
button svg:not([width]),
a svg:not([width]),
label svg:not([width]){ width: 18px; height: 18px; flex: 0 0 auto; }

.uiViewLoading,
.uiViewError{
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--page-pad-top) var(--page-pad-x);
  color: var(--text-2);
}
.uiViewError{ color: var(--danger); }
.uiInlineEmpty{ padding: 24px 4px; color: var(--text-3); font-size: var(--fs-13); }

/* ---------- Page header pieces ---------- */
.uiPageHeadText{ min-width: 0; }
.uiStatStrip{
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.uiStat{
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 10px 18px 11px;
}
.uiStat + .uiStat{ border-left: 1px solid var(--divider); }
.uiStat dt,
.uiStatLabel{ color: var(--text-2); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; }
.uiStat dd,
.uiStatValue{ margin: 0; color: var(--text); font-size: var(--fs-20); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uiStatPeriod{ color: var(--text-3); font-weight: 450; }
.uiStatPeriod:not(:empty)::before{ content: "· "; }
.uiStatPeriod:first-letter{ text-transform: none; }

/* ---------- Inline notices produced by the sections ---------- */
.empNotice,
.settingsNotice,
.ambNotice,
.docsNotice{
  display: block;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1.45;
}
.empNotice:empty,
.settingsNotice:empty,
.ambNotice:empty,
.docsNotice:empty{ display: none !important; }
.empNotice.ok, .settingsNotice.ok, .ambNotice.ok, .empNotice[data-tone="ok"]{ background: var(--success-soft); color: var(--success); }
.empNotice.warn, .settingsNotice.warn, .ambNotice.warn, .empNotice[data-tone="warn"]{ background: var(--warning-soft); color: var(--warning); }
.empNotice.bad, .empNotice.err, .settingsNotice.bad, .ambNotice.bad, .empNotice[data-tone="bad"]{ background: var(--danger-soft); color: var(--danger); }

/* ---------- Section toolbars (search + toolkit) ---------- */
.empToolsBar,
.timeToolsBar,
.paToolsBar{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 40px;
  margin: 0 0 12px;
}
.empSearchWrap,
.timeSearchWrap,
.paSearchWrap{
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 320px;
  min-width: 200px;
  order: 0;
}
.empSearchWrap > svg,
.timeSearchWrap > svg,
.paSearchWrap > svg{
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}
.empSearchInput,
.timeSearchInput{
  width: 100%;
  height: var(--ctl-h);
  padding: 0 34px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.empSearchInput::placeholder,
.timeSearchInput::placeholder{ color: var(--text-3); }
.empSearchInput:hover,
.timeSearchInput:hover{ border-color: var(--border-strong); }
.empSearchInput:focus,
.timeSearchInput:focus{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.empSearchInput::-webkit-search-cancel-button,
.timeSearchInput::-webkit-search-cancel-button{ display: none; }
.empSearchClear,
.timeSearchClear,
.uiSearchClear{
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
}
.empSearchClear:hover,
.timeSearchClear:hover{ background: var(--bg-hover); color: var(--text); }

.uiToolbarFilters{ display: flex; align-items: center; gap: 6px; flex-wrap: wrap; order: 1; }
/* The filter group takes the free space and wraps its own chips, so the count and the
   actions on the right never drop to a line of their own when filters are active. */
[data-ui-toolbar] > .uiToolbarFilters{ flex: 1 1 160px; min-width: 160px; row-gap: 6px; }
[data-ui-toolbar] > .uiToolbarSpacer{ display: none; }
@media (max-width: 720px){
  /* Phones: one swipeable row of filter chips, then count and actions. */
  [data-ui-toolbar] > .uiToolbarFilters{
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px;
    scrollbar-width: none;
  }
  [data-ui-toolbar] > .uiToolbarFilters::-webkit-scrollbar{ display: none; }
  [data-ui-toolbar] > .uiToolbarMeta{ margin-right: auto; }
}
.uiToolbarSpacer{ order: 2; }
.uiToolbarMeta{ order: 3; }
.empToolsBar > .uiBtn,
.timeToolsBar > .uiBtn,
.paToolsBar > .uiBtn{ order: 4; }
.empToolsBar .uiToolbarSpacer,
.timeToolsBar .uiToolbarSpacer,
.paToolsBar .uiToolbarSpacer{ flex: 1 1 auto; }
.uiToolbarEnd{ order: 9; display: flex; align-items: center; gap: 8px; }

.uiMenuTick{ display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--brand); }
.uiMenuItem[aria-checked] .uiMenuTick svg{ color: var(--brand); }

/* Row selection hit area */
.uiSelHit,
.uiSelHead{
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: -6px 4px -6px -8px;
  border-radius: 7px;
  cursor: pointer;
}
.uiSelHit:hover,
.uiSelHead:hover{ background: var(--bg-hover); }
th .uiSelHead{ vertical-align: middle; margin-top: -4px; margin-bottom: -4px; }
th.nameHead{ white-space: nowrap; }
th.nameHead > span{ vertical-align: middle; }

/* ---------- Command palette ---------- */
.uiPalette{
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.uiPalette[open]{ display: flex; flex-direction: column; }
.uiPaletteSearch{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
}
.uiPaletteSearch > svg{ width: 18px; height: 18px; color: var(--text-3); flex: 0 0 auto; }
.uiPaletteSearch input{
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-16);
}
.uiPaletteSearch input::placeholder{ color: var(--text-3); }
.uiPaletteSearch input:focus{ box-shadow: none; }
.uiPaletteList{ flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 8px 8px; }
.uiPaletteGroup{ padding: 10px 10px 4px; color: var(--text-3); font-size: var(--fs-12); font-weight: 500; }
.uiPaletteItem{
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.uiPaletteItem[aria-selected="true"]{ background: var(--bg-hover); }
.uiPaletteIcon{ display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--bg-muted); color: var(--text-2); flex: 0 0 auto; }
.uiPaletteIcon svg{ width: 16px; height: 16px; }
.uiPaletteAvatar{ width: 28px; height: 28px; font-size: 11px; background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%); color: #fff; }
.uiPaletteLabel{ flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text); font-size: var(--fs-14); text-overflow: ellipsis; white-space: nowrap; }
.uiPaletteMeta{ color: var(--text-3); font-size: var(--fs-12); font-family: var(--font-mono); }
.uiPaletteMeta svg{ width: 15px; height: 15px; color: var(--brand); }
.uiPaletteEmpty{ padding: 28px 12px; color: var(--text-2); text-align: center; }
.uiPaletteFoot{
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--divider);
  color: var(--text-3);
  font-size: var(--fs-12);
}
.uiPaletteFoot > span{ display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 720px){ .uiPalette{ margin-top: 8px; } .uiPaletteFoot{ display: none; } }

/* ---------- Confirm dialog ---------- */
.uiConfirm{ width: min(440px, calc(100vw - 24px)); padding: 0; }
.uiConfirm[open]{ display: flex; }
.uiConfirm .uiDialogHead{ min-height: 0; padding: 22px 24px 6px; }
.uiConfirmText{ color: var(--text-2); white-space: pre-line; line-height: 1.55; }
.uiConfirmList{
  display: grid;
  gap: 0;
  margin: 14px 0 0;
  padding: 0;
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  list-style: none;
  max-height: 220px;
  overflow: auto;
}
.uiConfirmList li{ display: grid; gap: 1px; padding: 9px 12px; font-size: var(--fs-13); }
.uiConfirmList li + li{ border-top: 1px solid var(--divider); }
.uiConfirmList strong{ color: var(--text); font-weight: 550; }
.uiConfirmList span{ color: var(--text-2); font-variant-numeric: tabular-nums; }
.uiConfirmList .uiConfirmMore{ color: var(--text-3); }
.uiConfirm .uiDialogFoot{ border-top: 0; padding-top: 8px; }
.uiDialogSub{ margin-top: 4px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
@media (max-width: 720px){
  .uiStatStrip{ width: 100%; flex-wrap: wrap; }
  .uiStat{ flex: 1 1 140px; min-width: 0; }
  .uiStat dt, .uiStatLabel{ white-space: normal; }
  .uiStat + .uiStat{ border-left: 0; border-top: 1px solid var(--divider); }
  .uiStatStrip .uiStat:nth-child(2n){ border-left: 1px solid var(--divider); }
  .uiStatStrip .uiStat:nth-child(2){ border-top: 0; }
  .uiStat dd, .uiStatValue{ font-size: var(--fs-18); }
}
/* ===================== Home =====================
 * The signature element is the presence grid: one cell per employee, lit in iLovePaghe blue for
 * those in service. Surfaces stay white (or the dark surface), type is black, colour is solid and
 * carries meaning: blue = in service / to act on, green = entry, amber = absence or something missing. */
.homePage{
  --hero-line: var(--divider);
  --hero-cell: #e4e5e9;
  --hero-on: var(--brand);
  --live: #12b76a;
  --amber: #f0a020;
  --slate: #6f7682;
  display: grid;
  gap: 20px;
}
:root[data-theme="dark"] .homePage{
  --hero-cell: #2e2e31;
  --live: #19c37d;
  --amber: #f2a93b;
  --slate: #7c8390;
}

/* ---------- Header ---------- */
.homeHead{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}
.homeDate{
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: var(--fs-14);
  font-weight: 500;
}
.homeDate:first-letter{ text-transform: uppercase; }
.homeTitle{
  max-width: 24ch;
  font-size: 40px;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.04;
}
.homeActions .uiBtn{ height: 40px; padding: 0 16px; }
.homeActions .uiBtn svg{ width: 17px; height: 17px; }

.homeSectionTitle{
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: var(--fs-15);
  font-weight: 600;
  letter-spacing: -.012em;
}

/* ---------- Hero: in servizio adesso ---------- */
.homeHero{
  position: relative;
  padding: 24px 28px 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(13, 13, 13, .04), 0 8px 24px -12px rgba(13, 13, 13, .08);
  overflow: hidden;
}
:root[data-theme="dark"] .homeHero{ box-shadow: none; }
.homeHeroTop{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.homeHeroTitle{
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: var(--fs-15);
  font-weight: 600;
  letter-spacing: -.01em;
}
.homeLiveDot{
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live);
}
.homeLiveDot::after{
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--live);
  opacity: 0;
  animation: homePulse 2.4s var(--ease) infinite;
}
@keyframes homePulse{ 0%{ transform: scale(.55); opacity: .8; } 80%, 100%{ transform: scale(1.9); opacity: 0; } }
.homeHeroUpdated{ color: var(--text-3); font-size: var(--fs-13); white-space: nowrap; }
.homeHeroUpdated b{ color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }

.homeHeroBody{
  display: grid;
  grid-template-columns: minmax(260px, .95fr) minmax(0, 1.25fr);
  gap: 24px 40px;
  align-items: start;
  padding: 22px 0 26px;
}
.homeHeroFigure{ display: grid; gap: 18px; align-content: start; }
.homeHeroCount{ display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.homeHeroNumber{
  color: var(--text);
  font-size: 104px;
  font-weight: 600;
  letter-spacing: -.06em;
  line-height: .8;
  font-variant-numeric: proportional-nums;
}
.homeHeroOf{ padding-bottom: 4px; color: var(--text-2); font-size: var(--fs-16); line-height: 1.3; }
.homeHeroOf b{ color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* One cell per employee */
.homeHeroGrid{
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 404px;
  min-height: 15px;
}
.homeHeroGrid > i{
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--hero-cell);
  transition: background-color .45s var(--ease-out);
}
.homeHeroGrid > i.isOn{ background: var(--hero-on); }
.homeHeroGrid[data-mode="empty"]{
  height: 15px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--hero-cell) 0 15px, transparent 15px 20px);
}
.homeHeroBar{ width: 100%; height: 12px; border-radius: 6px; background: var(--hero-cell); overflow: hidden; }
.homeHeroBar i{ display: block; height: 100%; border-radius: inherit; background: var(--hero-on); transition: width .6s var(--ease-out); }
.homeHeroCoverage{ color: var(--text-2); font-size: var(--fs-14); }
.homeHeroCoverage b{ color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* People in service */
.homeHeroPeople{ min-width: 0; padding-left: 40px; border-left: 1px solid var(--hero-line); align-self: stretch; }
.homeHero .homePresenceList{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  align-content: start;
}
.homeHero .dashPresenceItem{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 52px;
  border-bottom: 1px solid var(--hero-line);
}
.homeHero .dashPresenceIdentity{ display: flex; align-items: center; gap: 12px; min-width: 0; }
.dashPresenceAvatar{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
}
.homeHero .dashPresenceName{
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.homeHero .dashPresenceTime{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--text-2);
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}
.homeHero .dashPresenceTime svg{ width: 14px; height: 14px; color: var(--live); }
.homeHero .dashPresenceItemEmpty{
  grid-column: 1 / -1;
  justify-content: flex-start;
  min-height: 64px;
  border-bottom: 0;
}
.homeHero .dashPresenceItemEmpty .dashPresenceName{ color: var(--text-2); font-weight: 450; }
.homeHero .dashPresenceDot{ width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.homeHero .dashPresenceMore{
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  height: 34px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 600;
}
.homeHero .dashPresenceMore:hover{ background: var(--bg-hover); }
.homeHero .dashPresenceMore svg{ width: 15px; height: 15px; }

/* Absences today */
.homeHeroFoot{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 0 16px;
  border-top: 1px solid var(--hero-line);
  font-size: var(--fs-14);
}
.homeHeroFootIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--amber);
  color: #1a1204;
}
.homeHeroFootIcon svg{ width: 15px; height: 15px; }
.homeHeroFootLabel{ flex: 0 0 auto; color: var(--text-2); }
.homeHeroFootValue{ min-width: 0; overflow: hidden; color: var(--text); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }

/* Loading and errors */
.homeHero[data-admin-load="pending"] .homePresenceList{ min-height: 156px; border-radius: 12px; }
.homeHero > .adminDataStatus{ padding: 0 0 14px; color: var(--text-3); }
.homeHero[data-admin-load="error"] > .adminDataStatus{ color: var(--amber); }

/* ---------- Key figures ---------- */
.homeKpis{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 20px;
}
.homeKpi{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 218px;
  padding: 20px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  transition: background-color .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.homeKpiHead{ display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 10px; }
.homeKpiIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--inverse);
  color: var(--on-inverse);
}
.homeKpiIcon svg{ width: 16px; height: 16px; }
.homeKpiPending .homeKpiIcon{ background: var(--amber); color: #1a1204; }
.homeKpiPayroll .homeKpiIcon{ background: var(--brand); color: #fff; }
.homeKpiLabel{ min-width: 0; color: var(--text); font-size: var(--fs-14); font-weight: 600; letter-spacing: -.005em; }
.homeKpiPeriod{ margin-left: auto; color: var(--text-2); font-size: var(--fs-13); font-weight: 500; white-space: nowrap; }
.homeKpiPeriod:first-letter{ text-transform: uppercase; }
.homeKpiValue{
  color: var(--text);
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: proportional-nums;
  white-space: nowrap;
}
.homeKpiNote{ color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
.homeKpiLinks{ display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.homeKpi > .homeKpiAction{ margin-top: auto; }
.homeKpiAction{
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  height: 34px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.homeKpiAction:hover{ background: var(--bg-hover); }
.homeKpiAction svg{ width: 15px; height: 15px; }
.homeKpiAction--quiet{ border-color: transparent; color: var(--warning); }
.homeKpiAction--quiet:hover{ background: var(--warning-soft); }
.homeKpiAction[hidden]{ display: none; }

/* Pending requests: solid blue when a decision is waiting */
.homeKpiPending.isActive{
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}
.homeKpiPending.isActive .homeKpiLabel,
.homeKpiPending.isActive .homeKpiValue{ color: #fff; }
.homeKpiPending.isActive .homeKpiNote{ color: rgba(255, 255, 255, .86); }
.homeKpiPending.isActive .homeKpiIcon{ background: #fff; color: var(--brand); }
.homeKpiPending.isActive .homeKpiAction{ border-color: transparent; background: #fff; color: #0f4fb8; }
.homeKpiPending.isActive .homeKpiAction:hover{ background: rgba(255, 255, 255, .9); }
:root[data-theme="dark"] .homeKpiPending.isActive{ background: #1c6fe6; }
:root[data-theme="dark"] .homeKpiPending.isActive .homeKpiAction{ color: #0f4fb8; }
/* White text on a blue fill: in the dark theme the fill keeps the iLovePaghe blue of the light theme
   (white at 4.7:1); the lighter dark --brand stays for marks, bars and icons without text. */
:root[data-theme="dark"] :is(.sideCompanyAvatar, .navItem .navBadge, .ilpSupportBubble.customer){ background: #1c6fe6; }
.homeKpiPending.isActive .adminDataStatus{ color: rgba(255, 255, 255, .8); }

/* A single labelled figure row inside a card */
.homeKpiRow{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
  color: var(--text-2);
  font-size: var(--fs-13);
}
.homeKpiRow[hidden]{ display: none; }
.homeKpiRow b{ color: var(--text); font-size: var(--fs-14); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pending requests listed inside the card */
.homePendingList{ display: grid; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
.homePendingList[hidden]{ display: none; }
.homePendingList li{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, .22);
  font-size: var(--fs-13);
}
.homePendingList strong{ flex: 0 1 auto; min-width: 72px; overflow: hidden; color: #fff; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.homePendingList span{ flex: 0 1 auto; min-width: 0; overflow: hidden; color: rgba(255, 255, 255, .86); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.homePendingList .homePendingMore{ color: rgba(255, 255, 255, .86); }
.homeKpiPending .homeKpiAction{ margin-top: auto; }

/* Split bars (email coverage, clocking modes) */
.homeSplit{ display: grid; gap: 10px; margin-top: 8px; }
.homeSplit[hidden]{ display: none; }
.homeSplitBar{ display: flex; gap: 3px; height: 10px; }
.homeSplitBar > i{ flex: 0 1 0; min-width: 0; height: 100%; border-radius: 3px; transition: flex-grow .5s var(--ease-out); }
.homeSplitBar > i[hidden]{ display: none; }
.homeSplitBar > [data-ui-split="with"]{ background: var(--inverse); }
.homeSplitBar > [data-ui-split="without"]{ background: var(--amber); }
.homeSplitBar--modes{ margin: 2px 0 14px; }
.homeSplitBar--modes[data-empty="true"]{ background: var(--bg-muted); border-radius: 3px; }
.homeSplitBar > [data-mode="gps"]{ background: var(--brand); }
.homeSplitBar > [data-mode="qr"]{ background: var(--inverse); }
.homeSplitBar > [data-mode="direct"]{ background: var(--success-solid); }
.homeSplitBar > [data-mode="off"]{ background: var(--slate); }
.homeLegend{ display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: var(--fs-13); }
.homeLegend li{ display: inline-flex; align-items: center; gap: 7px; }
.homeLegend b{ color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.homeSwatch{ display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 3px; }
.homeSwatch--ink{ background: var(--inverse); }
.homeSwatch--amber{ background: var(--amber); }
.homeSwatch--blue{ background: var(--brand); }
.homeSwatch--green{ background: var(--success-solid); }
.homeSwatch--slate{ background: var(--slate); }

/* Payroll: six monthly bars */
.homeKpiPayroll .homeKpiValue{ margin-bottom: 4px; }
.dashPayrollTrend{
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  cursor: pointer;
  touch-action: pan-y;
}
/* The bars take whatever height the row gives the card. */
.dashPayrollTrend svg{ display: block; flex: 1 1 72px; width: 100%; min-height: 72px; max-height: 150px; overflow: visible; }
.dashPayrollTrend svg:focus-visible{ outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.dashTrendBar{ fill: var(--brand); transition: fill .15s var(--ease); }
.dashTrendBar.isSelected{ fill: var(--inverse); }
.dashTrendBar--missing{ fill: var(--border-strong); }
.dashTrendMonths{ display: flex; margin: 0; padding: 0; list-style: none; }
.dashTrendMonths li{ flex: 1 1 0; color: var(--text-3); font-size: var(--fs-12); text-align: center; }
.dashTrendMonths li.isSelected{ color: var(--text); font-weight: 600; }
.dashTrendMonths[hidden]{ display: none; }
.dashPayrollTrend[data-state="empty"]::after{
  content: "L’andamento compare dopo il primo caricamento delle buste paga.";
  color: var(--text-3);
  font-size: var(--fs-13);
}

/* ---------- Activity + side ---------- */
.homeGrid{
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: stretch;
}
.homeSide{ display: grid; gap: 20px; align-content: start; }
.homePanel{
  min-width: 0;
  padding: 20px 22px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.homePanelHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.homePanelLink{
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--brand-text);
  font-size: var(--fs-13);
  font-weight: 600;
  text-decoration: none;
}
.homePanelLink:hover{ text-decoration: underline; text-underline-offset: 3px; }
.homePanelLink svg{ width: 15px; height: 15px; }

/* Activity timeline */
.dashEventsAttribution{ color: var(--text-3); font-size: var(--fs-12); }
.dashEventsList{ display: grid; margin: 0; padding: 0; list-style: none; }
.dashEvent{
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 6px 0;
}
.dashEvent:not(:last-child)::before{
  content: "";
  position: absolute;
  top: 46px;
  bottom: -10px;
  left: 16px;
  width: 2px;
  border-radius: 1px;
  background: var(--divider);
}
.dashEventIcon{
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--inverse);
  color: var(--on-inverse);
}
.dashEventIcon svg{ width: 17px; height: 17px; }
.dashEvent[data-event-kind="in"] .dashEventIcon{ background: var(--success-solid); color: #fff; }
.dashEvent[data-event-kind="out"] .dashEventIcon{ background: var(--inverse); color: var(--on-inverse); }
.dashEvent[data-event-kind="absence"] .dashEventIcon{ background: var(--amber); color: #1a1204; }
.dashEvent[data-event-kind="communication"] .dashEventIcon{ background: var(--brand); color: #fff; }
.dashEvent[data-event-kind="payroll"] .dashEventIcon{ background: var(--data-3); color: #fff; }
.dashEventCopy{ display: grid; gap: 2px; min-width: 0; }
.dashEventCopy strong{
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashEventCopy > span{
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-13);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashEvent time{
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--text-3);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dashEvent time b{ color: var(--text); font-size: var(--fs-15); font-weight: 600; letter-spacing: -.01em; }
.dashEventsStatus{ padding: 12px 0 2px; color: var(--text-2); font-size: var(--fs-13); }
.dashEventsStatus:empty{ display: none; }

/* Message to everyone */
.dashQuickForm{ display: grid; gap: 12px; }
.dashQuickForm textarea{
  width: 100%;
  min-height: 104px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-inset);
  color: var(--text);
  font-size: var(--fs-14);
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.dashQuickForm textarea::placeholder{ color: var(--text-3); }
.dashQuickForm textarea:focus{ border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.dashQuickForm textarea:disabled{ cursor: not-allowed; }
.dashQuickFoot{ display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dashQuickHelp{ color: var(--text-2); font-size: var(--fs-12); line-height: 1.45; }
.dashQuickHelp a{ font-weight: 600; }
.dashQuickFoot .uiBtn{ flex: 0 0 auto; height: 34px; padding: 0 14px; }
.dashQuickStatus{ color: var(--text-2); font-size: var(--fs-13); }

/* Clocking modes */
.homeModesList{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.homeModesList li{ display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-13); }
.homeModeName{ flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.homeModesList b{ color: var(--text); font-size: var(--fs-14); font-weight: 600; font-variant-numeric: tabular-nums; }
.homeModesList li.isZero .homeModeName,
.homeModesList li.isZero b{ color: var(--text-3); }
@keyframes dashGpsReveal{
  0%{ box-shadow: 0 0 0 0 var(--brand-line); }
  40%{ box-shadow: 0 0 0 5px var(--brand-soft-2); }
  100%{ box-shadow: 0 0 0 0 transparent; }
}
.dashGpsCard.isGpsIntro{ animation: dashGpsReveal 1.8s var(--ease) 1; }

/* App: one slim full-width row */
.homeAppPanel{
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  padding: 16px 18px 16px 18px;
}
.homeAppMark{
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--inverse);
  color: var(--on-inverse);
}
.homeAppMark{ width: 44px; height: 44px; }
.homeAppMark svg{ width: 21px; height: 21px; }
.homeAppCopy{ display: grid; gap: 2px; min-width: 0; }
.homeAppTitle{ font-size: var(--fs-15); font-weight: 600; letter-spacing: -.01em; }
.homeAppText{ color: var(--text-2); font-size: var(--fs-13); }
.dashAppStores{ display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dashAppStoreBadge{ display: inline-flex; align-items: center; height: 40px; border-radius: 9px; overflow: hidden; }
.dashAppStoreBadge img{ display: block; width: 135px; height: 40px; object-fit: cover; }
:root[data-theme="dark"] .dashAppStoreBadge{ box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }

/* Servizio buste paga: a quiet offer card, blue icon = something to act on */
.homeService{ display: flex; flex-direction: column; }
.homeService .homePanelHead{ margin-bottom: 10px; }
.homeServiceIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}
.homeServiceIcon svg{ width: 15px; height: 15px; }
.homeService .uiBadge[hidden]{ display: none; }
.homeServiceText{ max-width: 44ch; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.homeServiceFoot{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.homeServicePrice{ display: grid; gap: 4px; }
.homeServicePrice b{ color: var(--text); font-size: var(--fs-24); font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.homeServicePrice span{ color: var(--text-2); font-size: var(--fs-12); }
.homeService[data-state="sent"] .homeServicePrice{ visibility: hidden; height: 0; }
.homeServiceAction{ margin-left: auto; text-decoration: none; }
.homeServiceAction:hover{ text-decoration: none; }

/* Two side columns between phone and wide desktop: the offer takes a full row instead of leaving a hole. */
@media (max-width: 1240px) and (min-width: 721px){
  .homeService{ grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; align-items: center; }
  .homeService .homePanelHead{ grid-column: 1; margin-bottom: 6px; }
  .homeServiceText{ grid-column: 1; }
  .homeServiceFoot{ grid-column: 2; grid-row: 1 / span 2; flex-wrap: nowrap; align-items: center; gap: 24px; margin-top: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1240px){
  .homeKpis{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homeKpiPayroll{ grid-column: 1 / -1; min-height: 0; }
  .homeGrid{ grid-template-columns: minmax(0, 1fr); }
  .homeSide{ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
@media (max-width: 980px){
  .homeHeroBody{ grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .homeHeroPeople{ padding-left: 0; border-left: 0; }
  .homeHeroGrid{ max-width: none; }
}
@media (max-width: 720px){
  .homeAppPanel{ grid-template-columns: 44px minmax(0, 1fr); }
  .dashAppStores{ grid-column: 1 / -1; justify-content: flex-start; margin-top: 8px; }
  .homeTitle{ font-size: 30px; }
  .homeActions{ width: 100%; }
  .homeActions .uiBtn{ flex: 1 1 0; justify-content: center; padding: 0 10px; }
  /* Three actions: the two secondary ones share a row, the upload keeps the full width. */
  .homeActions:has(.homeActionService){ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homeActions:has(.homeActionService) .uiBtn--primary{ grid-column: 1 / -1; }
  .homeHero{ padding: 20px 18px 0; border-radius: 18px; }
  .homeHeroNumber{ font-size: 80px; }
  .homeHeroGrid{ gap: 4px; }
  .homeHeroGrid > i{ width: 12px; height: 12px; border-radius: 3px; }
  .homeHero .homePresenceList{ grid-template-columns: minmax(0, 1fr); }
  .homeHeroFoot{ flex-wrap: wrap; row-gap: 4px; }
  .homeHeroFootValue{ flex-basis: 100%; padding-left: 36px; white-space: normal; }
  .homeKpis{ grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .homeKpi{ min-height: 0; padding: 18px; }
  .homeKpiValue{ font-size: 36px; }
  .homePanel{ padding: 18px; }
  .homeSide{ grid-template-columns: minmax(0, 1fr); }
  .dashQuickFoot{ flex-wrap: wrap; }
}
@media (max-width: 420px){
  .homeActions:has(.homeActionService) .uiBtn--secondary{ gap: 6px; padding: 0 8px; font-size: var(--fs-13); }
}
@media (max-width: 370px){
  .homeActions:has(.homeActionService) .uiBtn--secondary svg{ display: none; }
}
@media (prefers-reduced-motion: reduce){
  .homeLiveDot::after{ animation: none; }
  .homeHeroGrid > i, .homeHeroBar i, .homeSplitBar > i{ transition: none; }
}
/* ===================== Dipendenti ===================== */
#employeesView .uiPageHead{ align-items: flex-end; }

@media (min-width: 721px){ .empTable{ min-width: 900px; } }
.empTable col.colName{ width: 30%; }
.empTable col.colCF{ width: 17%; }
.empTable col.colSent{ width: 9%; }
.empTable col.colEmail{ width: 26%; }
.empTable col.colLastSent{ width: 12%; }
.empTable col.colLast{ width: 96px; }
.empTable .sentHead,
.empTable .sentCell{ text-align: right; font-variant-numeric: tabular-nums; }
.empTable .sentCell{ color: var(--text); font-weight: 500; }
.empTable .lastSentCell{ color: var(--text-2); font-size: var(--fs-13); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empTable .actionsHead,
.empTable .actionsCell{ text-align: right; }

/* Inline email editing: reads like text, becomes a field on hover/focus. */
.emailWrap{ position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
.emailInput{
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  margin-left: -9px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-14);
  text-overflow: ellipsis;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.emailInput::placeholder{ color: var(--text-3); }
tr:hover .emailInput{ border-color: var(--border); background: var(--surface); }
.emailInput:focus{ border-color: var(--brand) !important; background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.emailInput.invalid{ border-color: var(--danger) !important; color: var(--danger); }
.mailActions{ display: flex; gap: 4px; flex: 0 0 auto; }
.miniBtn{
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 500;
}
.miniBtn:hover{ background: var(--bg-subtle); }
.miniBtn.miniBtnPrimary,
.miniBtn[data-emp-save]{ border-color: transparent; background: var(--inverse); color: var(--on-inverse); }
.miniBtn:disabled{ opacity: .5; }
.mailState{ flex: 0 0 auto; color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; }
.mailState:empty{ display: none; }
tr[data-save-state="ok"] .mailState{ color: var(--success); }
tr[data-save-state="err"] .mailState,
tr[data-save-state="error"] .mailState{ color: var(--danger); }

.actionsBtn{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.actionsBtn svg{ width: 15px; height: 15px; }
tr:hover .actionsBtn{ color: var(--text); border-color: var(--border-strong); }
.actionsBtn:hover{ background: var(--bg-subtle); }

tr[data-emp-key]{ cursor: pointer; }
.empEmptyRow td{
  height: auto !important;
  padding: 56px 16px !important;
  color: var(--text-2);
  text-align: center;
}

/* Add employee button lives at the end of the toolbar */
.ilpManualEmployeeAddBtn{
  order: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--ctl-h);
  padding: 0 16px 0 12px;
  border-radius: var(--r-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  font-size: var(--fs-14);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease);
}
.ilpManualEmployeeAddBtn:hover{ background: var(--inverse-hover); }
.empAddBtnIcon{ display: inline-grid; place-items: center; }
.empAddBtnIcon svg{ width: 16px; height: 16px; }
.ilpManualEmployeeToolbarFallback{ display: flex; justify-content: flex-end; margin-bottom: 12px; }
.uiPageHeadText > .ilpManualEmployeeAddBtn{ display: none; }

/* ---------- Employee and attendance detail dialogs ---------- */
#empDetailOverlay,
#timeDetailOverlay{
  --detail-dialog-gap: 24px;
  justify-content: center !important;
  align-items: center !important;
  padding: var(--detail-dialog-gap) !important;
}
#empDetailOverlay > [role="dialog"],
#timeDetailOverlay > [role="dialog"]{
  width: min(1100px, 100%) !important;
  max-width: 100% !important;
  height: min(820px, calc(100dvh - 2 * var(--detail-dialog-gap))) !important;
  max-height: calc(100dvh - 2 * var(--detail-dialog-gap)) !important;
  border-radius: var(--r-xl) !important;
  animation: uiDialogIn .2s var(--ease-out) !important;
}
@media (max-width: 720px){
  #empDetailOverlay, #timeDetailOverlay{ --detail-dialog-gap: 12px; }
}

#empDetailOverlay .empModal,
#timeDetailOverlay .empModal{ display: flex; flex-direction: column; }
.empDetailMainHeader{
  padding: 20px 20px 16px 28px !important;
  border-bottom: 1px solid var(--divider) !important;
}
.empDetailIdentity{ display: flex; align-items: center; gap: 14px; min-width: 0; }
.empDetailAvatarBig{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%) !important;
  color: #fff;
  font-size: var(--fs-16);
  font-weight: 600;
}
.empDetailAvatarBig::after{ content: attr(data-init); }
.empDetailIdentityText{ display: grid; gap: 3px; min-width: 0; }
.empDetailName{
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-20);
  font-weight: 600;
  letter-spacing: -.018em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empDetailField{ display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.empDetailInlineMeta{ flex-wrap: wrap; column-gap: 14px; }
.empDetailMono{ font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); letter-spacing: .01em; }
.empDetailValue{ color: var(--text-2); font-size: var(--fs-13); min-width: 0; overflow-wrap: anywhere; }
.empDetailMainHeaderRight{ display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.empDetailMainHeaderRight .empModalListMeta{ color: var(--text-3); font-size: var(--fs-13); white-space: nowrap; }

.empModalBody.empDetailTwoCol{
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.empDetailSide{
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--divider);
  background: var(--surface-inset);
}
:root[data-theme="dark"] .empDetailSide{ background: rgba(0, 0, 0, .12); }
.empDetailSideContent{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  align-content: start;
  gap: 22px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 24px;
  scrollbar-gutter: stable;
}
.empDetailSideFooter{ flex: 0 0 auto; padding: 14px 20px 18px; border-top: 1px solid var(--divider); }
.empDetailBlock{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.empDetailLabelRow > div{ min-width: 0; overflow-wrap: anywhere; }
.empDetailLabelRow{ display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.empDetailLabel{ color: var(--text-2); font-size: var(--fs-13); font-weight: 500; }
.empDetailHelp{ margin-top: 2px; color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.empDetailToggleBlock{ padding: 14px 0; border-top: 1px solid var(--divider); }
.empDetailToggleBlock:first-child{ border-top: 0; padding-top: 0; }
.empAccessSettings h3,
.timeDetailSettings h3{
  margin-bottom: 4px;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 600;
}
.empAccessSettings{ min-width: 0; }
.empAccessContent{ display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 0; }
.timeToggleHint,
.empModalEditHint{ color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.timeToggleHint:empty,
.empModalEditHint:empty{ display: none; }
.timeToggleHint.ok, .empModalEditHint.ok{ color: var(--success); }
.timeToggleHint.warn, .empModalEditHint.warn{ color: var(--warning); }
.timeToggleHint.bad, .empModalEditHint.bad, .empModalEditHint.err{ color: var(--danger); }

.empModalEditRow{ display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 8px; }
.empModalEditInput{
  width: 100%;
  height: var(--ctl-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.empModalEditInput:hover{ border-color: var(--border-strong); }
.empModalEditInput:focus{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.empModalEditInput::placeholder{ color: var(--text-3); }
.empModalEditActions{ display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.empModalEditActionBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.empModalEditActionBtn:hover{ background: var(--bg-subtle); }
.empModalEditActionBtn.primary{ border-color: transparent; background: var(--inverse); color: var(--on-inverse); }
.empModalEditActionBtn.primary:hover{ background: var(--inverse-hover); }
.empModalEditActionBtn:disabled{ opacity: .45; }

/* Access code block */
.empManualSerialBlock{ padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.empManualSerialField{ display: flex; align-items: center; gap: 8px; }
.empManualSerialValue{
  flex: 1 1 auto;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text) !important;
  font-size: var(--fs-15) !important;
  letter-spacing: .08em;
}
.empManualSerialCopyBtn{
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-2);
}
.empManualSerialCopyBtn:hover:not(:disabled){ background: var(--bg-subtle); color: var(--text); }
.empManualSerialCopyBtn:disabled{ opacity: .4; }
.empManualSerialCopyBtn svg{ width: 16px; height: 16px; }
.empManualSerialBlock .empModalEditActions{ justify-content: flex-start; }
.empManualSerialHint{ color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.empManualSerialHint:empty{ display: none; }
.empManualSerialHint[data-state="error"]{ color: var(--danger); }
.empManualSerialHint[data-state="ok"], .empManualSerialHint[data-state="ready"]{ color: var(--success); }

.empDetailDeleteBig{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--ctl-h);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--danger);
  font-size: var(--fs-13);
  font-weight: 500;
}
.empDetailDeleteBig:hover{ background: var(--danger-soft); border-color: transparent; }
.empDetailDeleteBig:disabled{ opacity: .5; }

.empDetailMain{
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 22px 28px 24px;
  overflow: hidden;
}
.empDocsHeading{ display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.empDocsHeading h3{ font-size: var(--fs-15); font-weight: 600; }
.empDocsHeading .empModalListMeta{ color: var(--text-3); font-size: var(--fs-13); }
.empDocItems{ flex: 1 1 auto; min-height: 0; overflow: auto; }
.empDocSub{ color: var(--text-3); font-size: var(--fs-13); }

/* Payslip history table inside the sheet */
.empDocTableWrap{
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: auto;
  max-height: 100%;
}
.empDocTable{ width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14); }
.empDocTable thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 500;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
:root[data-theme="dark"] .empDocTable thead th{ background: #1d1d1f; }
.empDocTable tbody td{
  height: 48px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.empDocTable tbody tr:last-child td{ border-bottom: 0; }
.empDocTable tbody tr:hover td{ background: var(--bg-subtle); }
.empDocRow{ cursor: pointer; }
.empDocRow.isActive td{ background: var(--brand-soft) !important; }
.empDocBadge,
.emp-doc-badge,
.empDocBadgeOk{
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-12);
  font-weight: 500;
}
.assocWarnIcon{ color: var(--warning); }
.assocWarnIcon.isRejected{ color: var(--danger); }
.empDocOpenBtn,
.empDocResendBtn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}
.empDocOpenBtn:hover,
.empDocResendBtn:hover{ background: var(--bg-subtle); }
.empDocOpenBtn.isDisabled,
.empDocOpenBtn:disabled,
.empDocResendBtn:disabled{ opacity: .45; pointer-events: none; }
.empDocOpenBtn svg,
.empDocResendBtn svg{ width: 14px; height: 14px; }

@media (max-width: 900px){
  .empModalBody.empDetailTwoCol{ display: block; overflow-y: auto; }
  .empDetailSide{ border-right: 0; border-bottom: 1px solid var(--divider); }
  .empDetailSideContent{ overflow: visible; padding: 18px 18px 20px; }
  .empDetailSideFooter{ padding: 12px 18px 16px; }
  .empDetailMain{ overflow: visible; padding: 18px; }
  .empDetailMainHeader{ padding: 16px 12px 14px 18px !important; }
}
@media (max-width: 860px){
  #employeesView .uiStatStrip{ width: 100%; }
  #employeesView .uiStat{ flex: 1 1 0; min-width: 0; }
  .empSearchWrap{ flex: 1 1 100%; }
}
@media (max-width: 720px){
  .empDetailMainHeader{ display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: start; gap: 10px; }
  .empDetailMainHeader > .empDetailIdentity{ grid-column: 1; grid-row: 1; }
  .empDetailMainHeader .empDetailMainHeaderRight{ display: contents; }
  .empDetailMainHeader .empModalListMeta{ grid-column: 1; grid-row: 2; white-space: normal; }
  .empDetailMainHeader .empModalClose{ grid-column: 2; grid-row: 1; }
  /* Phones: the primary action leads the toolbar at full width. */
  .empToolsBar > #btnAddManualEmployee{ order: -1; flex: 1 1 100%; justify-content: center; }
}
/* ===================== Timbrature ===================== */

/* Company-wide clocking modes
   Compact cards: icon, title and switch stay the focus; the status line sits on the same baseline in every card. */
.timeModes{
  --time-mode-icon: 36px;
  --time-mode-gap: 12px;
  --time-mode-indent: calc(var(--time-mode-icon) + var(--time-mode-gap));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.timeModes > .cockpitCell{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
}
.timeModes > .cockpitCell > :last-child{ margin-top: auto; }
.timeModeHead{ display: flex; align-items: center; gap: var(--time-mode-gap, 14px); min-width: 0; }
.timeModeIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--time-mode-icon, 38px);
  height: var(--time-mode-icon, 38px);
  border-radius: 11px;
  background: var(--inverse);
  color: var(--on-inverse);
}
.timeModeIcon[data-mode="gps"]{ background: var(--brand); color: #fff; }
.timeModeIcon svg{ width: 18px; height: 18px; }
.timeModeText{ flex: 1 1 auto; min-width: 0; }
.timeModeText .metricLabel{ color: var(--text); font-size: var(--fs-15); font-weight: 600; line-height: 1.3; }
.timeModeHelp{ margin-top: 1px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.4; }
.timeBulkToggleRow{ flex: 0 0 auto; }
.timeBulkStatusValue{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  min-height: 20px;
  margin-left: var(--time-mode-indent, 52px);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.4;
}
.timeBulkStatusValue::before{
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
}

.timeModes > .cockpitCell > .timeBulkStatusValue{ align-self: flex-start; }

/* Uscita automatica: status and «Disattiva per tutti» on one line, info next to the title */
.timeModeTitleRow{ display: flex; align-items: center; gap: 6px; min-width: 0; }
.timeModeTitleRow > .metricLabel{ min-width: 0; }
.timeModeFoot{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  min-width: 0;
  min-height: 20px;
  margin-left: var(--time-mode-indent, 52px);
}
.timeModeFoot > .timeBulkStatusValue{ margin-left: 0; }
.timeBulkAutoExitOff{
  padding: 0;
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  cursor: pointer;
}
.timeBulkAutoExitOff:hover{ color: var(--text); }
.timeBulkAutoExitOff:disabled{ opacity: .5; cursor: default; }
.timeBulkAutoExitOff[hidden]{ display: none; }

/* «Come funziona» — shared by the company card and the employee sheet */
.timeAutoExitInfo > summary{
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  color: var(--text-2);
  font-size: inherit;
  font-weight: 500;
  line-height: 20px;
  list-style: none;
  cursor: pointer;
  border-radius: 6px;
}
.timeAutoExitInfo > summary::-webkit-details-marker{ display: none; }
.timeAutoExitInfo > summary::marker{ content: ""; }
.timeAutoExitInfo > summary svg{ flex: 0 0 auto; width: 14px; height: 14px; }
.timeAutoExitInfo > summary:hover,
.timeAutoExitInfo[open] > summary{ color: var(--text); }
.timeAutoExitInfo > summary:focus-visible{ outline: 2px solid var(--brand); outline-offset: 2px; }
/* Body of «Come funziona»: three rules with a run-in label, an example, a note */
.timeAutoExitBody{
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}
.timeAutoExitSteps{ display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.timeAutoExitSteps strong,
.timeAutoExitExample strong{ display: block; margin-bottom: 1px; color: var(--text); font-weight: 600; }
.timeAutoExitExample{
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-inset);
  font-variant-numeric: tabular-nums;
}
.timeAutoExitNote{ margin: 10px 0 0; color: var(--text-3); font-size: var(--fs-12); }
.timeAutoExitStatus:empty{ display: none; }
/* In the company card the info is a small icon next to the title and opens over the page,
   so reading it never stretches the cards or pushes the table down. */
.timeBulkAutoExitInfo{ flex: 0 0 auto; }
.timeBulkAutoExitInfo > summary{
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-3);
}
.timeBulkAutoExitInfo > summary svg{ width: 16px; height: 16px; }
.timeBulkAutoExitInfo[open] > summary{ color: var(--brand); background: var(--brand-soft); }
.timeAutoExitPanel{
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 12px;
  left: 12px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-13);
  cursor: auto;
}
.timeAutoExitPanelTitle{ color: var(--text); font-size: var(--fs-14); font-weight: 600; }
.timeAutoExitPanel .timeAutoExitBody{ margin-top: 10px; padding: 0; border: 0; background: none; }
.timeModeCard:has(input:checked) .timeBulkStatusValue{ color: var(--success); }
.timeModeCard:has(input:checked) .timeBulkStatusValue::before{ background: var(--success-solid); }
.timeModeCard:has(input:indeterminate) .timeBulkStatusValue::before{ background: var(--warning-solid); }
.ilpSwitch input:indeterminate + .ilpSwitchTrack{ background: var(--text-3); }
.ilpSwitch input:indeterminate + .ilpSwitchTrack::after{ transform: translateX(7px); }
.ilpSwitch--lg input:indeterminate + .ilpSwitchTrack::after{ transform: translateX(8px); }
@keyframes timeGpsSwitchReveal{
  0%{ box-shadow: 0 0 0 0 var(--brand-line); border-radius: 999px; }
  45%{ box-shadow: 0 0 0 6px var(--brand-soft-2); border-radius: 999px; }
  100%{ box-shadow: 0 0 0 0 transparent; border-radius: 999px; }
}
.isTimeGpsIntro{ animation: timeGpsSwitchReveal 1.6s var(--ease) 1; border-radius: 999px; }

/* Toolbar right side */
.timeToolsRight{ display: flex; align-items: center; gap: 8px; }
.timeMonthWrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  height: var(--ctl-h);
  padding: 0 10px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  cursor: pointer;
}
.timeMonthWrap:hover{ border-color: var(--border-strong); }
.timeMonthWrap:focus-within{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.timeMonthWrap > svg{ position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.timeMonthInput{
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-14);
  font-variant-numeric: tabular-nums;
  text-transform: capitalize;
}
.timeMonthInput:focus{ box-shadow: none; }
/* Chromium drew a second calendar icon at the right of the pill and opened the picker only from it:
   the native trigger now covers the whole pill, invisible, so a click anywhere opens the month picker. */
.timeMonthInput::-webkit-calendar-picker-indicator{
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.timeSettingsBtn{
  display: grid;
  place-items: center;
  width: var(--ctl-h);
  height: var(--ctl-h);
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
}
.timeSettingsBtn:hover{ background: var(--bg-subtle); color: var(--text); }
.timeSettingsBtn svg{ width: 17px; height: 17px; }
.timePdfBtn[data-loading="1"]{ opacity: .75; pointer-events: none; }

/* Table */
@media (min-width: 721px){ .timeTable{ min-width: 980px; } }
.timeTable col.colName{ width: 26%; }
.timeTable col.colCF{ width: 16%; }
.timeTable col.colStatus{ width: 10%; }
.timeTable col.colGps{ width: 72px; }
.timeTable col.colLast{ width: auto; }
.timeTable col.colErrors{ width: 120px; }
#timeTbody tr[data-time-key]{ cursor: pointer; }
.timeNameButton{
  min-width: 0;
  overflow: hidden;
  padding: 0;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeNameButton:hover{ text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.timeModeBadge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}
.timeModeBadge::before{ content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.timeModeBadge.gps{ background: var(--brand-soft); color: var(--brand-text); }
.timeModeBadge.qr{ background: var(--bg-muted); color: var(--text); }
.timeModeBadge.direct{ background: var(--success-soft); color: var(--success); }
.timeModeBadge.off{ background: transparent; color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border); }

.timeLastContent{ display: flex; align-items: center; gap: 14px; min-width: 0; }
.timeLastEvent{
  display: grid;
  flex: 0 0 auto;
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeLastEvent small{ color: var(--text-3); font-size: var(--fs-12); font-weight: 400; }
.timeLastAddress{
  display: grid;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid var(--divider);
  color: var(--text-2);
  font-size: var(--fs-13);
}
.timeLastAddressText{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeLastAddress small{ color: var(--warning); font-size: var(--fs-12); }
.timeLastEmpty,
.timeLastLoading,
.timeErrorEmpty{ color: var(--text-3); font-size: var(--fs-13); }
.timeAddressPending{
  display: inline-block;
  width: 120px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-muted) 0, var(--bg-subtle) 60px, var(--bg-muted) 120px) var(--bg-muted);
  background-size: 480px 100%;
  animation: uiShimmer 1.3s linear infinite;
  vertical-align: middle;
}
.timeErrorNone{ color: var(--text-3); }
.timeErrorBadge{
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: var(--fs-12);
  white-space: nowrap;
}
.timeErrorBadge strong{ font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums; }
.timeErrorBadge:hover{ filter: brightness(.97); }
.timeErrorRetry,
[data-time-latest-retry],
[data-time-gps-retry]{
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 500;
}
.timeGpsAttribution{ margin-top: 8px; color: var(--text-3); font-size: var(--fs-12); }

/* ---------- Time detail sheet ---------- */
.timeDetailSummaryPanel{ display: grid; gap: 14px; }
.timeDetailSummaryTop{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.timeDetailSummaryPickerWrap{ min-width: 0; }
.timeDetailSummaryEyebrow{ color: var(--text); font-size: var(--fs-14); font-weight: 600; white-space: normal; }
.timeDetailSummaryMonthInput{ width: 100%; min-width: 0; max-width: 100%; height: 36px; padding: 0 10px; font-size: var(--fs-13); text-transform: capitalize; }
.timeDetailSummaryGrid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.timeDetailMetricCard{
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.timeDetailMetricLabel{ color: var(--text-2); font-size: var(--fs-12); font-weight: 500; }
.timeDetailMetricValue{ overflow-wrap: anywhere; margin-top: 2px; color: var(--text); font-size: var(--fs-20); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timeDetailIssuesCard{
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.timeDetailIssuesHead{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.timeDetailIssuesTitle{ color: var(--text); font-size: var(--fs-13); font-weight: 600; }
.timeDetailIssuesBadge{
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.timeDetailIssuesBadge.isOk{ background: var(--success-soft); color: var(--success); }
.timeDetailIssuesBadge.isBad{ background: var(--warning-soft); color: var(--warning); }
.timeDetailIssuesHint{ color: var(--text-2); font-size: var(--fs-12); line-height: 1.45; }
.timeDetailIssuesHint:empty{ display: none; }
.timeDetailIssuesHint.isBad{ color: var(--warning); }
.timeDetailIssuesList{ display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.timeDetailIssuesList li{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: var(--fs-12);
}
.timeDetailIssuesList button{ color: inherit; font-weight: 600; text-decoration: underline; }
.timeDetailSettings{ display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 0; padding-top: 4px; border-top: 1px solid var(--divider); }
.timeDetailSettings h3{ padding-top: 16px; }

/* Monthly grid */
.timeDayTable{ min-width: 700px; }
.timeDayTable thead th{ text-align: center; }
.timeDayTable thead tr:first-child th:first-child{ text-align: left; }
.timeDayTable thead tr + tr th{ top: 38px; height: 32px; font-size: 11.5px; }
.timeDayTable col.colDay{ width: 112px; }
.timeDayTable col.colTot{ width: 76px; }
.timeDayTable col.colPosition{ width: 170px; }
.timeDayTable thead tr:first-child th:first-child{ position: sticky; left: 0; z-index: 3; }
.timeDayDateCell{
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  padding: 8px 14px !important;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  font-weight: 400;
  vertical-align: middle;
}
.timeDayDate{ display: block; color: var(--text); font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums; }
.timeDayWeekday{ display: block; color: var(--text-3); font-size: var(--fs-12); text-transform: capitalize; }
.timeDayIssueLabel{ display: inline-block; margin-top: 4px; color: var(--warning); font-size: 11px; font-weight: 600; }
.timeDayTable tr.timeDayWeekend td,
.timeDayTable tr.timeDayWeekend th{ background: var(--surface-inset); }
.timeDayTable tr.timeDayRowError th,
.timeDayTable tr.timeDayRowError td{ background: var(--warning-soft); }
/* On the amber of a day to check the grey weekday fell below AA in the dark theme (3.7:1): one step lighter. */
:root[data-theme="dark"] .timeDayTable tr.timeDayRowError .timeDayWeekday{ color: var(--text-2); }
.timeDayCellMono{ text-align: center; }
.timeDayRight{ text-align: right !important; }
.timeDayTotal{ color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Exit recorded by the system: a short tag under the time. Its old rule lived only in the historical
   timbrature page, so in the dashboard the note ran at full size over four lines. */
.timeAutoExitNotice{
  display: block;
  width: fit-content;
  margin: 3px auto 0;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  cursor: help;
}
.timeDayInputWrap{ display: inline-flex; }
.timeDayInput{
  width: 64px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.timeDayInput.isEmpty{ color: var(--text-3); }
.timeDayInput::placeholder{ color: var(--text-disabled); }
tr:hover .timeDayInput{ border-color: var(--border); background: var(--surface); }
.timeDayInput:focus{ border-color: var(--brand) !important; background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.timeDayInput[data-saving="1"]{ opacity: .55; }
.timeDayPositionCell{ max-width: 240px; color: var(--text-2); font-size: var(--fs-12); }
.timeDayLocations summary{
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  list-style: none;
  cursor: pointer;
  color: var(--text-2);
}
.timeDayLocations summary::-webkit-details-marker{ display: none; }
.timeDayLocations summary:hover{ color: var(--text); }
.timeDayLocationPreview{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeDayLocationCount{
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.timeDayLocationList{ display: grid; gap: 8px; padding: 6px 0 4px; }
.timeDayLocationEntry strong{ display: block; color: var(--text); font-size: var(--fs-12); font-weight: 600; }
.timePunchLocation{ display: grid; gap: 2px; }
.timePunchLocation small{ color: var(--warning); }
.timeSecondShift{ border-left: 1px solid var(--divider); }

/* Settings & QR dialogs */
#timeSettingsOverlay .uiDialog{ width: min(520px, 100%); }
.timeSettingsSection{ display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.timeSettingsIcon{ display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; background: var(--bg-muted); color: var(--text-2); }
.timeSettingsIcon svg{ width: 19px; height: 19px; }
.timeSettingsSectionText{ flex: 1 1 auto; min-width: 0; }
.timeSettingsSectionTitle{ color: var(--text); font-size: var(--fs-14); font-weight: 600; }
.timeSettingsSectionText p{ margin-top: 2px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
#timeQrOverlay .uiDialog{ width: min(460px, 100%); }
.timeQrHead{ min-width: 0; }
.timeQrTitle{ font-size: var(--fs-18); font-weight: 600; }
.timeQrSub{ margin-top: 2px; color: var(--text-2); font-size: var(--fs-13); }
.timeQrStage{ display: grid; justify-items: center; gap: 12px; padding-top: 8px !important; }
.timeQrStageInner{
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  aspect-ratio: 1;
  padding: 16px;
  border-radius: var(--r-xl);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.timeQrImage{ display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.timeQrLoader{ color: var(--text-2); font-size: var(--fs-13); }
.timeQrError{ color: var(--danger); font-size: var(--fs-13); text-align: center; }

/* Mid widths: three cards would squeeze titles and help onto three lines.
   GPS and QR share a row, the automatic exit takes the full row below. */
@media (max-width: 1360px){
  .timeModes{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeModes > .cockpitCell:nth-child(3):last-child{ grid-column: 1 / -1; }
}
@media (max-width: 720px){
  .timeModes{ grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px){
  .timeToolsRight{ width: 100%; }
  .timeToolsRight .timePdfBtn{ margin-left: auto; }
  .timeSearchWrap{ flex: 1 1 100%; }
}
@media (max-width: 560px){
  .timeModes{ --time-mode-icon: 34px; --time-mode-gap: 10px; gap: 10px; margin-bottom: 14px; }
  .timeModes > .cockpitCell{ gap: 6px; padding: 12px 14px; }
}
/* Phones: month, settings and print stay on one line instead of leaving «Stampa ore mese» alone below. */
@media (max-width: 480px){
  .timeToolsRight{ flex-wrap: nowrap; }
  .timeToolsRight .timeMonthWrap{ flex: 1 1 auto; min-width: 0; }
  .timeToolsRight .timeMonthInput{ width: 100%; min-width: 0; }
  .timeToolsRight .timePdfBtn{ flex: 0 0 auto; width: var(--ctl-h); margin-left: 0; padding: 0; justify-content: center; }
  .timeToolsRight .timePdfBtn > span{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* ===================== Permessi e assenze ===================== */
.paTabs{
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  scrollbar-width: none;
}
.paTabs::-webkit-scrollbar{ display: none; }
.paTabBtn{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  color: var(--text-2);
  font-size: var(--fs-14);
  font-weight: 500;
  white-space: nowrap;
}
.paTabBtn:hover{ color: var(--text); background: var(--bg-hover); }
.paTabBtn::after{
  content: "";
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}
.paTabBtn.isActive,
.paTabBtn[aria-pressed="true"]{ color: var(--text); }
.paTabBtn.isActive::after,
.paTabBtn[aria-pressed="true"]::after{ background: var(--text); }
.paTabLabel{ display: inline-flex; align-items: center; gap: 7px; }
.paTabLabel i{ width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.paTabBtn[data-pa-tab="pending"] .paTabLabel i{ background: var(--warning-solid); }
.paTabBtn[data-pa-tab="approved"] .paTabLabel i{ background: var(--success-solid); }
.paTabBtn[data-pa-tab="rejected"] .paTabLabel i{ background: var(--danger-solid); }
.paTabBtn[data-pa-tab="all"] .paTabLabel i{ display: none; }
.paTabMeta{
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.paTabBtn[data-pa-tab="pending"].isActive .paTabMeta{ background: var(--warning-soft); color: var(--warning); }

.paResultsMeta{ order: 3; color: var(--text-3); font-size: var(--fs-13); white-space: nowrap; font-variant-numeric: tabular-nums; }
.paToolsBar .uiToolbarMeta{ display: none; }

@media (min-width: 721px){ .paMatchTable{ min-width: 860px; } }
.paMatchTable col.colPerson{ width: 28%; }
.paMatchTable col.colPeriod{ width: 24%; }
.paMatchTable col.colKind{ width: 22%; }
.paMatchTable col.colState{ width: 13%; }
.paMatchTable col.colAction{ width: 120px; }
.paMatchTable .actionsHead,
.paActionsCell{ text-align: right; }
#paTableBody tr[data-pa-id]{ cursor: pointer; }
.paPerson{ display: flex; align-items: center; gap: 12px; min-width: 0; }
.paAvatar{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
}
.paCellText{ display: grid; gap: 1px; min-width: 0; }
.paCellText strong{ overflow: hidden; color: var(--text); font-size: var(--fs-14); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paCellText span{ overflow: hidden; color: var(--text-2); font-size: var(--fs-13); text-overflow: ellipsis; white-space: nowrap; }
.paCellText span:empty{ display: none; }
#paTableBody td[data-label="Periodo"] .paCellText strong{ white-space: normal; }

.paStatus{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}
.paStatus::before{ content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.paStatus.pending{ background: var(--warning-soft); color: var(--warning); }
.paStatus.approved{ background: var(--success-soft); color: var(--success); }
.paStatus.rejected{ background: var(--danger-soft); color: var(--danger); }
.paStatus.cancelled{ background: var(--bg-muted); color: var(--text-3); }

.paActionBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.paActionBtn svg{ width: 14px; height: 14px; }
.paActionBtn:hover{ background: var(--bg-subtle); }
.paActionBtn.paReviewBtn{ border-color: transparent; background: var(--inverse); color: var(--on-inverse); }
.paActionBtn.paReviewBtn:hover{ background: var(--inverse-hover); }
.paActionBtn:disabled{ opacity: .55; }
.paEmpty{ display: grid; justify-items: center; gap: 4px; }
.paEmpty strong{ color: var(--text); font-size: var(--fs-15); font-weight: 600; }
.paEmpty span{ color: var(--text-2); font-size: var(--fs-13); }

/* ---------- Request dialog ---------- */
#paDetailOverlay .paRequestDialog{ width: min(560px, 100%); }
#paDetailOverlay .adminDialogHeader{ padding: 18px 16px 10px 24px; }
.paRequestHeading{ display: flex; align-items: center; gap: 12px; min-width: 0; }
.paRequestIcon{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--bg-muted);
  color: var(--text-2);
}
.paRequestIcon svg{ width: 18px; height: 18px; }
.paRequestBody{ flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 24px 20px; }
.paRequestIdentity{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 2px 16px;
}
.paRequestIdentity h3{ color: var(--text); font-size: var(--fs-20); font-weight: 600; letter-spacing: -.015em; }
.paRequestIdentity #paDetailStatus{ grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.paRequestIdentity p{ color: var(--text-2); font-size: var(--fs-13); }
.paRequestCompany{ grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; color: var(--text-2); font-size: var(--fs-13); }
.paRequestLabel{ display: block; margin: 0 0 4px; color: var(--text-3); font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; text-transform: none; }
.paRequestCompany .paRequestLabel{ display: inline; margin: 0; }
.paRequestFacts{
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 2fr);
  gap: 16px;
  margin-top: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}
.paRequestFacts > div > span:last-child{ display: block; color: var(--text); font-size: var(--fs-15); font-weight: 600; font-variant-numeric: tabular-nums; }
.paRequestText{ margin-top: 16px; }
.paRequestText p{ color: var(--text); font-size: var(--fs-14); line-height: 1.55; white-space: pre-line; }
.paRequestDates{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; color: var(--text-2); font-size: var(--fs-13); font-variant-numeric: tabular-nums; }
.paRequestReceipts{ margin-top: 18px; border-top: 1px solid var(--divider); padding-top: 12px; }
.paRequestReceipts summary{ display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-13); font-weight: 500; cursor: pointer; list-style: none; }
.paRequestReceipts summary::-webkit-details-marker{ display: none; }
.paRequestReceipts summary::after{ content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s var(--ease); }
.paRequestReceipts[open] summary::after{ transform: rotate(225deg) translateY(-1px); }
.paRequestReceipts dl{ display: grid; gap: 10px; margin: 12px 0 0; }
.paRequestReceipts dl > div{ display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.paRequestReceipts dt{ color: var(--text-3); font-size: var(--fs-12); }
.paRequestReceipts dd{ margin: 0; color: var(--text); font-size: var(--fs-13); }
.paRequestFooter{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--divider);
}
.paDecisionHint{ flex: 1 1 auto; color: var(--text-2); font-size: var(--fs-13); }
.paDecisionHint:empty{ display: none; }
.paRequestActions{ display: flex; gap: 8px; }
.paRequestFooter .paActionBtn{ height: var(--ctl-h); padding: 0 18px; font-size: var(--fs-14); }
.paRejectBtn{ color: var(--danger) !important; }
.paRejectBtn:hover{ background: var(--danger-soft) !important; border-color: transparent !important; }
.paApproveBtn{ border-color: transparent !important; background: var(--inverse) !important; color: var(--on-inverse) !important; }
.paApproveBtn:hover{ background: var(--inverse-hover) !important; }
#paDetailOverlay [hidden]{ display: none !important; }

@media (max-width: 860px){
  .paSearchWrap{ flex: 1 1 100%; }
}
@media (max-width: 560px){
  /* Phones: each request becomes a two-line card (who + status, when + action). */
  .paMatchTable,
  .paMatchTable thead,
  .paMatchTable tbody{ display: block; }
  .paMatchTable colgroup{ display: none; }
  .paMatchTable thead tr{ display: flex; }
  .paMatchTable thead th{ display: none; }
  .paMatchTable thead th:first-child{ display: flex; align-items: center; flex: 1 1 auto; }
  #paTableBody tr[data-pa-id]{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
  }
  #paTableBody tr[data-pa-id]:last-child{ border-bottom: 0; }
  #paTableBody tr[data-pa-id] > td{ display: block; height: auto; padding: 0 !important; border: 0 !important; background: transparent !important; }
  #paTableBody tr[data-pa-id] > td:nth-child(1){ grid-column: 1; grid-row: 1; }
  #paTableBody tr[data-pa-id] > td:nth-child(2){ grid-column: 1; grid-row: 2; padding-left: 80px !important; }
  #paTableBody tr[data-pa-id] > td:nth-child(3){ display: none; }
  #paTableBody tr[data-pa-id] > td:nth-child(4){ grid-column: 2; grid-row: 1; align-self: center; justify-self: end; }
  #paTableBody tr[data-pa-id] > td:nth-child(5){ grid-column: 2; grid-row: 2; align-self: end; }
  #paTableBody tr[data-pa-id]:hover{ background: var(--bg-subtle); }
  #paTableBody tr[data-pa-id][data-ui-selected="true"]{ background: var(--brand-soft); }
  #paTableBody tr:not([data-pa-id]){ display: block; }
  #paTableBody tr:not([data-pa-id]) > td{ display: block; }
}
/* ===================== Impostazioni ===================== */
.settingsGrid{ display: grid; gap: 0; border-top: 1px solid var(--divider); }
.settingsSection{
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 16px 48px;
  padding: 28px 0;
  border-bottom: 1px solid var(--divider);
}
.settingsSectionTitle{ color: var(--text); font-size: var(--fs-15); font-weight: 600; letter-spacing: -.01em; }
.settingsSectionText{ margin-top: 4px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.settingsSectionBody{ min-width: 0; max-width: 640px; }
.settingsAction{ display: grid; justify-items: start; gap: 12px; }
.settingsDescription{ color: var(--text-2); font-size: var(--fs-14); line-height: 1.55; }
.settingsHint{ color: var(--text-3); font-size: var(--fs-13); }
.settingsHint:empty{ display: none; }
.settingsLabel{ color: var(--text-2); font-size: var(--fs-13); }
.settingsValue{ margin: 0; color: var(--text); font-size: var(--fs-14); font-weight: 500; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.settingsRows{ display: grid; margin: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.settingsRow{ display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 10px 16px; }
.settingsRow + .settingsRow{ border-top: 1px solid var(--divider); }
.settingsRow dt{ flex: 0 0 auto; }
.settingsRow dd{ text-align: right; }
.irCompanyIdentity{ display: flex; align-items: center; gap: 14px; }
.irCompanyMonogram{ width: 44px !important; height: 44px !important; border-radius: 12px !important; font-size: 14px !important; }
.irCompanyName{ color: var(--text); font-size: var(--fs-18); font-weight: 600; letter-spacing: -.015em; }
#btnManageSubscription.isLoading{ opacity: .7; pointer-events: none; }
.settingsThemePicker .uiSegmented button{ height: 32px; padding: 0 14px; }
.settingsThemePicker .uiSegmented button span{ display: inline; }

/* Electronic invoice button (rebuilt by invoice-requests.js) */
.irOpenButton{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--ctl-h);
  padding: 0 12px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 500;
}
.irOpenButton:hover{ background: var(--bg-subtle); }
.irOpenButton svg{ width: 16px; height: 16px; color: var(--text-3); }
.irOpenButton[data-status="loading"]{ opacity: .7; }
.irOpenButton[data-status="sent"],
.irOpenButton[data-status="saved"]{ border-color: transparent; background: var(--success-soft); color: var(--success); }
.irOpenButton > *:not(svg){ min-width: 0; }
.irLogoutButton svg{ width: 16px; height: 16px; }

@media (max-width: 860px){
  .settingsSection{ grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 22px 0; }
  .settingsRow{ flex-direction: column; align-items: flex-start; gap: 2px; }
  .settingsRow dd{ text-align: left; }
}
/* ===================== Ambassador ===================== */
.ambGrid{ display: grid; gap: 20px; }
.ambLinkCard,
.ambLeadsCard{ padding: 20px 22px 22px; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); }
.ambLinkHead{ display: grid; gap: 4px; margin-bottom: 14px; }
.ambLinkHelp{ color: var(--text-2); font-size: var(--fs-13); }
.ambLinkBox{
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  height: 46px;
  padding: 0 6px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-inset);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.ambLinkBox:hover{ border-color: var(--border-strong); }
.ambLinkBox.isDisabled{ cursor: not-allowed; opacity: .6; }
.ambLinkInput{
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  text-overflow: ellipsis;
  cursor: inherit;
}
.ambLinkInput:focus{ box-shadow: none; }
.ambCopyIcon{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 0 12px;
  border-radius: var(--r-pill);
  background: var(--inverse);
  color: var(--on-inverse);
  font-size: var(--fs-13);
  font-weight: 500;
}
.ambCopySvg{ width: 15px; height: 15px; }
.ambCopySvg.iconCheck{ display: none; }
.ambCopyable.isCopied .ambCopySvg.iconCopy{ display: none; }
.ambCopyable.isCopied .ambCopySvg.iconCheck{ display: inline; }
.ambCopyable.isCopied .ambCopyIcon{ background: var(--success-solid); color: #fff; }
.ambCopyable.isCopied .ambCopyLabel{ font-size: 0; }
.ambCopyable.isCopied .ambCopyLabel::after{ content: "Copiato"; font-size: var(--fs-13); }
.ambLeadsHead{ display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ambLeadsHeadLeft{ display: grid; gap: 4px; }
.settingsCardMeta{ color: var(--text-3); font-size: var(--fs-13); }
.ambLeadFilters{ display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--bg-muted); }
.ambFilterBtn{ height: 28px; padding: 0 14px; border-radius: var(--r-pill); color: var(--text-2); font-size: var(--fs-13); font-weight: 500; }
.ambFilterBtn:hover{ color: var(--text); }
.ambFilterBtn.isActive{ background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs), 0 0 0 1px var(--border); }
:root[data-theme="dark"] .ambFilterBtn.isActive{ background: var(--bg-active); box-shadow: none; }
.ambMatchTable{ min-width: 640px; }
.ambEmailCell{ color: var(--text-2); }
.ambStatus{ display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: var(--fs-12); font-weight: 500; }
.ambStatusPremium{ background: var(--brand-soft); color: var(--brand-text); }
.ambStatusFree{ background: var(--bg-muted); color: var(--text-2); }
/* ===================== Premium gate ===================== */
.hrGateOverlay{ z-index: 4000 !important; background: var(--bg) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.hrGateCard{
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(920px, 100%) !important;
  max-height: calc(100dvh - 32px) !important;
  overflow: auto !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm) !important;
}
.hrGateLeft{ display: grid; align-content: start; gap: 12px; padding: 40px; }
.hrGateMark{ width: 40px; height: 40px; border-radius: 11px; }
.hrGateEyebrow{ margin-top: 10px; color: var(--brand-text); font-size: var(--fs-13); font-weight: 600; }
.hrGateTitle{ color: var(--text); font-size: var(--fs-28); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
.hrGateText{ color: var(--text-2); font-size: var(--fs-15); line-height: 1.55; }
.hrGatePriceRow{ display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.hrGatePriceAmount{ color: var(--text); font-size: var(--fs-36); font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hrGatePricePeriod{ color: var(--text-2); font-size: var(--fs-15); }
.hrGateBtns{ display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hrGateBtn{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--ctl-h-lg);
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 500;
  text-decoration: none;
}
.hrGateBtn:hover{ background: var(--bg-subtle); text-decoration: none; }
.hrGateBtn.primary{ border-color: transparent; background: var(--inverse); color: var(--on-inverse); }
.hrGateBtn.primary:hover{ background: var(--inverse-hover); }
.hrGateBtn.primary.isLoading{ padding-left: 46px; pointer-events: none; opacity: .85; }
.hrGateBtn.primary.isLoading::before{
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: uiSpin .8s linear infinite;
}
.hrGateRight{
  display: grid;
  align-content: center;
  gap: 4px;
  margin: 0;
  padding: 28px;
  list-style: none;
  border-left: 1px solid var(--divider);
  background: var(--surface-inset);
}
.hrGateFeature{ display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px; }
.hrGateFeatureIcon{ display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.hrGateFeatureIcon svg{ width: 17px; height: 17px; }
.hrGateFeatureName{ display: block; color: var(--text); font-size: var(--fs-14); font-weight: 600; }
.hrGateFeatureDesc{ display: block; color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
@media (max-width: 760px){
  .hrGateCard{ grid-template-columns: minmax(0, 1fr); }
  .hrGateLeft{ padding: 28px 22px; }
  .hrGateRight{ border-left: 0; border-top: 1px solid var(--divider); padding: 18px; }
}
/* ===================== PDF preview ===================== */
.pdfPreviewOverlay{
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease);
}
.pdfPreviewOverlay[aria-hidden="true"]{ display: none; }
.pdfPreviewOverlay[aria-hidden="false"]{ opacity: 1; pointer-events: auto; }
.pdfPreviewShell{
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  min-height: 0;
  border-radius: var(--r-xl);
  background: var(--surface-inset);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: uiDialogIn .2s var(--ease-out);
}
:root[data-theme="dark"] .pdfPreviewShell{ background: #080808; }
.pdfPreviewTopbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  height: 56px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-raised);
}
.pdfTopLeft{ display: flex; align-items: center; gap: 10px; min-width: 0; }
.pdfDocIcon{ display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); }
.pdfDocIcon svg{ width: 16px; height: 16px; }
.pdfFileName{ overflow: hidden; color: var(--text); font-size: var(--fs-14); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.pdfTopRight{ display: flex; align-items: center; gap: 2px; }
.pdfIconBtn,
.pdfCtlBtn{
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-2);
}
.pdfIconBtn:hover,
.pdfCtlBtn:hover{ background: var(--bg-hover); color: var(--text); }
.pdfIconBtn svg,
.pdfCtlBtn svg{ width: 18px; height: 18px; }
.pdfIconBtn:disabled,
.pdfCtlBtn:disabled{ opacity: .35; }
.pdfAssocBanner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--warning-soft);
  color: var(--warning);
}
.pdfAssocBanner[aria-hidden="true"]{ display: none; }
.pdfAssocLeft{ display: flex; align-items: center; gap: 10px; font-size: var(--fs-13); font-weight: 500; }
.pdfAssocDot{ display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warning-solid); color: #fff; font-size: 12px; font-weight: 700; }
.pdfAssocBtns{ display: flex; gap: 6px; }
.pdfAssocBtn{ height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--text); font-size: var(--fs-13); font-weight: 500; }
.pdfAssocBtnConfirm{ border-color: transparent; background: var(--inverse); color: var(--on-inverse); }
.pdfAssocBtnReject{ color: var(--danger); }
.pdfPreviewCanvasWrap{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  overscroll-behavior: contain;
}
.pdfPreviewPage{ display: flex; justify-content: center; margin: 0 auto 20px; }
.pdfPreviewPaper{ background: #ffffff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .1); overflow: hidden; }
.pdfPreviewPaper canvas{ display: block; }
.pdfPreviewFrame{ display: none; flex: 1 1 auto; width: 100%; border: 0; background: #fff; }
.pdfPreviewShell[data-frame="1"] .pdfPreviewFrame,
.pdfPreviewFrame[aria-hidden="false"]{ display: block; }
.pdfPreviewControls{
  position: absolute;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-pop);
  transform: translateX(-50%);
}
.pdfPageIndicator{ min-width: 92px; padding: 0 6px; color: var(--text-2); font-size: var(--fs-13); text-align: center; font-variant-numeric: tabular-nums; }
.pdfCtlSep{ width: 1px; height: 20px; margin: 0 4px; background: var(--divider); }
.pdfLoadingOverlay{ position: absolute; inset: 56px 0 0; z-index: 3; display: none; align-items: center; justify-content: center; background: var(--surface-inset); }
.pdfLoadingOverlay[data-on="1"]{ display: flex; }
.pdfLoadingCard{ display: grid; justify-items: center; gap: 12px; padding: 24px; color: var(--text-2); font-size: var(--fs-14); }
.pdfLoadingOverlay[data-error="1"] .pdfLoadingSpinner{ display: none; }
.pdfLoadingOverlay[data-error="1"] .pdfLoadingText{ color: var(--danger); }
#btnPdfPreviewRetry{ height: 32px; padding: 0 14px; border-radius: var(--r-pill); background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-13); font-weight: 500; }
.pdfPreviewShell[data-loading="1"] .pdfPreviewControls{ opacity: .5; pointer-events: none; }
@media (max-width: 720px){
  .pdfPreviewOverlay{ padding: 0; }
  .pdfPreviewShell{ border-radius: 0; }
  .pdfPreviewCanvasWrap{ padding: 12px 8px 80px; }
}
/* ===================== Support chat launcher ===================== */
.ilpSupportWidget{
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  color: var(--text);
}
body.admin-modal-open .ilpSupportWidget,
body.modalOpen .ilpSupportWidget,
body.ilpSideOpen .ilpSupportWidget,
body[data-ilp-boot="1"] .ilpSupportWidget{ display: none !important; }
.ilpSupportLauncher{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 20px rgba(28, 111, 230, .32), 0 2px 6px rgba(13, 13, 13, .12);
  transition: background-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.ilpSupportLauncher:hover{ background: var(--brand-hover); }
.ilpLaunchIcon{ display: block; flex: 0 0 28px; width: 28px; height: 28px; margin: 0; padding: 0; }
.ilpSupportLauncher .ilpLaunchIcon svg{ display: block; width: 28px; height: 28px; margin: 0; }
.ilpSupportWidget.isOpen .ilpSupportLauncher{ opacity: 0; pointer-events: none; }
.ilpSupportLauncher::after,
.ilpSupportAvatar::after{
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--success-solid);
  display: none;
}
.ilpSupportWidget.supportOnline .ilpSupportLauncher::after,
.ilpSupportWidget.supportOnline .ilpSupportAvatar::after{ display: block; }
.ilpSupportPanel{
  position: absolute;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  width: min(392px, calc(100vw - 28px));
  height: min(620px, calc(100dvh - 100px));
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  transform-origin: 100% 100%;
}
.ilpSupportWidget.isOpen .ilpSupportPanel{ display: flex; animation: uiDialogIn .22s var(--ease-out) both; }
.ilpSupportHead{ display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px; border-bottom: 1px solid var(--divider); }
.ilpSupportHeadL{ display: flex; align-items: center; gap: 12px; min-width: 0; }
.ilpSupportAvatar{ position: relative; display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); }
.ilpSupportAvatar svg{ width: 26px; height: 26px; }
.ilpSupportTitleWrap{ display: grid; gap: 2px; min-width: 0; }
.ilpSupportTitle{ margin: 0; color: var(--text); font-size: var(--fs-16); font-weight: 600; }
.ilpSupportStatusLine{ display: none; }
.ilpSupportClose{ display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--text-2); }
.ilpSupportClose:hover{ background: var(--bg-hover); color: var(--text); }
.ilpSupportClose svg{ width: 18px; height: 18px; }
.ilpSupportMessages{ display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; overflow: auto; padding: 14px 16px; }
.ilpSupportRow{ display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.ilpSupportRow.me{ align-self: flex-end; flex-direction: row-reverse; }
.ilpSupportRowAvatar{ display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); }
.ilpSupportRowAvatar svg{ width: 20px; height: 20px; }
.ilpSupportBubble{ max-width: 100%; padding: 10px 14px; border-radius: 18px; font-size: var(--fs-14); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ilpSupportBubble.bot{ align-self: flex-start; background: var(--bg-muted); color: var(--text); border-bottom-left-radius: 6px; }
.ilpSupportBubble.customer{ align-self: flex-end; max-width: 84%; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.ilpSupportBubble.admin{ align-self: flex-start; background: var(--success-soft); color: var(--text); border-bottom-left-radius: 6px; }
.ilpSupportBubble.system{ align-self: center; max-width: 92%; border-radius: 12px; background: transparent; color: var(--text-3); font-size: var(--fs-12); text-align: center; }
.ilpSupportTime{ display: block; margin-top: 4px; font-size: 10.5px; opacity: .6; }
.ilpSupportTyping{ align-self: flex-start; padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--bg-muted); color: var(--text-2); font-size: var(--fs-13); }
.ilpSupportComposer{ flex: 0 0 auto; padding: 10px 14px 14px; }
.ilpSupportInputWrap{ display: flex; align-items: flex-end; gap: 6px; min-height: 46px; padding: 4px 4px 4px 6px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); }
.ilpSupportInputWrap:focus-within{ border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.ilpSupportComposer textarea{ display: block; flex: 1 1 auto; min-width: 0; height: 38px; min-height: 38px; max-height: 112px; padding: 9px 6px 9px 10px; border: 0; background: none; color: var(--text); font-size: var(--fs-14); line-height: 20px; resize: none; }
.ilpSupportComposer textarea::placeholder{ color: var(--text-3); }
.ilpSupportComposer textarea:focus{ box-shadow: none; }
.ilpSupportComposer button{ display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--inverse); color: var(--on-inverse); }
.ilpSupportComposer button:disabled{ opacity: .3; }
.ilpSupportComposer button svg{ width: 17px; height: 17px; }
.ilpSupportFoot{ display: none !important; }
@media (max-width: 560px){
  .ilpSupportWidget{ right: 14px; bottom: 14px; }
  .ilpSupportPanel{ width: calc(100vw - 24px); height: min(640px, calc(100dvh - 88px)); }
}
/* ===================== Print ===================== */
@media print{
  :root{ color-scheme: light; }
  body{ overflow: visible !important; background: #fff !important; color: #000 !important; }
  .sideNav, .adminTopbar, .ilpSupportWidget, .uiBulkBar, .uiToolbar, .empToolsBar, .timeToolsBar, .paToolsBar, .sectionLoadOverlay{ display: none !important; }
  .pageShell, #adminContentRoot, #adminContentRoot > *{ display: block !important; height: auto !important; overflow: visible !important; }
}
/* Full viewport shared engine; no extra dashboard toolbar. */
#payrollUploadView { position: fixed; inset: 0; z-index: 2147482000; margin: 0; padding: 0; width: 100%; height: 100dvh; overflow: hidden; background: var(--bg); }
#payrollUploadView[hidden] { display: none !important; }
body.ilpUploadFullscreen > :not(#payrollUploadView):not(dialog):not(script):not(style) { visibility: hidden !important; }
#payrollUploadView .uiUploadPage { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.uiUploadClose { position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 50%; color: var(--text); background: var(--bg); cursor: pointer; }
.uiUploadClose svg { width: 20px; height: 20px; pointer-events: none; }
.uiUploadClose:hover { background: var(--surface-2, var(--bg)); }
.uiUploadClose:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 3px; }
#payrollUploadView:is([data-upload-phase="match"], [data-upload-phase="sending"], [data-upload-phase="history"], [data-upload-phase="directory"]) .uiUploadClose { display: none; }
.uiUploadNotice { padding: 8px 64px 8px 20px; font-size: 13px; color: var(--warning); background: var(--warning-soft); border-bottom: 1px solid var(--border); }
.uiUploadContent { position: relative; display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--bg); }
.uiUploadFrame { display: block; flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; border: 0; background: var(--bg); }
.uiUploadFrame[hidden], .uiUploadStatus[hidden], .uiUploadNotice[hidden], .uiUploadStatus button[hidden] { display: none !important; }
.uiUploadStatus { flex: 1; align-self: center; padding: 24px; text-align: center; color: var(--text-2); font-size: 14px; }
.uiUploadStatus.isError { color: var(--danger); }
.uiUploadStatus p { margin: 0 0 16px; }
.uiUploadBootBar { width: min(320px, 100%); height: 4px; margin: 0 auto; overflow: hidden; border-radius: 999px; background: var(--border); }
.uiUploadBootBar span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--accent, #2563eb); animation: uiUploadBoot 1.2s ease-in-out infinite alternate; }
.uiUploadStatus.isError .uiUploadBootBar { display: none; }
@keyframes uiUploadBoot { to { transform: translateX(185%); } }
@media (prefers-reduced-motion: reduce) { .uiUploadBootBar span { animation: none; } }

/* >>> ilpCompanyDialog */
/* ===== Company check dialog (November 2026) =====
   Same layer in the engine (#adminModal, --e-*) and in the dashboard (--text, --border):
   only the scope and the token mapping below differ. Hooks set by company-account.js:
   data-mode (add | verify | upload), data-compare, data-phase, data-busy, .cg-live[data-tone]. */
#ilpCompanyDialog{--cg-font:var(--font-sans);--cg-mono:var(--font-mono);--cg-text:var(--text);--cg-text-2:var(--text-2);--cg-text-3:var(--text-3);--cg-surface:var(--surface-raised);--cg-subtle:var(--bg-subtle);--cg-muted:var(--bg-muted);--cg-border:var(--border);--cg-border-strong:var(--border-strong);--cg-divider:var(--divider);--cg-hover:var(--bg-hover);--cg-inverse:var(--inverse);--cg-inverse-hover:var(--inverse-hover);--cg-on-inverse:var(--on-inverse);--cg-brand:var(--brand);--cg-brand-ring:var(--brand-soft-2);--cg-success:var(--success);--cg-success-icon:var(--success-solid);--cg-success-soft:var(--success-soft);--cg-warning:var(--warning);--cg-warning-soft:var(--warning-soft);--cg-danger:var(--danger);--cg-danger-soft:var(--danger-soft);--cg-shadow:var(--shadow-modal);--cg-scrim:var(--scrim);--cg-focus:var(--focus-ring);--cg-ease:var(--ease);}
#ilpCompanyDialog, #ilpCompanyDialog *{box-sizing:border-box;}
#ilpCompanyDialog{
  width:min(520px,calc(100vw - 32px));min-height:0;max-height:min(780px,calc(100dvh - 48px));
  margin:auto;padding:0;border:0;border-radius:20px;overflow:hidden;
  background:var(--cg-surface);color:var(--cg-text);box-shadow:var(--cg-shadow);
  font:400 14px/1.5 var(--cg-font);letter-spacing:-.003em;
  font-feature-settings:"ss01" 0,"cv11" 1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;
}
#ilpCompanyDialog:not([open]){display:none;}
#ilpCompanyDialog[open]{display:flex;flex-direction:column;animation:ilpCompanyDialogIn .22s cubic-bezier(.16,1,.3,1);}
#ilpCompanyDialog::backdrop{background:var(--cg-scrim,rgba(13,13,13,.38));-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);}
#ilpCompanyDialog [hidden]{display:none!important;}

/* Title and one line on what to do */
#ilpCompanyDialog .uiDialogHead{display:block;flex:0 0 auto;min-height:0;padding:28px 28px 0;border:0;background:none;}
#ilpCompanyDialog h2{margin:0;color:var(--cg-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:-.018em;text-wrap:balance;}
#ilpCompanyDialog h2:focus,#ilpCompanyDialog h2:focus-visible{outline:none;box-shadow:none;}
#ilpCompanyDialog .uiDialogBody{flex:1 1 auto;min-height:0;padding:8px 28px 0;overflow:auto;overscroll-behavior:contain;
  /* A hairline appears at the top or bottom edge only while there is more content to scroll. */
  background:linear-gradient(var(--cg-surface),var(--cg-surface)) top/100% 2px no-repeat local,linear-gradient(var(--cg-surface),var(--cg-surface)) bottom/100% 2px no-repeat local,
    linear-gradient(var(--cg-border),var(--cg-border)) top/100% 1px no-repeat scroll,linear-gradient(var(--cg-border),var(--cg-border)) bottom/100% 1px no-repeat scroll;}
#ilpCompanyDialog #cg-reason{margin:0;color:var(--cg-text-2);font-size:14.5px;font-weight:400;line-height:1.55;white-space:normal;text-wrap:pretty;}

/* Comparison: account above, PDF below, joined by one connector */
#ilpCompanyDialog #cg-companies{display:block;margin:22px 0 0;padding:0;border:1px solid var(--cg-border);border-radius:14px;list-style:none;max-height:none;overflow:visible;background:transparent;}
#ilpCompanyDialog #cg-companies>li{position:relative;display:block;min-width:0;margin:0;padding:17px 18px 17px 62px;font-size:14px;}
#ilpCompanyDialog #cg-companies>li+li{border-top:1px solid var(--cg-border);}
#ilpCompanyDialog .cg-node{position:absolute;left:16px;top:15px;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--cg-muted);box-shadow:inset 0 0 0 1px var(--cg-border);color:var(--cg-text-2);}
#ilpCompanyDialog .cg-node svg{display:block;width:16px;height:16px;}
#ilpCompanyDialog:is([data-compare="different"],[data-compare="pdf"]) #cg-detected .cg-node{background:var(--cg-warning-soft);box-shadow:none;color:var(--cg-warning);}
#ilpCompanyDialog #cg-account::after{content:"";position:absolute;left:30.5px;top:51px;bottom:-11px;border-left:1px dashed var(--cg-border-strong);}
#ilpCompanyDialog .cg-vs{position:absolute;z-index:1;left:20px;top:-11.5px;display:none;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--cg-surface);box-shadow:inset 0 0 0 1px var(--cg-border);color:var(--cg-text-2);}
#ilpCompanyDialog[data-compare="different"] .cg-vs{display:grid;}
#ilpCompanyDialog .cg-vs svg{display:block;width:12px;height:12px;}
#ilpCompanyDialog .cg-rowHead{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:0 12px;min-width:0;margin:0 0 3px;}
#ilpCompanyDialog .cg-companyHeading{margin:0;color:var(--cg-text-2);font-size:12.5px;font-weight:500;line-height:20px;letter-spacing:0;}
#ilpCompanyDialog #cg-account-email{display:block;min-width:0;margin:0;color:var(--cg-text-2);font-size:12.5px;line-height:20px;overflow-wrap:anywhere;}
#ilpCompanyDialog #cg-account-email span:first-child{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}
#ilpCompanyDialog[data-code="COMPANY_EMPLOYEE_CONFLICT"] #cg-account-email{display:none;}
#ilpCompanyDialog .cg-companyDetails{display:grid;gap:12px;min-width:0;}
#ilpCompanyDialog .cg-company{display:grid;gap:3px;min-width:0;}
#ilpCompanyDialog .cg-company strong{color:var(--cg-text);font-size:16px;font-weight:600;line-height:1.35;letter-spacing:-.011em;overflow-wrap:anywhere;}
#ilpCompanyDialog .cg-ids{display:flex;flex-wrap:wrap;gap:2px 16px;min-width:0;color:var(--cg-text-2);font-size:13px;line-height:1.5;}
#ilpCompanyDialog .cg-id{display:inline-flex;align-items:baseline;gap:6px;min-width:0;color:var(--cg-text-2);}
#ilpCompanyDialog .cg-idLabel{color:var(--cg-text-2);}
#ilpCompanyDialog .cg-idValue{color:var(--cg-text);font-family:var(--cg-mono);font-size:12.5px;letter-spacing:0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
#ilpCompanyDialog .cg-company--note strong{color:var(--cg-text-2);font-size:14px;font-weight:500;letter-spacing:-.003em;}

/* What adding the company costs; Stripe asks monthly or annual */
#ilpCompanyDialog #cg-help{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 16px;margin:14px 2px 0;color:var(--cg-text-2);font-size:13.5px;line-height:1.5;white-space:normal;}
#ilpCompanyDialog .cg-offerPrice{color:var(--cg-text);font-weight:500;font-variant-numeric:tabular-nums;}
#ilpCompanyDialog[data-phase="waiting"] #cg-help{display:none!important;}

/* Live feedback: waiting for payment, not confirmed yet, errors */
#ilpCompanyDialog .cg-live{display:grid;grid-template-columns:minmax(0,1fr);row-gap:8px;margin:0;}
#ilpCompanyDialog .cg-live:has(> :not([hidden])){margin-top:16px;}
#ilpCompanyDialog .cg-live[data-tone]{grid-template-columns:16px minmax(0,1fr);column-gap:10px;margin-top:16px;padding:12px 14px;border-radius:12px;background:var(--cg-subtle);box-shadow:inset 0 0 0 1px var(--cg-border);color:var(--cg-text);}
#ilpCompanyDialog .cg-live[data-tone]::before{content:"";grid-row:1;align-self:start;width:16px;height:16px;margin-top:2px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5M12 16.2v.3'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5M12 16.2v.3'/%3E%3C/svg%3E") center/contain no-repeat;}
#ilpCompanyDialog .cg-live[data-tone="progress"]::before{width:8px;height:8px;margin:6px 4px 0;border-radius:50%;background:var(--cg-brand);-webkit-mask:none;mask:none;box-shadow:0 0 0 0 var(--cg-brand-ring);animation:ilpCompanyPulse 1.6s cubic-bezier(.4,0,.6,1) infinite;}
#ilpCompanyDialog .cg-live[data-tone="warning"]{background:var(--cg-warning-soft);box-shadow:none;color:var(--cg-warning);}
#ilpCompanyDialog .cg-live[data-tone="error"]{background:var(--cg-danger-soft);box-shadow:none;color:var(--cg-danger);}
#ilpCompanyDialog #cg-status{grid-column:-2;margin:0;color:inherit;font-size:13.5px;font-weight:400;line-height:1.5;overflow-wrap:anywhere;}
#ilpCompanyDialog .cg-live[data-tone="progress"] #cg-status{color:var(--cg-text);}
#ilpCompanyDialog #cg-payment-back{grid-column:-2;justify-self:start;}

/* Actions */
#ilpCompanyDialog .uiDialogFoot{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-end;gap:8px;flex:0 0 auto;padding:24px 28px;border:0;background:none;}
#ilpCompanyDialog .uiBtn{
  --btn-bg:transparent;--btn-fg:var(--cg-text);--btn-bd:transparent;--btn-bg-hover:var(--cg-hover);
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:0 0 auto;
  width:auto;height:38px;min-height:auto;margin:0;padding:0 18px;border:1px solid var(--btn-bd);border-radius:999px;
  background:var(--btn-bg);color:var(--btn-fg);font:500 14px/1 var(--cg-font);letter-spacing:-.003em;
  white-space:nowrap;text-decoration:none;user-select:none;cursor:pointer;box-shadow:none;transform:none;
  transition:background-color .16s var(--cg-ease),border-color .16s var(--cg-ease),color .16s var(--cg-ease),opacity .16s var(--cg-ease);
}
#ilpCompanyDialog .uiBtn--primary{--btn-bg:var(--cg-inverse);--btn-fg:var(--cg-on-inverse);--btn-bg-hover:var(--cg-inverse-hover);order:3;}
#ilpCompanyDialog .uiBtn--secondary{--btn-bg:var(--cg-surface);--btn-bd:var(--cg-border);--btn-bg-hover:var(--cg-subtle);order:2;}
#ilpCompanyDialog .uiBtn:hover{background:var(--btn-bg-hover);text-decoration:none;}
#ilpCompanyDialog .uiBtn:active{filter:brightness(.97);}
#ilpCompanyDialog .uiBtn:disabled{opacity:.45;pointer-events:none;cursor:not-allowed;}
#ilpCompanyDialog .uiBtn:focus-visible{outline:none;box-shadow:var(--cg-focus);}
#ilpCompanyDialog .uiBtn.cg-link{--btn-bg:transparent;--btn-bg-hover:transparent;--btn-fg:var(--cg-text-2);height:auto;min-height:32px;padding:0 2px;border:0;border-radius:6px;order:1;margin-right:auto;}
#ilpCompanyDialog .uiBtn.cg-link:hover{color:var(--cg-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;}
#ilpCompanyDialog .cg-live .uiBtn.cg-link{min-height:0;margin:0;padding:0;color:var(--cg-text);font-size:13.5px;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;}

/* Busy and done states keep their label readable */
#ilpCompanyDialog[data-busy] #cg-add,#ilpCompanyDialog #cg-contact:is([data-state="pending"],[data-state="done"]){opacity:1;}
#ilpCompanyDialog[data-busy] #cg-add{cursor:progress;}
#ilpCompanyDialog[data-busy] #cg-add::before,#ilpCompanyDialog #cg-contact[data-state="pending"]::before{content:"";flex:0 0 auto;width:14px;height:14px;border-radius:50%;border:1.75px solid currentColor;border-right-color:transparent;animation:ilpCompanySpin .7s linear infinite;}
#ilpCompanyDialog #cg-contact[data-state="done"]{color:var(--cg-text);}
#ilpCompanyDialog #cg-contact.uiBtn--primary[data-state="done"]{--btn-bg:var(--cg-success-soft);--btn-fg:var(--cg-text);}
#ilpCompanyDialog #cg-contact[data-state="done"]::before{content:"";flex:0 0 auto;width:16px;height:16px;background:var(--cg-success-icon);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;}

@keyframes ilpCompanyDialogIn{from{opacity:0;transform:translateY(8px) scale(.985);}to{opacity:1;transform:none;}}
@keyframes ilpCompanySheetUp{from{transform:translateY(24px);opacity:0;}to{transform:none;opacity:1;}}
@keyframes ilpCompanySpin{to{transform:rotate(360deg);}}
@keyframes ilpCompanyPulse{0%{box-shadow:0 0 0 0 var(--cg-brand-ring);}70%,100%{box-shadow:0 0 0 7px transparent;}}

/* Phone: bottom sheet, full-width actions, leading action first */
@media(max-width:720px){
  #ilpCompanyDialog{width:100%!important;max-width:100%!important;max-height:calc(100dvh - 24px)!important;border-radius:20px 20px 0 0!important;}
  #ilpCompanyDialog[open]{animation:ilpCompanySheetUp .28s cubic-bezier(.16,1,.3,1)!important;}
  #ilpCompanyDialog .uiDialogHead{padding:24px 20px 0;}
  #ilpCompanyDialog h2{font-size:19px;}
  #ilpCompanyDialog .uiDialogBody{padding:8px 20px 0;}
  #ilpCompanyDialog #cg-companies{margin-top:20px;}
  #ilpCompanyDialog #cg-companies>li{padding:15px 16px 15px 56px;}
  #ilpCompanyDialog .cg-node{left:14px;top:13px;}
  #ilpCompanyDialog #cg-account::after{left:28.5px;top:49px;bottom:-9px;}
  #ilpCompanyDialog .cg-vs{left:18px;}
  #ilpCompanyDialog .uiDialogFoot{flex-direction:column;align-items:stretch;gap:8px;padding:20px 20px calc(16px + env(safe-area-inset-bottom,0px));}
  #ilpCompanyDialog .uiDialogFoot .uiBtn{width:100%;height:46px;font-size:15px;}
  #ilpCompanyDialog .uiDialogFoot .uiBtn--primary{order:1;}
  #ilpCompanyDialog .uiDialogFoot .uiBtn--secondary{order:2;}
  #ilpCompanyDialog .uiDialogFoot .uiBtn.cg-link{order:3;align-self:center;width:auto;height:40px;margin:0;}
}
@media(prefers-reduced-motion:reduce){
  #ilpCompanyDialog[open]{animation:none!important;}
  #ilpCompanyDialog .cg-live[data-tone="progress"]::before{animation:none;}
  #ilpCompanyDialog[data-busy] #cg-add::before,#ilpCompanyDialog #cg-contact[data-state="pending"]::before{animation-duration:1.6s;}
}
/* <<< ilpCompanyDialog */
/* Opening the engine: the bar is enough. The message stays in the live region for screen readers;
   errors keep their visible text and the "Riprova" button. */
.uiUploadStatus:not(.isError) [data-upload-message]{ position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ===================== Impostazioni › Aziende =====================
   Azienda in uso, selettore ed elenco unico delle aziende dell’account.
   Solo token del design system (00-tokens.css): chiaro e scuro seguono il tema. */
.stCompanyBody{ display: grid; gap: 16px; }

/* ---------- Azienda in uso ---------- */
.stCompanyCurrent{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
}
.stCompanyCurrent .irCompanyIdentity{ flex: 1 1 240px; min-width: 0; }
.stCompanyCurrentText{ display: grid; gap: 2px; min-width: 0; }
.stCompanyCurrentText .irCompanyName{ line-height: 1.3; overflow-wrap: anywhere; }
.stCompanyCurrentMeta{ color: var(--text-3); font-size: var(--fs-13); line-height: 1.45; }
.stCompanyCurrentMeta:empty{ display: none; }
.stCompanyBody[data-state="empty"] .stCompanyCurrent,
.stCompanyBody[data-state="error"] .stCompanyCurrent{ display: none; }
.stCompanyBody[data-current="none"] #stCompanyName{ display: none; }
.stCompanyBody[data-current="none"] #stCompanyCurrentLabel{ color: var(--text); font-size: var(--fs-16); font-weight: 600; letter-spacing: -.01em; }
.stCompanyBody[data-current="none"] .irCompanyMonogram{ border: 1px dashed var(--border-strong); background: transparent; color: transparent; }
/* Primo caricamento: segnaposto al posto di nome e monogramma */
.stCompanyBody[data-state="loading"] .irCompanyMonogram,
.stCompanyBody[data-state="loading"] #stCompanyName{
  color: transparent;
  background: linear-gradient(90deg, var(--bg-muted) 0, var(--bg-subtle) 60px, var(--bg-muted) 120px) var(--bg-muted);
  background-size: 480px 100%;
  animation: uiShimmer 1.3s linear infinite;
}
.stCompanyBody[data-state="loading"] #stCompanyName{ width: min(180px, 100%); border-radius: var(--r-sm); }

/* ---------- Selettore ---------- */
.stCompanySelector{ display: grid; gap: 6px; flex: 0 1 260px; min-width: 0; }
.stCompanyBody[data-switchable="false"] .stCompanySelector{ display: none; }
.stCompanySelectWrap{ position: relative; min-width: 0; }
.stCompanySelectWrap select{
  -webkit-appearance: none;
  appearance: none;
  height: 40px;
  padding: 0 38px 0 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.stCompanySelectWrap select:disabled{ cursor: not-allowed; }
.stCompanySelectWrap svg{
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  color: var(--text-3);
  pointer-events: none;
}

/* ---------- Avvisi (stato, pagamento, errori) ---------- */
.stCompanyNotice{
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1.5;
}
.stCompanyNotice[data-tone="info"]{ background: var(--brand-soft); color: var(--brand-text); }
.stCompanyNotice[data-tone="warn"]{ background: var(--warning-soft); color: var(--warning); }
.stCompanyNotice[data-tone="error"]{ background: var(--danger-soft); color: var(--danger); }

/* ---------- Elenco aziende ---------- */
.stCompanyPanel{
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.stCompanyPanelHead{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 52px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--divider);
}
.stCompanyPanelTitle{ display: flex; align-items: baseline; gap: 8px; color: var(--text); font-size: var(--fs-14); font-weight: 600; letter-spacing: -.01em; }
.stCompanyCount{ color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.stCompanyPanelTools{ display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; }
.stCompanyVerified{ color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stCompanyRefresh{ color: var(--text-2); }
.stCompanyRefresh svg{ width: 15px; height: 15px; }
.stCompanyRefresh[data-loading="true"]{ opacity: 1; }
.stCompanyRefresh[data-loading="true"] svg{ animation: uiSpin .9s linear infinite; }

.stCompanyActivations{ display: grid; }
.stCompanyRow{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  min-height: 68px;
  padding: 12px 16px;
}
.stCompanyRow + .stCompanyRow{ border-top: 1px solid var(--divider); }
.stCompanyRow[data-pending="true"]{ background: var(--bg-subtle); }
.stCompanyRow:focus{ outline: none; }
.stCompanyRow:focus-visible{ outline: 2px solid var(--brand); outline-offset: -2px; }

.stCompanyAvatar{
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: .02em;
}
.stCompanyRow[data-state="current"] .stCompanyAvatar{ background: var(--brand); color: #fff; }
.stCompanyRow[data-state="inactive"] .stCompanyAvatar,
.stCompanyRow[data-state="attention"] .stCompanyAvatar{ border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3); }

.stCompanyRowMain{ display: grid; gap: 3px; min-width: 0; }
.stCompanyRowTitle{ display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.stCompanyRowName{ min-width: 0; color: var(--text); font-size: var(--fs-14); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.stCompanyRow[data-state="inactive"] .stCompanyRowName{ color: var(--text-2); }
.stCompanyRowTitle .uiBadge{ height: 20px; padding: 0 7px; }
.stCompanyRowTitle .stCompanyBadgeOff{ background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); }
.stCompanyRowMeta{ color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }

.stCompanyRowActions{ display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.stCompanyRenewal{ color: var(--text-2); }
.stCompanyRenewal:hover{ color: var(--text); }
.stCompanyInUse{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl-h-sm);
  padding: 0 12px 0 10px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.stCompanyInUse svg{ width: 14px; height: 14px; }

/* Caricamento */
.stCompanyRow--skeleton .stCompanyAvatar{ border: 0; }
.stCompanySkelName{ display: block; width: 42%; height: 12px; }
.stCompanySkelMeta{ display: block; width: 26%; height: 10px; margin-top: 4px; }

/* Nessuna azienda / elenco non disponibile */
.stCompanyEmpty{ display: grid; justify-items: center; gap: 6px; padding: 32px 24px; text-align: center; }
.stCompanyEmptyIcon{ display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 4px; border-radius: 12px; background: var(--bg-muted); color: var(--text-2); }
.stCompanyEmptyIcon svg{ width: 20px; height: 20px; }
.stCompanyEmptyTitle{ color: var(--text); font-size: var(--fs-14); font-weight: 600; }
.stCompanyEmptyText{ max-width: 42ch; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.stCompanyEmpty .uiBtn{ margin-top: 8px; }

/* Costi */
.stCompanySummary{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  background: var(--surface-inset);
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1.45;
}
.stCompanySummaryText{ display: grid; gap: 2px; min-width: 0; }
.stCompanySummaryHint{ color: var(--text-3); }
.stCompanySummaryTotal{ display: grid; justify-items: end; gap: 1px; text-align: right; font-variant-numeric: tabular-nums; }
.stCompanySummaryTotal span{ color: var(--text-3); font-size: var(--fs-12); }
.stCompanySummaryTotal strong{ color: var(--text); font-size: var(--fs-14); font-weight: 600; }

.stCompanyFootnote{ line-height: 1.5; }

@media (max-width: 600px){
  .stCompanySelector{ flex-basis: 100%; }
  .stCompanyRow{ grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 14px; }
  .stCompanyRowActions{ grid-column: 2; flex-wrap: wrap; justify-content: flex-start; padding-top: 6px; }
  .stCompanyRowActions:empty{ display: none; }
  .stCompanyRenewal{ order: 2; }
  .stCompanyBody:not([aria-busy="true"]) .stCompanyVerified{ display: none; }
  .stCompanyPanelHead{ padding-left: 14px; }
  .stCompanySummary{ padding: 12px 14px; }
  .stCompanySummaryTotal{ justify-items: start; text-align: left; }
}

/* ===================== Impostazioni › Amministratori =====================
   Titolare e amministratore aggiuntivo: elenco degli accessi, invito, aziende autorizzate,
   dashboard disponibili, indicatore nella barra laterale e finestre di invito.
   Solo token del design system (00-tokens.css): chiaro e scuro seguono il tema. */
#stSharedAdminsCard [hidden],
#sharedScopeSwitch[hidden],
.sideScopeTag[hidden]{ display: none !important; }

.sharedAdminsSection .settingsSectionHead{ align-content: start; }
.sharedSeatBadge{ margin-top: 12px; }
.sharedAdminsBody{ display: grid; gap: 16px; }

/* ---------- Pannello elenco (accessi, dashboard disponibili) ---------- */
.sharedPanel{
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.sharedPanelHead{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 52px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--divider);
}
.sharedPanelTitle{ color: var(--text); font-size: var(--fs-14); font-weight: 600; letter-spacing: -.01em; }
.sharedPanelTools{ display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; }
.sharedVerified{ color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sharedScope .sharedPanelHead{ padding-right: 16px; }
#sharedScopeSwitch{ margin-bottom: 16px; }
.sharedRefresh{ color: var(--text-2); }
.sharedRefresh svg{ width: 15px; height: 15px; }
.sharedRefresh[data-loading="true"]{ opacity: 1; }
.sharedRefresh[data-loading="true"] svg{ animation: uiSpin .9s linear infinite; }

.sharedAdminsList{ display: grid; }
.sharedMember{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  min-height: 68px;
  padding: 12px 16px;
}
.sharedAdminsList > .sharedMember + .sharedMember,
.sharedAdminsList + .sharedMember{ border-top: 1px solid var(--divider); }
.sharedMember[data-current="true"]{ background: var(--bg-subtle); }
/* Righe con più azioni: il testo resta a tutta larghezza, le azioni vanno sotto. */
.sharedMember[data-kind="delegate"]:has(.sharedMemberActions .uiBtn){ grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.sharedMember[data-kind="delegate"]:has(.sharedMemberActions .uiBtn) .sharedMemberActions{ grid-column: 2; justify-content: flex-start; padding-top: 8px; }
.sharedMember[data-kind="delegate"]:has(.sharedMemberActions .uiBtn) .sharedRevoke{ margin-left: auto; }

.sharedAvatar{
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsl(var(--av-h, 220) calc(var(--av-s, 16%) * .9) 47%);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: .02em;
}
.sharedAvatar.uiSkeleton{ background: var(--bg-muted); }
.sharedAvatar--empty{ border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3); }
.sharedAvatar svg,
.sharedIcon svg{ display: block; width: 16px; height: 16px; }
.sharedIcon{ display: inline-grid; place-items: center; flex: 0 0 auto; }

.sharedMemberMain{ display: grid; gap: 3px; min-width: 0; }
.sharedMemberTitle{ display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.sharedMemberName{ min-width: 0; color: var(--text); font-size: var(--fs-14); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.sharedMemberTitle .uiBadge{ height: 20px; padding: 0 7px; }
.sharedMemberMeta{ color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; overflow-wrap: anywhere; }
.sharedMemberMeta--muted{ color: var(--text-3); }
.sharedMember--empty .sharedMemberName{ color: var(--text-2); font-weight: 500; }
.sharedMember[data-status="expired"] .sharedMemberName{ color: var(--text-2); }
.sharedMemberNote{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: var(--fs-13);
  line-height: 1.45;
}
.sharedMemberNote .sharedIcon{ margin-top: 1px; }
.sharedMemberNote .sharedIcon svg{ width: 15px; height: 15px; }

.sharedMemberActions{ display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.sharedMemberActions:empty{ display: none; }
.sharedMemberActions .uiBtn .sharedIcon svg{ width: 14px; height: 14px; }
.sharedMemberActions .uiBtn[data-done="true"]{ border-color: transparent; background: var(--success-soft); color: var(--success); }
.sharedRevoke{ color: var(--danger); }
.sharedRevoke:hover{ background: var(--danger-soft); }
.sharedYou{ color: var(--text-3); font-size: var(--fs-13); }
.sharedInUse{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl-h-sm);
  padding: 0 12px 0 10px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.sharedInUse .sharedIcon svg{ width: 14px; height: 14px; }

.sharedSkelName{ display: block; width: 42%; height: 12px; }
.sharedSkelMeta{ display: block; width: 26%; height: 10px; margin-top: 4px; }

/* ---------- Avvisi (esito delle azioni, errori) ---------- */
.sharedNotice{
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1.5;
}
.sharedNotice:empty{ display: none; }
.sharedNotice[data-tone="ok"]{ background: var(--success-soft); color: var(--success); }
.sharedNotice[data-tone="bad"]{ background: var(--danger-soft); color: var(--danger); }
.sharedNotice[data-tone="info"]{ background: var(--brand-soft); color: var(--brand-text); }

/* ---------- Invito / modifica aziende ---------- */
.sharedForm{
  display: grid;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.sharedForm[data-mode="edit"]{ border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.sharedFormHead{ display: grid; gap: 4px; }
.sharedFormTitle{ color: var(--text); font-size: var(--fs-15); font-weight: 600; letter-spacing: -.01em; }
.sharedFormText{ color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }

.sharedField{ display: grid; gap: 6px; max-width: 420px; }
#stSharedAdminsCard .sharedField .uiInput{ height: 40px; }
.sharedField[data-invalid="true"] .uiInput{ border-color: var(--danger-solid); }
.sharedField[data-invalid="true"] .uiInput:focus{ box-shadow: 0 0 0 3px var(--danger-soft); }
.sharedFieldHint{ color: var(--danger); font-size: var(--fs-13); line-height: 1.45; }
.sharedFieldHint:empty{ display: none; }

.sharedCompaniesFieldset{ display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
/* La legenda flottante diventa una cella della griglia: etichetta a sinistra, conteggio e «Seleziona tutte» a destra. */
.sharedLegend{ float: left; grid-column: 1; grid-row: 1; padding: 0; color: var(--text-2); font-size: var(--fs-13); }
.sharedCompaniesHead{ grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: var(--ctl-h-sm); }
.sharedCompanies,
.sharedCompaniesFieldset > .sharedFieldHint{ grid-column: 1 / -1; }
.sharedCount{ color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.sharedSelectAll{ margin-right: -8px; color: var(--brand-text); }
.sharedCompanies{
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.sharedCompanies[data-invalid="true"]{ border-color: var(--danger-solid); }
.sharedChoice{
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.sharedChoice + .sharedChoice{ border-top: 1px solid var(--divider); }
.sharedChoice:hover{ background: var(--bg-hover); }
.sharedChoice[data-checked="true"]{ background: var(--brand-soft); }
.sharedChoice[data-active="false"]{ cursor: not-allowed; }
.sharedChoice[data-active="false"]:hover{ background: transparent; }
.sharedChoice:has(input:focus-visible){ box-shadow: inset 0 0 0 2px var(--brand); }
.sharedChoiceAvatar{
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.sharedChoice[data-checked="true"] .sharedChoiceAvatar{ background: var(--brand); color: #fff; }
.sharedChoice[data-active="false"] .sharedChoiceAvatar{ border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3); }
.sharedChoiceMain{ display: grid; gap: 1px; min-width: 0; }
.sharedChoiceName{ color: var(--text); font-size: var(--fs-14); font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.sharedChoice[data-active="false"] .sharedChoiceName{ color: var(--text-3); }
.sharedChoiceMeta{ color: var(--text-3); font-size: var(--fs-12); line-height: 1.4; }
.sharedChoicesEmpty{ display: grid; gap: 3px; padding: 16px; }

.sharedRules{
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-inset);
  list-style: none;
}
.sharedRules li{ display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.sharedRules svg{ width: 16px; height: 16px; margin-top: 1px; color: var(--text-3); }
#stSharedDelegateRules{ border: 1px solid var(--border); background: var(--surface); }

.sharedAdminActions{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Barra laterale: dashboard di un altro titolare ---------- */
.sideScopeTag{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 6px 0 2px;
  padding: 8px 10px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-lg);
  background: var(--brand-soft);
  color: var(--brand-text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.sideScopeTag:hover{ background: var(--brand-soft-2); }
.sideScopeTag:focus-visible{ outline: none; box-shadow: var(--focus-ring); }
.sideScopeTag > .sharedIcon:first-child{ display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface); }
.sideScopeTag > .sharedIcon:last-child svg{ width: 14px; height: 14px; opacity: .7; }
.sideScopeText{ display: grid; gap: 1px; min-width: 0; flex: 1 1 auto; }
.sideScopeKicker{ font-size: var(--fs-11); font-weight: 500; letter-spacing: .02em; opacity: .85; }
.sideScopeOwner{ overflow: hidden; color: var(--text); font-size: var(--fs-13); font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Finestre: invito, invito non disponibile, permessi cambiati ---------- */
.sharedDialog{ width: min(480px, calc(100vw - 24px)); padding: 0; }
.sharedDialog[open]{ display: flex; }
.sharedDialog .uiDialogHead{ min-height: 0; padding: 22px 24px 4px; }
.sharedDialog .uiDialogBody{ display: grid; gap: 14px; padding: 8px 24px 20px; }
.sharedDialog .uiDialogFoot{ border-top: 0; padding-top: 4px; }
.sharedDialogLead,
.sharedDialogText{ color: var(--text-2); font-size: var(--fs-14); line-height: 1.55; }
.sharedDialogText strong{ color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.sharedDialogIcon{ display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.sharedDialogIcon svg{ width: 20px; height: 20px; }
.sharedDialog--notice .uiDialogBody{ grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 14px; }

.sharedInvite{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.sharedInviteMain{ display: grid; gap: 4px; min-width: 0; }
.sharedInviteOwner{ color: var(--text); font-size: var(--fs-15); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.sharedInviteMeta{ color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
.sharedInviteError{ color: var(--danger); font-size: var(--fs-13); line-height: 1.45; }
.sharedInviteError:empty{ display: none; }
.sharedInvite > .uiBtn{ align-self: center; }
.sharedChips{ display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.sharedChips li{
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-muted);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  overflow-wrap: anywhere;
}

@media (max-width: 600px){
  .sharedMember{ padding: 14px; }
  .sharedPanelHead{ padding-left: 14px; }
  .sharedAdminsBody:not([aria-busy="true"]) .sharedVerified{ display: none; }
  .sharedScope .sharedVerified{ display: none; }
  .sharedForm{ padding: 16px; gap: 18px; }
  .sharedField{ max-width: none; }
  .sharedLegend{ grid-column: 1 / -1; }
  .sharedCompaniesHead{ grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .sharedAdminActions .uiBtn{ flex: 1 1 auto; }
  .sharedInvite{ grid-template-columns: auto minmax(0, 1fr); }
  .sharedInvite > .uiBtn{ grid-column: 2; justify-self: start; }
  .sharedDialog{ width: 100%; margin: auto 0 0; }
  .sharedDialog .uiDialogFoot .uiBtn{ flex: 1 1 auto; }
}
