/* Luca Desktop kit. Built from luca/web/desktop/tokens.ts: edit the tokens, not this file.
   Layered, so a page's own CSS still wins. Scheme follows the system, a "dark" or
   "light" class on <html>, and last a data-al-scheme attribute set by the app. */
@layer al-kit {
  :root {
    --al-ground: #EFF4F9;
    --al-surface: #FFFFFF;
    --al-raised: #E4ECF5;
    --al-inset: #EDF2F8;
    --al-border: #14375C24;
    --al-border-strong: #14375C42;
    --al-text: #0C1B2C;
    --al-text-body: #22384F;
    --al-text-muted: #465B70;
    --al-text-faint: #52667A;
    --al-accent: #086B5C;
    --al-accent-on: #FFFFFF;
    --al-accent-soft: #086B5C1F;
    --al-good: #11683A;
    --al-warn: #755109;
    --al-bad: #A32F22;
    --al-info: #1B50A6;
    --al-idle: #465B70;
    --al-shadow: #0A1A2B29;
    --al-hue-1: #B8590C;
    --al-hue-2: #2563C9;
    --al-hue-3: #6242C4;
    --al-hue-4: #C0367A;
    --al-hue-5: #8A600C;
    --al-hue-6: #0F7A8C;
    --al-hue-7: #3F7F1A;
    --al-hue-8: #B5422F;
    --al-syntax-keyword: #086B5C;
    --al-syntax-string: #11683A;
    --al-syntax-number: #755109;
    --al-syntax-comment: #52667A;
    --al-syntax-property: #1B50A6;
    --al-syntax-type: #6242C4;
    --al-syntax-function: #A8500A;
    --al-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    --al-font-mono: ui-monospace, "SF Mono", Menlo, monospace;
    --al-text-xs: 18px;
    --al-text-sm: 19px;
    --al-text-base: 20px;
    --al-text-md: 21px;
    --al-text-lg: 23px;
    --al-text-xl: 27px;
    --al-text-2xl: 33px;
    --al-text-3xl: 40px;
    --al-leading-tight: 1.2;
    --al-leading-normal: 1.45;
    --al-space-1: 2px;
    --al-space-2: 4px;
    --al-space-3: 6px;
    --al-space-4: 8px;
    --al-space-5: 12px;
    --al-space-6: 16px;
    --al-space-7: 24px;
    --al-space-8: 32px;
    --al-radius-sm: 4px;
    --al-radius-md: 8px;
    --al-radius-lg: 12px;
    --al-radius-pill: 999px;
    --al-motion-fast: 120ms;
    --al-motion-base: 180ms;
    --al-motion-slow: 320ms;
    --al-motion-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --al-tile-header: 34px;
    --al-status-line: 36px;
    --al-tile-gap: 6px;
    --al-focus-ring: 1px;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --al-ground: #070D18;
      --al-surface: #0E1A2D;
      --al-raised: #16283F;
      --al-inset: #0A1524;
      --al-border: #7EA0D624;
      --al-border-strong: #7EA0D642;
      --al-text: #EAF3FD;
      --al-text-body: #C9D8EA;
      --al-text-muted: #97ADC6;
      --al-text-faint: #7D97B7;
      --al-accent: #57E0C4;
      --al-accent-on: #04241D;
      --al-accent-soft: #57E0C429;
      --al-good: #4ADE80;
      --al-warn: #F5C46B;
      --al-bad: #FA8484;
      --al-info: #7CB4F5;
      --al-idle: #97ADC6;
      --al-shadow: #00000073;
      --al-hue-1: #F0A96B;
      --al-hue-2: #7CB4F5;
      --al-hue-3: #B4A3F8;
      --al-hue-4: #F57FB0;
      --al-hue-5: #F5C46B;
      --al-hue-6: #6BD6C6;
      --al-hue-7: #9BD66B;
      --al-hue-8: #F08A7A;
      --al-syntax-keyword: #57E0C4;
      --al-syntax-string: #4ADE80;
      --al-syntax-number: #F5C46B;
      --al-syntax-comment: #7D97B7;
      --al-syntax-property: #7CB4F5;
      --al-syntax-type: #B4A3F8;
      --al-syntax-function: #F0A96B;
    }
  }
  :root.light {
    --al-ground: #EFF4F9;
    --al-surface: #FFFFFF;
    --al-raised: #E4ECF5;
    --al-inset: #EDF2F8;
    --al-border: #14375C24;
    --al-border-strong: #14375C42;
    --al-text: #0C1B2C;
    --al-text-body: #22384F;
    --al-text-muted: #465B70;
    --al-text-faint: #52667A;
    --al-accent: #086B5C;
    --al-accent-on: #FFFFFF;
    --al-accent-soft: #086B5C1F;
    --al-good: #11683A;
    --al-warn: #755109;
    --al-bad: #A32F22;
    --al-info: #1B50A6;
    --al-idle: #465B70;
    --al-shadow: #0A1A2B29;
    --al-hue-1: #B8590C;
    --al-hue-2: #2563C9;
    --al-hue-3: #6242C4;
    --al-hue-4: #C0367A;
    --al-hue-5: #8A600C;
    --al-hue-6: #0F7A8C;
    --al-hue-7: #3F7F1A;
    --al-hue-8: #B5422F;
    --al-syntax-keyword: #086B5C;
    --al-syntax-string: #11683A;
    --al-syntax-number: #755109;
    --al-syntax-comment: #52667A;
    --al-syntax-property: #1B50A6;
    --al-syntax-type: #6242C4;
    --al-syntax-function: #A8500A;
  }
  :root.dark {
    --al-ground: #070D18;
    --al-surface: #0E1A2D;
    --al-raised: #16283F;
    --al-inset: #0A1524;
    --al-border: #7EA0D624;
    --al-border-strong: #7EA0D642;
    --al-text: #EAF3FD;
    --al-text-body: #C9D8EA;
    --al-text-muted: #97ADC6;
    --al-text-faint: #7D97B7;
    --al-accent: #57E0C4;
    --al-accent-on: #04241D;
    --al-accent-soft: #57E0C429;
    --al-good: #4ADE80;
    --al-warn: #F5C46B;
    --al-bad: #FA8484;
    --al-info: #7CB4F5;
    --al-idle: #97ADC6;
    --al-shadow: #00000073;
    --al-hue-1: #F0A96B;
    --al-hue-2: #7CB4F5;
    --al-hue-3: #B4A3F8;
    --al-hue-4: #F57FB0;
    --al-hue-5: #F5C46B;
    --al-hue-6: #6BD6C6;
    --al-hue-7: #9BD66B;
    --al-hue-8: #F08A7A;
    --al-syntax-keyword: #57E0C4;
    --al-syntax-string: #4ADE80;
    --al-syntax-number: #F5C46B;
    --al-syntax-comment: #7D97B7;
    --al-syntax-property: #7CB4F5;
    --al-syntax-type: #B4A3F8;
    --al-syntax-function: #F0A96B;
  }
  :root[data-al-scheme="light"] {
    --al-ground: #EFF4F9;
    --al-surface: #FFFFFF;
    --al-raised: #E4ECF5;
    --al-inset: #EDF2F8;
    --al-border: #14375C24;
    --al-border-strong: #14375C42;
    --al-text: #0C1B2C;
    --al-text-body: #22384F;
    --al-text-muted: #465B70;
    --al-text-faint: #52667A;
    --al-accent: #086B5C;
    --al-accent-on: #FFFFFF;
    --al-accent-soft: #086B5C1F;
    --al-good: #11683A;
    --al-warn: #755109;
    --al-bad: #A32F22;
    --al-info: #1B50A6;
    --al-idle: #465B70;
    --al-shadow: #0A1A2B29;
    --al-hue-1: #B8590C;
    --al-hue-2: #2563C9;
    --al-hue-3: #6242C4;
    --al-hue-4: #C0367A;
    --al-hue-5: #8A600C;
    --al-hue-6: #0F7A8C;
    --al-hue-7: #3F7F1A;
    --al-hue-8: #B5422F;
    --al-syntax-keyword: #086B5C;
    --al-syntax-string: #11683A;
    --al-syntax-number: #755109;
    --al-syntax-comment: #52667A;
    --al-syntax-property: #1B50A6;
    --al-syntax-type: #6242C4;
    --al-syntax-function: #A8500A;
  }
  :root[data-al-scheme="dark"] {
    --al-ground: #070D18;
    --al-surface: #0E1A2D;
    --al-raised: #16283F;
    --al-inset: #0A1524;
    --al-border: #7EA0D624;
    --al-border-strong: #7EA0D642;
    --al-text: #EAF3FD;
    --al-text-body: #C9D8EA;
    --al-text-muted: #97ADC6;
    --al-text-faint: #7D97B7;
    --al-accent: #57E0C4;
    --al-accent-on: #04241D;
    --al-accent-soft: #57E0C429;
    --al-good: #4ADE80;
    --al-warn: #F5C46B;
    --al-bad: #FA8484;
    --al-info: #7CB4F5;
    --al-idle: #97ADC6;
    --al-shadow: #00000073;
    --al-hue-1: #F0A96B;
    --al-hue-2: #7CB4F5;
    --al-hue-3: #B4A3F8;
    --al-hue-4: #F57FB0;
    --al-hue-5: #F5C46B;
    --al-hue-6: #6BD6C6;
    --al-hue-7: #9BD66B;
    --al-hue-8: #F08A7A;
    --al-syntax-keyword: #57E0C4;
    --al-syntax-string: #4ADE80;
    --al-syntax-number: #F5C46B;
    --al-syntax-comment: #7D97B7;
    --al-syntax-property: #7CB4F5;
    --al-syntax-type: #B4A3F8;
    --al-syntax-function: #F0A96B;
  }

  /* The page as a tile: the app's ground behind it, body text and font. Opt in on <body>. */
  .al-page {
    margin: 0;
    min-height: 100vh;
    background: var(--al-ground);
    color: var(--al-text-body);
    font-family: var(--al-font-sans);
    font-size: var(--al-text-base);
    line-height: var(--al-leading-normal);
    -webkit-font-smoothing: antialiased;
  }
  .al-page-body { padding: var(--al-space-7); max-width: 980px; box-sizing: border-box; }

  /* Type roles. Prose is the UI font; code, paths and values take al-code. */
  .al-title { color: var(--al-text); font-size: var(--al-text-2xl); font-weight: 600; line-height: var(--al-leading-tight); margin: 0 0 var(--al-space-4); }
  .al-heading { color: var(--al-text); font-size: var(--al-text-md); font-weight: 600; line-height: var(--al-leading-tight); margin: 0 0 var(--al-space-3); }
  .al-body { color: var(--al-text-body); font-size: var(--al-text-sm); }
  .al-meta { color: var(--al-text-muted); font-size: var(--al-text-xs); }
  .al-faint { color: var(--al-text-faint); }
  .al-code { font-family: var(--al-font-mono); font-size: 0.95em; }
  .al-link { color: var(--al-accent); text-decoration: none; }
  .al-link:hover { text-decoration: underline; }

  .al-section { margin: 0 0 var(--al-space-8); }
  .al-section-title {
    display: flex;
    align-items: center;
    gap: var(--al-space-4);
    color: var(--al-text);
    font-size: var(--al-text-md);
    font-weight: 600;
    margin: 0 0 var(--al-space-5);
    padding-left: var(--al-space-4);
    border-left: 3px solid var(--al-section, var(--al-accent));
  }

  .al-card {
    background: var(--al-surface);
    color: var(--al-text-body);
    border: 1px solid var(--al-border);
    border-radius: var(--al-radius-lg);
    padding: var(--al-space-5) var(--al-space-6);
    font-family: var(--al-font-sans);
    font-size: var(--al-text-sm);
    line-height: var(--al-leading-normal);
    box-sizing: border-box;
  }
  .al-card-title { color: var(--al-text); font-size: var(--al-text-md); font-weight: 600; line-height: var(--al-leading-tight); margin: 0 0 var(--al-space-2); }
  .al-card-meta { color: var(--al-text-faint); font-family: var(--al-font-mono); font-size: var(--al-text-xs); }
  .al-card-tint { border-top: 3px solid var(--al-tint, var(--al-accent)); }
  .al-card.al-focus, .al-card[aria-current="true"] { border-color: var(--al-accent); }

  .al-stacks { display: flex; gap: var(--al-tile-gap); align-items: flex-start; overflow-x: auto; }
  .al-stack { display: flex; flex-direction: column; gap: var(--al-space-3); min-width: 0; flex: 1 1 0; max-width: 520px; }
  .al-stack-title {
    color: var(--al-text-muted);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0 var(--al-space-2);
  }
  .al-stack > .al-card { padding: var(--al-space-4) var(--al-space-5); transition: border-color var(--al-motion-fast) var(--al-motion-ease); }

  .al-row {
    display: flex;
    align-items: center;
    gap: var(--al-space-4);
    min-height: 32px;
    padding: var(--al-space-2) var(--al-space-4);
    border-radius: var(--al-radius-md);
    color: var(--al-text-body);
    font-family: var(--al-font-sans);
    font-size: var(--al-text-sm);
    box-sizing: border-box;
  }
  .al-row + .al-row { border-top: 1px solid var(--al-border); }
  .al-row.al-focus, .al-row[aria-selected="true"] { background: var(--al-raised); color: var(--al-text); }
  .al-row-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .al-row-meta { color: var(--al-text-faint); font-family: var(--al-font-mono); font-size: var(--al-text-xs); }

  .al-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--al-space-2);
    padding: 1px var(--al-space-3);
    border: 1px solid var(--al-border);
    border-radius: var(--al-radius-pill);
    background: var(--al-raised);
    color: var(--al-text-body);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
    line-height: 1.4;
    white-space: nowrap;
  }
  .al-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--al-project, var(--al-idle)); flex: none; }

  .al-badge {
    --al-badge: var(--al-idle);
    display: inline-flex;
    align-items: center;
    padding: 0 var(--al-space-3);
    border-radius: var(--al-radius-sm);
    background: color-mix(in srgb, var(--al-badge) 12%, transparent);
    color: var(--al-badge);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
    font-weight: 600;
    line-height: 1.4;
    text-transform: lowercase;
    white-space: nowrap;
  }
  .al-badge-good, .al-badge[data-status="done"], .al-badge[data-status="completed"], .al-badge[data-status="approved"], .al-badge[data-status="live"], .al-badge[data-status="running"] { --al-badge: var(--al-good); }
  .al-badge-info, .al-badge[data-status="starting"], .al-badge[data-status="in_progress"], .al-badge[data-status="building"], .al-badge[data-status="exploring"] { --al-badge: var(--al-info); }
  .al-badge-warn, .al-badge[data-status="blocked"], .al-badge[data-status="waiting"], .al-badge[data-status="needs-review"] { --al-badge: var(--al-warn); }
  .al-badge-bad, .al-badge[data-status="failed"], .al-badge[data-status="error"], .al-badge[data-status="rejected"] { --al-badge: var(--al-bad); }
  .al-badge-accent { --al-badge: var(--al-accent); }

  .al-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 var(--al-space-2);
    border: 1px solid var(--al-border-strong);
    border-bottom-width: 2px;
    border-radius: var(--al-radius-sm);
    background: var(--al-inset);
    color: var(--al-text-muted);
    font-family: var(--al-font-mono);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    box-sizing: border-box;
    vertical-align: middle;
  }
  .al-key-badge { margin-left: var(--al-space-3); pointer-events: none; }

  .al-button {
    display: inline-flex;
    align-items: center;
    gap: var(--al-space-3);
    height: 32px;
    padding: 0 var(--al-space-5);
    border: 1px solid var(--al-border-strong);
    border-radius: var(--al-radius-md);
    background: var(--al-raised);
    color: var(--al-text);
    font-family: var(--al-font-sans);
    font-size: var(--al-text-sm);
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    transition: background var(--al-motion-fast) var(--al-motion-ease), border-color var(--al-motion-fast) var(--al-motion-ease);
  }
  .al-button:hover { border-color: var(--al-accent); }
  .al-button:focus-visible { outline: var(--al-focus-ring) solid var(--al-accent); outline-offset: 1px; }
  .al-button:disabled { opacity: 0.5; cursor: default; }
  .al-button-primary { background: var(--al-accent); border-color: var(--al-accent); color: var(--al-accent-on); }
  .al-button-ghost { background: transparent; }

  .al-input {
    height: 32px;
    padding: 0 var(--al-space-4);
    border: 1px solid var(--al-border-strong);
    border-radius: var(--al-radius-md);
    background: var(--al-inset);
    color: var(--al-text);
    font-family: var(--al-font-sans);
    font-size: var(--al-text-sm);
    box-sizing: border-box;
  }
  .al-input.al-textarea { height: auto; min-height: 72px; padding: var(--al-space-3) var(--al-space-4); line-height: var(--al-leading-normal); }
  .al-input::placeholder { color: var(--al-text-faint); }
  .al-input:focus { outline: var(--al-focus-ring) solid var(--al-accent); border-color: var(--al-accent); }

  .al-table { width: 100%; border-collapse: collapse; font-family: var(--al-font-sans); font-size: var(--al-text-sm); color: var(--al-text-body); }
  .al-table th {
    text-align: left;
    padding: var(--al-space-3) var(--al-space-4);
    border-bottom: 1px solid var(--al-border-strong);
    color: var(--al-text-muted);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .al-table td { padding: var(--al-space-3) var(--al-space-4); border-bottom: 1px solid var(--al-border); }
  .al-table tr.al-focus td { background: var(--al-raised); color: var(--al-text); }

  .al-meter { position: relative; height: 6px; border-radius: var(--al-radius-pill); background: var(--al-raised); overflow: hidden; }
  .al-meter-fill { height: 100%; width: calc(var(--al-value, 0) * 100%); border-radius: inherit; background: var(--al-meter, var(--al-accent)); transition: width var(--al-motion-base) var(--al-motion-ease); }

  .al-tile-header {
    display: flex;
    align-items: center;
    gap: var(--al-space-3);
    height: var(--al-tile-header);
    padding: 0 var(--al-space-4);
    border-bottom: 1px solid var(--al-border);
    background: var(--al-surface);
    color: var(--al-text-muted);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
    box-sizing: border-box;
    white-space: nowrap;
  }
  .al-tile-header-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--al-text); }
  .al-tile-header.al-focus { box-shadow: inset 0 0 0 var(--al-focus-ring) var(--al-accent); }

  .al-keys {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--al-space-3) var(--al-space-6);
    padding: var(--al-space-2) var(--al-space-4);
    color: var(--al-text-muted);
    font-family: var(--al-font-mono);
    font-size: var(--al-text-xs);
  }
  .al-keys-item { display: inline-flex; align-items: center; gap: var(--al-space-2); }

  /* Code colors, for a highlighter that emits these classes. */
  .al-syntax-keyword { color: var(--al-syntax-keyword); }
  .al-syntax-string { color: var(--al-syntax-string); }
  .al-syntax-number { color: var(--al-syntax-number); }
  .al-syntax-comment { color: var(--al-syntax-comment); }
  .al-syntax-property { color: var(--al-syntax-property); }
  .al-syntax-type { color: var(--al-syntax-type); }
  .al-syntax-function { color: var(--al-syntax-function); }
}
