/*
 * Rental Manager 2.11.2 theme + branding foundation.
 *
 * Ownership contract:
 *   1) Theme owns readability: canvas, surfaces, text, borders, inputs, shadows.
 *   2) Branding owns identity: primary/secondary accents, sidebar/nav identity,
 *      brand tint, semantic success/warning/error colors, configured button text.
 *   3) Components consume semantic tokens; they do not decide light/dark or
 *      reinterpret saved brand settings themselves.
 *
 * This file intentionally keeps the employee palette independent from
 * --cfl-brand-background. A dark/custom brand background can never turn light
 * mode into a dark application. Saved branding is still exposed through the
 * brand-role tokens below and remains visible in actions/navigation/statuses.
 */
.cfl-v2-shell{
  /* Stable light theme: proven 2.10.3.1 readability baseline. */
  --cfl-ui-font:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --cfl-ui-app:#eef2f7;
  --cfl-ui-surface:#ffffff;
  --cfl-ui-surface-raised:#ffffff;
  --cfl-ui-surface-subtle:#f8fafc;
  --cfl-ui-surface-muted:#eef3f8;
  --cfl-ui-text:#172033;
  --cfl-ui-text-muted:#64748b;
  --cfl-ui-text-soft:#7b8aa0;
  --cfl-ui-border:#d9e2ec;
  --cfl-ui-border-strong:#c6d2df;

  /* Brand identity. Theme never replaces these saved business choices. */
  --cfl-ui-primary:var(--cfl-brand-primary,#17324d);
  --cfl-ui-on-primary:var(--cfl-brand-button-text,var(--cfl-brand-on-primary,#fff));
  --cfl-ui-secondary:var(--cfl-brand-secondary,#64748b);
  --cfl-ui-brand-dark:var(--cfl-brand-dark,#10233b);
  --cfl-ui-on-brand-dark:var(--cfl-brand-on-dark,#fff);
  --cfl-ui-brand-background:var(--cfl-brand-background,#eef2f7);
  --cfl-ui-brand-tint:color-mix(in srgb,var(--cfl-ui-brand-background) 12%,var(--cfl-ui-surface));

  /* Semantic state hues originate from saved branding. */
  --cfl-ui-success-base:var(--cfl-brand-success,#176b31);
  --cfl-ui-warning-base:var(--cfl-brand-warning,#9a6700);
  --cfl-ui-danger-base:var(--cfl-brand-error,#b42318);
  --cfl-ui-success:var(--cfl-ui-success-base);
  --cfl-ui-warning:var(--cfl-ui-warning-base);
  --cfl-ui-danger:var(--cfl-ui-danger-base);
  --cfl-ui-info:#2f66b3;
  --cfl-ui-success-soft:color-mix(in srgb,var(--cfl-ui-success-base) 9%,var(--cfl-ui-surface));
  --cfl-ui-warning-soft:color-mix(in srgb,var(--cfl-ui-warning-base) 9%,var(--cfl-ui-surface));
  --cfl-ui-danger-soft:color-mix(in srgb,var(--cfl-ui-danger-base) 8%,var(--cfl-ui-surface));
  --cfl-ui-info-soft:color-mix(in srgb,var(--cfl-ui-info) 8%,var(--cfl-ui-surface));

  --cfl-ui-focus:color-mix(in srgb,var(--cfl-ui-primary) 27%,transparent);
  --cfl-ui-shadow-xs:0 1px 2px rgba(15,23,42,.04);
  --cfl-ui-shadow-sm:0 5px 16px rgba(15,23,42,.055);
  --cfl-ui-shadow:0 12px 32px rgba(15,23,42,.075);
  --cfl-ui-shadow-lg:0 22px 55px rgba(15,23,42,.13);
  --cfl-ui-radius-xs:7px;
  --cfl-ui-radius-sm:10px;
  --cfl-ui-radius:14px;
  --cfl-ui-radius-lg:18px;
  --cfl-ui-control-height:44px;
  --cfl-ui-touch-size:44px;
  --cfl-ui-space-1:4px;
  --cfl-ui-space-2:8px;
  --cfl-ui-space-3:12px;
  --cfl-ui-space-4:16px;
  --cfl-ui-space-5:20px;
  --cfl-ui-space-6:24px;
  --cfl-ui-space-7:32px;
  --cfl-ui-space-8:40px;
  --cfl-ui-content-max:1560px;
  color-scheme:light;
}

.cfl-v2-shell[data-theme="dark"]{
  /* Stable dark theme: independent from business background colors. */
  --cfl-ui-app:#162235;
  --cfl-ui-surface:#203047;
  --cfl-ui-surface-raised:#23354d;
  --cfl-ui-surface-subtle:#263850;
  --cfl-ui-surface-muted:#2b3f59;
  --cfl-ui-text:#f8fafc;
  --cfl-ui-text-muted:#b8c5d6;
  --cfl-ui-text-soft:#92a5bb;
  --cfl-ui-border:#344861;
  --cfl-ui-border-strong:#445a74;

  /* Keep business identity, adapt only foreground semantics for contrast. */
  --cfl-ui-brand-tint:color-mix(in srgb,var(--cfl-ui-brand-background) 7%,var(--cfl-ui-surface));
  --cfl-ui-success:color-mix(in srgb,var(--cfl-ui-success-base) 62%,#ffffff);
  --cfl-ui-warning:color-mix(in srgb,var(--cfl-ui-warning-base) 58%,#ffffff);
  --cfl-ui-danger:color-mix(in srgb,var(--cfl-ui-danger-base) 58%,#ffffff);
  --cfl-ui-info:#7fb5ff;
  --cfl-ui-success-soft:color-mix(in srgb,var(--cfl-ui-success-base) 18%,var(--cfl-ui-surface));
  --cfl-ui-warning-soft:color-mix(in srgb,var(--cfl-ui-warning-base) 17%,var(--cfl-ui-surface));
  --cfl-ui-danger-soft:color-mix(in srgb,var(--cfl-ui-danger-base) 18%,var(--cfl-ui-surface));
  --cfl-ui-info-soft:color-mix(in srgb,#4385d1 18%,var(--cfl-ui-surface));
  --cfl-ui-focus:color-mix(in srgb,var(--cfl-ui-primary) 42%,transparent);
  --cfl-ui-shadow-xs:0 1px 2px rgba(0,0,0,.12);
  --cfl-ui-shadow-sm:0 6px 18px rgba(0,0,0,.18);
  --cfl-ui-shadow:0 16px 36px rgba(0,0,0,.28);
  --cfl-ui-shadow-lg:0 26px 60px rgba(0,0,0,.34);
  color-scheme:dark;
}

/* Bridge the semantic contract into all established employee/legacy aliases. */
.cfl-v2-shell{
  --cfl-v2-radius-sm:var(--cfl-ui-radius-sm);
  --cfl-v2-radius:var(--cfl-ui-radius);
  --cfl-v2-radius-lg:var(--cfl-ui-radius-lg);
  --cfl-v2-shadow:var(--cfl-ui-shadow);
  --cfl-v2-sidebar:var(--cfl-ui-brand-dark);
  --cfl-v2-sidebar-2:color-mix(in srgb,var(--cfl-ui-brand-dark) 84%,#000 16%);
  --cfl-v2-sidebar-text:var(--cfl-ui-on-brand-dark);
  --cfl-v2-surface:var(--cfl-ui-surface);
  --cfl-v2-surface-2:var(--cfl-ui-surface-subtle);
  --cfl-v2-text:var(--cfl-ui-text);
  --cfl-v2-muted:var(--cfl-ui-text-muted);
  --cfl-v2-line:var(--cfl-ui-border);
  --cfl-v2-app:var(--cfl-ui-app);
  --cfl-v2-primary:var(--cfl-ui-primary);
  --cfl-v2-secondary:var(--cfl-ui-secondary);
  --cfl-v2-success:var(--cfl-ui-success);
  --cfl-v2-warning:var(--cfl-ui-warning);
  --cfl-v2-danger:var(--cfl-ui-danger);

  /* Older modules still consume these names. Keep them theme-owned. */
  --cfl-app-bg:var(--cfl-ui-app);
  --cfl-surface:var(--cfl-ui-surface);
  --cfl-surface-2:var(--cfl-ui-surface-subtle);
  --cfl-border:var(--cfl-ui-border);
  --cfl-text:var(--cfl-ui-text);
  --cfl-text-primary:var(--cfl-ui-text);
  --cfl-text-secondary:var(--cfl-ui-text-muted);
  --cfl-muted:var(--cfl-ui-text-muted);
  --cfl-primary:var(--cfl-ui-primary);

  /* Old portal modules use these pre-V2 names. Override their inherited
   * light-only defaults at the shell boundary so every employee page follows
   * the same active theme. */
  --cfl-ink:var(--cfl-ui-text);
  --cfl-line:var(--cfl-ui-border);
  --cfl-soft:var(--cfl-ui-surface-subtle);
  --cfl-orange:var(--cfl-ui-primary);
  --cfl-orange-dark:color-mix(in srgb,var(--cfl-ui-primary) 84%,#000 16%);
  --cfl-navy:var(--cfl-ui-brand-dark);
}

/* Browser/page canvas is theme-owned too. Do not read brand-background here. */
body.cfl-rental-employee-portal.cfl-v2-theme-light{background:#eef2f7!important;}
body.cfl-rental-employee-portal.cfl-v2-theme-dark{background:#162235!important;}
@supports selector(body:has(*)){
  html:has(.cfl-v2-shell[data-theme="light"]),
  body.cfl-rental-employee-portal:has(.cfl-v2-shell[data-theme="light"]){background:#eef2f7!important;}
  html:has(.cfl-v2-shell[data-theme="dark"]),
  body.cfl-rental-employee-portal:has(.cfl-v2-shell[data-theme="dark"]){background:#162235!important;}
}

/* Shared interaction baseline. */
.cfl-v2-shell :is(a,button,input,select,textarea,summary):focus-visible{
  outline:3px solid var(--cfl-ui-focus)!important;
  outline-offset:2px!important;
}
.cfl-v2-shell :is(button,.cfl-btn,a.cfl-btn)[disabled],
.cfl-v2-shell :is(button,.cfl-btn,a.cfl-btn)[aria-disabled="true"]{
  cursor:not-allowed!important;
  opacity:.55!important;
  transform:none!important;
  box-shadow:none!important;
}
.cfl-v2-shell .cfl-ui-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;
}

/* Reusable semantic surfaces for 2.11 and later passes. */
.cfl-v2-shell .cfl-ui-panel{
  border:1px solid var(--cfl-ui-border);
  border-radius:var(--cfl-ui-radius);
  background:var(--cfl-ui-surface);
  color:var(--cfl-ui-text);
  box-shadow:var(--cfl-ui-shadow-sm);
}
.cfl-v2-shell .cfl-ui-brand-surface{
  border-color:color-mix(in srgb,var(--cfl-ui-primary) 16%,var(--cfl-ui-border));
  background:var(--cfl-ui-brand-tint);
}
.cfl-v2-shell .cfl-ui-status-surface.is-danger{border-color:color-mix(in srgb,var(--cfl-ui-danger-base) 38%,var(--cfl-ui-border));background:var(--cfl-ui-danger-soft)}
.cfl-v2-shell .cfl-ui-status-surface.is-warning{border-color:color-mix(in srgb,var(--cfl-ui-warning-base) 38%,var(--cfl-ui-border));background:var(--cfl-ui-warning-soft)}
.cfl-v2-shell .cfl-ui-status-surface.is-success{border-color:color-mix(in srgb,var(--cfl-ui-success-base) 34%,var(--cfl-ui-border));background:var(--cfl-ui-success-soft)}
.cfl-v2-shell .cfl-ui-status-surface.is-info{border-color:color-mix(in srgb,var(--cfl-ui-info) 34%,var(--cfl-ui-border));background:var(--cfl-ui-info-soft)}

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