/* ============================================
   WIREFRAME KIT — Neo Design System (Lo-Fi)
   A sketch-style wireframe system for
   low-fidelity prototyping at Moderne.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Handlee&family=Fira+Code:wght@400&display=swap');

/* --- Custom Properties --- */
:root {
  /* Typography */
  --wf-font: 'Handlee', cursive;
  --wf-font-mono: 'Fira Code', monospace;
  /* Sizes tuned so the handwritten font's optical weight mimics Neo's Inter
     ramp (caption 11, body 14, pageHeader 21). Handwritten fonts read ~1px
     larger per step than Inter at the same px, so the scale is trimmed. */
  --wf-font-size-xs: 11px;
  --wf-font-size-sm: 12px;
  --wf-font-size-md: 14px;
  --wf-font-size-lg: 16px;
  --wf-font-size-xl: 20px;
  --wf-font-size-2xl: 26px;
  --wf-line-height: 1.45;

  /* Colors — cool grays (aligned with Neo neutrals) */
  --wf-white: #fafafa;
  --wf-bg: #f5f5f5;
  --wf-surface: #ffffff;
  --wf-fill: #ebebeb;
  --wf-fill-dark: #e0e0e0;
  --wf-border: #c2c2c2;
  --wf-border-dark: #9e9e9e;
  --wf-text: #333333;
  --wf-text-light: #757575;
  --wf-text-lighter: #b0b0b0;
  --wf-accent: #616161;
  --wf-highlight: #e8e8e8;

  /* Semantic colors — subtle tints, just enough to read as status */
  --wf-info: #8e96a0;
  --wf-info-light: #eceef1;
  --wf-info-dark: #5f6670;
  --wf-success: #8e9a8f;
  --wf-success-light: #ecf0ec;
  --wf-success-dark: #5f6e60;
  --wf-warning: #9e978a;
  --wf-warning-light: #f0eee8;
  --wf-warning-dark: #6a6458;
  --wf-error: #9e8e8e;
  --wf-error-light: #f0ecec;
  --wf-error-dark: #6a5858;

  /* Sketch effect */
  --wf-radius: 3px 4px 3px 5px;
  --wf-radius-lg: 5px 7px 6px 8px;
  --wf-border-style: 1.5px solid var(--wf-border);
  --wf-shadow: 1px 2px 0px rgba(0,0,0,0.06);
  --wf-shadow-lg: 2px 3px 0px rgba(0,0,0,0.08);

  /* Spacing */
  --wf-space-xs: 4px;
  --wf-space-sm: 8px;
  --wf-space-md: 16px;
  --wf-space-lg: 24px;
  --wf-space-xl: 32px;
  --wf-space-2xl: 48px;

  /* =========================================
     NEO-ALIGNED SEMANTIC TOKENS
     Maps wireframe primitives to Neo's token
     hierarchy. When upgrading, swap these for
     Neo's actual resolved values.
     ========================================= */

  /* Surfaces  (Neo collection: Color → surfaces/*) */
  --wf-surface-page: var(--wf-bg);                /* → surfaces/page */
  --wf-surface-chrome: var(--wf-bg);              /* → surfaces/page (rail + topbar use page color, so chrome reads as one piece) */
  --wf-surface-card: var(--wf-surface);            /* → surfaces/card */
  --wf-surface-white: var(--wf-surface);           /* → surfaces/white */
  --wf-surface-hover: var(--wf-fill);              /* → surfaces/list-hover */
  --wf-surface-highlight: var(--wf-highlight);     /* → surfaces/highlight-background */
  --wf-surface-tooltip: var(--wf-text);            /* → surfaces/tooltip */
  --wf-surface-scrim: rgba(0,0,0,0.4);            /* → surfaces/scrim */
  --wf-surface-code: var(--wf-text);               /* → code/background */
  --wf-surface-input: var(--wf-surface);           /* → input/background */
  --wf-surface-datagrid: var(--wf-surface);        /* → surfaces/data-grid/background */
  --wf-surface-tab-secondary: var(--wf-fill);      /* → surfaces/tab-secondary-background */
  --wf-surface-nav-active: var(--wf-fill-dark);    /* → buttons/navigation active */

  /* Borders  (Neo collection: Color → border/*) */
  --wf-border-primary: var(--wf-border-dark);      /* → border/primary */
  --wf-border-secondary: var(--wf-border);         /* → border/secondary */
  --wf-border-focus: var(--wf-accent);             /* → border/focus */
  --wf-border-overlay: var(--wf-border);           /* → border/overlay */

  /* Typography colors  (Neo collection: Color → typography/*) */
  --wf-type-body: var(--wf-text);                  /* → typography/body */
  --wf-type-secondary: var(--wf-text-light);       /* → typography/legal */
  --wf-type-placeholder: var(--wf-text-lighter);   /* → typography/input/placeholder */
  --wf-type-tooltip: var(--wf-white);              /* → typography/tooltip */
  --wf-type-error: var(--wf-error-dark);           /* → typography/error */
  --wf-type-success: var(--wf-success-dark);       /* → typography/success */
  --wf-type-warning: var(--wf-warning-dark);       /* → typography/warning */
  --wf-type-link: var(--wf-accent);                /* → typography/link/default */
  --wf-type-navigation: var(--wf-text-light);      /* → typography/navigation/default */
  --wf-type-navigation-selected: var(--wf-text);   /* → typography/navigation/selected */

  /* Shadows  (Neo collection: Shadow) */
  --wf-shadow-card: var(--wf-shadow);              /* → Card/Shadow */
  --wf-shadow-modal: var(--wf-shadow-lg);          /* → Modal/Shadow */
  --wf-shadow-dropdown: var(--wf-shadow);          /* → Dropdown/Shadow */
  --wf-shadow-drawer: var(--wf-shadow-lg);         /* → Drawer/Shadow */
  --wf-shadow-hard-line: 0 1px 0 var(--wf-border); /* → Hard Line/Shadow */

  /* Type scale  (Neo collection: Type primitives → Font size/*) */
  --wf-type-size-sm: var(--wf-font-size-sm);       /* → Font size/sm */
  --wf-type-size-body: var(--wf-font-size-md);     /* → Font size/body */
  --wf-type-size-h6: var(--wf-font-size-md);       /* → Font size/h6 */
  --wf-type-size-h5: var(--wf-font-size-lg);       /* → Font size/h5 */
  --wf-type-size-h4: var(--wf-font-size-xl);       /* → Font size/h4 */
  --wf-type-size-h2: var(--wf-font-size-2xl);      /* → Font size/h2 */
}

