/*
 * Candle V3 application styles.
 * Tokens mirror docs/design-system/tokens/tokens.css; components mirror
 * docs/design-system/examples/components.css (class prefix .cdl-).
 * Change the design system first, then this file.
 */
@font-face { font-family: "Lato"; src: url("/css/lato/Lato-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/css/lato/Lato-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/css/lato/Lato-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lato"; src: url("/css/lato/Lato-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
/* Inter and PT Sans stay bundled for document content that names them. The app UI is Lato only. */
@font-face { font-family: "Inter"; src: url("/css/inter/Inter.ttf") format("truetype"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/css/inter/Inter-Italic.ttf") format("truetype"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("/css/pt-sans/PT_Sans-Web-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("/css/pt-sans/PT_Sans-Web-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("/css/pt-sans/PT_Sans-Web-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("/css/pt-sans/PT_Sans-Web-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }

/* ============ Tokens ============ */
:root {
  /* Brand */
  --cdl-orange: #FF7213;
  --cdl-orange-text: #A34700;
  --cdl-orange-soft: #FFEBDD;
  --cdl-orange-border: #FFD3B5;
  --cdl-orange-tint: #FFB98A;
  --cdl-charcoal: #494850;

  /* Neutrals */
  --cdl-ink: #111111;
  --cdl-muted: #666666;
  --cdl-page: #F5F5F5;
  --cdl-surface: #FFFFFF;
  --cdl-subtle: #FAFAFA;
  --cdl-hover: #F0F0F0;
  --cdl-tooltip-fill: #F0F0F0;
  --cdl-tooltip-ink: #000000;
  --cdl-border: #DDDDDD;
  --cdl-divider: #EEEEEE;
  --cdl-on-dark: #FFFFFF;

  /* Workflow status */
  --cdl-status-not-started: #CCCCCC;
  --cdl-status-not-started-bg: #F0F0F0;
  --cdl-status-not-started-text: #555555;
  --cdl-status-in-progress: #FF7213;
  --cdl-status-in-progress-bg: #FFEBDD;
  --cdl-status-in-progress-text: #A34700;
  --cdl-status-submitted: #2D5A9E;
  --cdl-status-submitted-bg: #EAF0F8;
  --cdl-status-submitted-text: #2D5A9E;
  --cdl-status-returned: #8A1C1C;
  --cdl-status-returned-bg: #F8E6E6;
  --cdl-status-returned-text: #8A1C1C;
  --cdl-status-approved: #287344;
  --cdl-status-approved-bg: #EDF6EF;
  --cdl-status-approved-text: #287344;

  /* Agent status */
  --cdl-agent-needs: #FF7213;
  --cdl-agent-working: #494850;
  --cdl-agent-watching: #2D5A9E;

  /* Documents */
  --cdl-doc-canvas: #E7E9E5;
  --cdl-doc-page: #FFFFFF;
  --cdl-doc-markup: #C62828;
  --cdl-doc-markup-bg: #FDECEC;

  /* Typography */
  --cdl-font: "Lato", "Segoe UI", system-ui, sans-serif;
  --cdl-weight-regular: 400;
  --cdl-weight-bold: 700;
  --cdl-text-display: 29px;
  --cdl-text-title: 22px;
  --cdl-text-lead: 17px;
  --cdl-text-body: 15px;
  --cdl-text-small: 14px;
  --cdl-text-meta: 13px;
  --cdl-text-caption: 12px;
  --cdl-text-micro: 11px;
  --cdl-leading-body: 1.55;
  --cdl-leading-tight: 1.3;
  --cdl-tracking-eyebrow: 0.08em;

  /* Spacing (4px base) */
  --cdl-space-1: 4px;
  --cdl-space-2: 8px;
  --cdl-space-3: 12px;
  --cdl-space-4: 16px;
  --cdl-space-5: 20px;
  --cdl-space-6: 24px;
  --cdl-space-7: 28px;
  --cdl-space-8: 32px;
  --cdl-space-10: 40px;

  /* Shape */
  --cdl-radius-card: 2px;
  --cdl-radius-control: 2px;
  --cdl-radius-window: 14px;
  --cdl-radius-pill: 999px;
  --cdl-radius-round: 50%;

  /* Sizing */
  --cdl-header-height: 64px;
  --cdl-touch-target: 44px;
  --cdl-bubble: 48px;

  /* Elevation */
  --cdl-shadow-card: 0 2px 8px #11111114, 0 1px 3px #1111110D;
  --cdl-shadow-float: 0 10px 30px #1111111A;
  --cdl-shadow-window: 0 18px 50px #11111126, 0 2px 6px #11111110;
  --cdl-shadow-page: 0 4px 18px #11111126;
  --cdl-ring-selected: 0 0 0 3px #11111114;

  /* Layering */
  --cdl-z-card-overlay: 1;
  --cdl-z-card-controls: 3;
  --cdl-z-header: 10;
  --cdl-z-viewer: 20;
  --cdl-z-dock: 30;
  --cdl-z-window: 40;
  --cdl-z-header-menu: 46;

  /* Motion */
  --cdl-ease: ease;
  --cdl-duration-fast: 150ms;

  /* Focus */
  --cdl-focus-ring: 2px solid var(--cdl-orange-text);
  --cdl-focus-offset: 3px;

  /* Page gutter: 28px on desktop, 16px on phones */
  --cdl-gutter: var(--cdl-space-7);

  /* Width of the document viewer when it sits beside the conversation */
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--cdl-font);
  font-size: var(--cdl-text-body);
  font-weight: var(--cdl-weight-regular);
  line-height: var(--cdl-leading-body);
  color: var(--cdl-ink);
  background: var(--cdl-page);
}
a { color: inherit; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; font-weight: var(--cdl-weight-bold); line-height: 1.25; }
h1 { font-size: var(--cdl-text-display); letter-spacing: -.03em; }
h2 { font-size: var(--cdl-text-title); }
h3 { font-size: var(--cdl-text-lead); }
p { text-wrap: pretty; }
:focus-visible { outline: var(--cdl-focus-ring); outline-offset: var(--cdl-focus-offset); }
.cdl-eyebrow, .eyebrow {
  margin: 0;
  font-size: var(--cdl-text-caption);
  font-weight: var(--cdl-weight-bold);
  letter-spacing: var(--cdl-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--cdl-muted);
}
.cdl-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============ Header ============ */
.cdl-header {
  position: sticky; top: 0; z-index: var(--cdl-z-header);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--cdl-space-2) var(--cdl-space-6);
  min-height: var(--cdl-header-height); padding: 0 var(--cdl-gutter);
  background: var(--cdl-surface); border-bottom: 1px solid var(--cdl-border);
}
.cdl-header--private { flex-wrap: nowrap; column-gap: var(--cdl-space-4); }
.cdl-header-context { display: flex; align-items: center; gap: var(--cdl-space-4); min-width: 0; }
.cdl-header-account, .cdl-account-panel { display: flex; align-items: center; gap: var(--cdl-space-4); }
.cdl-header-account { position: relative; margin-left: auto; flex: none; }
.cdl-wordmark {
  display: inline-flex; align-items: baseline; flex-shrink: 0; min-height: var(--cdl-touch-target);
  padding: 8px 0 0; color: var(--cdl-ink); text-decoration: none;
  font-size: 32px; font-weight: var(--cdl-weight-bold); letter-spacing: -1.1px; line-height: 1;
}
.cdl-wordmark svg { width: 17px; height: 27px; align-self: baseline; flex-shrink: 0; margin: 0 1px; transform: translateY(1px); }
.cdl-header--private .cdl-wordmark { align-items: center; padding: 0; }
.cdl-header--private .cdl-wordmark svg { align-self: center; transform: none; }
.cdl-switcher {
  min-height: 40px; display: inline-flex; align-items: center; gap: var(--cdl-space-2);
  padding: 0 var(--cdl-space-3); background: var(--cdl-page); border: 1px solid var(--cdl-border);
  border-radius: var(--cdl-radius-control); font-size: var(--cdl-text-body); text-decoration: none;
}
.cdl-switcher:hover { background: var(--cdl-hover); }
.cdl-switcher span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdl-switcher svg { flex: 0 0 auto; }
.cdl-board-project-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--cdl-space-4);
  padding: var(--cdl-space-4) var(--cdl-gutter) 0;
}
.cdl-project-info-link { color: var(--cdl-muted); text-underline-offset: 4px; }
.cdl-project-info-link:hover { color: var(--cdl-ink); }
.cdl-tabs { display: flex; gap: var(--cdl-space-1); min-width: 0; overflow-x: auto; }
.cdl-header--private .cdl-tabs { flex: none; }
.cdl-tab {
  flex: 0 0 auto; min-height: var(--cdl-header-height); display: inline-flex; align-items: center;
  padding: 0 var(--cdl-space-3); color: var(--cdl-muted); text-decoration: none;
}
.cdl-tab:hover { color: var(--cdl-ink); }
.cdl-tab[aria-current="page"] {
  color: var(--cdl-ink); font-weight: var(--cdl-weight-bold);
  text-decoration: underline;
  text-decoration-color: var(--cdl-orange);
  text-decoration-thickness: 2px;
  text-underline-offset: var(--cdl-space-3);
}
.cdl-command { flex: none; }
.cdl-command:disabled {
  min-height: var(--cdl-touch-target); padding: var(--cdl-space-2);
  background: var(--cdl-surface); border: 1px solid var(--cdl-border);
  border-radius: var(--cdl-radius-control); color: var(--cdl-muted);
  justify-content: flex-start; text-align: left;
}
.cdl-command:disabled:hover { background: var(--cdl-surface); }
.cdl-command:disabled svg { flex: 0 0 auto; width: 11px; height: 18px; }
.cdl-avatar {
  flex: 0 0 auto; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--cdl-charcoal); color: var(--cdl-on-dark);
  font-size: var(--cdl-text-small); font-weight: var(--cdl-weight-bold); text-decoration: none;
}
.cdl-account-toggle, .cdl-account-settings { display: none; }
.cdl-company-tab { padding-inline: 0; }
.cdl-header--public .cdl-contact {
  margin-left: auto; min-height: 40px; display: inline-flex; align-items: center;
  font-size: var(--cdl-text-small); font-weight: var(--cdl-weight-bold); text-decoration: none;
  border-bottom: 2px solid var(--cdl-orange);
}
.cdl-contact:hover { color: var(--cdl-orange-text); }

/* ============ Project board toolbar ============ */
.cdl-board-project-controls {
  position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--cdl-space-2); padding: var(--cdl-space-6) var(--cdl-space-7) 0;
  background: transparent; border: 0;
}
.cdl-board-view { display: flex; align-items: center; gap: var(--cdl-space-2); padding-left: var(--cdl-space-4); margin-left: var(--cdl-space-2); border-left: 1px solid var(--cdl-border); color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.cdl-board-actions { display: flex; align-items: center; gap: var(--cdl-space-1); margin-left: auto; }
.cdl-board-control {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--cdl-space-2);
  min-height: var(--cdl-touch-target); padding: 0 var(--cdl-space-3); margin: 0;
  border: 1px solid transparent; border-radius: var(--cdl-radius-control); background: transparent;
  color: var(--cdl-charcoal); font: inherit; font-size: var(--cdl-text-small); font-weight: var(--cdl-weight-bold);
  text-decoration: none; cursor: pointer; list-style: none; white-space: nowrap;
}
.cdl-board-control::-webkit-details-marker { display: none; }
.cdl-board-control:hover:not(.cdl-board-actions *) { background: transparent; color: var(--cdl-ink); outline: var(--cdl-focus-ring); outline-offset: var(--cdl-focus-offset); }
.cdl-board-actions .cdl-board-control:is(:hover, :active, [aria-pressed="true"]),
.cdl-board-actions .cdl-board-menu[open] > .cdl-board-control { background: transparent; color: var(--cdl-orange-text); }
.cdl-board-control--icon { width: var(--cdl-touch-target); padding: 0; flex-shrink: 0; }
.cdl-board-control svg, .cdl-board-view svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cdl-board-control--share { margin-left: var(--cdl-space-2); background: var(--cdl-page); border-color: var(--cdl-border); border-bottom: 2px solid var(--cdl-orange); }
.cdl-board-actions .cdl-board-control[aria-pressed="true"] svg { fill: currentColor; }
.cdl-board-filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 var(--cdl-space-1); background: var(--cdl-charcoal); color: var(--cdl-on-dark); border-radius: var(--cdl-radius-control); font-size: var(--cdl-text-caption); }
.cdl-board-menu { position: relative; }
.cdl-board-popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 312px;
  padding: var(--cdl-space-5); border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control);
  background: var(--cdl-surface); color: var(--cdl-ink); text-align: left; font-size: var(--cdl-text-small);
}
.cdl-board-popover h2 { margin: 0; font-size: var(--cdl-text-lead); }
.cdl-board-popover__head { display: flex; align-items: center; justify-content: space-between; gap: var(--cdl-space-3); margin-bottom: var(--cdl-space-3); }
.cdl-board-text-button { min-height: var(--cdl-touch-target); padding: 0 var(--cdl-space-2); border: 0; background: transparent; color: var(--cdl-orange-text); font: inherit; font-weight: var(--cdl-weight-bold); cursor: pointer; }
.cdl-board-text-button:hover { background: var(--cdl-orange-soft); }
.cdl-board-search-label, .cdl-board-filter-options legend { display: block; margin-bottom: var(--cdl-space-2); font-weight: var(--cdl-weight-bold); }
.cdl-board-popover input[type="search"] { box-sizing: border-box; width: 100%; min-height: var(--cdl-touch-target); padding: var(--cdl-space-2); border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control); background: var(--cdl-surface); color: var(--cdl-ink); font: inherit; }
.cdl-board-filter-options { min-width: 0; padding: 0; margin: var(--cdl-space-4) 0 0; border: 0; }
.cdl-board-filter-options label { display: flex; align-items: center; gap: var(--cdl-space-3); min-height: var(--cdl-touch-target); margin: 0; cursor: pointer; font-weight: var(--cdl-weight-regular); }
.cdl-board-filter-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--cdl-charcoal); }
.cdl-board-option-count { margin-left: auto; color: var(--cdl-muted); }
.cdl-board-popover__note { margin: var(--cdl-space-3) 0 0; color: var(--cdl-muted); font-size: var(--cdl-text-meta); line-height: var(--cdl-leading-body); }
.cdl-board-copy { width: 100%; min-height: var(--cdl-touch-target); margin-top: var(--cdl-space-4); border: 1px solid var(--cdl-border); background: var(--cdl-page); color: var(--cdl-ink); font: inherit; cursor: pointer; }
.cdl-board-popover--links a { display: flex; align-items: center; min-height: var(--cdl-touch-target); padding-inline: var(--cdl-space-2); color: var(--cdl-ink); text-decoration: none; }
.cdl-board-popover--links a:hover { background: transparent; outline: var(--cdl-focus-ring); outline-offset: var(--cdl-focus-offset); }
.cdl-board-popover--links h2 { margin-bottom: var(--cdl-space-3); }
.cdl-board-filter-summary { display: flex; align-items: center; gap: var(--cdl-space-3); padding: var(--cdl-space-2) var(--cdl-space-7) 0; color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.cdl-board-filter-summary[hidden], .cdl-board-filter-count[hidden], .cdl-board-note[hidden], .cdl-board .cdl-card[hidden] { display: none; }
@media (max-width: 900px) {
  .cdl-board-actions { justify-content: flex-end; }
  .cdl-board-menu { position: static; }
  .cdl-board-popover { right: var(--cdl-space-7); top: calc(100% + 4px); max-width: calc(100vw - 56px); }
}
@media (max-width: 640px) {
  .cdl-board-project-controls { padding: var(--cdl-space-4) var(--cdl-space-4) 0; }
  .cdl-board-view { padding-left: var(--cdl-space-2); margin-left: 0; }
  .cdl-board-actions { flex-basis: 100%; gap: 0; justify-content: space-between; }
  .cdl-board-control { padding-inline: var(--cdl-space-2); }
  .cdl-board-control--icon { padding: 0; }
  .cdl-board-control--share { margin-left: 0; }
  .cdl-board-popover { right: var(--cdl-space-4); max-width: calc(100vw - 32px); }
  .cdl-board-filter-summary { padding-inline: var(--cdl-space-4); }
}

@media (max-width: 420px) {
  .cdl-board-actions { flex-wrap: wrap; }
  .cdl-board-menu > .cdl-board-control { position: relative; width: var(--cdl-touch-target); padding: 0; }
  .cdl-board-menu > .cdl-board-control > span:not(.cdl-board-filter-count) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .cdl-board-filter-count { position: absolute; top: -2px; right: -2px; }
}

.cdl-project-switcher { position: relative; min-width: 0; max-width: 480px; }
.cdl-project-switcher[open] { z-index: 1; }
.cdl-project-switcher > .cdl-switcher { display: flex; width: 100%; color: var(--cdl-ink); font-weight: var(--cdl-weight-bold); cursor: pointer; list-style: none; }
.cdl-project-switcher > summary::-webkit-details-marker { display: none; }
.cdl-project-switcher[open] > .cdl-switcher { color: var(--cdl-orange-text); }
.cdl-project-switcher > .cdl-switcher svg { color: var(--cdl-muted); }
.cdl-project-switcher[open] > .cdl-switcher svg { transform: rotate(180deg); }
.cdl-project-switcher > .cdl-board-popover {
  left: 0; right: auto; top: calc(100% + var(--cdl-space-1));
  width: max(100%, 260px); max-width: calc(100vw - 56px);
  padding: var(--cdl-space-4) 0; border: 0; border-top: 3px solid var(--cdl-orange);
  border-radius: 0 0 var(--cdl-radius-control) var(--cdl-radius-control);
  box-shadow: var(--cdl-shadow-card); font-size: var(--cdl-text-lead); letter-spacing: normal;
}
.cdl-project-switcher .cdl-board-popover__note { margin: 0; padding-inline: var(--cdl-space-6); }
.cdl-project-switcher__controls { display: flex; gap: var(--cdl-space-2); margin: 0 var(--cdl-space-4) var(--cdl-space-2); }
.cdl-project-switcher__controls input[type="search"] { flex: 1; width: auto; min-width: 0; }
.cdl-project-switcher__controls input[type="search"]::-webkit-search-cancel-button { display: none; }
.cdl-project-switcher__controls input:disabled { background: var(--cdl-page); cursor: not-allowed; }
.cdl-project-create {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 var(--cdl-touch-target); height: var(--cdl-touch-target); padding: 0;
  border: 0; background: transparent; color: var(--cdl-ink);
}
.cdl-project-create:hover { color: var(--cdl-orange-text); }
.cdl-project-create svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.cdl-project-switcher__list { max-height: min(320px, 50vh); overflow-y: auto; }
.cdl-project-switcher__list a { gap: var(--cdl-space-3); min-height: calc(var(--cdl-touch-target) + var(--cdl-space-1)); padding: var(--cdl-space-2) var(--cdl-space-6); line-height: var(--cdl-leading-tight); }
.cdl-project-switcher__list a[hidden] { display: none; }
.cdl-project-switcher__list a:hover { background: var(--cdl-orange-soft); outline: none; }
.cdl-project-switcher__list a:focus-visible { background: var(--cdl-orange-soft); outline: var(--cdl-focus-ring); outline-offset: -2px; }
.cdl-project-switcher__list a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdl-project-switcher__list a[aria-current="page"] { color: var(--cdl-orange-text); }
.cdl-project-switcher__list svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; }
.cdl-project-title-tooltip {
  position: fixed; inset: auto; margin: 0; width: max-content; max-width: min(24rem, calc(100% - 16px));
  padding: var(--cdl-space-1) var(--cdl-space-2); border: 1px solid var(--cdl-border);
  border-radius: var(--cdl-radius-control); background: var(--cdl-tooltip-fill); color: var(--cdl-tooltip-ink);
  box-shadow: var(--cdl-shadow-card); font-family: var(--cdl-font); font-size: var(--cdl-text-meta);
  line-height: var(--cdl-leading-tight); overflow-wrap: anywhere; pointer-events: none;
}
@media (max-width: 900px) {
  .cdl-header--private { flex-wrap: wrap; column-gap: var(--cdl-space-3); }
}
@media (max-width: 640px) {
  .cdl-header--private:has(> .cdl-tabs) .cdl-header-context { flex: 1 0 100%; }
  .cdl-project-switcher > .cdl-board-popover { max-width: calc(100vw - 32px); }
}
@media (max-width: 420px) {
  .cdl-header-context { position: relative; }
  .cdl-header-context > .cdl-project-switcher { position: static; }
  .cdl-header-context > .cdl-project-switcher > .cdl-board-popover { width: 260px; }
}

