/*
 * Snapline Design System — Fizzy-inspired
 * Vanilla CSS with custom properties. Works alongside Tailwind utilities.
 * Follows Fizzy's pattern: OKLCH colors, CSS layers, semantic components.
 */

@layer tokens, base, components;

/* ================================================================
   TOKENS — Design tokens as CSS custom properties
   ================================================================ */
@layer tokens {
  :root {
    /* Ink (neutral text/borders) — 7-tier OKLCH scale like Fizzy */
    --ink-darkest: oklch(0.26 0.02 264);
    --ink-darker: oklch(0.40 0.015 262);
    --ink-dark: oklch(0.56 0.01 260);
    --ink-medium: oklch(0.66 0.008 258);
    --ink-light: oklch(0.84 0.005 256);
    --ink-lighter: oklch(0.92 0.003 254);
    --ink-lightest: oklch(0.96 0.002 252);

    /* Canvas */
    --canvas: oklch(1 0 0);
    --canvas-alt: oklch(0.975 0.002 260);

    /* Brand (blue) */
    --brand: oklch(0.55 0.20 260);
    --brand-light: oklch(0.92 0.04 260);
    --brand-hover: oklch(0.48 0.20 260);

    /* Status column colors — Fizzy's card-color pattern */
    --status-new: oklch(0.58 0.18 260);
    --status-quoted: oklch(0.55 0.18 305);
    --status-approved: oklch(0.58 0.17 145);
    --status-scheduled: oklch(0.62 0.16 85);
    --status-in-progress: oklch(0.60 0.18 55);
    --status-completed: oklch(0.55 0.14 175);
    --status-invoiced: oklch(0.52 0.16 280);
    --status-paid: oklch(0.58 0.17 160);
    --status-declined: oklch(0.55 0.18 25);
    --status-cancelled: oklch(0.55 0 0);

    /* Feedback */
    --positive: oklch(0.55 0.17 145);
    --negative: oklch(0.55 0.19 27);
    --warning: oklch(0.65 0.16 85);

    /* Shadows — Fizzy's multi-layer realistic shadows */
    --shadow:
      0 0 0 1px oklch(0 0 0 / 0.04),
      0 1px 1px oklch(0 0 0 / 0.06),
      0 3px 6px oklch(0 0 0 / 0.06);
    --shadow-lg:
      0 0 0 1px oklch(0 0 0 / 0.04),
      0 2px 4px oklch(0 0 0 / 0.06),
      0 8px 24px oklch(0 0 0 / 0.1);
    --shadow-card:
      0 0 0 1px oklch(0 0 0 / 0.03),
      0 1px 2px oklch(0 0 0 / 0.04);

    /* Radii — Fizzy uses large pill radii */
    --radius: 0.5em;
    --radius-lg: 0.75em;
    --radius-pill: 99rem;

    /* Easing — Fizzy's overshoot for playful spring */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-panel: 300;
    --z-toast: 500;

    /* Column layout */
    --column-gap: 0.75rem;
    --column-collapsed: 2.5rem;
  }

  /* Dark mode — Fizzy pattern: data-theme attribute */
  html[data-theme="dark"] {
    --ink-darkest: oklch(0.96 0.003 260);
    --ink-darker: oklch(0.86 0.006 260);
    --ink-dark: oklch(0.74 0.009 260);
    --ink-medium: oklch(0.62 0.012 260);
    --ink-light: oklch(0.40 0.015 260);
    --ink-lighter: oklch(0.30 0.018 260);
    --ink-lightest: oklch(0.25 0.020 260);
    --canvas: oklch(0.18 0.015 260);
    --canvas-alt: oklch(0.22 0.015 260);
    --brand: oklch(0.65 0.18 260);
    --brand-light: oklch(0.25 0.06 260);
    --brand-hover: oklch(0.72 0.18 260);
    --shadow:
      0 0 0 1px oklch(0 0 0 / 0.3),
      0 1px 2px oklch(0 0 0 / 0.3),
      0 4px 8px oklch(0 0 0 / 0.3);
    --shadow-lg:
      0 0 0 1px oklch(0 0 0 / 0.3),
      0 4px 8px oklch(0 0 0 / 0.3),
      0 12px 32px oklch(0 0 0 / 0.4);
    --shadow-card:
      0 0 0 1px oklch(1 0 0 / 0.06);
  }

  /* System preference fallback */
  @media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
      --ink-darkest: oklch(0.96 0.003 260);
      --ink-darker: oklch(0.86 0.006 260);
      --ink-dark: oklch(0.74 0.009 260);
      --ink-medium: oklch(0.62 0.012 260);
      --ink-light: oklch(0.40 0.015 260);
      --ink-lighter: oklch(0.30 0.018 260);
      --ink-lightest: oklch(0.25 0.020 260);
      --canvas: oklch(0.18 0.015 260);
      --canvas-alt: oklch(0.22 0.015 260);
      --brand: oklch(0.65 0.18 260);
      --brand-light: oklch(0.25 0.06 260);
      --brand-hover: oklch(0.72 0.18 260);
      --shadow:
        0 0 0 1px oklch(0 0 0 / 0.3),
        0 1px 2px oklch(0 0 0 / 0.3),
        0 4px 8px oklch(0 0 0 / 0.3);
      --shadow-lg:
        0 0 0 1px oklch(0 0 0 / 0.3),
        0 4px 8px oklch(0 0 0 / 0.3),
        0 12px 32px oklch(0 0 0 / 0.4);
      --shadow-card:
        0 0 0 1px oklch(1 0 0 / 0.06);
    }
  }
}