/* --- Crosshatch Pattern (SVG data URI) --- */
:root {
  --wf-crosshatch: url("data:image/svg+xml,%3Csvg width='12' height='12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 12L12 0M-2 2L2 -2M10 14L14 10' stroke='%23d0d0d0' stroke-width='0.5'/%3E%3C/svg%3E");
  --wf-dots: url("data:image/svg+xml,%3Csvg width='8' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='0.6' fill='%23c8c8c8'/%3E%3C/svg%3E");
}

/* --- SVG Filter for Sketch Effect --- */
svg.wf-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --- Base / Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
}

/* --- Lucide icons ---
   Inline SVGs sized via the `width`/`height` attributes set in JS (1em by
   default, or a px override). Stroke uses currentColor so icons inherit the
   container's text colour. */
.wf-lucide {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}
/* Inside circular icon "pills" (alert/changelog/prereq) the SVG should never
   bleed past the container; the JS sets px sizes, but guard against the rare
   case a caller passes a too-large 1em icon. */
.wf-alert__icon .wf-lucide,
.wf-tree-item__icon .wf-lucide,
.wf-tree-item__toggle .wf-lucide,
.wf-activation__prereq-icon .wf-lucide,
.wf-changelog-entry__icon .wf-lucide,
.wf-empty-state__icon .wf-lucide,
.wf-sidebar__item-icon .wf-lucide,
.wf-navbar__action .wf-lucide,
.wf-navbar__search-icon .wf-lucide,
.wf-search__icon .wf-lucide,
.wf-datepicker__icon .wf-lucide,
.wf-select__arrow .wf-lucide,
.wf-icon .wf-lucide,
.wf-logo__mark .wf-lucide {
  vertical-align: middle;
}

.wf-kit, .wf-kit * {
  font-family: var(--wf-font);
  line-height: var(--wf-line-height);
  color: var(--wf-text);
}

.wf-kit {
  font-size: var(--wf-font-size-md);
  background: var(--wf-bg);
  min-height: 100vh;
}

/* --- Typography --- */
.wf-h1, .wf-kit h1 { font-size: var(--wf-font-size-2xl); font-weight: 400; margin: 0 0 var(--wf-space-md); }
.wf-h2, .wf-kit h2 { font-size: var(--wf-font-size-xl); font-weight: 400; margin: 0 0 var(--wf-space-md); }
.wf-h3, .wf-kit h3 { font-size: var(--wf-font-size-lg); font-weight: 400; margin: 0 0 var(--wf-space-sm); }
.wf-h4, .wf-kit h4 { font-size: var(--wf-font-size-md); font-weight: 400; margin: 0 0 var(--wf-space-sm); }
.wf-text-light { color: var(--wf-text-light); }
.wf-text-sm { font-size: var(--wf-font-size-sm); }
.wf-text-xs { font-size: var(--wf-font-size-xs); }
.wf-mono { font-family: var(--wf-font-mono); font-size: var(--wf-font-size-sm); }

/* Placeholder text lines */
.wf-placeholder {
  background: var(--wf-fill-dark);
  border-radius: 2px;
  height: 12px;
  margin: 6px 0;
}
.wf-placeholder--short { width: 40%; }
.wf-placeholder--medium { width: 70%; }
.wf-placeholder--long { width: 95%; }

/* --- Page Layout --- */
/* L-shape app shell:
   - Left rail spans full height (grid rows 1-2)
   - Top bar sits only over the main content column
   - Main content "floats" inside the chrome with a rounded top-left corner
   Matches the shell used in trigrep.html / results.html. */
.wf-page {
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "nav topbar"
    "nav main";
  /* Lock the shell to the viewport so the rail + topbar stay pinned and only
     the main column scrolls — matches results.html / trigrep.html shells. */
  height: 100vh;
  overflow: hidden;
  background: var(--wf-surface-chrome);
}

.wf-page--no-sidebar {
  grid-template-columns: 1fr;
  grid-template-areas:
    "topbar"
    "main";
}

/* --- Navbar (top bar — only over main column) --- */
.wf-navbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: 10px var(--wf-space-lg);
  background: var(--wf-surface-chrome);
  height: 56px;
}

.wf-navbar__org {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: var(--wf-font-size-sm);
  border: 1.5px solid var(--wf-border);
  border-radius: 999px;
  background: var(--wf-surface);
  color: var(--wf-text);
  cursor: pointer;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-navbar__org:hover { background: var(--wf-fill); }

.wf-navbar__spacer { flex: 1; }

.wf-navbar__search {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  height: 36px;
  padding: 0 14px;
  width: 260px;
  font-size: var(--wf-font-size-sm);
  border: 1.5px solid var(--wf-border);
  border-radius: 999px;
  background: var(--wf-surface);
  color: var(--wf-text-light);
  cursor: text;
}
.wf-navbar__search-icon { color: var(--wf-text-lighter); font-size: 14px; }
.wf-navbar__search-kbd {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
}
.wf-navbar__search-kbd kbd {
  font-family: var(--wf-font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--wf-fill);
  border: 1px solid var(--wf-border);
  border-radius: 3px;
  color: var(--wf-text-light);
  line-height: 1;
}

.wf-navbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.wf-navbar__action {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--wf-text-light);
  cursor: pointer;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-md);
}
.wf-navbar__action:hover { background: var(--wf-fill); color: var(--wf-text); }