/* ============ Buttons ============ */
/* Primary is the default: white with the orange bottom rule (Candle signature). */
.button, button {
  min-height: var(--cdl-touch-target);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--cdl-space-2);
  padding: 0 var(--cdl-space-4);
  border: 0; border-bottom: 2px solid var(--cdl-orange); border-radius: var(--cdl-radius-control);
  background: var(--cdl-surface); color: var(--cdl-ink);
  font: inherit; font-size: var(--cdl-text-small); text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--cdl-subtle); text-decoration: none; }
.secondary { border: 1px solid var(--cdl-border); background: var(--cdl-page); }
.secondary:hover { background: var(--cdl-hover); }
.danger { color: var(--cdl-status-returned-text); border-bottom-color: var(--cdl-status-returned); }
.cdl-button--dark {
  border: 1px solid var(--cdl-charcoal); border-radius: var(--cdl-radius-pill);
  background: var(--cdl-charcoal); color: var(--cdl-on-dark);
}
.cdl-button--dark:hover { background: #3B3A42; color: var(--cdl-on-dark); }
.cdl-button--dark svg { flex: 0 0 auto; width: 10px; height: 17px; }
button:disabled, .button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ============ Tags and pills ============ */
.cdl-tag {
  display: inline-block; padding: 2px 6px; border-radius: var(--cdl-radius-card);
  font-size: var(--cdl-text-micro); font-weight: var(--cdl-weight-bold);
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.5;
}
.cdl-tag--submittal { background: var(--cdl-hover); color: #444444; }
.cdl-tag--rfi { background: var(--cdl-charcoal); color: var(--cdl-on-dark); }
.cdl-pill {
  display: inline-block; flex: 0 0 auto; padding: 3px 8px; border-radius: 3px;
  font-size: var(--cdl-text-caption); font-weight: var(--cdl-weight-bold); line-height: 1.5; white-space: nowrap;
  background: var(--cdl-status-not-started-bg); color: var(--cdl-status-not-started-text);
}
.cdl-pill--in-progress { background: var(--cdl-status-in-progress-bg); color: var(--cdl-status-in-progress-text); }
.cdl-pill--submitted   { background: var(--cdl-status-submitted-bg); color: var(--cdl-status-submitted-text); }
.cdl-pill--returned    { background: var(--cdl-status-returned-bg); color: var(--cdl-status-returned-text); }
.cdl-pill--approved    { background: var(--cdl-status-approved-bg); color: var(--cdl-status-approved-text); }

/* ============ Page shells ============ */
.page { width: min(1240px, 100%); margin-inline: auto; padding: var(--cdl-space-6) var(--cdl-gutter) 120px; }
.page.narrow { max-width: 776px; }
.page.wide { width: 100%; max-width: none; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cdl-space-3) var(--cdl-space-6); margin-bottom: var(--cdl-space-5); }
.section-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cdl-space-3) var(--cdl-space-6); }
.back-link { margin: 0 0 var(--cdl-space-4); }
.back-link a {
  min-height: 36px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--cdl-muted); font-size: var(--cdl-text-small); text-decoration: none;
}
.back-link a:hover { color: var(--cdl-ink); }
.lead { max-width: 60ch; margin: 8px 0 0; color: var(--cdl-muted); font-size: var(--cdl-text-lead); }
.cdl-panel, .card, .empty, .project-form, .archive, .settings-section {
  background: var(--cdl-surface); border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
}
.cdl-panel__head { margin: 0; padding: 14px var(--cdl-space-4); border-bottom: 1px solid var(--cdl-border); }
.card { padding: var(--cdl-space-8); }
.auth-card { width: min(460px, calc(100% - 32px)); margin: 64px auto; }
.empty { padding: var(--cdl-space-7); }
.empty :is(h2, h3) { font-size: var(--cdl-text-lead); }
.empty p { margin: 8px 0 0; color: var(--cdl-muted); }
body:has(> .cdl-project-documents) { background: var(--cdl-page); }
.cdl-project-documents .empty { background: var(--cdl-surface); }
.foot { margin: 24px 0 0; color: var(--cdl-muted); text-align: center; }

