/* FCU Whitelabel Design System */

:root {
  /* Default Design Tokens (Easily overridable by custom stylesheets) */
  --fcu-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fcu-font-size-base: 14px;
  --fcu-font-size-sm: 12px;
  --fcu-font-size-lg: 18px;
  --fcu-font-size-xl: 24px;
  
  --fcu-border-radius: 6px;
  
  /* Color Palette (HSL-based for easy shade generation) */
  --fcu-primary-hue: 215;
  --fcu-primary-sat: 80%;
  --fcu-primary-light: 50%;
  
  --fcu-primary: hsl(var(--fcu-primary-hue), var(--fcu-primary-sat), var(--fcu-primary-light));
  --fcu-primary-hover: hsl(var(--fcu-primary-hue), var(--fcu-primary-sat), calc(var(--fcu-primary-light) - 8%));
  --fcu-on-primary: #ffffff;
  
  --fcu-secondary: #64748b;
  --fcu-secondary-hover: #475569;
  --fcu-on-secondary: #ffffff;
  
  --fcu-success: #10b981;
  --fcu-on-success: #ffffff;
  --fcu-danger: #ef4444;
  --fcu-on-danger: #ffffff;
  --fcu-warning: #f59e0b;
  --fcu-on-warning: #ffffff;
  --fcu-info: #06b6d4;
  --fcu-on-info: #ffffff;

  --fcu-bg: #f8fafc;
  --fcu-surface: #ffffff;
  --fcu-surface-alt: #f1f5f9;
  --fcu-text: #0f172a;
  --fcu-text-muted: #64748b;
  --fcu-border: #e2e8f0;
  --fcu-border-focus: hsl(var(--fcu-primary-hue), var(--fcu-primary-sat), 65%);
  --fcu-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);

  /* Layout Dimensions */
  --fcu-sidebar-width: 260px;
  --fcu-navbar-height: 60px;
  --fcu-layout-padding: 24px;
  --fcu-gap: 16px;

  /* Notification count badge. Defaults to the semantic warning colour (the
     AdminLTE look); a design can recolour just the badge by overriding these
     without affecting other warning-coloured UI. */
  --fcu-navbar-badge-bg: var(--fcu-warning);
  --fcu-navbar-badge-text: var(--fcu-on-warning);

  /* Charts (pygal). These tokens are injected verbatim into every chart's
     inline <style>, so they resolve against the page: charts inherit the
     design's font and follow light/dark mode for free. Override any of them
     in a design stylesheet to restyle charts without touching Python.
     --fcu-chart-font-family is the single knob for the chart typeface; it
     defaults to the theme font but can be pointed at any other family. */
  --fcu-chart-font-family: var(--fcu-font-family);
  --fcu-chart-color-1: var(--fcu-primary);
  --fcu-chart-color-2: var(--fcu-success);
  --fcu-chart-color-3: var(--fcu-warning);
  --fcu-chart-color-4: var(--fcu-danger);
  --fcu-chart-color-5: var(--fcu-info);
  --fcu-chart-color-6: var(--fcu-secondary);

  /* Dark-scheme companion values. These are inert until a dark scheme is
     activated (via [data-fcu-color-scheme="dark"] or the prefers-color-scheme
     media query below), at which point the activation block re-points each
     live `--fcu-*` token at its `--*--dark` value. Designs (e.g. sandstone)
     only need to override these values — the activation wiring is shared. */
  --fcu-primary-light--dark: 62%;
  --fcu-on-primary--dark: #ffffff;
  --fcu-bg--dark: #0f172a;
  --fcu-surface--dark: #1e293b;
  --fcu-surface-alt--dark: #273449;
  --fcu-text--dark: #e2e8f0;
  --fcu-text-muted--dark: #94a3b8;
  --fcu-border--dark: #334155;
  --fcu-shadow--dark: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);

  /* Alert palette as live tokens (light defaults; dark companions below). */
  --fcu-alert-success-bg: #ecfdf5; --fcu-alert-success-border: #a7f3d0; --fcu-alert-success-text: #065f46;
  --fcu-alert-danger-bg: #fef2f2; --fcu-alert-danger-border: #fca5a5; --fcu-alert-danger-text: #991b1b;
  --fcu-alert-warning-bg: #fffbeb; --fcu-alert-warning-border: #fde68a; --fcu-alert-warning-text: #92400e;
  --fcu-alert-info-bg: #ecfeff; --fcu-alert-info-border: #a5f3fc; --fcu-alert-info-text: #0891b2;
  --fcu-alert-success-bg--dark: #022c22; --fcu-alert-success-border--dark: #065f46; --fcu-alert-success-text--dark: #6ee7b7;
  --fcu-alert-danger-bg--dark: #2a0a0a; --fcu-alert-danger-border--dark: #991b1b; --fcu-alert-danger-text--dark: #fca5a5;
  --fcu-alert-warning-bg--dark: #2a1d05; --fcu-alert-warning-border--dark: #92400e; --fcu-alert-warning-text--dark: #fcd34d;
  --fcu-alert-info-bg--dark: #042f33; --fcu-alert-info-border--dark: #0e7490; --fcu-alert-info-text--dark: #67e8f9;

  color-scheme: light;
}