/* Legacy top-bar link list — retained for backward compat with prototypes that
   used the old <wf-navbar items="..."> shape, but de-emphasized. New prototypes
   should put primary nav in the rail. */
.wf-navbar__items {
  display: flex;
  gap: var(--wf-space-md);
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.wf-navbar__item {
  color: var(--wf-type-navigation);
  cursor: pointer;
  text-decoration: none;
  font-size: var(--wf-font-size-sm);
}
.wf-navbar__item:hover,
.wf-navbar__item--active { color: var(--wf-type-navigation-selected); }

/* Legacy brand slot — new prototypes put the brand on the rail (wf-sidebar__home). */
.wf-navbar__brand {
  font-size: var(--wf-font-size-lg);
  color: var(--wf-text);
  margin-right: auto;
  text-decoration: none;
}

/* --- Sidebar (left rail) --- */
.wf-sidebar {
  grid-area: nav;
  width: 88px;
  background: var(--wf-surface-chrome);
  padding: 8px 6px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  overflow-y: auto;
}

.wf-sidebar__home,
.wf-sidebar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--wf-radius-lg);
  color: var(--wf-type-navigation);
  cursor: pointer;
  text-decoration: none;
  font-size: var(--wf-font-size-xs);
  line-height: 1.1;
  text-align: center;
  background: transparent;
  border: none;
  font-family: var(--wf-font);
}

.wf-sidebar__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: var(--wf-radius-lg);
  background: transparent;
  color: var(--wf-text);
  font-size: var(--wf-font-size-md);
  transition: background 0.15s, border-color 0.15s;
}

.wf-sidebar__item:hover .wf-sidebar__item-icon,
.wf-sidebar__item--active .wf-sidebar__item-icon,
.wf-sidebar__home:hover .wf-sidebar__item-icon {
  background: var(--wf-surface-nav-active);
  border-color: var(--wf-border);
}

.wf-sidebar__item-label {
  font-size: var(--wf-font-size-xs);
  color: var(--wf-type-navigation);
}
.wf-sidebar__item--active .wf-sidebar__item-label,
.wf-sidebar__home .wf-sidebar__item-label {
  color: var(--wf-type-navigation-selected);
  /* Default-vs-selected typographic step (mirrors Neo's
     Body/Navigation/Default vs Body/Navigation/selected text styles). */
  font-weight: 600;
}

.wf-sidebar__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wf-space-sm);
  padding-top: var(--wf-space-sm);
}

.wf-sidebar__tenant {
  width: 44px;
  height: 44px;
  border-radius: var(--wf-radius-lg);
  background: var(--wf-text);
  color: var(--wf-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--wf-font-size-xs);
  text-align: center;
  line-height: 1.1;
  padding: 4px;
  background-image: var(--wf-crosshatch);
}

/* Optional section grouping (kept; rail items can be wrapped in __section
   with an __title for grouped rails like Workspace / Settings). */
.wf-sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--wf-space-sm);
}
.wf-sidebar__title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--wf-text-lighter);
  text-align: center;
  padding: 4px 0 2px;
}

/* --- Main Content --- */
.wf-main {
  grid-area: main;
  padding: var(--wf-space-xl);
  overflow-y: auto;
  background: var(--wf-surface);
  border-top-left-radius: 14px 16px;
  box-shadow: var(--wf-shadow);
}
.wf-page--no-sidebar .wf-main {
  border-top-left-radius: 0;
}

.wf-main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--wf-space-lg);
}

/* --- Grid Layouts --- */
.wf-grid {
  display: grid;
  gap: var(--wf-space-md);
}
.wf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.wf-grid--3 { grid-template-columns: repeat(3, 1fr); }
.wf-grid--4 { grid-template-columns: repeat(4, 1fr); }

.wf-stack {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-md);
}

.wf-row {
  display: flex;
  gap: var(--wf-space-md);
  align-items: center;
}

.wf-row--spread {
  justify-content: space-between;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* --- Alert --- */
.wf-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-md);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  background: var(--wf-surface);
  box-shadow: var(--wf-shadow);
}
.wf-alert__icon {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--wf-border-dark);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--wf-text-light);
}
.wf-alert__content { flex: 1; }
.wf-alert__title { font-size: var(--wf-font-size-md); margin-bottom: 2px; }
.wf-alert__message { font-size: var(--wf-font-size-sm); color: var(--wf-text-light); }

.wf-alert--info { border-left: 4px solid var(--wf-info); }
.wf-alert--success { border-left: 4px solid var(--wf-success); }
.wf-alert--warning { border-left: 4px solid var(--wf-warning); }
.wf-alert--error { border-left: 4px solid var(--wf-error); }

/* --- Avatar --- */
.wf-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wf-fill-dark);
  border: 1.5px solid var(--wf-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  flex-shrink: 0;
  background-image: var(--wf-crosshatch);
}
.wf-avatar--sm { width: 28px; height: 28px; font-size: var(--wf-font-size-xs); }
.wf-avatar--lg { width: 48px; height: 48px; font-size: var(--wf-font-size-lg); }
.wf-avatar--xl { width: 64px; height: 64px; font-size: var(--wf-font-size-xl); }

/* --- Badge --- */
.wf-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--wf-font-size-xs);
  border: 1px solid var(--wf-border);
  border-radius: 10px 12px 11px 10px;
  background: var(--wf-fill);
  color: var(--wf-text-light);
  line-height: 1.4;
}
.wf-badge--filled {
  background: var(--wf-fill-dark);
  color: var(--wf-text);
}