/* ============ Forms ============ */
form { display: grid; gap: 18px; margin-top: 24px; }
label { display: grid; gap: 6px; color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
input, select, textarea {
  width: 100%; min-height: var(--cdl-touch-target); padding: 10px 14px;
  border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control);
  background: var(--cdl-surface); color: var(--cdl-ink);
  font: inherit; font-size: var(--cdl-text-body);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--cdl-charcoal); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--cdl-orange); box-shadow: 0 0 0 3px var(--cdl-page); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; justify-content: flex-end; gap: var(--cdl-space-3); margin-top: 8px; }
.project-form { margin-top: var(--cdl-space-5); padding: var(--cdl-space-7); }
.archive { margin-top: var(--cdl-space-5); padding: var(--cdl-space-7); border-color: var(--cdl-status-returned-bg); }
.archive h2 { font-size: var(--cdl-text-lead); }
.archive p { margin: 8px 0 0; color: var(--cdl-muted); }
.archive form { margin-top: 12px; justify-items: start; }

.error, .success { margin: var(--cdl-space-4) 0; padding: 12px 14px; border-left: 3px solid currentColor; border-radius: var(--cdl-radius-card); }
.error { background: var(--cdl-status-returned-bg); color: var(--cdl-status-returned-text); }
.success { background: var(--cdl-status-approved-bg); color: var(--cdl-status-approved-text); }

/* ============ Projects directory ============ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.project-card {
  display: flex; flex-direction: column; gap: var(--cdl-space-4); padding: var(--cdl-space-5);
  background: var(--cdl-surface); border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
  color: inherit; text-decoration: none;
}
.project-card:hover { border-color: var(--cdl-charcoal); box-shadow: var(--cdl-ring-selected); }
.project-card h2 { font-size: var(--cdl-text-lead); line-height: var(--cdl-leading-tight); overflow-wrap: anywhere; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cdl-space-4); }
.card-metadata { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cdl-space-4); margin: 0; }
.card-metadata div { min-width: 0; }
.card-metadata dt { color: var(--cdl-muted); font-size: var(--cdl-text-caption); }
.card-metadata dd { margin: 2px 0 0; font-size: var(--cdl-text-small); overflow-wrap: anywhere; }
.project-empty { grid-column: 1 / -1; }

/* ============ Work Board ============ */
[data-candle-workspace]:has(> .cdl-board) {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
.cdl-board {
  flex: 1 0 auto; align-content: start;
  display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px; padding: 18px var(--cdl-gutter) 110px; overflow-x: auto;
}
.cdl-board-note { margin: 0; padding: 18px var(--cdl-gutter) 0; color: var(--cdl-muted); font-size: var(--cdl-text-small); }
.cdl-board-note + .cdl-board { padding-top: var(--cdl-space-3); }
.cdl-column { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cdl-column__head { display: flex; align-items: center; gap: var(--cdl-space-2); padding: 4px 2px; }
.cdl-column__title {
  margin: 0; padding-bottom: 3px; font-size: var(--cdl-text-body);
  border-bottom: 2px solid var(--cdl-column-color, var(--cdl-border));
}
.cdl-column__count { font-size: var(--cdl-text-meta); color: var(--cdl-muted); }
.cdl-column[data-status="not-started"] { --cdl-column-color: var(--cdl-status-not-started); }
.cdl-column[data-status="in-progress"] { --cdl-column-color: var(--cdl-status-in-progress); }
.cdl-column[data-status="submitted"]   { --cdl-column-color: var(--cdl-status-submitted); }
.cdl-column[data-status="returned"]    { --cdl-column-color: var(--cdl-status-returned); }
.cdl-column[data-status="approved"]    { --cdl-column-color: var(--cdl-status-approved); }

/* ============ Work card ============ */
.cdl-card {
  position: relative; display: flex; flex-direction: column; gap: var(--cdl-space-2);
  padding: 14px; background: var(--cdl-surface);
  border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
  box-shadow: var(--cdl-shadow-card);
}
.cdl-card:hover::after, .cdl-card:focus-within::after {
  content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px;
  height: 2px; background: var(--cdl-orange); pointer-events: none;
  z-index: var(--cdl-z-card-overlay);
}
/* Whole-card link: an invisible anchor stretched over the card */
.cdl-card__open { position: absolute; inset: 0; z-index: var(--cdl-z-card-overlay); border-radius: var(--cdl-radius-card); }
/* Keep the label and title clear of the cone controls in the top-right slot. */
.cdl-card__top, .cdl-card__title { padding-right: 36px; }
.cdl-card__top { display: flex; align-items: center; gap: var(--cdl-space-2); }
.cdl-card__num { font-size: var(--cdl-text-meta); font-weight: var(--cdl-weight-bold); overflow-wrap: anywhere; }
.cdl-card__title { font-size: var(--cdl-text-body); font-weight: 500; line-height: var(--cdl-leading-tight); overflow-wrap: anywhere; }
.cdl-card__meta { font-size: var(--cdl-text-caption); color: var(--cdl-muted); overflow-wrap: anywhere; }

/* Hover cone: start a new agent on this card */
.cdl-card__spawn {
  position: absolute; z-index: var(--cdl-z-card-controls); top: 8px; right: 8px;
  width: 32px; min-height: 0; height: 32px; padding: 0; border-radius: var(--cdl-radius-round);
  border: 1px solid var(--cdl-border); background: var(--cdl-surface); box-shadow: 0 2px 8px #1111111A;
  opacity: 0; transform: scale(.8);
  transition: opacity var(--cdl-duration-fast) var(--cdl-ease), transform var(--cdl-duration-fast) var(--cdl-ease), border-color var(--cdl-duration-fast) var(--cdl-ease);
}
.cdl-card__spawn svg { width: 10px; height: 17px; }
.cdl-card:hover .cdl-card__spawn, .cdl-card:focus-within .cdl-card__spawn, .cdl-card__spawn[aria-expanded="true"] { opacity: 1; transform: scale(1); }
.cdl-card__spawn:hover, .cdl-card__spawn[aria-expanded="true"] { border-color: var(--cdl-orange); background: var(--cdl-surface); }
@media (hover: none) { .cdl-card__spawn { opacity: 1; transform: scale(1); } }
.cdl-card__spawn[hidden] { display: none; }
button.cdl-card__open { width: auto; min-height: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }

/* Cone marker: the card's cone icon with a status underline. Done stays
   until the cone is closed. */
.cdl-card__cone {
  position: absolute; z-index: var(--cdl-z-card-controls); top: 6px; right: 6px;
  width: 34px; min-height: 0; height: 36px; padding: 2px 4px 6px; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.cdl-card__cone[hidden] { display: none; }
.cdl-card__cone img { width: 24px; height: 24px; object-fit: contain; }
.cdl-card__cone[data-cone-status="working"] img { animation: cdl-cone-hop 1.4s ease-in-out infinite; }
.cdl-card__cone::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--cdl-cone-status, transparent); }
[data-cone-status="working"]   { --cdl-cone-status: var(--cdl-agent-working); }
[data-cone-status="needs_you"] { --cdl-cone-status: var(--cdl-agent-needs); }
[data-cone-status="watching"]  { --cdl-cone-status: var(--cdl-agent-watching); }
[data-cone-status="done"]      { --cdl-cone-status: var(--cdl-status-approved); }
.cdl-card__cone[data-cone-status="done"] img { opacity: .5; }

/* ============ Agent layer: bubble and floating window ============ */
/* The bubble shows the cone count, a ring while any cone works and a
   "Needs you" tag; it opens the dock, and a dock row opens the cone window. */
.cdl-bubble-wrap {
  position: fixed; z-index: var(--cdl-z-dock); right: 36px; bottom: 50px;
  width: var(--cdl-bubble); height: var(--cdl-bubble);
}
.cdl-bubble {
  width: var(--cdl-bubble); min-height: 0; height: var(--cdl-bubble); padding: 0;
  border-radius: var(--cdl-radius-round); border: 1px solid var(--cdl-border);
  background: var(--cdl-surface); box-shadow: var(--cdl-shadow-float); cursor: grab; touch-action: none;
  transition: border-color var(--cdl-duration-fast) var(--cdl-ease);
}
.cdl-bubble:hover, .cdl-bubble[aria-expanded="true"] { border-color: var(--cdl-orange); background: var(--cdl-surface); }
.cdl-bubble svg { width: 13px; height: 22px; }
.cdl-agent.is-dragging, .cdl-agent.is-dragging * { user-select: none; }
.cdl-agent.is-dragging .cdl-bubble, .cdl-agent.is-dragging .cdl-agent-window__head { cursor: grabbing; }

.cdl-orb {
  position: relative; flex: 0 0 auto; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--cdl-radius-round); background: var(--cdl-surface); border: 1px solid #E3E3E3;
}
.cdl-orb svg { width: 12px; height: 20px; }
.cdl-icon-button {
  flex: 0 0 auto; width: 40px; min-height: 0; height: 40px; padding: 0;
  border: 0; border-radius: var(--cdl-radius-round); background: none;
}
.cdl-icon-button:hover { background: var(--cdl-hover); }
.cdl-icon-button--dark, .cdl-icon-button--dark:hover { background: var(--cdl-charcoal); color: var(--cdl-on-dark); }