/* --- Dark mode activation ------------------------------------------------
   Two entry points share one set of overrides via a custom property fallback:
   `--fcu-dark` is empty by default, set to a non-empty token when dark is
   active, but rather than relying on that we simply duplicate the (small)
   activation block for the explicit attribute and the system-preference path.
   Keeping the *values* in `:root` (above) means this only repeats assignments. */
:root[data-fcu-color-scheme="dark"] {
  color-scheme: dark;
  --fcu-primary-light: var(--fcu-primary-light--dark);
  --fcu-on-primary: var(--fcu-on-primary--dark);
  --fcu-bg: var(--fcu-bg--dark);
  --fcu-surface: var(--fcu-surface--dark);
  --fcu-surface-alt: var(--fcu-surface-alt--dark);
  --fcu-text: var(--fcu-text--dark);
  --fcu-text-muted: var(--fcu-text-muted--dark);
  --fcu-border: var(--fcu-border--dark);
  --fcu-shadow: var(--fcu-shadow--dark);
  --fcu-alert-success-bg: var(--fcu-alert-success-bg--dark); --fcu-alert-success-border: var(--fcu-alert-success-border--dark); --fcu-alert-success-text: var(--fcu-alert-success-text--dark);
  --fcu-alert-danger-bg: var(--fcu-alert-danger-bg--dark); --fcu-alert-danger-border: var(--fcu-alert-danger-border--dark); --fcu-alert-danger-text: var(--fcu-alert-danger-text--dark);
  --fcu-alert-warning-bg: var(--fcu-alert-warning-bg--dark); --fcu-alert-warning-border: var(--fcu-alert-warning-border--dark); --fcu-alert-warning-text: var(--fcu-alert-warning-text--dark);
  --fcu-alert-info-bg: var(--fcu-alert-info-bg--dark); --fcu-alert-info-border: var(--fcu-alert-info-border--dark); --fcu-alert-info-text: var(--fcu-alert-info-text--dark);
}

@media (prefers-color-scheme: dark) {
  /* "auto": follow the OS unless the scheme is explicitly pinned. */
  :root:not([data-fcu-color-scheme="light"]):not([data-fcu-color-scheme="dark"]) {
    color-scheme: dark;
    --fcu-primary-light: var(--fcu-primary-light--dark);
    --fcu-on-primary: var(--fcu-on-primary--dark);
    --fcu-bg: var(--fcu-bg--dark);
    --fcu-surface: var(--fcu-surface--dark);
    --fcu-surface-alt: var(--fcu-surface-alt--dark);
    --fcu-text: var(--fcu-text--dark);
    --fcu-text-muted: var(--fcu-text-muted--dark);
    --fcu-border: var(--fcu-border--dark);
    --fcu-shadow: var(--fcu-shadow--dark);
    --fcu-alert-success-bg: var(--fcu-alert-success-bg--dark); --fcu-alert-success-border: var(--fcu-alert-success-border--dark); --fcu-alert-success-text: var(--fcu-alert-success-text--dark);
    --fcu-alert-danger-bg: var(--fcu-alert-danger-bg--dark); --fcu-alert-danger-border: var(--fcu-alert-danger-border--dark); --fcu-alert-danger-text: var(--fcu-alert-danger-text--dark);
    --fcu-alert-warning-bg: var(--fcu-alert-warning-bg--dark); --fcu-alert-warning-border: var(--fcu-alert-warning-border--dark); --fcu-alert-warning-text: var(--fcu-alert-warning-text--dark);
    --fcu-alert-info-bg: var(--fcu-alert-info-bg--dark); --fcu-alert-info-border: var(--fcu-alert-info-border--dark); --fcu-alert-info-text: var(--fcu-alert-info-text--dark);
  }
}