/* --- Banner --- */
.wf-banner {
  display: flex;
  align-items: center;
  gap: var(--wf-space-md);
  padding: var(--wf-space-sm) var(--wf-space-lg);
  background: var(--wf-fill);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius);
  font-size: var(--wf-font-size-sm);
}
.wf-banner__dismiss {
  margin-left: auto;
  cursor: pointer;
  color: var(--wf-text-light);
  background: none;
  border: none;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-md);
}

/* --- Disclaimer ---
   Sits at the top of a wireframe to remind viewers that the page is a
   prototype, not working software. Intentionally loud (dashed border,
   crosshatch fill) so it can't be mistaken for product chrome. */
.wf-disclaimer {
  display: flex;
  align-items: center;
  gap: var(--wf-space-md);
  padding: var(--wf-space-sm) var(--wf-space-lg);
  border: 2px dashed var(--wf-border-dark);
  border-radius: var(--wf-radius);
  background: var(--wf-warning-light);
  background-image: var(--wf-crosshatch);
  color: var(--wf-text);
  font-size: var(--wf-font-size-sm);
}
.wf-disclaimer__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wf-warning-dark);
}
.wf-disclaimer__content { flex: 1; min-width: 0; }
.wf-disclaimer__title {
  font-size: var(--wf-font-size-md);
  color: var(--wf-text);
  line-height: 1.2;
}
.wf-disclaimer__note {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  margin-top: 2px;
}

/* --- Breadcrumb --- */
.wf-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  list-style: none;
  margin: 0;
  padding: 0;
}
.wf-breadcrumb__item { text-decoration: none; color: var(--wf-text-light); cursor: pointer; }
.wf-breadcrumb__item:hover { color: var(--wf-text); }
.wf-breadcrumb__item--active { color: var(--wf-text); cursor: default; }
.wf-breadcrumb__sep { color: var(--wf-text-lighter); }

/* --- Button --- */
.wf-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: 1.5px solid var(--wf-border-dark);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
  color: var(--wf-text);
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.4;
}
.wf-button:hover { background: var(--wf-fill); }

.wf-button--primary {
  background: var(--wf-text);
  color: var(--wf-white);
  border-color: var(--wf-text);
}
.wf-button--primary:hover { background: #555555; }

.wf-button--secondary {
  background: var(--wf-fill-dark);
  border-color: var(--wf-border);
}

/* Neo's "Tertiary" hierarchy. `ghost` kept as alias for older prototypes. */
.wf-button--ghost,
.wf-button--tertiary {
  background: transparent;
  border-color: transparent;
}
.wf-button--ghost:hover,
.wf-button--tertiary:hover { background: var(--wf-fill); }

.wf-button--destructive {
  border-color: var(--wf-error);
  color: var(--wf-error-dark);
}

.wf-button--sm { padding: 4px 10px; font-size: var(--wf-font-size-xs); }
.wf-button--lg { padding: 10px 22px; font-size: var(--wf-font-size-md); }

.wf-button:disabled, .wf-button--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wf-button--pressed { background: var(--wf-fill-dark); }
.wf-button--primary.wf-button--pressed { background: #1f1f1f; }

.wf-button--loading {
  cursor: progress;
  pointer-events: none;
}
.wf-button__spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: wf-spin 0.8s linear infinite;
  opacity: 0.7;
}
.wf-button__icon {
  display: inline-flex;
  align-items: center;
}

/* --- ButtonGroup --- */
.wf-button-group {
  display: inline-flex;
}
.wf-button-group .wf-button {
  border-radius: 0;
  margin-left: -1.5px;
}
.wf-button-group .wf-button:first-child {
  border-radius: 3px 0 0 5px;
  margin-left: 0;
}
.wf-button-group .wf-button:last-child {
  border-radius: 0 4px 3px 0;
}

/* --- ButtonTab --- */
.wf-button-tab {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--wf-fill);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
}
.wf-button-tab__item {
  padding: 5px 14px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: none;
  border-radius: var(--wf-radius);
  background: transparent;
  color: var(--wf-text-light);
  cursor: pointer;
}
.wf-button-tab__item--active {
  background: var(--wf-surface);
  color: var(--wf-text);
  box-shadow: var(--wf-shadow);
}

/* --- Card --- */
.wf-card {
  background: var(--wf-surface);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  box-shadow: var(--wf-shadow);
  overflow: hidden;
}
.wf-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-md);
  border-bottom: 1px solid var(--wf-fill-dark);
}
.wf-card__body {
  padding: var(--wf-space-md);
}
.wf-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-top: 1px solid var(--wf-fill-dark);
  background: var(--wf-fill);
}

/* Stat card variant */
.wf-stat-card {
  background: var(--wf-surface);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  box-shadow: var(--wf-shadow);
  padding: var(--wf-space-md);
}
.wf-stat-card__label {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  margin-bottom: var(--wf-space-xs);
}
.wf-stat-card__value {
  font-size: var(--wf-font-size-2xl);
}
.wf-stat-card__change {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  margin-top: var(--wf-space-xs);
}

/* --- Checkbox --- */
.wf-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  cursor: pointer;
  font-size: var(--wf-font-size-sm);
}
.wf-checkbox__box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--wf-border-dark);
  border-radius: 3px 4px 3px 4px;
  background: var(--wf-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--wf-text);
}
.wf-checkbox--checked .wf-checkbox__box {
  background: var(--wf-fill-dark);
}
.wf-checkbox--checked .wf-checkbox__box::after {
  content: '✓';
}