.cdl-agent-window {
  position: fixed; z-index: var(--cdl-z-window); right: var(--cdl-space-7); bottom: 210px;
  width: 410px; max-width: calc(100vw - 16px); height: min(520px, calc(100dvh - 300px));
  min-width: 320px; min-height: 300px;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--cdl-surface); border: 1px solid var(--cdl-border);
  border-radius: var(--cdl-radius-window); box-shadow: var(--cdl-shadow-window);
}
.cdl-agent-window[hidden] { display: none; }
/* An explicitly opened dock must remain clickable above its conversation. */
.cdl-bubble-wrap.is-dock-open { z-index: calc(var(--cdl-z-window) + 1); }
.cdl-agent.is-dragging .cdl-agent-window { box-shadow: 0 28px 70px #11111138, 0 4px 10px #11111118; }
.cdl-agent-window__head {
  flex: 0 0 auto; display: flex; align-items: center; gap: var(--cdl-space-3); padding: 14px 14px 12px 16px;
  border-bottom: 1px solid var(--cdl-divider); user-select: none; cursor: grab; touch-action: none;
}
.cdl-agent-window__title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdl-agent-window__body { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 16px; display: flex; flex-direction: column; gap: var(--cdl-space-3); overflow-wrap: anywhere; }
.cdl-agent-window__composer { flex: 0 0 auto; display: flex; align-items: center; gap: var(--cdl-space-2); padding: 10px 18px 10px 16px; border-top: 1px solid var(--cdl-divider); }
.cdl-agent-window__composer textarea {
  flex: 1 1 auto; min-width: 0; min-height: 40px; max-height: 160px; padding: 10px 0; border: 0; background: transparent; box-shadow: none;
  font: inherit; font-size: var(--cdl-text-small); line-height: 1.4; resize: none;
}
.cdl-agent-window__composer textarea:focus-visible { outline: var(--cdl-focus-ring); }
.cdl-agent-window__composer textarea::placeholder { color: var(--cdl-muted); opacity: 1; }
.cdl-msg { display: flex; flex-direction: column; gap: 4px; }
.cdl-msg__who { font-size: var(--cdl-text-micro); font-weight: var(--cdl-weight-bold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cdl-muted); }
.cdl-msg__text { margin: 0; font-size: var(--cdl-text-small); line-height: 1.5; }
.cdl-msg__text > :first-child { margin-top: 0; }
.cdl-msg__text > :last-child { margin-bottom: 0; }
.cdl-agent-window__body :is(.cdl-cone-thread, .cdl-msg, .cdl-msg__text, .chat-documents, .chat-document) { min-width: 0; max-width: 100%; }
.cdl-agent-window__body pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cdl-agent-window__body table { width: 100%; table-layout: fixed; }
.cdl-agent-window__body :is(img, video) { max-width: 100%; }

/* Bubble count, working ring and "Needs you" tag */
.cdl-bubble { position: relative; }
.cdl-bubble__count {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center; border-radius: var(--cdl-radius-pill);
  background: var(--cdl-charcoal); color: var(--cdl-on-dark); font-size: var(--cdl-text-micro); font-weight: var(--cdl-weight-bold);
}
.cdl-bubble__count[hidden], .cdl-bubble__needs[hidden], .cdl-dock[hidden] { display: none; }
.cdl-bubble.is-working::before {
  content: ""; position: absolute; inset: -5px; border-radius: var(--cdl-radius-round);
  border: 2px solid var(--cdl-orange-border); border-top-color: var(--cdl-orange);
  animation: cdl-cone-spin 1.2s linear infinite;
}
@keyframes cdl-cone-spin { to { transform: rotate(1turn); } }
@keyframes cdl-cone-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-3px); } }
@keyframes cdl-cone-attention { 0%, 50%, 100% { transform: translateY(0); box-shadow: var(--cdl-shadow-float); } 15% { transform: translateY(-6px); box-shadow: var(--cdl-shadow-float), 0 0 0 5px var(--cdl-orange-tint); } 30% { transform: translateY(0); } }
.cdl-bubble.needs-attention { border-color: var(--cdl-orange); animation: cdl-cone-attention 2.4s ease-in-out infinite; }
.cdl-agent.is-dragging .cdl-bubble { animation: none; }
.cdl-bubble__needs {
  position: absolute; right: 0; top: calc(100% + 6px); white-space: nowrap;
  min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--cdl-radius-pill);
  background: var(--cdl-orange); color: var(--cdl-ink); font-size: var(--cdl-text-caption); font-weight: var(--cdl-weight-bold);
}
.cdl-bubble__needs:hover { background: var(--cdl-orange-tint); }