/* Base resets & document styles */
body {
  margin: 0;
  padding: 0;
  font-family: var(--fcu-font-family);
  font-size: var(--fcu-font-size-base);
  background-color: var(--fcu-bg);
  color: var(--fcu-text);
  line-height: 1.5;
}

/* App Grid Shell */
.fcu-app-layout {
  display: grid;
  grid-template-areas:
    "navbar navbar"
    "sidebar main"
    "footer footer";
  grid-template-columns: var(--fcu-sidebar-width) 1fr;
  grid-template-rows: var(--fcu-navbar-height) 1fr auto;
  min-height: 100vh;
}

/* Public/anonymous layout (structure/public.html): no sidebar, full-width main. */
.fcu-public .fcu-app-layout {
  grid-template-areas:
    "navbar"
    "main"
    "footer";
  grid-template-columns: 1fr;
}

.fcu-navbar {
  grid-area: navbar;
  height: var(--fcu-navbar-height);
  background-color: var(--fcu-surface);
  border-bottom: 1px solid var(--fcu-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--fcu-layout-padding);
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 100;
}

.fcu-navbar__brand {
  font-size: var(--fcu-font-size-lg);
  font-weight: 700;
  color: var(--fcu-text);
  text-decoration: none;
}

/* Right-hand navbar action group: search, notifications, user menu — all on
   one row, vertically centered. */
.fcu-navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--fcu-gap);
}
.fcu-navbar__search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.fcu-navbar__search-input {
  font-family: inherit;
  font-size: var(--fcu-font-size-sm);
  padding: 6px 10px;
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  background-color: var(--fcu-surface);
  color: var(--fcu-text);
}
.fcu-navbar__search-input:focus {
  outline: none;
  border-color: var(--fcu-border-focus);
}
.fcu-navbar__icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  color: var(--fcu-text);
  cursor: pointer;
}
.fcu-navbar__badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: var(--fcu-navbar-badge-text);
  background-color: var(--fcu-navbar-badge-bg);
  border-radius: 8px;
}
.fcu-navbar__user {
  font-weight: 600;
  color: var(--fcu-text);
}
.fcu-navbar__action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fcu-text-muted);
  text-decoration: none;
}
.fcu-navbar__action-link:hover {
  color: var(--fcu-text);
}

/* No-JS navbar dropdowns (user menu, notifications) via native <details>. The
   panel is absolutely positioned under the trigger; clicking the summary
   toggles it with zero JavaScript. */
.fcu-navbar__dropdown {
  position: relative;
}
.fcu-navbar__dropdown > summary {
  list-style: none;
  cursor: pointer;
}
.fcu-navbar__dropdown > summary::-webkit-details-marker {
  display: none;
}
.fcu-navbar__dropdown-arrow {
  color: var(--fcu-text-muted);
  transition: transform 0.15s ease;
}
.fcu-navbar__dropdown[open] > summary .fcu-navbar__dropdown-arrow {
  transform: rotate(90deg);
}
.fcu-navbar__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background-color: var(--fcu-surface);
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  box-shadow: var(--fcu-shadow);
  z-index: 200;
}
.fcu-navbar__menu--wide {
  min-width: 280px;
}
.fcu-navbar__menu-header {
  padding: 8px 10px;
  font-size: var(--fcu-font-size-sm);
  font-weight: 700;
  color: var(--fcu-text-muted);
}
.fcu-navbar__menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--fcu-text);
  text-decoration: none;
  border-radius: var(--fcu-border-radius);
}
.fcu-navbar__menu-item:hover {
  background-color: var(--fcu-surface-alt);
}