/* ================================================================
   BASE — Reset and base element styles
   ================================================================ */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html {
    color-scheme: light dark;
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: var(--canvas-alt);
    color: var(--ink-darkest);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  a { color: var(--brand); text-decoration: none; }
  a:hover { text-decoration: underline; }

  /* Focus ring — Fizzy pattern */
  :focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }

  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ================================================================
   COMPONENTS
   ================================================================ */
@layer components {

  /* --- Buttons (Fizzy pattern) --- */
  .btn {
    align-items: center;
    background: var(--canvas);
    border: 1px solid var(--ink-light);
    border-radius: var(--radius-pill);
    color: var(--ink-darkest);
    cursor: pointer;
    display: inline-flex;
    font-size: max(16px, 0.875em);
    font-weight: 500;
    gap: 0.5em;
    justify-content: center;
    line-height: 1.25;
    padding: 0.5em 1.1em;
    text-decoration: none;
    transition: 100ms ease-out;
    transition-property: background-color, border-color, box-shadow, color, filter, opacity;
    user-select: none;
    white-space: nowrap;
  }

  .btn:hover {
    filter: brightness(0.95);
    text-decoration: none;
  }

  .btn:active { transform: scale(0.97); }

  .btn:disabled, .btn[aria-busy="true"] {
    opacity: 0.4;
    pointer-events: none;
  }

  /* Fizzy: loading dots via mask animation */
  .btn[aria-busy="true"]::after {
    content: "";
    width: 1.5em;
    aspect-ratio: 8/5;
    --d: radial-gradient(farthest-side, currentColor 90%, transparent);
    -webkit-mask: var(--d) 0% 50%, var(--d) 50% 50%, var(--d) 100% 50%;
    -webkit-mask-size: 25% 40%;
    -webkit-mask-repeat: no-repeat;
    mask: var(--d) 0% 50%, var(--d) 50% 50%, var(--d) 100% 50%;
    mask-size: 25% 40%;
    mask-repeat: no-repeat;
    background: currentColor;
    animation: dots 1s infinite linear;
  }

  @keyframes dots {
    0%    { -webkit-mask-position: 0% 0%,   50% 0%,   100% 0%;   mask-position: 0% 0%,   50% 0%,   100% 0%; }
    25%   { -webkit-mask-position: 0% 100%, 50% 0%,   100% 0%;   mask-position: 0% 100%, 50% 0%,   100% 0%; }
    50%   { -webkit-mask-position: 0% 0%,   50% 100%, 100% 0%;   mask-position: 0% 0%,   50% 100%, 100% 0%; }
    75%   { -webkit-mask-position: 0% 0%,   50% 0%,   100% 100%; mask-position: 0% 0%,   50% 0%,   100% 100%; }
    100%  { -webkit-mask-position: 0% 0%,   50% 0%,   100% 0%;   mask-position: 0% 0%,   50% 0%,   100% 0%; }
  }

  .btn--brand {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
  }
  .btn--brand:hover { filter: brightness(1.1); }

  .btn--positive {
    background: var(--positive);
    border-color: var(--positive);
    color: white;
  }

  .btn--negative {
    background: var(--negative);
    border-color: var(--negative);
    color: white;
  }

  .btn--plain {
    background: transparent;
    border-color: transparent;
    color: var(--ink-dark);
  }
  .btn--plain:hover { background: var(--ink-lightest); }

  .btn--sm {
    font-size: max(14px, 0.75em);
    padding: 0.35em 0.8em;
  }

  /* --- Cards (Fizzy pattern: color-mix derived from --card-color) --- */
  .gj-card {
    --card-bg: color-mix(in srgb, var(--card-color, var(--ink-medium)) 4%, var(--canvas));
    --card-text: color-mix(in srgb, var(--card-color, var(--ink-medium)) 30%, var(--ink-darkest));
    --card-border: color-mix(in srgb, var(--card-color, var(--ink-medium)) 20%, var(--canvas));
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    color: var(--card-text);
    display: flex;
    flex-direction: column;
    padding: 0.75em 1em;
    transition: box-shadow 100ms ease-out, transform 100ms ease-out;
    cursor: pointer;
    text-decoration: none;
  }

  .gj-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    text-decoration: none;
  }

  .gj-card__title {
    font-size: 0.875em;
    font-weight: 600;
    line-height: 1.3;
    color: var(--card-text);
  }

  .gj-card__meta {
    font-size: 0.75em;
    color: var(--ink-dark);
    margin-top: 0.25em;
  }

  .gj-card__hint {
    font-size: 0.6875em;
    font-weight: 500;
    color: var(--warning);
    margin-top: 0.375em;
  }

  /* Unread indicator — Fizzy's accent border */
  .gj-card--unread {
    border-left: 3px solid var(--brand);
  }

  /* Search results (inside menu overlay) */
  .search-results {
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 0.25rem;
  }

  .search-results__header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--ink-lightest);
  }

  .search-results__item {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    transition: background 100ms ease-out;
  }

  .search-results__item:hover {
    background: var(--canvas-alt);
    text-decoration: none;
  }

  .search-results__item + .search-results__item {
    border-top: 1px solid var(--ink-lightest);
  }

  .search-results__empty {
    padding: 1rem;
    text-align: center;
  }

  /* --- Pipeline board: responsive 3-column grid --- */
  .pipeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--column-gap);
    padding: 0 1rem 1rem;
    height: calc(100dvh - 4.25rem);
    max-width: 80rem;
    margin: 0 auto;
    overflow: hidden;
  }

  @media (max-width: 639px) {
    /* Mobile: stack columns vertically, scroll the page */
    .pipeline {
      display: flex;
      flex-direction: column;
      height: auto;
      overflow: visible;
      padding: 0 0.5rem 1rem;
      gap: 0.75rem;
    }
    .pipeline-col {
      max-height: none;
      overflow-y: visible;
    }
  }

  .pipeline-col {
    --card-color: var(--status-new);
    --col-bg: color-mix(in srgb, var(--card-color) 6%, var(--canvas-alt));
    background: var(--col-bg);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    transition: background 200ms ease-out;
  }

  .pipeline-col__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, var(--card-color) 50%, var(--ink-darkest));
    position: sticky;
    top: 0;
    background: var(--col-bg);
    z-index: 1;
  }

  .pipeline-col__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--card-color) 18%, transparent);
    color: color-mix(in srgb, var(--card-color) 55%, var(--ink-darkest));
  }

  /* Sub-groups within a column (one per status) */
  .pipeline-subgroup {
    padding: 0 0.5rem;
  }

  .pipeline-subgroup__label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-medium);
    padding: 0.375rem 0.5rem 0.25rem;
  }

  .pipeline-subgroup__count {
    color: var(--ink-light);
    font-weight: 500;
  }

  .pipeline-subgroup__list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding-bottom: 0.5rem;
    min-height: 1.5rem;
  }

  /* Drag and drop states */
  .gj-card[draggable="true"] { touch-action: none; }

  .gj-card.is-dragging {
    filter: grayscale(1) brightness(0.97);
    opacity: 0.6;
    outline: 2px dashed var(--ink-light);
  }

  .pipeline-subgroup.is-drag-over {
    background: color-mix(in srgb, var(--card-color) 12%, var(--canvas-alt));
    border-radius: var(--radius);
    outline: 2px dashed color-mix(in srgb, var(--card-color) 40%, var(--ink-medium));
    outline-offset: -2px;
  }

  /* --- Inputs (Fizzy pattern) --- */
  .input {
    appearance: none;
    background: var(--canvas);
    border: 1px solid var(--ink-light);
    border-radius: var(--radius);
    color: var(--ink-darkest);
    font-size: max(16px, 1em);
    line-height: 1.5;
    padding: 0.5em 0.8em;
    transition: border-color 100ms ease-out, box-shadow 100ms ease-out;
    width: 100%;
  }

  .input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 20%, transparent);
    outline: none;
  }

  .input::placeholder { color: var(--ink-medium); }

  .input--sm { font-size: 0.875rem; padding: 0.35em 0.6em; }

  .input:autofill, .input:-webkit-autofill {
    -webkit-text-fill-color: var(--ink-darkest);
    -webkit-box-shadow: 0 0 0px 1000px var(--canvas) inset;
  }

  textarea.input { resize: vertical; min-height: 4.5em; }

  select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath stroke='%237a7b8d' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    padding-right: 2.5em;
  }

  .label {
    display: block;
    font-size: 0.875em;
    font-weight: 500;
    color: var(--ink-darker);
    margin-bottom: 0.25em;
  }

  /* --- Badge (Fizzy: color-mix from status color) --- */
  .badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875em;
    font-weight: 600;
    padding: 0.15em 0.6em;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    background: color-mix(in srgb, var(--badge-color, var(--ink-medium)) 15%, var(--canvas));
    color: color-mix(in srgb, var(--badge-color, var(--ink-medium)) 70%, var(--ink-darkest));
  }

  .badge--new { --badge-color: var(--status-new); }
  .badge--quoted { --badge-color: var(--status-quoted); }
  .badge--approved { --badge-color: var(--status-approved); }
  .badge--scheduled { --badge-color: var(--status-scheduled); }
  .badge--in-progress { --badge-color: var(--status-in-progress); }
  .badge--completed { --badge-color: var(--status-completed); }
  .badge--invoiced { --badge-color: var(--status-invoiced); }
  .badge--paid { --badge-color: var(--status-paid); }
  .badge--declined { --badge-color: var(--status-declined); }
  .badge--cancelled { --badge-color: var(--status-cancelled); }

  /* --- Surface (card-like container, simpler than .gj-card) --- */
  .surface {
    background: var(--canvas);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
  }

  .surface--flat {
    box-shadow: var(--shadow-card);
  }

  /* --- Top Bar (Fizzy: 3-column grid) --- */
  .sl-topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    height: 3.25rem;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    background: var(--canvas);
    border-bottom: 1px solid var(--ink-lighter);
    z-index: var(--z-sticky);
  }

  .sl-topbar__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-pill);
    color: var(--ink-dark);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 100ms ease-out, color 100ms ease-out;
    position: relative;
  }
  .sl-topbar__btn:hover {
    background: var(--brand-light);
    color: var(--brand);
    text-decoration: none;
  }

  .sl-topbar__logo {
    justify-self: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background 100ms ease-out;
  }
  .sl-topbar__logo:hover {
    background: var(--ink-lightest);
  }

  /* --- Menu Overlay (Fizzy popup pattern) --- */
  .sl-menu__backdrop {
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 0.15);
    z-index: calc(var(--z-panel) - 1);
  }

  .sl-menu {
    position: fixed;
    top: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 24rem);
    max-height: calc(100dvh - 4rem);
    overflow-y: auto;
    background: var(--canvas);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-panel);
  }

  /* Menu animation */
  .sl-menu--enter { transition: opacity 150ms ease-out, transform 150ms var(--ease-overshoot); }
  .sl-menu--enter-from { opacity: 0; transform: translateX(-50%) scale(0.95); }
  .sl-menu--enter-to { opacity: 1; transform: translateX(-50%) scale(1); }
  .sl-menu--leave { transition: opacity 100ms ease-out, transform 100ms ease-out; }
  .sl-menu--leave-from { opacity: 1; transform: translateX(-50%) scale(1); }
  .sl-menu--leave-to { opacity: 0; transform: translateX(-50%) scale(0.95); }

  .sl-menu__section {
    padding: 0.5rem;
    border-bottom: 1px solid var(--ink-lightest);
  }
  .sl-menu__section:last-of-type { border-bottom: none; }

  .sl-menu__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-medium);
    padding: 0.25rem 0.5rem;
  }

  .sl-menu__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-darker);
    text-decoration: none;
    transition: background 100ms ease-out;
  }
  .sl-menu__item:hover {
    background: var(--ink-lightest);
    text-decoration: none;
  }
  .sl-menu__item--info {
    color: var(--ink-medium);
    cursor: default;
  }
  .sl-menu__item--info:hover { background: transparent; }

  .sl-menu__search-input {
    width: 100%;
    border: 1px solid var(--ink-lighter);
    border-radius: var(--radius);
    font-size: max(16px, 0.875rem);
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background-color: var(--canvas-alt);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.625rem center;
    background-size: 1rem;
    color: var(--ink-darkest);
    outline: none;
    transition: border-color 100ms ease-out, box-shadow 100ms ease-out;
  }
  .sl-menu__search-input::placeholder { color: var(--ink-medium); }
  .sl-menu__search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
    background-color: var(--canvas);
  }

  .sl-menu__theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
  }
  .sl-menu__theme-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-darker);
  }

  .sl-menu__footer {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--ink-medium);
    border-top: 1px solid var(--ink-lightest);
  }
  .sl-menu__footer kbd {
    display: inline-block;
    background: var(--ink-lightest);
    border-radius: 0.25rem;
    padding: 0.05rem 0.35rem;
    font-size: 0.625rem;
    font-family: inherit;
    color: var(--ink-dark);
  }

  /* --- Alerts Bell --- */
  .sl-alerts {
    position: relative;
  }

  .sl-alerts__badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: var(--radius-pill);
    background: var(--negative);
    color: white;
    font-size: 0.5625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .sl-alerts__dropdown {
    position: absolute;
    right: -0.5rem;
    top: calc(100% + 0.5rem);
    width: min(90vw, 22rem);
    background: var(--canvas);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-panel);
    overflow: hidden;
  }

  .sl-alerts__header {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-medium);
    border-bottom: 1px solid var(--ink-lightest);
  }

  .sl-alerts__item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    transition: background 100ms ease-out;
  }
  .sl-alerts__item:hover {
    background: var(--canvas-alt);
    text-decoration: none;
  }
  .sl-alerts__item + .sl-alerts__item {
    border-top: 1px solid var(--ink-lightest);
  }

  .sl-alerts__item-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: var(--ink-medium);
  }

  .sl-alerts__item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-darkest);
  }

  .sl-alerts__item-meta {
    font-size: 0.6875rem;
    color: var(--ink-medium);
  }

  .sl-alerts__footer {
    display: block;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--brand);
    text-decoration: none;
    border-top: 1px solid var(--ink-lightest);
  }
  .sl-alerts__footer:hover {
    background: var(--canvas-alt);
    text-decoration: none;
  }

  /* --- Toast (Fizzy: slide-up-fade-in) --- */
  .toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
  }

  .toast {
    pointer-events: auto;
    background: var(--canvas);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    max-width: 22rem;
    padding: 0.75rem 1rem;
    animation: slide-up-fade 300ms var(--ease-overshoot);
  }

  @keyframes slide-up-fade {
    from { opacity: 0; transform: translateY(1rem) scale(0.95); }
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  /* --- Flash messages (Fizzy style) --- */
  .flash {
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .flash--success { background: color-mix(in srgb, var(--positive) 12%, var(--canvas)); color: var(--positive); }
  .flash--error { background: color-mix(in srgb, var(--negative) 12%, var(--canvas)); color: var(--negative); }
  .flash--info { background: color-mix(in srgb, var(--brand) 12%, var(--canvas)); color: var(--brand); }

  /* --- Timeline --- */
  .timeline-event {
    padding: 0.75rem 1rem;
    transition: background 100ms ease-out;
  }

  .timeline-event + .timeline-event {
    border-top: 1px solid var(--ink-lighter);
  }

  .timeline-event--note {
    background: color-mix(in srgb, var(--warning) 8%, var(--canvas));
  }

  .time-gap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--ink-medium);
    font-size: 0.6875rem;
    font-weight: 500;
  }

  .time-gap::before, .time-gap::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ink-lighter);
  }

  /* --- Theme switcher (Fizzy: 3-state toggle) --- */
  .theme-switcher {
    display: inline-flex;
    border: 1px solid var(--ink-light);
    border-radius: var(--radius-pill);
    overflow: hidden;
  }

  .theme-switcher__btn {
    background: transparent;
    border: none;
    color: var(--ink-dark);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    transition: background 100ms ease-out, color 100ms ease-out;
  }

  .theme-switcher__btn:hover { background: var(--ink-lightest); }
  .theme-switcher__btn--active {
    background: var(--brand-light);
    color: var(--brand);
  }

  /* --- Utility: unread dot --- */
  .unread-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--brand);
    flex-shrink: 0;
  }

  /* --- Panel slide-over --- */
  .panel-backdrop {
    position: fixed; inset: 0;
    background: oklch(0 0 0 / 0.3);
    z-index: var(--z-panel);
    opacity: 0; pointer-events: none;
    transition: opacity 300ms var(--ease);
  }
  .panel-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(32rem, 100vw);
    background: var(--canvas);
    z-index: calc(var(--z-panel) + 1);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 300ms var(--ease);
    overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .panel.is-open { transform: translateX(0); }

  @media (max-width: 768px) {
    .panel {
      top: auto; left: 0; right: 0; width: 100%;
      max-height: 90vh;
      border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      transform: translateY(100%);
    }
    .panel.is-open { transform: translateY(0); }
    .panel.is-fullscreen { max-height: 100vh; border-radius: 0; }
  }

  .panel-header {
    position: sticky; top: 0; z-index: 1;
    background: var(--canvas);
    border-bottom: 1px solid var(--ink-lighter);
    padding: 0.75rem 1rem;
    display: flex; align-items: center; gap: 0.75rem;
  }

  .panel-body {
    flex: 1; overflow-y: auto;
    overscroll-behavior: contain;
  }

  .panel-footer {
    position: sticky; bottom: 0;
    background: var(--canvas);
    border-top: 1px solid var(--ink-lighter);
    padding: 0.75rem 1rem;
  }

  /* --- Public page header/footer --- */
  .public-header {
    background: var(--canvas);
    border-bottom: 1px solid var(--ink-lighter);
  }
  .public-header__inner {
    max-width: 42rem; margin: 0 auto;
    padding: 0.75rem 1rem;
  }

  .public-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: 42rem; margin: 0 auto;
    background: var(--canvas);
    border-top: 1px solid var(--ink-lighter);
    padding: 0.75rem 1rem;
    z-index: var(--z-sticky);
  }
  .public-footer-spacer { height: 4.5rem; }

  /* --- Chat input (shared: panel + snapline) --- */
  .chat-input {
    display: flex; align-items: flex-end; gap: 0.5rem;
  }
  .chat-input textarea {
    flex: 1; min-height: 2.5rem; max-height: 8rem; resize: none;
  }
  .chat-input-actions {
    display: flex; gap: 0.25rem;
  }

  /* --- Avatar --- */
  .avatar {
    width: 2rem; height: 2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.75em; flex-shrink: 0;
    background: var(--brand-light); color: var(--brand);
  }
  .avatar-sm { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
  .avatar-lg { width: 2.5rem; height: 2.5rem; font-size: 0.875em; }

  /* --- Progress steps (customer snapline) --- */
  .progress-steps {
    display: flex; align-items: center; gap: 0;
    overflow-x: auto; padding: 0.75rem 0;
  }
  .progress-step {
    display: flex; align-items: center; gap: 0.25rem;
    font-size: 0.75em; white-space: nowrap;
  }
  .progress-step-dot {
    width: 0.75rem; height: 0.75rem; border-radius: 50%;
    border: 2px solid var(--ink-light); flex-shrink: 0;
  }
  .progress-step--done .progress-step-dot {
    background: var(--positive); border-color: var(--positive);
  }
  .progress-step--current .progress-step-dot {
    background: var(--brand); border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
  }
  .progress-step-line {
    width: 1.5rem; height: 2px; background: var(--ink-light);
  }
  .progress-step--done + .progress-step .progress-step-line {
    background: var(--positive);
  }

  /* --- Photo dropzone --- */
  .photo-dropzone {
    border: 2px dashed var(--ink-light);
    border-radius: var(--radius);
    padding: 1.5rem; text-align: center;
    transition: border-color 150ms, background 150ms;
    cursor: pointer;
  }
  .photo-dropzone.drag-over {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
  }
  .photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
    gap: 0.5rem; margin-top: 0.5rem;
  }
  .photo-preview img {
    aspect-ratio: 1; object-fit: cover;
    border-radius: 0.375rem;
  }

  /* --- New updates banner --- */
  .new-updates-banner {
    position: sticky; top: 0; z-index: var(--z-sticky);
    background: var(--brand); color: white;
    text-align: center; padding: 0.5rem;
    font-size: 0.875em; font-weight: 500;
    cursor: pointer;
  }

  /* --- Loading bar (HTMX) --- */
  .loading-bar {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px; background: var(--brand);
    z-index: calc(var(--z-toast) + 1);
    transform: scaleX(0); transform-origin: left;
    transition: transform 200ms ease-out;
  }
  .loading-bar.is-active {
    transform: scaleX(0.6);
    transition: transform 8s cubic-bezier(0.1, 0.4, 0.2, 1);
  }
  .loading-bar.is-done {
    transform: scaleX(1);
    transition: transform 100ms ease-out;
    opacity: 0;
    transition: transform 100ms ease-out, opacity 300ms 100ms ease-out;
  }

  /* --- Photo lightbox --- */
  .lightbox {
    position: fixed; inset: 0;
    background: oklch(0 0 0 / 0.85);
    z-index: calc(var(--z-panel) + 20);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .lightbox img {
    max-width: 90vw; max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
  }

  /* --- Last visit line --- */
  .last-visit-line {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 1rem;
  }
  .last-visit-line::before, .last-visit-line::after {
    content: ""; flex: 1; height: 2px;
    background: var(--brand);
    border-style: dashed;
  }
  .last-visit-line span {
    font-size: 0.6875rem; font-weight: 600;
    text-transform: uppercase;
    color: var(--brand); white-space: nowrap;
  }

  /* --- Contextual actions bar --- */
  .action-bar {
    display: flex; gap: 0.5rem; padding: 0.75rem 1rem;
    overflow-x: auto; flex-wrap: wrap;
    border-bottom: 1px solid var(--ink-lighter);
  }

  /* --- Tap-to-call / Tap-to-navigate links --- */
  .gj-tap-link {
    display: inline-flex; align-items: center; gap: 0.25rem;
    color: var(--ink-dark); text-decoration: none;
  }
  .gj-tap-link:hover { color: var(--brand); text-decoration: underline; }
  .gj-tap-link__icon { flex-shrink: 0; opacity: 0.6; }

  /* (FAB removed — + button is in top bar) */

  /* --- Collapsible column chevron — mobile only --- */
  .gj-collapse-chevron { display: none; }

  /* --- Pull-to-refresh indicator --- */
  .pull-refresh-indicator {
    text-align: center; font-size: 0.75rem; font-weight: 500;
    color: var(--ink-medium); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
  }

  /* --- Agent chat (AI assistant) --- */
  .agent-page {
    padding: 0; max-width: none;
    height: calc(100vh - 3rem); /* viewport minus topbar */
    overflow: hidden;
  }
  .agent-layout {
    display: grid;
    grid-template-columns: 16rem 1fr;
    height: 100%;
  }
  @media (max-width: 768px) {
    .agent-layout { grid-template-columns: 1fr; }
    .agent-sidebar { display: none; }
  }

  .agent-sidebar {
    border-right: 1px solid var(--ink-lighter);
    background: var(--surface);
    overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .agent-sidebar__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ink-lighter);
  }
  .agent-sidebar__title {
    font-size: 0.875rem; font-weight: 600; color: var(--ink-dark);
  }
  .agent-sidebar__list { flex: 1; overflow-y: auto; }
  .agent-sidebar__item {
    display: block; padding: 0.5rem 1rem;
    text-decoration: none; color: var(--ink-dark);
    border-bottom: 1px solid var(--ink-lighter);
    transition: background 150ms;
  }
  .agent-sidebar__item:hover { background: var(--surface-hover); }
  .agent-sidebar__item--active {
    background: color-mix(in srgb, var(--brand) 8%, transparent);
    border-left: 3px solid var(--brand);
  }
  .agent-sidebar__item-title {
    display: block; font-size: 0.8125rem; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .agent-sidebar__item-date {
    font-size: 0.6875rem; color: var(--ink-medium);
  }
  .agent-sidebar__empty {
    padding: 2rem 1rem; text-align: center;
    font-size: 0.8125rem; color: var(--ink-medium);
  }

  .agent-chat {
    display: flex; flex-direction: column;
    height: 100%; overflow: hidden;
  }
  .agent-messages {
    flex: 1; overflow-y: auto;
    padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
    overscroll-behavior: contain;
  }

  .agent-message { max-width: 80%; }
  .agent-message--user {
    align-self: flex-end;
    background: var(--brand);
    color: white;
    border-radius: var(--radius) var(--radius) 0.25rem var(--radius);
    padding: 0.625rem 0.875rem;
  }
  .agent-message--assistant {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--ink-lighter);
    border-radius: var(--radius) var(--radius) var(--radius) 0.25rem;
    padding: 0.625rem 0.875rem;
  }
  .agent-message--error {
    align-self: flex-start;
    background: color-mix(in srgb, var(--negative) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--negative) 30%, transparent);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    color: var(--negative);
    display: flex; align-items: flex-start; gap: 0.5rem;
  }
  .agent-message__content {
    font-size: 0.875rem; line-height: 1.5;
    word-break: break-word;
  }

  .agent-tool-summary {
    margin-top: 0.5rem;
    font-size: 0.75rem;
  }
  .agent-tool-summary__toggle {
    display: flex; align-items: center; gap: 0.375rem;
    color: var(--ink-medium);
    cursor: pointer;
  }
  .agent-tool-summary__toggle:hover { color: var(--ink-dark); }
  .agent-tool-summary__list {
    margin-top: 0.375rem;
    padding-left: 1.25rem;
    display: flex; flex-direction: column; gap: 0.25rem;
  }
  .agent-tool-summary__item {
    display: flex; align-items: baseline; gap: 0.375rem;
  }
  .agent-tool-summary__name {
    font-weight: 600; color: var(--ink-dark);
    font-family: var(--font-mono);
  }
  .agent-tool-summary__result { color: var(--ink-medium); }
  .agent-tool-summary__result--error { color: var(--negative); }

  .agent-input {
    display: flex; align-items: flex-end; gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--ink-lighter);
    background: var(--canvas);
  }
  .agent-input__textarea {
    flex: 1; min-height: 2.5rem; max-height: 6rem; resize: none;
    border: 1px solid var(--ink-light);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--ink-darkest);
    line-height: 1.4;
  }
  .agent-input__textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
  }
  .agent-input__send {
    display: flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: var(--radius);
    background: var(--brand); color: white;
    border: none; cursor: pointer;
    flex-shrink: 0;
    transition: background 150ms;
  }
  .agent-input__send:hover { background: var(--brand-hover); }

  .agent-loading {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--ink-medium);
    display: flex; align-items: center; gap: 0.5rem;
  }
  .agent-loading__dots {
    display: flex; gap: 0.25rem;
  }
  .agent-loading__dots span {
    width: 0.375rem; height: 0.375rem;
    border-radius: 50%;
    background: var(--ink-medium);
    animation: agent-dot-pulse 1.2s ease-in-out infinite;
  }
  .agent-loading__dots span:nth-child(2) { animation-delay: 0.15s; }
  .agent-loading__dots span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes agent-dot-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
  }

  .agent-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2rem; text-align: center;
    color: var(--ink-medium);
  }
  .agent-empty__icon { color: var(--brand); opacity: 0.5; margin-bottom: 1rem; }
  .agent-empty__text { font-size: 0.9375rem; margin-bottom: 1.5rem; }
  .agent-empty__suggestions {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  }
  .agent-suggestion {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--ink-light);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    color: var(--ink-dark);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 150ms, background 150ms;
  }
  .agent-suggestion:hover {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
  }

  /* Markdown prose in agent messages */
  .agent-md p { margin: 0 0 0.5rem; }
  .agent-md p:last-child { margin-bottom: 0; }
  .agent-md ul, .agent-md ol { margin: 0.25rem 0 0.5rem 1.25rem; padding: 0; }
  .agent-md li { margin-bottom: 0.125rem; }
  .agent-md strong { font-weight: 600; }
  .agent-md a {
    color: var(--brand); text-decoration: underline;
    text-underline-offset: 2px;
  }
  .agent-md a:hover { color: var(--brand-hover); }
  .agent-md code {
    font-family: var(--font-mono); font-size: 0.8125rem;
    background: var(--canvas-alt); padding: 0.125rem 0.25rem;
    border-radius: 3px;
  }
  .agent-md pre {
    background: var(--canvas-alt); padding: 0.5rem;
    border-radius: var(--radius); overflow-x: auto;
    margin: 0.25rem 0 0.5rem; font-size: 0.8125rem;
  }
  .agent-md h1, .agent-md h2, .agent-md h3 {
    font-weight: 600; margin: 0.5rem 0 0.25rem;
  }
  .agent-md h1 { font-size: 1.125rem; }
  .agent-md h2 { font-size: 1rem; }
  .agent-md h3 { font-size: 0.9375rem; }

  /* Clickable action buttons (suggest_actions tool) */
  .agent-actions {
    display: flex; flex-wrap: wrap; gap: 0.375rem;
    margin-top: 0.5rem;
  }
  .agent-action-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--brand);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    color: var(--brand);
    background: transparent;
    cursor: pointer;
    transition: background 150ms, color 150ms;
  }
  .agent-action-btn:hover {
    background: var(--brand); color: white;
  }

  /* Inline job cards (show_job_cards tool) */
  .agent-job-cards {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-top: 0.5rem;
  }
  .agent-job-card {
    display: block; text-decoration: none; color: var(--ink-dark);
    border: 1px solid var(--ink-lighter);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    min-width: 12rem; max-width: 18rem;
    background: var(--canvas);
    transition: border-color 150ms, box-shadow 150ms;
  }
  .agent-job-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 15%, transparent);
  }
  .agent-job-card__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; margin-bottom: 0.25rem;
  }
  .agent-job-card__type {
    font-weight: 600; font-size: 0.8125rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .agent-job-card__customer {
    font-size: 0.75rem; color: var(--ink-medium);
  }
  .agent-job-card__address {
    font-size: 0.6875rem; color: var(--ink-medium);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .agent-job-card__amount {
    font-size: 0.8125rem; font-weight: 600;
    color: var(--positive); margin-top: 0.25rem;
  }

  /* Voice input mic button */
  .agent-mic {
    display: flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: var(--radius);
    background: var(--surface); color: var(--ink-medium);
    border: 1px solid var(--ink-light);
    cursor: pointer; flex-shrink: 0;
    transition: background 150ms, color 150ms, border-color 150ms;
  }
  .agent-mic:hover {
    color: var(--ink-dark); border-color: var(--ink-medium);
  }
  .agent-mic--active,
  .agent-mic--listening {
    background: var(--positive); color: white;
    border-color: var(--positive);
    animation: agent-mic-pulse 1.5s ease-in-out infinite;
  }
  .agent-mic--processing {
    background: var(--warning); color: white;
    border-color: var(--warning);
    animation: agent-mic-spin 1s linear infinite;
  }
  .agent-mic--speaking {
    background: var(--brand); color: white;
    border-color: var(--brand);
    animation: agent-mic-pulse-blue 1.5s ease-in-out infinite;
  }
  @keyframes agent-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--positive) 40%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--positive) 0%, transparent); }
  }
  @keyframes agent-mic-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  @keyframes agent-mic-pulse-blue {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 0%, transparent); }
  }

  /* Voice mode toggle button — hidden via inline style, shown by JS */
  .voice-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: var(--radius);
    background: var(--surface); color: var(--ink-medium);
    border: 1px solid var(--ink-light);
    cursor: pointer; flex-shrink: 0;
    transition: background 150ms, color 150ms;
  }
  .voice-toggle:hover { color: var(--ink-dark); border-color: var(--ink-medium); }
  .voice-toggle--active {
    background: var(--positive); color: white;
    border-color: var(--positive);
  }

  /* Voice banner — status indicator above input (hidden via inline style, shown by JS) */
  .voice-banner {
    display: flex;
    align-items: center; gap: 0.5rem;
    padding: 0.375rem 1rem;
    background: color-mix(in srgb, var(--positive) 10%, var(--canvas));
    border-top: 1px solid color-mix(in srgb, var(--positive) 20%, transparent);
    font-size: 0.8125rem; color: var(--positive);
    font-weight: 500;
  }
  .voice-banner__dot {
    width: 0.5rem; height: 0.5rem;
    border-radius: 50%;
    background: var(--positive);
    animation: voice-dot-blink 1.2s ease-in-out infinite;
  }
  @keyframes voice-dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
  }

  /* Larger mic in voice mode for thumb-friendly jobsite use */
  body.voice-mode .agent-mic {
    width: 3.5rem; height: 3.5rem;
  }
  body.voice-mode .agent-mic svg {
    width: 1.5rem; height: 1.5rem;
  }

  /* Usage bar */
  .agent-usage {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--ink-lighter);
    background: var(--surface);
    font-size: 0.75rem; color: var(--ink-medium);
    display: flex; align-items: center; gap: 0.75rem;
  }
  .agent-usage__bar {
    flex: 1; height: 0.375rem;
    background: var(--ink-lighter);
    border-radius: 0.1875rem; overflow: hidden;
  }
  .agent-usage__fill {
    height: 100%;
    background: var(--brand);
    border-radius: 0.1875rem;
    transition: width 300ms ease;
  }
  .agent-usage__fill--warning { background: var(--warning); }
  .agent-usage__fill--danger { background: var(--negative); }
  .agent-usage__stats {
    white-space: nowrap;
  }
  .agent-usage__cost {
    color: var(--ink-dark); font-weight: 500;
  }

  /* Contextual suggestions after assistant response */
  .agent-suggestions {
    display: flex; flex-wrap: wrap; gap: 0.375rem;
    padding: 0.25rem 0;
    align-self: flex-start;
  }

  /* --- Mobile-specific styles --- */
  @media (max-width: 639px) {
    body { overscroll-behavior-y: contain; }

    .gj-hide-mobile { display: none !important; }

    .gj-collapse-chevron {
      display: inline-block; width: 0.75rem; height: 0.75rem;
      transition: transform 200ms var(--ease);
    }
    .pipeline-col__header { cursor: pointer; }

    .gj-card { touch-action: pan-y; }
    .gj-card[draggable="true"] { -webkit-user-drag: none; }

    .toast-container { bottom: 1rem; }
  }
}

/* ================================================================
   UNLAYERED — Critical layout that must not be overridden by
   Tailwind CDN's unlayered preflight/reset.
   ================================================================ */
.sl-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.public-header__inner {
  max-width: 42rem;
  margin: 0 auto;
}

.public-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 42rem;
  margin: 0 auto;
}