/* Expanded dock: independently movable, with scrolling agents and fixed actions. */
.cdl-dock {
  position: fixed; z-index: calc(var(--cdl-z-window) + 1); right: 36px; bottom: 118px;
  width: max-content; max-width: calc(100vw - 16px);
}
.cdl-dock__bar {
  display: flex; align-items: center; gap: 6px; padding: 8px;
  border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-pill);
  background: var(--cdl-surface); box-shadow: var(--cdl-shadow-float); cursor: grab;
}
.cdl-dock__list { display: flex; flex: 0 1 auto; min-width: 0; gap: 4px; list-style: none; margin: 0; padding: 4px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
.cdl-dock__list:empty { display: none; }
.cdl-dock__list > li { flex: 0 0 auto; }
.cdl-dock__row {
  min-height: 48px; padding: 5px 14px 5px 5px; justify-content: flex-start; gap: 10px;
  border: 0; border-radius: var(--cdl-radius-pill); background: transparent; text-align: left;
}
.cdl-dock__row:hover, .cdl-dock__row[aria-pressed="true"] { background: var(--cdl-hover); }
.cdl-dock__icon { width: 38px; height: 38px; }
.cdl-dock .cdl-dock__icon img { width: 26px; height: 26px; object-fit: contain; }
.cdl-dock__row[data-cone-status="working"] .cdl-dock__icon::after {
  content: ""; position: absolute; inset: -3px; border: 2px solid transparent;
  border-top-color: var(--cdl-orange); border-right-color: var(--cdl-orange);
  border-radius: var(--cdl-radius-round); animation: cdl-cone-spin 1.2s linear infinite;
}
.cdl-dock__row[data-cone-status="working"] .cdl-dock__icon img { animation: cdl-cone-hop 1.4s ease-in-out infinite; }
.cdl-dock__row[data-cone-status="needs_you"] .cdl-dock__icon::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 12px; height: 12px;
  border: 2px solid var(--cdl-surface); border-radius: var(--cdl-radius-round); background: var(--cdl-orange);
}
.cdl-dock__text { min-width: 0; max-width: 160px; display: flex; flex-direction: column; }
.cdl-dock__name { font-size: var(--cdl-text-meta); font-weight: var(--cdl-weight-bold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdl-dock__status { font-size: var(--cdl-text-caption); color: var(--cdl-muted); }
.cdl-dock__row[data-cone-status="working"] .cdl-dock__status,
.cdl-dock__row[data-cone-status="needs_you"] .cdl-dock__status { color: var(--cdl-orange-text); }
.cdl-dock__row[data-cone-status="needs_you"] .cdl-dock__status { font-weight: var(--cdl-weight-bold); }
.cdl-dock__row[data-cone-status="watching"] .cdl-dock__status { color: var(--cdl-agent-watching); }
.cdl-dock__empty { padding: 8px; font-size: var(--cdl-text-meta); color: var(--cdl-muted); }
.cdl-dock__list:not(:empty) + .cdl-dock__empty { display: none; }
.cdl-dock__grip, .cdl-dock__collapse, .cdl-dock__add { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--cdl-radius-round); background: transparent; }
.cdl-dock__grip { cursor: grab; touch-action: none; color: var(--cdl-muted); }
.cdl-dock__add { border: 1px dashed var(--cdl-orange-text); color: var(--cdl-orange-text); font-size: 24px; }
.cdl-dock__divider { flex: 0 0 1px; height: 30px; background: var(--cdl-border); }
.cdl-dock__hint { max-width: 340px; margin: 8px 0 0 auto; padding: 8px 12px; border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control); background: var(--cdl-surface); font-size: var(--cdl-text-meta); color: var(--cdl-muted); }
.cdl-dock__hint[hidden], [data-cone-start-project][hidden] { display: none; }
.cdl-agent.is-dragging .cdl-dock__bar, .cdl-agent.is-dragging .cdl-dock__grip { cursor: grabbing; }
/* Cone window: heading, controls, rename, close confirmation, errors */
.cdl-orb img { width: 22px; height: 22px; object-fit: contain; }
.cdl-agent-window__heading { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cdl-agent-window__status { font-size: var(--cdl-text-caption); color: var(--cdl-muted); }
.cdl-agent-window__status:empty { display: none; }
.cdl-agent-window__bar, .cdl-agent-window__rename, .cdl-agent-window__confirm {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 16px;
  border-bottom: 1px solid var(--cdl-divider); font-size: var(--cdl-text-meta);
}
.cdl-agent-window__bar[hidden], .cdl-agent-window__rename[hidden], .cdl-agent-window__confirm[hidden], .cdl-agent-window__error[hidden], .cdl-agent-window__bar [hidden] { display: none; }
.cdl-agent-window__rename input { flex: 1 1 160px; min-height: 32px; }
.cdl-agent-window__confirm { background: var(--cdl-orange-soft); }
.cdl-agent-window__confirm p { flex: 1 1 100%; margin: 0; }
.cdl-agent-window__confirm button { min-height: 32px; }
.cdl-agent-window__link { font-size: var(--cdl-text-meta); }
.cdl-text-button {
  min-height: 32px; padding: 0 2px; border: 0; background: transparent; color: var(--cdl-ink);
  font-size: var(--cdl-text-meta); text-decoration: underline; text-underline-offset: 3px;
}
.cdl-text-button:hover { background: transparent; color: var(--cdl-orange-text); }
.cdl-agent-window__error { flex: 0 0 auto; margin: 0; border-radius: 0; padding: 6px 16px; font-size: var(--cdl-text-meta); }

/* Cone thread: messages, steps and the working state */
.cdl-cone-thread { display: flex; flex-direction: column; gap: var(--cdl-space-3); }
.cdl-cone-thread__messages { display: flex; flex-direction: column; gap: var(--cdl-space-3); }
.cdl-msg--user { align-items: flex-end; }
.cdl-msg--user .cdl-msg__text { max-width: 85%; padding: 8px 12px; background: var(--cdl-page); border-radius: 10px 10px 2px 10px; }
.cdl-msg--system .cdl-msg__text { color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.cdl-cone-document__link { display: flex; gap: var(--cdl-space-3); padding: 12px; border: 1px solid var(--cdl-border); border-radius: 8px; color: var(--cdl-ink); background: var(--cdl-surface); text-decoration: none; }
.cdl-cone-document__link:hover { border-color: var(--cdl-orange); }
.cdl-cone-document__link:focus-visible { outline-offset: 2px; }
.cdl-cone-document__preview { position: relative; display: grid; place-items: center; flex: 0 0 72px; height: 96px; overflow: hidden; background: var(--cdl-doc-page); border: 1px solid var(--cdl-divider); }
.cdl-cone-document__preview .chat-file-icon { width: 28px; height: 36px; color: var(--cdl-charcoal); }
.cdl-cone-document__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; background: var(--cdl-doc-page); }
.cdl-cone-document__preview img.is-loaded { opacity: 1; }
.cdl-cone-document__info { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; font-size: var(--cdl-text-meta); }
.cdl-cone-document__label, .cdl-cone-document__filename, .cdl-cone-document__detail { color: var(--cdl-muted); }
.cdl-cone-document__name { font-weight: var(--cdl-weight-bold); }
.cdl-cone-document__open { color: var(--cdl-orange-text); text-decoration: underline; text-underline-offset: 3px; }
.cdl-cone-steps { padding: 10px 12px; border: 1px solid var(--cdl-orange-border); background: var(--cdl-orange-soft); border-radius: 8px; font-size: var(--cdl-text-meta); overflow-wrap: anywhere; }
.cdl-cone-steps__heading { margin: 0 0 8px; font-weight: var(--cdl-weight-bold); }
.cdl-cone-steps ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cdl-cone-steps li { display: flex; gap: 8px; }
.cdl-cone-steps li > span[aria-hidden] { flex: 0 0 14px; text-align: center; }
.cdl-cone-steps__done > span[aria-hidden] { color: var(--cdl-status-approved); }
.cdl-cone-steps__now { font-weight: var(--cdl-weight-bold); }
.cdl-cone-steps__now > span[aria-hidden] { color: var(--cdl-orange); }
.cdl-cone-steps__blocker { color: var(--cdl-status-returned-text); }
.cdl-cone-steps__waiting { color: var(--cdl-muted); }
.cdl-cone-thread__state:empty { display: none; }
.cdl-cone-thread__state [data-working] { display: flex; flex-direction: column; gap: 4px; color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.cdl-cone-thread__state .working-accessible::after { content: "…"; }
.cdl-cone-thread .chat-documents { display: flex; flex-direction: column; gap: 4px; }
.cdl-cone-thread .chat-document { display: flex; align-items: center; gap: 8px; font-size: var(--cdl-text-meta); }
.cdl-cone-thread .chat-document .chat-file-icon { width: 16px; height: 20px; flex: 0 0 auto; }
.integration-sign-in-button { align-self: flex-start; }
.integration-sign-in-button svg { width: 18px; height: 18px; }
/* Resize handles: edges and corners; the bottom-right corner is a real button for keyboard resizing */
.cdl-resize { position: absolute; z-index: 6; touch-action: none; }
.cdl-resize[data-agent-resize="t"]  { top: 0; left: 14px; right: 14px; height: 6px; cursor: ns-resize; }
.cdl-resize[data-agent-resize="b"]  { bottom: 0; left: 14px; right: 18px; height: 6px; cursor: ns-resize; }
.cdl-resize[data-agent-resize="l"]  { left: 0; top: 14px; bottom: 14px; width: 6px; cursor: ew-resize; }
.cdl-resize[data-agent-resize="r"]  { right: 0; top: 14px; bottom: 18px; width: 6px; cursor: ew-resize; }
.cdl-resize[data-agent-resize="tl"] { left: 0; top: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.cdl-resize[data-agent-resize="tr"] { right: 0; top: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.cdl-resize[data-agent-resize="bl"] { left: 0; bottom: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.cdl-resize[data-agent-resize="br"] {
  right: 0; bottom: 0; z-index: 7; width: 18px; min-height: 0; height: 18px; padding: 0;
  display: flex; align-items: flex-end; justify-content: flex-end;
  border: 0; border-radius: 0; background: transparent; color: var(--cdl-muted); cursor: nwse-resize;
}

/* ============ Submittal page ============ */
.cdl-stack { display: flex; flex-direction: column; gap: 18px; }
.cdl-sub-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--cdl-space-5); padding: 22px var(--cdl-space-6); }
.cdl-sub-head__main { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: var(--cdl-space-2); }
.cdl-sub-head__top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cdl-space-3); }
.cdl-sub-head__num { font-size: var(--cdl-text-body); font-weight: var(--cdl-weight-bold); color: var(--cdl-muted); }
.cdl-sub-head__title { display: flex; align-items: center; gap: var(--cdl-space-3); }
.cdl-sub-head__title button { flex: none; }
.cdl-sub-head h1 { line-height: 1.2; overflow-wrap: anywhere; }
.cdl-facts { flex: 0 1 520px; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px var(--cdl-space-5); }
.cdl-facts div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cdl-facts dt { font-size: var(--cdl-text-caption); color: var(--cdl-muted); }
.cdl-facts dd { margin: 0; font-size: var(--cdl-text-body); overflow-wrap: anywhere; }
.cdl-sub-cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.cdl-sub-cols__side { flex: 0 1 320px; min-width: 260px; }
.cdl-sub-cols__main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.cdl-section { padding: 18px var(--cdl-space-5); display: flex; flex-direction: column; gap: 14px; }
.cdl-section__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cdl-space-3); }
.cdl-section__head .company-documents-view-toggle { margin-left: auto; }
.cdl-section__date { font-size: var(--cdl-text-meta); color: var(--cdl-muted); }
.cdl-section p { margin: 0; }
.cdl-prose { font-size: var(--cdl-text-small); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cdl-revision-activity { display: grid; gap: var(--cdl-space-2); margin: 0; padding: 0; list-style: none; }
.cdl-revision-activity > li {
  display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--cdl-space-3); font-size: var(--cdl-text-small); overflow-wrap: anywhere;
}
.cdl-revision-activity time { font-size: var(--cdl-text-meta); color: var(--cdl-muted); }
@media (max-width: 640px) {
  .cdl-revision-activity > li { grid-template-columns: minmax(0, 1fr); gap: var(--cdl-space-1); }
}
.cdl-muted { color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.cdl-refs { display: flex; flex-wrap: wrap; gap: var(--cdl-space-2); margin: 0; padding: 0; list-style: none; }
.cdl-ref {
  min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 6px var(--cdl-space-3);
  background: var(--cdl-page); border: 1px solid var(--cdl-border); font-size: var(--cdl-text-meta); overflow-wrap: anywhere;
}
.cdl-ref b { flex: 0 0 auto; font-weight: var(--cdl-weight-bold); }

/* Revision list */
.cdl-rev {
  width: 100%; display: flex; gap: var(--cdl-space-3); padding: 14px var(--cdl-space-4);
  background: var(--cdl-surface); border-top: 1px solid var(--cdl-divider);
  color: inherit; text-align: left; text-decoration: none;
}
.cdl-panel__head + .cdl-rev { border-top: 0; }
.cdl-rev:hover { background: var(--cdl-subtle); }
.cdl-rev[aria-current="page"] { background: var(--cdl-subtle); box-shadow: inset 3px 0 0 var(--cdl-orange); }
.cdl-rev__n { width: 22px; flex: 0 0 auto; font-size: 20px; font-weight: var(--cdl-weight-bold); line-height: 1.1; }
.cdl-rev__text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cdl-rev__state { font-size: var(--cdl-text-small); font-weight: var(--cdl-weight-bold); }
.cdl-rev__date { font-size: var(--cdl-text-caption); color: var(--cdl-muted); }

/* ============ Documents ============ */
.page.cdl-document-library { display: grid; grid-template-columns: 240px minmax(0, 1fr); padding: 0; min-height: calc(100dvh - var(--cdl-header-height)); }
.cdl-document-library.is-sidebar-hidden { grid-template-columns: minmax(0, 1fr); }
.cdl-document-sidebar { padding: 22px 16px; border-right: 1px solid var(--cdl-border); background: var(--cdl-subtle); display: flex; flex-direction: column; gap: 4px; }
.cdl-document-sidebar[hidden] { display: none; }
.cdl-document-sidebar a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 10px; color: var(--cdl-ink); text-decoration: none; font-size: var(--cdl-text-small); }
.cdl-document-sidebar a:hover { background: var(--cdl-orange-soft); }
.cdl-document-sidebar a[aria-current="page"] { background: var(--cdl-surface); box-shadow: inset 2px 0 0 var(--cdl-orange); font-weight: var(--cdl-weight-bold); }
.cdl-document-category-count { color: var(--cdl-muted); font-size: var(--cdl-text-caption); font-weight: var(--cdl-weight-regular); }
.cdl-document-library-content { min-width: 0; padding: 22px var(--cdl-gutter) 120px; }
.cdl-sidebar-toggle { display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; background: transparent; border: 0; color: var(--cdl-ink); }
.cdl-sidebar-toggle:hover, .cdl-sidebar-toggle:focus-visible { background: transparent; color: var(--cdl-orange-text); }
.cdl-sidebar-toggle:focus-visible { outline: 1px solid var(--cdl-orange); outline-offset: -1px; }
.cdl-categorize-button { min-height: 44px; }
.cdl-categorize-button:hover { background: var(--cdl-orange); }
.document-category-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control); background: var(--cdl-surface); color: var(--cdl-ink); box-shadow: var(--cdl-shadow-window); }
.document-category-dialog::backdrop { background: #11111155; }
.document-category-dialog form { display: grid; gap: 12px; }
.document-category-dialog h2 { margin: 0 0 8px; }
.document-category-dialog select { width: 100%; min-width: 0; }
.document-category-dialog [hidden] { display: none; }
.document-category-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) {
  .page.cdl-document-library { grid-template-columns: minmax(0, 1fr); }
  .cdl-document-sidebar { border-right: 0; border-bottom: 1px solid var(--cdl-border); }
  .cdl-document-library-content { padding: 16px 16px 100px; }
}
.cdl-docs-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--cdl-space-5); margin-bottom: var(--cdl-space-3); }
.cdl-docs-description { margin: 0 0 var(--cdl-space-4); color: var(--cdl-muted); }
@media (max-width: 760px) {
  .cdl-docs-heading { flex-direction: column; align-items: flex-start; }
}
.cdl-docs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cdl-space-3) var(--cdl-space-4); margin-bottom: var(--cdl-space-4); }
.cdl-search { flex: 1 1 320px; max-width: 520px; min-height: 42px; padding: 0 14px; font-size: var(--cdl-text-small); }
.company-documents-controls { display: flex; align-items: center; gap: var(--cdl-space-2); margin-left: auto; }
.cdl-no-match { margin: var(--cdl-space-4) 0 0; color: var(--cdl-muted); font-size: var(--cdl-text-small); }
.cdl-no-match[hidden] { display: none; }
.company-documents-view-toggle {
  display: inline-flex; border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-control); background: var(--cdl-surface);
}
.company-documents-view-toggle button {
  width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--cdl-muted);
}
.company-documents-view-toggle button:hover { background: var(--cdl-hover); }
.company-documents-view-toggle button[aria-pressed="true"] { background: var(--cdl-charcoal); color: var(--cdl-on-dark); }
.company-documents-view-toggle svg { width: 16px; height: 16px; }