/* --- Chip --- */
.wf-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--wf-font-size-xs);
  border: 1px solid var(--wf-border);
  border-radius: 12px;
  background: var(--wf-surface);
  color: var(--wf-text);
}
.wf-chip__remove {
  cursor: pointer;
  color: var(--wf-text-light);
  font-size: 14px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--wf-font);
}

/* --- CodeSnippet --- */
.wf-code-snippet {
  background: var(--wf-text);
  color: #d0d0d0;
  font-family: var(--wf-font-mono);
  font-size: var(--wf-font-size-sm);
  padding: var(--wf-space-md);
  border-radius: var(--wf-radius-lg);
  border: 1.5px solid var(--wf-border-dark);
  overflow-x: auto;
  position: relative;
  line-height: 1.5;
}
.wf-code-snippet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-sm) var(--wf-space-md);
  background: #2a2a2a;
  border-bottom: 1px solid #4a4a4a;
  margin: calc(-1 * var(--wf-space-md));
  margin-bottom: var(--wf-space-md);
  border-radius: 5px 7px 0 0;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-xs);
  color: #858585;
}
.wf-code-snippet__copy {
  cursor: pointer;
  color: #858585;
  background: none;
  border: 1px solid #4a4a4a;
  border-radius: var(--wf-radius);
  padding: 2px 8px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-xs);
}
.wf-code-snippet__line {
  display: block;
}
.wf-code-snippet__line-number {
  display: inline-block;
  width: 30px;
  text-align: right;
  margin-right: 12px;
  color: #5a5a5a;
  user-select: none;
}

/* --- DataGrid / Table --- */
.wf-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  overflow: hidden;
  background: var(--wf-surface);
  box-shadow: var(--wf-shadow);
}
.wf-table th {
  text-align: left;
  padding: 10px var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  background: var(--wf-fill);
  border-bottom: var(--wf-border-style);
  font-weight: 400;
}
.wf-table td {
  padding: 10px var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
  border-bottom: 1px solid var(--wf-fill-dark);
}
.wf-table tr:last-child td {
  border-bottom: none;
}
.wf-table tr:hover td {
  background: var(--wf-fill);
}

/* DataGrid toolbar */
.wf-datagrid__toolbar {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-sm) var(--wf-space-md);
  background: var(--wf-fill);
  border: var(--wf-border-style);
  border-bottom: none;
  border-radius: 5px 7px 0 0;
}

/* --- DatePicker --- */
.wf-datepicker {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: 7px 12px;
  border: var(--wf-border-style);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
  font-size: var(--wf-font-size-sm);
  cursor: pointer;
}
.wf-datepicker__icon {
  color: var(--wf-text-light);
  font-size: 14px;
}

/* --- DiffStat --- */
.wf-diffstat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--wf-font-size-sm);
  font-family: var(--wf-font-mono);
}
.wf-diffstat__bar {
  display: flex;
  gap: 1px;
  height: 10px;
}
.wf-diffstat__segment {
  width: 8px;
  height: 10px;
  border-radius: 1px;
}
.wf-diffstat__segment--add { background: var(--wf-success); }
.wf-diffstat__segment--remove { background: var(--wf-error); }
.wf-diffstat__segment--neutral { background: var(--wf-fill-dark); }
.wf-diffstat__text--add { color: var(--wf-success-dark); }
.wf-diffstat__text--remove { color: var(--wf-error-dark); }

/* --- Divider --- */
.wf-divider {
  border: none;
  border-top: 1.5px solid var(--wf-border);
  margin: var(--wf-space-md) 0;
}
.wf-divider--dashed {
  border-top-style: dashed;
}

/* --- Dropdown --- */
.wf-dropdown {
  position: relative;
  display: inline-block;
}
.wf-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--wf-surface);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  box-shadow: var(--wf-shadow-lg);
  padding: var(--wf-space-xs) 0;
  z-index: 100;
  margin-top: 4px;
}
.wf-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: 6px var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
  cursor: pointer;
  color: var(--wf-text);
  text-decoration: none;
}
.wf-dropdown__item:hover { background: var(--wf-fill); }
.wf-dropdown__divider {
  border-top: 1px solid var(--wf-fill-dark);
  margin: var(--wf-space-xs) 0;
}

/* --- Icon (placeholder) --- */
.wf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--wf-border);
  border-radius: 3px;
  background: var(--wf-fill);
  font-size: 10px;
  color: var(--wf-text-light);
  flex-shrink: 0;
}
.wf-icon--sm { width: 16px; height: 16px; font-size: 8px; }
.wf-icon--lg { width: 28px; height: 28px; font-size: 14px; }

/* --- Input --- */
.wf-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wf-input-group__label {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text);
}
.wf-input-group__helper {
  font-size: var(--wf-font-size-xs);
  color: var(--wf-text-light);
}
.wf-input-group__error {
  font-size: var(--wf-font-size-xs);
  color: var(--wf-error-dark);
}

.wf-input {
  padding: 7px 12px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
  color: var(--wf-text);
  outline: none;
  width: 100%;
}
.wf-input::placeholder { color: var(--wf-text-lighter); }
.wf-input:focus { border-color: var(--wf-border-dark); }
.wf-input--error { border-color: var(--wf-error); }

/* --- KeyValuePair --- */
.wf-kv {
  display: flex;
  gap: var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
  padding: var(--wf-space-sm) 0;
}
.wf-kv__key {
  color: var(--wf-text-light);
  min-width: 120px;
  flex-shrink: 0;
}
.wf-kv__value {
  color: var(--wf-text);
}