.fcu-sidebar {
  grid-area: sidebar;
  background-color: var(--fcu-surface-alt);
  border-right: 1px solid var(--fcu-border);
  padding: 16px;
  box-sizing: border-box;
}

.fcu-main-content {
  grid-area: main;
  padding: var(--fcu-layout-padding);
  box-sizing: border-box;
}

.fcu-footer {
  grid-area: footer;
  background-color: var(--fcu-surface);
  border-top: 1px solid var(--fcu-border);
  padding: 16px var(--fcu-layout-padding);
  text-align: center;
  color: var(--fcu-text-muted);
  font-size: var(--fcu-font-size-sm);
}

/* Layout Utilities */
.fcu-vbox {
  display: flex;
  flex-direction: column;
}
.fcu-hbox {
  display: flex;
  flex-direction: row;
  width: 100%;
}
.fcu-grid {
  display: grid;
}

/* Buttons */
.fcu-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  border-radius: var(--fcu-border-radius);
  border: 1px solid var(--fcu-border);
  background-color: var(--fcu-surface);
  color: var(--fcu-text);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  gap: 8px;
}
.fcu-btn:hover {
  background-color: var(--fcu-surface-alt);
}
.fcu-btn--primary {
  background-color: var(--fcu-primary);
  border-color: var(--fcu-primary);
  color: var(--fcu-on-primary);
}
.fcu-btn--primary:hover {
  background-color: var(--fcu-primary-hover);
}
.fcu-btn--secondary {
  background-color: var(--fcu-secondary);
  border-color: var(--fcu-secondary);
  color: var(--fcu-on-secondary);
}
.fcu-btn--secondary:hover {
  background-color: var(--fcu-secondary-hover);
}
.fcu-btn--success { background-color: var(--fcu-success); border-color: var(--fcu-success); color: var(--fcu-on-success); }
.fcu-btn--danger { background-color: var(--fcu-danger); border-color: var(--fcu-danger); color: var(--fcu-on-danger); }
.fcu-btn--warning { background-color: var(--fcu-warning); border-color: var(--fcu-warning); color: var(--fcu-on-warning); }
.fcu-btn--info { background-color: var(--fcu-info); border-color: var(--fcu-info); color: var(--fcu-on-info); }