/* Document cards */
.company-document-collection[hidden] { display: none !important; }
.company-document-collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cdl-section .company-document-collection { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.resource-card {
  position: relative; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--cdl-surface); border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
  color: inherit; text-align: left; text-decoration: none; overflow-wrap: anywhere;
}
a.resource-card:hover, a.resource-card:focus-visible { background: var(--cdl-orange-soft); }
a.resource-card:hover .company-document-preview,
a.resource-card:focus-visible .company-document-preview { background: var(--cdl-orange-soft); }
.resource-card[hidden] { display: none; }
.resource-card h3 { font-size: var(--cdl-text-small); line-height: var(--cdl-leading-tight); }
.resource-card small { font-size: var(--cdl-text-caption); color: var(--cdl-muted); }
.company-document-icon { display: none; }
.company-document-preview {
  position: relative; order: -1; height: 140px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--cdl-surface);
}
.cdl-section .company-document-preview { height: 120px; }
.company-document-preview .chat-file-icon { width: 40px; height: 47px; }
.company-document-preview img {
  position: absolute; inset: 0; margin: auto; max-width: calc(100% - 32px); max-height: calc(100% - 24px);
  visibility: hidden; background: var(--cdl-doc-page); box-shadow: 0 1px 3px #11111122;
}
.company-document-preview img.is-loaded { visibility: visible; }
.company-document-preview:has(img.is-loaded) .chat-file-icon { visibility: hidden; }
.document-card-details { padding: var(--cdl-space-3) var(--cdl-space-3) 0; }
.document-card-code {
  display: block; margin-bottom: 3px;
  color: var(--cdl-orange-text); font-size: var(--cdl-text-caption); font-weight: var(--cdl-weight-bold);
}
.resource-card > [data-document-card-revision] { padding: 3px var(--cdl-space-3) var(--cdl-space-3); }
.company-documents-list-heading, .company-document-modified { display: none; }
.company-document-modified-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* List layout (view toggle) */
.company-document-collection.is-list { display: block; background: var(--cdl-surface); border: 0; border-radius: 0; }
.company-document-collection.is-list .company-document-preview { display: none; }
.company-document-collection.is-list .company-document-icon { display: grid; place-items: center; }
.company-document-collection.is-list .company-document-icon .chat-file-icon { width: 16px; height: 20px; }
.company-document-collection.is-list > :is(.company-documents-list-heading, .resource-card) {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(92px, 18%) minmax(116px, 22%);
  align-items: center; gap: var(--cdl-space-3); padding: 10px 14px;
  border: 0; border-top: 1px solid var(--cdl-divider); border-radius: 0;
}
.company-document-collection.is-list > .resource-card[hidden] { display: none; }
.company-document-collection.is-list > .company-documents-list-heading {
  border-top: 0; color: var(--cdl-muted); font-size: var(--cdl-text-caption); font-weight: var(--cdl-weight-bold);
  letter-spacing: var(--cdl-tracking-eyebrow); text-transform: uppercase;
}
.company-document-collection.is-list > a.resource-card:hover,
.company-document-collection.is-list > a.resource-card:focus-visible { background: var(--cdl-orange-soft); }
.company-documents-list-heading > :first-child { grid-column: 2; }
.company-document-collection.is-list .document-card-details { min-width: 0; padding: 0; }
.company-document-collection.is-list .resource-card > [data-document-card-revision] { padding: 0; }
.company-document-collection.is-list .company-document-modified { display: block; }