/* --- ListItem --- */
.wf-list-item {
  display: flex;
  align-items: center;
  gap: var(--wf-space-md);
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-bottom: 1px solid var(--wf-fill-dark);
  cursor: pointer;
}
.wf-list-item:hover { background: var(--wf-fill); }
.wf-list-item:last-child { border-bottom: none; }
.wf-list-item__content { flex: 1; }
.wf-list-item__title { font-size: var(--wf-font-size-sm); }
.wf-list-item__subtitle { font-size: var(--wf-font-size-xs); color: var(--wf-text-light); }
.wf-list-item__trailing { font-size: var(--wf-font-size-xs); color: var(--wf-text-light); }

/* --- Modal --- */
.wf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.wf-modal {
  background: var(--wf-surface);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  box-shadow: 3px 4px 0px rgba(0,0,0,0.1);
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
}
.wf-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-md);
  border-bottom: 1px solid var(--wf-fill-dark);
}
.wf-modal__title { font-size: var(--wf-font-size-lg); }
.wf-modal__close {
  cursor: pointer;
  color: var(--wf-text-light);
  background: none;
  border: none;
  font-size: var(--wf-font-size-lg);
  font-family: var(--wf-font);
}
.wf-modal__body { padding: var(--wf-space-md); }
.wf-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-top: 1px solid var(--wf-fill-dark);
}

/* --- Pagination --- */
.wf-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wf-pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
  cursor: pointer;
  color: var(--wf-text-light);
}
.wf-pagination__item:hover { background: var(--wf-fill); }
.wf-pagination__item--active {
  background: var(--wf-text);
  color: var(--wf-white);
  border-color: var(--wf-text);
}
.wf-pagination__ellipsis {
  color: var(--wf-text-lighter);
  padding: 0 4px;
}

/* --- Progress --- */
.wf-progress {
  width: 100%;
  height: 10px;
  background: var(--wf-fill-dark);
  border: 1px solid var(--wf-border);
  border-radius: 6px;
  overflow: hidden;
}
.wf-progress__bar {
  height: 100%;
  background: var(--wf-border-dark);
  background-image: var(--wf-crosshatch);
  border-radius: 5px;
  transition: width 0.3s;
}

/* --- Radio --- */
.wf-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  cursor: pointer;
  font-size: var(--wf-font-size-sm);
}
.wf-radio__circle {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--wf-border-dark);
  border-radius: 50%;
  background: var(--wf-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wf-radio--selected .wf-radio__circle::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wf-text);
}

/* --- Search --- */
.wf-search {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: 7px 12px;
  border: var(--wf-border-style);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
}
.wf-search__icon { color: var(--wf-text-lighter); font-size: 14px; }
.wf-search__input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text);
  width: 100%;
}
.wf-search__input::placeholder { color: var(--wf-text-lighter); }

/* --- Select --- */
.wf-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wf-space-sm);
  padding: 7px 12px;
  min-width: 160px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius);
  background: var(--wf-surface);
  color: var(--wf-text);
  cursor: pointer;
}
.wf-select__arrow { color: var(--wf-text-light); font-size: 10px; }
.wf-select--placeholder { color: var(--wf-text-lighter); }

/* --- Tabs --- */
.wf-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--wf-border);
}
.wf-tabs__item {
  padding: var(--wf-space-sm) var(--wf-space-md);
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: none;
  background: none;
  color: var(--wf-text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
}
.wf-tabs__item:hover { color: var(--wf-text); }
.wf-tabs__item--active {
  color: var(--wf-text);
  border-bottom-color: var(--wf-text);
}

/* --- Tag --- */
.wf-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--wf-font-size-xs);
  border: 1px dashed var(--wf-border);
  border-radius: var(--wf-radius);
  background: var(--wf-fill);
  color: var(--wf-text-light);
}

/* --- Textarea --- */
.wf-textarea {
  padding: 10px 12px;
  font-family: var(--wf-font);
  font-size: var(--wf-font-size-sm);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  background: var(--wf-surface);
  color: var(--wf-text);
  outline: none;
  width: 100%;
  min-height: 80px;
  resize: vertical;
}
.wf-textarea::placeholder { color: var(--wf-text-lighter); }

/* --- Toast --- */
.wf-toast-container {
  position: fixed;
  bottom: var(--wf-space-lg);
  right: var(--wf-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-sm);
  z-index: 1100;
}
.wf-toast {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-sm) var(--wf-space-md);
  background: var(--wf-text);
  color: #d0d0d0;
  font-size: var(--wf-font-size-sm);
  border-radius: var(--wf-radius-lg);
  box-shadow: var(--wf-shadow-lg);
  min-width: 260px;
}
.wf-toast__dismiss {
  margin-left: auto;
  cursor: pointer;
  color: #858585;
  background: none;
  border: none;
  font-family: var(--wf-font);
}

/* --- Toggle --- */
.wf-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  cursor: pointer;
  font-size: var(--wf-font-size-sm);
}
.wf-toggle__track {
  width: 36px;
  height: 20px;
  border: 1.5px solid var(--wf-border-dark);
  border-radius: 12px;
  background: var(--wf-fill-dark);
  position: relative;
  transition: background 0.2s;
}
.wf-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  transition: left 0.2s;
}
.wf-toggle--on .wf-toggle__track {
  background: var(--wf-border-dark);
}
.wf-toggle--on .wf-toggle__thumb {
  left: 18px;
}

/* --- Tooltip --- */
.wf-tooltip-wrapper {
  position: relative;
  display: inline-block;
}
.wf-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--wf-text);
  color: #d0d0d0;
  font-size: var(--wf-font-size-xs);
  border-radius: var(--wf-radius);
  white-space: nowrap;
  z-index: 200;
}
.wf-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--wf-text);
}