/* Cards */
.fcu-card {
  background-color: var(--fcu-surface);
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  box-shadow: var(--fcu-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fcu-card-header {
  padding: 16px;
  border-bottom: 1px solid var(--fcu-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fcu-card-header h3 {
  margin: 0;
  font-size: var(--fcu-font-size-lg);
  font-weight: 600;
}
.fcu-card-body {
  padding: 16px;
}
/* Card Outline/Variants */
.fcu-card--outline {
  border-top-width: 4px;
}
.fcu-card--primary { border-top-color: var(--fcu-primary); }
.fcu-card--success { border-top-color: var(--fcu-success); }
.fcu-card--danger { border-top-color: var(--fcu-danger); }
.fcu-card--warning { border-top-color: var(--fcu-warning); }
.fcu-card--info { border-top-color: var(--fcu-info); }

/* Forms */
.fcu-form-group {
  margin-bottom: var(--fcu-gap);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fcu-label {
  font-weight: 600;
  color: var(--fcu-text);
}
.fcu-form-control {
  font-family: inherit;
  font-size: inherit;
  padding: 8px 12px;
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  background-color: var(--fcu-surface);
  color: var(--fcu-text);
  box-sizing: border-box;
  width: 100%;
}
.fcu-form-control:focus, .fcu-form-control:focus-within {
  outline: none;
  border-color: var(--fcu-border-focus);
  box-shadow: 0 0 0 3px hsl(var(--fcu-primary-hue), var(--fcu-primary-sat), 90%);
}

/* Form field dropdowns (Related/ManyRelated pickers). The menu is an
   overlay anchored to the group, opened via :focus-within (search input
   or trigger field holds focus while the menu is in use). */
.fcu-dropdown-group {
  position: relative;
}
.fcu-dropdown-menu {
  position: absolute;
  display: none;
  z-index: 50;
  margin-top: 4px;
  width: 100%;
  background: var(--fcu-surface);
  border: 1px solid var(--fcu-border);
  box-shadow: var(--fcu-shadow);
  border-radius: var(--fcu-border-radius);
  padding: 8px;
  box-sizing: border-box;
  list-style: none;
}
.fcu-dropdown-group:focus-within .fcu-dropdown-menu {
  display: block;
}
.fcu-dropdown-menu a.fcu-dropdown-item.active {
  background-color: var(--fcu-surface-alt);
}

/* Tables */
.fcu-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.fcu-table th, .fcu-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--fcu-border);
}
.fcu-table th {
  background-color: var(--fcu-surface-alt);
  font-weight: 600;
}
.fcu-table--striped tbody tr:nth-child(even) {
  background-color: var(--fcu-surface-alt);
}
.fcu-table--hover tbody tr:hover {
  background-color: var(--fcu-surface-alt);
}

/* Navigation & Submenus */
.fcu-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fcu-menu-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--fcu-text-muted);
  letter-spacing: 0.05em;
  padding: 12px 8px 4px;
}
.fcu-menu-link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--fcu-text);
  border-radius: var(--fcu-border-radius);
  transition: background-color 0.15s ease;
  font-weight: 500;
  gap: 12px;
}
.fcu-menu-link:hover {
  background-color: var(--fcu-border);
}
.fcu-menu-link.active,
.fcu-submenu-link.active {
  background-color: var(--fcu-primary);
  color: var(--fcu-on-primary);
}
.fcu-menu-toggle {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
/* No-JS collapsible submenu via native <details>. */
.fcu-submenu-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fcu-submenu-details > summary::-webkit-details-marker {
  display: none;
}
.fcu-submenu-arrow {
  color: var(--fcu-text-muted);
  transition: transform 0.15s ease;
  flex: none;
}
.fcu-submenu-details[open] > summary .fcu-submenu-arrow {
  transform: rotate(90deg);
}
.fcu-submenu {
  list-style: none;
  padding-left: 20px;
  margin: 4px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fcu-submenu-link {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--fcu-text-muted);
  font-size: var(--fcu-font-size-sm);
  border-radius: var(--fcu-border-radius);
  transition: all 0.15s ease;
  gap: 10px;
}
.fcu-submenu-link:hover {
  color: var(--fcu-text);
  background-color: var(--fcu-border);
}

/* Tabs */
.fcu-tabs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.fcu-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--fcu-border);
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.fcu-tab-link {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--fcu-text-muted);
  border-bottom: 2px solid transparent;
  font-weight: 500;
  margin-bottom: -1px;
}
.fcu-tab-link:hover {
  color: var(--fcu-text);
}
.fcu-tab-link.active {
  color: var(--fcu-primary);
  border-bottom-color: var(--fcu-primary);
}

/* Calendars */
.fcu-calendar-wrapper {
  background-color: var(--fcu-surface);
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  overflow: hidden;
  box-shadow: var(--fcu-shadow);
}
.fcu-calendar-header {
  padding: 16px;
  background-color: var(--fcu-surface-alt);
  border-bottom: 1px solid var(--fcu-border);
}
.fcu-calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.fcu-calendar-table th, .fcu-calendar-table td {
  border: 1px solid var(--fcu-border);
  padding: 8px;
  vertical-align: top;
}
.fcu-calendar-table th {
  background-color: var(--fcu-surface-alt);
  text-align: center;
  font-weight: 600;
}
.fcu-calendar-table td {
  height: 100px;
}
.fcu-calendar-table td.disabled {
  background-color: var(--fcu-surface-alt);
  color: var(--fcu-text-muted);
}
.fcu-calendar-day-num {
  font-weight: bold;
  text-align: right;
  margin-bottom: 4px;
}

/* Mini Calendar */
.fcu-calendar-mini {
  max-width: 300px;
}
.fcu-calendar-mini td {
  height: 36px;
  text-align: center;
  vertical-align: middle;
}
.fcu-calendar-mini-marker {
  display: block;
  width: 4px;
  height: 4px;
  background-color: var(--fcu-primary);
  border-radius: 50%;
  margin: 2px auto 0;
}