/* File-type icons */
.chat-file-icon { width: 48px; height: 56px; color: var(--cdl-muted); }
.chat-file-icon-pdf { color: #b42318; }
.chat-file-icon-word { color: #2457a6; }
.chat-file-icon-sheet { color: #237347; }
.chat-file-icon-audio { color: #653a92; }
.chat-file-icon-image { color: #176875; }

/* ============ Full-screen document viewer ============ */
.document-viewer {
  position: fixed; inset: 0; z-index: var(--cdl-z-viewer);
  display: flex; flex-direction: column; background: var(--cdl-doc-page); container-type: size;
}
.document-viewer[hidden] { display: none; }
body.document-viewer-fullscreen { overflow: hidden; }
body.document-viewer-floating :is([data-document-viewer], [data-agent-window], [data-cone-dock], [data-agent-bubble]) {
  z-index: calc(var(--cdl-z-window) + 2 + var(--cdl-float-order, 0));
}
.document-viewer[data-mode="floating"] {
  inset: auto; min-width: 0; min-height: 0; border: 1px solid var(--cdl-border);
  border-radius: var(--cdl-radius-control); box-shadow: var(--cdl-shadow-window);
}
.document-viewer[data-mode="floating"] .document-viewer-header { cursor: move; touch-action: none; }
.document-viewer[data-mode="floating"] .document-viewer-heading { flex-basis: 0; }
.document-viewer[data-mode="floating"] .document-viewer-header { gap: 4px; padding: 6px; }
.document-viewer.is-moving { user-select: none; }
.document-viewer.is-moving .document-viewer-preview { pointer-events: none; }
.document-resize { display: none; }
.document-viewer[data-mode="floating"] .document-resize {
  display: block; position: absolute; z-index: 3; background: transparent; padding: 0;
  border: 0; margin: 0; min-width: 0; min-height: 0; touch-action: none;
}
.document-resize[data-document-resize="t"] { top: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.document-resize[data-document-resize="b"] { bottom: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.document-resize[data-document-resize="l"] { left: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.document-resize[data-document-resize="r"] { right: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.document-resize[data-document-resize="tl"], .document-resize[data-document-resize="tr"],
.document-resize[data-document-resize="bl"], .document-resize[data-document-resize="br"] { width: 16px; height: 16px; }
.document-resize[data-document-resize="tl"] { top: -4px; left: -4px; cursor: nwse-resize; }
.document-resize[data-document-resize="tr"] { top: -4px; right: -4px; cursor: nesw-resize; }
.document-resize[data-document-resize="bl"] { bottom: -4px; left: -4px; cursor: nesw-resize; }
.document-resize[data-document-resize="br"] { bottom: 0; right: 0; cursor: nwse-resize; color: var(--cdl-muted); }
.workspace-navigation-status { position: fixed; left: 16px; bottom: 16px; z-index: 45; max-width: min(500px, calc(100vw - 32px)); padding: 12px 16px; margin: 0; background: var(--cdl-surface); border: 1px solid var(--cdl-border); box-shadow: var(--cdl-shadow-float); }
.workspace-navigation-status[hidden] { display: none; }
.document-viewer-header {
  flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--cdl-space-2);
  min-height: 60px; padding: 8px var(--cdl-space-4);
  background: var(--cdl-surface); border-bottom: 1px solid var(--cdl-border);
}
.document-viewer-header:has(> .document-viewer-tools:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr); }
.document-viewer-leading { grid-column: 1; display: flex; align-items: center; gap: var(--cdl-space-2); min-width: 0; }
.document-viewer-heading { flex: 1 1 0; min-width: 0; }
.document-viewer-category {
  color: var(--cdl-orange-text); line-height: var(--cdl-leading-tight);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.document-viewer-header h2 { margin: 0; font-size: var(--cdl-text-lead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-viewer-action-list, .document-viewer-tools { display: flex; align-items: center; gap: var(--cdl-space-1); }
.document-viewer-actions { justify-self: end; }
.document-viewer-actions-toggle { display: none; }
.cdl-command.cdl-button--dark, .document-viewer-actions .cdl-button--dark { padding-inline: var(--cdl-space-2); }
.document-viewer-content { flex: 1; min-height: 0; display: flex; }
.document-viewer-header > .document-viewer-tools { grid-column: 2; }
@container (max-width: 680px) {
  .document-viewer-header:has(> .document-viewer-tools:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto auto; }
  .document-viewer-actions { position: relative; }
  .document-viewer-actions-toggle { display: inline-flex; }
  .document-viewer-actions-toggle[aria-expanded="false"] + .document-viewer-action-list { display: none; }
  .document-viewer-action-list {
    position: absolute; z-index: 2; inset-block-start: calc(100% + var(--cdl-space-1)); inset-inline-end: 0;
    flex-direction: column; align-items: stretch; width: max-content; padding: var(--cdl-space-2);
    max-block-size: calc(100cqh - 64px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--cdl-surface); border: 1px solid var(--cdl-border);
    border-radius: var(--cdl-radius-control); box-shadow: var(--cdl-shadow-float); cursor: auto;
  }
  .document-viewer-action-list > :is(button, a) { flex: none; justify-content: flex-start; }
  .document-viewer-action-list .document-viewer-icon { gap: var(--cdl-space-2); font-size: var(--cdl-text-body); }
  .document-viewer-action-list .document-viewer-icon::after { content: attr(aria-label); }
}
@container (max-width: 400px) {
  .document-viewer-header:has(> .document-viewer-tools:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }
  .document-viewer-header:has(> .document-viewer-tools:not([hidden])) .document-viewer-leading { grid-column: 1 / -1; }
  .document-viewer-header > .document-viewer-tools { grid-column: 1; justify-self: center; }
  .document-viewer-header:has(> .document-viewer-tools:not([hidden])) .document-viewer-action-list { max-block-size: calc(100cqh - 112px); }
}
.document-viewer-icon, .document-viewer-tools button {
  flex: 0 0 auto; min-width: var(--cdl-touch-target); min-height: var(--cdl-touch-target); height: var(--cdl-touch-target); padding: 0 10px;
  border: 0; border-radius: var(--cdl-radius-control);
  background: transparent; font-size: 18px; white-space: nowrap;
}
.document-viewer-icon:hover, .document-viewer-tools button:hover { background: transparent; color: var(--cdl-orange-text); }
.document-viewer-icon svg { width: 16px; height: 16px; }
.document-viewer-details-toggle[aria-expanded="true"] { background: var(--cdl-orange-soft); color: var(--cdl-orange-text); }
[data-document-window-toggle] { min-width: var(--cdl-touch-target); min-height: var(--cdl-touch-target); height: var(--cdl-touch-target); }
.document-viewer-close { width: var(--cdl-touch-target); }
.document-viewer[data-mode="floating"] .document-viewer-heading { cursor: grab; touch-action: none; }
.document-viewer-heading:focus-visible { outline-offset: 2px; }
.document-viewer.is-moving .document-viewer-heading { cursor: grabbing; }
.document-viewer-tools[hidden], .document-viewer-actions [hidden] { display: none; }
.document-viewer-status {
  position: absolute; z-index: 1; inset: auto auto var(--cdl-space-4) var(--cdl-space-4);
  width: fit-content; max-width: calc(100% - 32px); margin: 0; padding: 4px 8px;
  background: #FFFFFFCC; color: #555555; font-size: var(--cdl-text-caption); overflow-wrap: anywhere;
}
.document-viewer-status:empty { display: none; }
.document-viewer-status.error { padding: 8px 12px; border: 0; background: var(--cdl-status-returned-bg); color: var(--cdl-status-returned-text); }
.document-viewer-preview-area { position: relative; flex: 1; display: flex; min-width: 0; min-height: 0; }
.document-viewer-preview { flex: 1; min-width: 0; min-height: 0; overflow: auto; background: var(--cdl-page); }
.document-viewer-preview:focus-visible { outline-offset: -2px; }
/* PDF pages: server-rendered images in a scrolling stack. JS sets --pdf-scale
   (pixels per PDF point) and each page's --page-width (points). */
.document-viewer-pages {
  box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 24px;
  width: max-content; min-width: 100%; padding: 24px;
}
.document-viewer-pages.can-pan { cursor: grab; }
.document-viewer-pages.is-panning { cursor: grabbing; user-select: none; }
.document-viewer-page {
  position: relative; flex: 0 0 auto; width: calc(var(--page-width) * var(--pdf-scale, 1) * 1px);
  background: var(--cdl-doc-page); box-shadow: var(--cdl-shadow-page);
}
.document-viewer-page img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; -webkit-user-drag: none; }
.document-viewer-page-status {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  color: var(--cdl-muted); font-size: var(--cdl-text-caption); text-align: center;
}
.document-viewer-page.is-loaded .document-viewer-page-status { display: none; }
.document-viewer-preview > img {
  display: block; max-width: calc(100% - 56px); max-height: calc(100% - 56px); margin: 28px auto;
  object-fit: contain; background: var(--cdl-doc-page); box-shadow: var(--cdl-shadow-page);
}
.document-viewer-details {
  flex: 0 0 17rem; min-block-size: 0; overflow: auto; overscroll-behavior: contain;
  padding: var(--cdl-space-3) var(--cdl-space-4); overflow-wrap: anywhere;
  background: var(--cdl-surface); border-inline-start: 1px solid var(--cdl-border);
  color: var(--cdl-ink); font-size: var(--cdl-text-small);
}
.document-viewer-details[hidden], .document-viewer-details [hidden] { display: none; }
.document-viewer-details:focus-visible, .document-viewer-details-links a:focus-visible { outline-offset: -2px; }
.document-viewer-details-note { margin: 0; color: var(--cdl-muted); }
.document-viewer-details-note[data-document-details-status]:not(:empty) { margin-block: var(--cdl-space-2); }
.document-viewer-details-values {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--cdl-space-1) var(--cdl-space-4);
  margin: var(--cdl-space-3) 0 0;
}
.document-viewer-details-values dt { color: var(--cdl-muted); }
.document-viewer-details-values dd { margin: 0; }
.document-viewer-linked-submittals { display: grid; gap: var(--cdl-space-2); margin-block-start: var(--cdl-space-4); }
.document-viewer-linked-submittals .document-viewer-details-note { font-size: var(--cdl-text-meta); }
.document-viewer-details-links { display: grid; gap: var(--cdl-space-2); min-width: 0; padding: 0; margin: 0; list-style: none; }
.document-viewer-details-links:empty { display: none; }
.document-viewer-submittal-card {
  display: flex; align-items: center; gap: 10px; min-block-size: var(--cdl-touch-target);
  padding: var(--cdl-space-2) 10px; background: var(--cdl-surface); color: var(--cdl-ink);
  border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
  font-size: var(--cdl-text-meta); line-height: var(--cdl-leading-tight); text-decoration: none;
}
a.document-viewer-submittal-card:hover { background: var(--cdl-subtle); border-color: var(--cdl-orange-border); }
.document-viewer-submittal-number { max-inline-size: 40%; font-weight: var(--cdl-weight-bold); }
.document-viewer-submittal-title { flex: 1; min-inline-size: 0; }
.document-viewer-submittal-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-viewer-submittal-title small { display: block; color: var(--cdl-muted); font-size: var(--cdl-text-caption); }
.document-viewer-submittal-status {
  max-inline-size: 42%; padding: 2px 6px; font-size: var(--cdl-text-micro);
  line-height: var(--cdl-leading-tight); white-space: normal;
}
@container (max-width: 52rem) {
  .document-viewer-content { flex-direction: column; }
  .document-viewer-details {
    flex: 0 1 auto; max-block-size: min(18rem, 48%);
    border-inline-start: 0; border-block-start: 1px solid var(--cdl-border);
  }
}
.document-viewer-text {
  width: min(880px, calc(100% - 56px)); min-height: calc(100% - 56px); margin: 28px auto; padding: 48px 56px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--cdl-doc-page); color: var(--cdl-ink); box-shadow: var(--cdl-shadow-page);
}
.document-viewer-docx { box-sizing: content-box; min-height: 100%; margin-inline: auto; padding: 24px; background: var(--cdl-page); color: #202020; color-scheme: light; }
.document-viewer-docx.docx-editor p { max-width: none; }
.document-viewer-docx .docx-page { background: var(--cdl-doc-page); box-shadow: var(--cdl-shadow-page); }
.document-viewer-docx .docx-pages .docx-hf:hover { background: transparent !important; }
.document-viewer-docx .docx-pages .docx-hf-edit-hint,
.document-viewer-docx .docx-table-furniture { display: none; }
.document-viewer-docx .docx-pages .docx-hf--placeholder:hover::after { content: none; }
.document-viewer-docx .docx-pages--hf-editing .docx-hf,
.document-viewer-docx .docx-pages--hf-editing .docx-page-content { opacity: 1; border: none; cursor: text; }
.document-viewer-docx .docx-pages--hf-editing .docx-page-content,
.document-viewer-docx .docx-pages--hf-editing .docx-page-content * { pointer-events: auto !important; }
.document-viewer:has(.docx-pages--hf-editing) :is(.docx-table-insert-column, .docx-table-insert-row) { display: none; }
.sheet-note { margin: 0; padding: 16px; background: var(--cdl-surface); }
.sheet-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: var(--cdl-surface); border-bottom: 1px solid var(--cdl-border); }
.sheet-tabs button { min-height: 40px; }
.sheet-tabs [aria-selected="true"] { background: var(--cdl-charcoal); border-color: var(--cdl-charcoal); color: var(--cdl-on-dark); }
.sheet-scroll { overflow: auto; }
.sheet-table { width: max-content; min-width: 100%; border-collapse: collapse; white-space: pre-wrap; background: var(--cdl-surface); font-size: var(--cdl-text-meta); }
.sheet-table th, .sheet-table td { min-width: 110px; max-width: 300px; padding: 6px 10px; border: 1px solid var(--cdl-border); overflow-wrap: anywhere; text-align: left; vertical-align: top; }
.sheet-table th { position: sticky; top: 0; background: var(--cdl-page); }
.sheet-table th:first-child { min-width: 54px; }

/* ============ Project info ============ */
.cdl-info__title { display: flex; align-items: center; gap: var(--cdl-space-3); min-width: 0; min-height: var(--cdl-touch-target); }
.cdl-info__title h1 { min-width: 0; overflow-wrap: anywhere; }
.cdl-info__form .cdl-info__title { flex: 1 1 25rem; max-width: 36rem; }
.cdl-info__title .cdl-info__name {
  min-width: 0; padding-block: var(--cdl-space-2);
  font-size: var(--cdl-text-display); font-weight: var(--cdl-weight-bold); line-height: 1.25; letter-spacing: -.03em;
}
.cdl-info__edit { display: grid; place-items: center; flex: 0 0 var(--cdl-touch-target); height: var(--cdl-touch-target); color: var(--cdl-charcoal); }
.cdl-info__edit:hover { color: var(--cdl-orange-text); }
.cdl-info__form { display: block; margin: 0; }
.cdl-info__card .page-header { padding-bottom: var(--cdl-space-4); border-bottom: 1px solid var(--cdl-divider); }
.cdl-fields { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--cdl-space-6) var(--cdl-space-10); }
.cdl-field { min-width: 0; }
.cdl-field dt { font-size: var(--cdl-text-meta); font-weight: var(--cdl-weight-bold); letter-spacing: var(--cdl-tracking-eyebrow); text-transform: uppercase; }
.cdl-field dt label { display: inline; color: inherit; font-size: inherit; }
.cdl-field dd { margin: var(--cdl-space-2) 0 0; font-size: var(--cdl-text-lead); overflow-wrap: anywhere; }
.cdl-info__actions { flex-wrap: wrap; margin-top: var(--cdl-space-5); }
.cdl-info__archive { margin-inline-end: auto; }
@media (max-width: 640px) {
  .cdl-info__archive { margin-inline-end: 0; }
}

/* Requested-upload results: kept for the cone window */
.chat-upload-results > [data-upload-state="ready"],
.chat-upload-results:not(:has(> [data-upload-state]:not([data-upload-state="ready"]))),
.upload-request:has(.chat-upload-results):not(:has([data-upload-state]:not([data-upload-state="ready"]), [data-batch-status]:not(:empty))) {
  display: none;
}
.chat-upload-results .chat-upload-file { display: flex; align-items: center; gap: 8px; min-height: 28px; margin: 0; padding: 4px 6px; font-size: var(--cdl-text-meta); line-height: 1.4; }
.chat-upload-file .chat-file-icon { flex: 0 0 auto; width: 16px; height: 20px; }
.chat-upload-name { min-width: 0; overflow-wrap: anywhere; }
.chat-upload-results .chat-upload-state { flex: 0 0 auto; margin-inline-start: auto; color: var(--cdl-muted); }
.chat-upload-results .upload-result > p { margin: 4px 6px; font-size: var(--cdl-text-meta); }
.upload-request { width: 100%; max-width: none; }

/* Upload drop zone */
.document-upload {
  width: 100%; min-height: 86px; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px; padding: 16px;
  border: 1px dashed var(--cdl-orange-text); border-radius: var(--cdl-radius-card);
  background: var(--cdl-surface); color: var(--cdl-muted); font-size: var(--cdl-text-small); text-align: center; cursor: pointer;
}
.document-upload-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.document-upload-button, .document-upload-close { width: 44px; height: 44px; padding: 0; flex: 0 0 auto; border: 0; background: transparent; color: var(--cdl-charcoal); }
.document-upload-button > .document-upload-icon { width: 24px; height: 24px; }
.document-upload-button:hover, .document-upload-button:focus-visible { background: transparent; color: var(--cdl-orange-text); }
.document-upload-close:hover { background: transparent; outline: var(--cdl-focus-ring); outline-offset: var(--cdl-focus-offset); }
.document-upload.dragging { background: var(--cdl-orange-soft); color: var(--cdl-ink); }
.document-upload.upload-error { color: var(--cdl-status-returned-text); border-color: var(--cdl-status-returned); }
.document-upload[data-uploading="true"] { cursor: wait; }
.upload-input { display: none; }
.document-upload-dialog {
  width: min(560px, calc(100% - 32px)); max-height: 90dvh; overflow-y: auto; padding: var(--cdl-space-7);
  border: 1px solid var(--cdl-border); border-radius: var(--cdl-radius-card);
  background: var(--cdl-surface); color: var(--cdl-ink); box-shadow: var(--cdl-shadow-window);
}
.document-upload-dialog::backdrop { background: #11111166; }
.document-upload-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.document-upload-dialog .document-upload { margin-top: 24px; }
.upload-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; width: 100%; }
.upload-results:not(:empty) { margin-bottom: var(--cdl-space-4); }
.document-upload-dialog .upload-results:not(:empty) { margin: var(--cdl-space-4) 0 0; }
[data-batch-status]:empty { margin: 0; }
.upload-result { min-width: 0; overflow-wrap: anywhere; }
.upload-result p:empty { display: none; }
.resource-card.upload-result { gap: 4px; padding: 14px; }
.resource-card.upload-result p { margin: 0; color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.resource-card.upload-result a { font-size: var(--cdl-text-meta); }
.resource-card.upload-result button { justify-self: start; align-self: flex-start; margin-top: 6px; }

/* ============ Account settings ============ */
.settings-card { width: min(1080px, 100%); margin: 0 auto; padding: var(--cdl-space-6) var(--cdl-gutter) 120px; }
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; gap: var(--cdl-space-8); margin-top: var(--cdl-space-5); }
.settings-nav { position: sticky; top: calc(var(--cdl-header-height) + 24px); display: grid; gap: 4px; }
.settings-nav a {
  display: flex; align-items: center; min-height: 40px; padding: 0 10px;
  color: var(--cdl-ink); font-size: var(--cdl-text-small); text-decoration: none;
}
.settings-nav a:hover { background: var(--cdl-hover); }
.settings-nav a[aria-current="location"] { background: var(--cdl-surface); box-shadow: inset 2px 0 0 var(--cdl-orange); font-weight: var(--cdl-weight-bold); }
.settings-content { display: grid; gap: 18px; min-width: 0; }
.settings-content > :is(.success, .error) { margin: 0; }
.settings-section { min-width: 0; padding: var(--cdl-space-6); scroll-margin-top: calc(var(--cdl-header-height) + 24px); overflow-wrap: anywhere; }
.settings-section > h2 { margin-bottom: var(--cdl-space-4); font-size: var(--cdl-text-lead); }
.settings-section > ul { margin-block: 0; padding-left: 0; list-style: none; }
.settings-section > ul > li + li { margin-top: var(--cdl-space-4); padding-top: var(--cdl-space-4); border-top: 1px solid var(--cdl-divider); }
.settings-section form { justify-items: start; margin-top: var(--cdl-space-3); }
.settings-section form label { width: min(100%, 420px); }
.settings-section form label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: var(--cdl-space-2); width: auto; }
.settings-section:target { border-color: var(--cdl-orange); }
.connected-accounts-list { padding: 0; list-style: none; }
.connected-account { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding-block: 16px; }
.settings-section > ul > li.connected-account { margin-top: 0; }
.connected-account:first-child { padding-top: 0; }
.connected-account:last-child { padding-bottom: 0; }
.connected-account + .connected-account { border-top: 1px solid var(--cdl-divider); padding-top: 16px; }
.connected-account-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.connected-account-icon { display: flex; flex: 0 0 24px; }
.connected-account-icon svg { width: 24px; height: 24px; }
.connected-account-details { min-width: 0; }
.connected-account-details > strong, .integration-status { display: block; }
.integration-status { color: var(--cdl-muted); font-size: var(--cdl-text-meta); }
.integration-status.is-connected { color: var(--cdl-status-approved-text); }
.connected-account-details > p { margin: 6px 0 0; font-size: var(--cdl-text-meta); }
.connected-account .actions { flex-wrap: wrap; align-items: center; gap: 8px; max-width: 220px; margin: 0; }
.connected-account .actions form { margin: 0; min-width: 0; }
.connected-account .actions button { overflow-wrap: anywhere; }

/* ============ Motion ============ */
@media (prefers-reduced-motion: reduce) {
  .cdl-bubble, .cdl-card__spawn { transition: none; }
  .cdl-bubble.needs-attention, .cdl-bubble.is-working::before,
  .cdl-card__cone[data-cone-status="working"] img,
  .cdl-dock__row[data-cone-status="working"] .cdl-dock__icon::after,
  .cdl-dock__row[data-cone-status="working"] .cdl-dock__icon img { animation: none; }
}

/* ============ Responsive ============ */
@media (max-width: 640px), (max-height: 599px) {
  .cdl-agent-window__head > .cdl-icon-button,
  .cdl-agent-window__composer > .cdl-icon-button {
    min-width: var(--cdl-touch-target); min-height: var(--cdl-touch-target);
  }
}
@media (max-height: 599px) {
  .cdl-dock { bottom: 8px !important; }
  .cdl-bubble-wrap.is-dock-open { visibility: hidden; }
  .cdl-agent .cdl-agent-window { bottom: 104px !important; min-height: 0; height: calc(100dvh - 112px) !important; max-height: calc(100dvh - 112px); }
}
@media (max-width: 900px) {
  .cdl-facts { flex-basis: 100%; }
}
@media (max-width: 640px) {
  :root { --cdl-gutter: var(--cdl-space-4); }
  /* Let the stacked header scroll with the page on phones. */
  .cdl-header { position: static; gap: 0 var(--cdl-space-3); padding-top: 6px; padding-bottom: 6px; }
  .cdl-header--private { position: relative; }
  .cdl-tab { min-height: var(--cdl-touch-target); padding-inline: var(--cdl-space-2); }
  .cdl-switcher { flex: 1 1 0; min-width: 0; max-width: none; }
  body:not(.document-viewer-fullscreen) .cdl-header--private:has(.cdl-account-toggle[aria-expanded="true"]) { z-index: var(--cdl-z-header-menu); }
  .cdl-account-toggle {
    display: flex; width: var(--cdl-touch-target); height: var(--cdl-touch-target);
    padding: 0; border: 0; border-radius: 5px; background: var(--cdl-charcoal); color: var(--cdl-on-dark);
  }
  .cdl-account-toggle:hover { background: var(--cdl-charcoal); }
  .cdl-account-desktop, .cdl-account-panel { display: none; }
  .cdl-account-toggle[aria-expanded="true"] + .cdl-account-panel {
    display: flex; position: absolute; z-index: 1; top: calc(100% + var(--cdl-space-1)); right: 0;
    flex-direction: column; align-items: stretch; gap: var(--cdl-space-1); width: 192px; padding: var(--cdl-space-2);
    border-top: 3px solid var(--cdl-orange); border-radius: 0 0 var(--cdl-radius-control) var(--cdl-radius-control);
    background: var(--cdl-surface); box-shadow: var(--cdl-shadow-card);
  }
  .cdl-account-panel .cdl-tab { display: flex; text-underline-offset: var(--cdl-space-1); }
  .cdl-account-panel .cdl-tab:hover, .cdl-account-panel .cdl-tab:focus-visible { background: var(--cdl-orange-soft); }
  .cdl-account-panel .cdl-command { align-self: flex-start; }
  .cdl-bubble-wrap { right: var(--cdl-space-4); bottom: 58px; translate: none !important; }
  .cdl-dock { right: 8px; bottom: 120px; max-width: calc(100vw - 16px); translate: none !important; }
  .cdl-dock__grip { display: none; }
  .cdl-dock__bar { cursor: default; }
  .cdl-dock__text { max-width: 120px; }
  /* On phones the agent window spans the screen with 16px insets and does not move. */
  .cdl-agent-window {
    left: var(--cdl-space-4); right: var(--cdl-space-4); bottom: 210px; max-width: none; min-width: 0;
    width: auto !important; height: min(520px, calc(100dvh - 300px)) !important; translate: none !important;
  }
  .cdl-agent-window .cdl-resize { display: none; }
  .cdl-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cdl-sub-head { padding: var(--cdl-space-5) var(--cdl-space-4); }
  .cdl-sub-cols__side { flex-basis: 100%; }
  .cdl-section { padding: var(--cdl-space-4); }
  .cdl-search { flex-basis: 100%; max-width: none; }
  .company-documents-controls { margin-left: 0; }
  .company-document-collection.is-list > .company-documents-list-heading { display: none; }
  .company-document-collection.is-list > .resource-card { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 10px; }
  .company-document-collection.is-list .document-card-details { grid-column: 2 / -1; }
  .company-document-collection.is-list [data-document-card-revision] { grid-column: 2; }
  .company-document-modified-label { position: static; width: auto; height: auto; clip-path: none; }
  .document-viewer-docx { padding: 8px; }
  .document-viewer-text { padding: 24px 20px; }
  .document-viewer-pages { gap: 8px; padding: 8px; }
  .card { padding: var(--cdl-space-6) var(--cdl-space-5); }
  .auth-card { margin-top: 28px; }
  .form-grid, .card-metadata { grid-template-columns: 1fr; }
  .actions { align-items: stretch; flex-direction: column-reverse; text-align: center; }
  .project-form, .archive, .empty { padding: var(--cdl-space-5); }
  .document-upload-dialog { padding: var(--cdl-space-5); }
  .document-upload-dialog header { display: grid; }
  .document-upload-dialog header .secondary { justify-self: start; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
  .settings-section { padding: var(--cdl-space-5); }
  .connected-account { grid-template-columns: minmax(0, 1fr); }
}
.cdl-activity-panel > summary { padding: 18px var(--cdl-space-5); cursor: pointer; }
.cdl-activity-panel > :is(ol, p) { margin: 0; padding: 0 var(--cdl-space-5) 18px; }
.cdl-revision-activity [data-actor-kind="candle"] { color: var(--cdl-orange-text); }
.cdl-revision-activity [data-actor-kind="reviewer"] { color: var(--cdl-status-submitted-text); }
.cdl-revision-activity [data-actor-kind="system"] { color: var(--cdl-muted); }