/* --- Tree --- */
.wf-tree {
  font-size: var(--wf-font-size-sm);
}
.wf-tree-item {
  padding: 3px 0;
}
.wf-tree-item__row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--wf-space-sm);
  border-radius: var(--wf-radius);
  cursor: pointer;
}
.wf-tree-item__row:hover { background: var(--wf-fill); }
.wf-tree-item__toggle {
  width: 16px;
  font-size: 10px;
  color: var(--wf-text-light);
  text-align: center;
}
.wf-tree-item__icon {
  width: 16px;
  height: 16px;
  border: 1px solid var(--wf-border);
  border-radius: 2px;
  background: var(--wf-fill);
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wf-text-light);
}
.wf-tree-item__children {
  padding-left: 20px;
}

/* --- Chart Placeholder --- */
.wf-chart {
  background: var(--wf-surface);
  border: var(--wf-border-style);
  border-radius: var(--wf-radius-lg);
  box-shadow: var(--wf-shadow);
  padding: var(--wf-space-md);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.wf-chart__title {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  margin-bottom: var(--wf-space-md);
}
.wf-chart__area {
  flex: 1;
  background-image: var(--wf-dots);
  border-left: 1.5px solid var(--wf-border);
  border-bottom: 1.5px solid var(--wf-border);
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: var(--wf-space-sm);
}
.wf-chart__bar {
  flex: 1;
  background: var(--wf-fill-dark);
  background-image: var(--wf-crosshatch);
  border: 1px solid var(--wf-border);
  border-radius: 3px 3px 0 0;
  min-width: 20px;
}

/* --- Empty State --- */
.wf-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--wf-space-2xl);
  text-align: center;
}
.wf-empty-state__icon {
  width: 64px;
  height: 64px;
  border: 2px dashed var(--wf-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--wf-space-md);
  background-image: var(--wf-crosshatch);
  color: var(--wf-text-lighter);
  font-size: 24px;
}
.wf-empty-state__title {
  font-size: var(--wf-font-size-lg);
  margin-bottom: var(--wf-space-sm);
}
.wf-empty-state__message {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
  margin-bottom: var(--wf-space-md);
  max-width: 360px;
}

/* --- Icon --- */
.wf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--wf-font-size-md);
  color: var(--wf-text-light);
  width: 1.2em;
  height: 1.2em;
  vertical-align: middle;
}
.wf-icon--sm { font-size: var(--wf-font-size-xs); }
.wf-icon--lg { font-size: var(--wf-font-size-xl); }

/* --- Logo --- */
.wf-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-space-sm);
  font-size: var(--wf-font-size-lg);
}
.wf-logo__mark {
  font-size: 1.3em;
  color: var(--wf-accent);
}
.wf-logo__text {
  font-weight: normal;
  letter-spacing: 0.02em;
}
.wf-logo--sm { font-size: var(--wf-font-size-sm); }
.wf-logo--lg { font-size: var(--wf-font-size-2xl); }

/* --- Slider --- */
.wf-slider {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-xs);
}
.wf-slider__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.wf-slider__label {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text);
}
.wf-slider__value {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-text-light);
}
.wf-slider__input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--wf-fill-dark);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.wf-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wf-surface);
  border: 1.5px solid var(--wf-border-dark);
  box-shadow: var(--wf-shadow);
  cursor: pointer;
}
.wf-slider__input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wf-surface);
  border: 1.5px solid var(--wf-border-dark);
  box-shadow: var(--wf-shadow);
  cursor: pointer;
}
.wf-slider__input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Spinner --- */
.wf-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--wf-fill-dark);
  border-top-color: var(--wf-border-dark);
  border-radius: 50%;
  animation: wf-spin 0.8s linear infinite;
}
.wf-spinner--sm { width: 14px; height: 14px; border-width: 1.5px; }
.wf-spinner--lg { width: 32px; height: 32px; border-width: 3px; }

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

/* --- Skeleton --- */
.wf-skeleton {
  background: linear-gradient(90deg, var(--wf-fill-dark) 25%, var(--wf-fill) 50%, var(--wf-fill-dark) 75%);
  background-size: 200% 100%;
  animation: wf-shimmer 1.5s infinite;
  border-radius: var(--wf-radius);
}
.wf-skeleton--text { height: 14px; margin: 6px 0; }
.wf-skeleton--heading { height: 22px; width: 60%; margin: 8px 0; }
.wf-skeleton--circle { border-radius: 50%; }
.wf-skeleton--rect { border-radius: var(--wf-radius-lg); }

@keyframes wf-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Utility --- */
.wf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}
.wf-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-crosshatch-bg { background-image: var(--wf-crosshatch); }
.wf-dots-bg { background-image: var(--wf-dots); }

/* ============================================
   ASSEMBLIES
   ============================================ */

/* --- Card Table Layout --- */
.wf-card-table {
  border: 1.5px solid var(--wf-border);
  border-radius: var(--wf-radius-lg);
  background: var(--wf-surface-card);
  overflow: hidden;
}
.wf-card-table__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-md) var(--wf-space-lg);
  border-bottom: 1.5px solid var(--wf-border);
  background: var(--wf-surface-page);
}
.wf-card-table__title {
  font-size: var(--wf-font-size-lg);
  font-weight: 600;
  color: var(--wf-type-body);
}
.wf-card-table__actions {
  display: flex;
  gap: var(--wf-space-sm);
  align-items: center;
}
.wf-card-table__row {
  padding: var(--wf-space-md) var(--wf-space-lg);
  border-bottom: 1px solid var(--wf-fill-dark);
  display: flex;
  align-items: flex-start;
  gap: var(--wf-space-md);
  transition: background 0.15s;
}
.wf-card-table__row:last-child { border-bottom: none; }
.wf-card-table__row:hover { background: var(--wf-surface-hover); }
.wf-card-table__row-content {
  flex: 1;
  min-width: 0;
}
.wf-card-table__row-title {
  font-weight: 600;
  color: var(--wf-type-body);
  margin-bottom: var(--wf-space-xs);
}
.wf-card-table__row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wf-space-xs);
  align-items: center;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}