/* Flashes / Alerts */
.fcu-alert {
  padding: 12px 16px;
  border-radius: var(--fcu-border-radius);
  border: 1px solid transparent;
  margin-bottom: var(--fcu-gap);
  display: flex;
  align-items: center;
  gap: 12px;
}
.fcu-alert--success { background-color: var(--fcu-alert-success-bg); border-color: var(--fcu-alert-success-border); color: var(--fcu-alert-success-text); }
.fcu-alert--danger { background-color: var(--fcu-alert-danger-bg); border-color: var(--fcu-alert-danger-border); color: var(--fcu-alert-danger-text); }
.fcu-alert--warning { background-color: var(--fcu-alert-warning-bg); border-color: var(--fcu-alert-warning-border); color: var(--fcu-alert-warning-text); }
.fcu-alert--info { background-color: var(--fcu-alert-info-bg); border-color: var(--fcu-alert-info-border); color: var(--fcu-alert-info-text); }

/* Typography Component Classes */
.fcu-text {
  margin-top: 0;
  margin-bottom: 0;
}
.fcu-text--h1 { font-size: var(--fcu-font-size-xl); font-weight: 800; margin-bottom: 16px; }
.fcu-text--h2 { font-size: var(--fcu-font-size-lg); font-weight: 700; margin-bottom: 12px; }
.fcu-text--h3 { font-size: var(--fcu-font-size-base); font-weight: 600; margin-bottom: 8px; }
.fcu-text--h4 { font-size: var(--fcu-font-size-base); font-weight: 500; margin-bottom: 6px; }
.fcu-text--p { font-size: var(--fcu-font-size-base); font-weight: 400; margin-bottom: 12px; }
.fcu-text--label { font-size: var(--fcu-font-size-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.fcu-text--span { font-size: var(--fcu-font-size-sm); }
.fcu-text--muted { color: var(--fcu-text-muted); }
.fcu-text--primary { color: var(--fcu-primary); }
.fcu-text--success { color: var(--fcu-success); }
.fcu-text--danger { color: var(--fcu-danger); }

.hidden {
  display: none !important;
}

.cursor-pointer {
  cursor: pointer;
}

.opacity-50 {
  opacity: 0.5;
}

.pointer-events-none {
  pointer-events: none;
}

/* --- Kanban component ------------------------------------------------------
   Structural styling for components/kanban.html. App-semantic looks (column
   accent colours, board headers) belong to the app's own stylesheet via the
   column/card css_class hooks. */

/* Columns scroll horizontally so the page body itself never does. */
.kanban-columns {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}
.kanban-column {
  flex: 0 0 260px;
  background-color: var(--fcu-surface-alt);
  border: 1px solid var(--fcu-border);
  border-top: 3px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  padding: 10px;
}
.kanban-column h2 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-count {
  font-size: 0.8em;
  color: var(--fcu-text-muted);
}

.kanban-card {
  position: relative;
  background-color: var(--fcu-surface);
  border: 1px solid var(--fcu-border);
  border-radius: var(--fcu-border-radius);
  padding: 8px 10px;
  margin-bottom: 8px;
  overflow: hidden; /* the grip strip inherits the rounded corners */
}
.kanban-card-title {
  font-weight: 600;
}
.kanban-card-title a {
  color: inherit;
}

/* Top strip — the grip is the whole move story in one element: a link into
   the server-side placement flow (the no-JS path), drawn as a drag handle
   because in JS mode dragging the card does the same thing without ever
   firing the click. */
.kanban-card-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  margin: -8px -10px 6px;
  color: var(--fcu-text-muted);
  text-decoration: none;
}
.kanban-card-grip:hover,
.kanban-card-grip:focus-visible {
  background-color: var(--fcu-surface-alt);
  color: inherit;
}
.js-enabled .kanban-card-grip {
  cursor: grab;
}
.kanban-grip-dots {
  width: 18px;
  height: 8px;
  background-image: radial-gradient(circle, currentColor 1px, transparent 1.4px);
  background-size: 5px 4px;
  opacity: 0.7;
}
.kanban-card-grip--cancel {
  height: auto;
  padding: 3px 0;
  font-size: 0.78em;
  color: var(--fcu-primary);
}

/* Close: a small ghost × in the card's top-right corner (close_action). */
.kanban-card-close {
  position: absolute;
  top: 3px;
  right: 4px;
  margin: 0;
}
.kanban-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fcu-text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.kanban-close-btn:hover,
.kanban-close-btn:focus-visible {
  background-color: hsla(0, 70%, 50%, 0.15);
  color: var(--fcu-danger);
}

.kanban-card-meta,
.kanban-card-people {
  font-size: 0.85em;
  color: var(--fcu-text-muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kanban-person,
.kanban-badge {
  background-color: var(--fcu-surface-alt);
  border-radius: 999px;
  padding: 1px 8px;
}
.kanban-badge {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kanban-empty-col {
  color: var(--fcu-text-muted);
  text-align: center;
}

/* Card footer: labelled action buttons (KanbanCardAction). */
.kanban-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
}
.kanban-action {
  display: inline;
  margin: 0;
}
.kanban-btn {
  min-height: 32px;
  padding: 4px 8px;
  line-height: 1;
  font-size: 0.85em;
  text-decoration: none;
}

/* Drag-and-drop enhancement (kanban-dnd.js). The zone keeps a little height
   so empty columns stay droppable; `js-enabled` is stamped on <html> by the
   base template, so the grab cursor only shows when the drag layer can
   actually run. */
.kanban-cards {
  min-height: 20px;
}
.js-enabled .kanban-card[data-item-id] {
  cursor: grab;
}
.kanban-card--dragging {
  opacity: 0.5;
}

/* The card being moved (the ?move= flow) is visually lifted. */
.kanban-card--moving {
  border-color: var(--fcu-primary);
  box-shadow: 0 0 0 2px
    hsla(var(--fcu-primary-hue), var(--fcu-primary-sat), var(--fcu-primary-light), 0.35);
}

/* "Move here" drop slots rendered in the gaps during a move. */
.kanban-slot-form {
  margin: 0 0 8px;
}
.kanban-slot {
  display: block;
  width: 100%;
  padding: 6px;
  font-size: 0.85em;
  color: var(--fcu-primary);
  background: none;
  border: 1px dashed
    hsla(var(--fcu-primary-hue), var(--fcu-primary-sat), var(--fcu-primary-light), 0.6);
  border-radius: var(--fcu-border-radius);
  cursor: pointer;
}
.kanban-slot:hover {
  background-color: hsla(var(--fcu-primary-hue), var(--fcu-primary-sat), var(--fcu-primary-light), 0.1);
}

/* Per-column quick-add: one name field and a submit. */
.kanban-add {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.kanban-add .fcu-form-control {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: 0.85em;
}

/* With JS on (`js-enabled` is stamped by a script, so this never touches the
   no-JS layout) the quick-add rests as a small ghost field; focusing it grows
   it to full size and reveals the submit. It stays expanded while it holds
   text (`:placeholder-shown` flips), so tabbing away doesn't swallow the
   button mid-entry — and Enter submits regardless. */
.js-enabled .kanban-add .fcu-form-control {
  padding: 2px 8px;
  font-size: 0.8em;
  background-color: transparent;
  border-style: dashed;
  transition: padding 0.15s ease, font-size 0.15s ease;
}
.js-enabled .kanban-add .fcu-btn {
  display: none;
}
.js-enabled .kanban-add:focus-within .fcu-form-control,
.js-enabled .kanban-add:has(.fcu-form-control:not(:placeholder-shown)) .fcu-form-control {
  padding: 4px 8px;
  font-size: 0.85em;
  background-color: var(--fcu-surface);
  border-style: solid;
}
.js-enabled .kanban-add:focus-within .fcu-btn,
.js-enabled .kanban-add:has(.fcu-form-control:not(:placeholder-shown)) .fcu-btn {
  display: inline-block;
}
@media (prefers-reduced-motion: reduce) {
  .js-enabled .kanban-add .fcu-form-control {
    transition: none;
  }
}