.wf-card-table__row-secondary {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
  margin-top: var(--wf-space-xs);
}
.wf-card-table__row-actions {
  flex-shrink: 0;
  display: flex;
  gap: var(--wf-space-xs);
}

/* --- Filter Results Layout --- */
.wf-filter-results {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.wf-filter-results__bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wf-space-sm);
  align-items: center;
  padding: var(--wf-space-sm) var(--wf-space-md);
  border: 1.5px solid var(--wf-border);
  border-bottom: none;
  border-radius: var(--wf-radius-lg) var(--wf-radius-lg) 0 0;
  background: var(--wf-surface-card);
}
.wf-filter-results__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wf-space-xs);
  flex: 1;
}
.wf-filter-results__search {
  flex-shrink: 0;
}
.wf-filter-results__table {
  border: 1.5px solid var(--wf-border);
  border-top: none;
  border-radius: 0 0 var(--wf-radius-lg) var(--wf-radius-lg);
  overflow: hidden;
}
.wf-filter-results__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-top: 1px solid var(--wf-fill-dark);
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
  background: var(--wf-surface-card);
}

/* --- Data Table Layout --- */
.wf-data-table-layout {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--wf-border);
  border-radius: var(--wf-radius-lg);
  background: var(--wf-surface-card);
  overflow: hidden;
}
.wf-data-table-layout__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wf-space-sm);
  align-items: center;
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-bottom: 1.5px solid var(--wf-border);
  background: var(--wf-surface-page);
}
.wf-data-table-layout__toolbar-left {
  display: flex;
  gap: var(--wf-space-sm);
  flex: 1;
  align-items: center;
}
.wf-data-table-layout__toolbar-right {
  display: flex;
  gap: var(--wf-space-sm);
  align-items: center;
}
.wf-data-table-layout__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-top: 1.5px solid var(--wf-border);
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}

/* --- Changelog Feed Layout --- */
.wf-changelog-feed {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-md);
}
.wf-changelog-feed__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wf-space-sm);
  align-items: center;
  padding: var(--wf-space-sm) 0;
}
.wf-changelog-feed__list {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-sm);
}
.wf-changelog-entry {
  display: flex;
  gap: var(--wf-space-md);
  padding: var(--wf-space-md);
  border: 1.5px solid var(--wf-border);
  border-radius: var(--wf-radius-lg);
  background: var(--wf-surface-card);
  transition: background 0.15s;
  cursor: pointer;
}
.wf-changelog-entry:hover { background: var(--wf-surface-hover); }
.wf-changelog-entry__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--wf-fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}
.wf-changelog-entry__body {
  flex: 1;
  min-width: 0;
}
.wf-changelog-entry__header {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  margin-bottom: var(--wf-space-xs);
}
.wf-changelog-entry__title {
  font-weight: 600;
  color: var(--wf-type-body);
}
.wf-changelog-entry__meta {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}
.wf-changelog-entry__timestamp {
  flex-shrink: 0;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
  text-align: right;
}

/* ============================================
   COMPOSITIONS
   ============================================ */

/* --- Recipe Execution Results --- */
.wf-recipe-results {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.wf-recipe-results__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-md) var(--wf-space-lg);
  border: 1.5px solid var(--wf-border);
  border-radius: var(--wf-radius-lg) var(--wf-radius-lg) 0 0;
  background: var(--wf-surface-card);
}
.wf-recipe-results__summary-left {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-xs);
}
.wf-recipe-results__recipe-name {
  font-size: var(--wf-font-size-lg);
  font-weight: 600;
  color: var(--wf-type-body);
}
.wf-recipe-results__stats {
  display: flex;
  gap: var(--wf-space-lg);
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}
.wf-recipe-results__stat-value {
  font-weight: 600;
  color: var(--wf-type-body);
  margin-right: var(--wf-space-xs);
}
.wf-recipe-results__summary-right {
  display: flex;
  gap: var(--wf-space-sm);
  align-items: center;
}
.wf-recipe-results__tabs {
  border-left: 1.5px solid var(--wf-border);
  border-right: 1.5px solid var(--wf-border);
}
.wf-recipe-results__body {
  border: 1.5px solid var(--wf-border);
  border-top: none;
  border-radius: 0 0 var(--wf-radius-lg) var(--wf-radius-lg);
  overflow: hidden;
}

/* --- Empty State Activation --- */
.wf-activation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--wf-space-3xl) var(--wf-space-xl);
  min-height: 360px;
}
.wf-activation__illustration {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--wf-fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--wf-text-light);
  margin-bottom: var(--wf-space-lg);
}
.wf-activation__headline {
  font-size: var(--wf-font-size-xl);
  font-weight: 700;
  color: var(--wf-type-body);
  margin-bottom: var(--wf-space-sm);
}
.wf-activation__description {
  font-size: var(--wf-font-size-base);
  color: var(--wf-type-secondary);
  max-width: 480px;
  margin-bottom: var(--wf-space-lg);
  line-height: 1.5;
}
.wf-activation__prereqs {
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-sm);
  margin-bottom: var(--wf-space-lg);
  text-align: left;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-type-secondary);
}
.wf-activation__prereq {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
}
.wf-activation__prereq-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.wf-activation__prereq--done .wf-activation__prereq-icon {
  background: var(--wf-success-light);
  color: var(--wf-success-dark);
}
.wf-activation__prereq--pending .wf-activation__prereq-icon {
  background: var(--wf-fill);
  color: var(--wf-text-lighter);
}
.wf-activation__cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wf-space-sm);
}
.wf-activation__links {
  display: flex;
  gap: var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
}
.wf-activation__link {
  color: var(--wf-type-link);
  text-decoration: underline;
  cursor: pointer;
}
