* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale
}

button,
input,
select {
  font: inherit
}

button,
select {
  cursor: pointer
}

button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600
}

/* Keep default hover colors below component styles, including embedded widgets. */
button:where(:hover) {
  background: var(--subtle);
  border-color: var(--line-strong)
}

button:disabled {
  opacity: .45;
  cursor: default
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--portal-accent);
  outline-offset: 1px
}

[hidden] {
  display: none !important
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 20px 0 24px;
  gap: 20px
}

.brand {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: -.7px
}

/* Names the product beside the CoderFlow or company logo. Administrators can
   rename it, so long names truncate instead of crowding the header controls. */
.brand-product {
  min-width: 0;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 20px;
  white-space: nowrap
}

/* The built-in name continues the CoderFlow wordmark ("CoderFlow for Business"),
   so it sits closer to the logo without a divider. */
.brand-product.brand-suffix {
  margin-left: -4px;
  padding-left: 0;
  border-left: 0
}

.context {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
  width: clamp(220px, 22vw, 300px);
  min-width: 0
}

.context select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 30px 8px 12px;
  color: var(--ink);
  background: var(--canvas);
  max-width: 240px
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width, 224px) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-height))
}

/* The library stays in view beside long reports and scrolls on its own. */
.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px
}

/* Section headings read as titles, not row labels: larger, bold and full ink.
   Heading actions line up with the row actions below them. */
.nav-heading {
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0;
  color: var(--ink);
  margin: 6px 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px
}

.search {
  position: relative;
  display: block
}

.search::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--muted);
  -webkit-mask: var(--glyph-search) center / contain no-repeat;
  mask: var(--glyph-search) center / contain no-repeat;
  pointer-events: none
}

.search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas);
  padding: 0 10px 0 32px;
  font-size: 13px
}

.search input:hover {
  border-color: var(--line-strong)
}

.search input:focus-visible {
  outline: none;
  background: var(--surface);
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 3px var(--focus-ring)
}

.sidebar nav {
  display: grid;
  gap: 1px;
  margin-top: 6px
}

.report-link {
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  line-height: 1.4
}

.report-link .report-icon[data-icon-color="default"] { color: var(--accent); }

.report-link span:first-child {
  font-size: 17px
}

/* Names stay on one line so rows keep a steady rhythm as actions appear. */
.report-link > span:last-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.report-link.selected {
  color: var(--portal-accent);
  font-weight: 600
}

/* A saved report is a real link, so the browser can open it in a new tab or
   window; it keeps the look of the other sidebar rows. */
a.report-link {
  color: var(--ink);
  text-decoration: none;
  cursor: pointer
}

a.report-link.selected {
  color: var(--portal-accent)
}

a.report-link:focus-visible {
  outline: 2px solid var(--portal-accent);
  outline-offset: 1px
}

.rail-note {
  margin: 0 2px;
  padding-top: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6
}

.tabs {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  height: 44px;
  display: flex;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--surface)
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0
}

.tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--portal-accent);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  pointer-events: none
}

.tab button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  white-space: nowrap
}

.tab .close {
  padding: 9px;
  font-size: 16px;
  color: var(--muted)
}

main {
  padding: 28px 32px 48px;
  max-width: 1550px;
  margin: auto
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin-bottom: 20px
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 10px
}

h1 {
  font-size: 24px;
  letter-spacing: -.02em;
  line-height: 1.25;
  margin: 0 0 4px;
  font-weight: 700
}

p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0
}

h2 {
  font-size: 17px;
  letter-spacing: -.01em;
  margin: 0 0 7px
}

.primary {
  background: var(--action-bg);
  color: var(--action-text);
  border-color: var(--action-bg);
  box-shadow: inset 0 1px 0 #ffffff1f, var(--shadow-sm);
  white-space: nowrap
}

.primary:hover:not(:disabled) {
  background: var(--action-hover);
  border-color: var(--action-hover);
  color: var(--action-text)
}

.primary:disabled {
  background: var(--subtle);
  border-color: var(--line);
  color: var(--muted);
  box-shadow: none;
  opacity: 1
}

/* Secondary page actions share one quiet, raised treatment. */
:is(#edit-report, #share-report, #pin-report, #pin-it-dashboard, #close-authoring, #copy-samples, #cancel-authoring, .application-toolbar > button, .dialog-actions > button:not(.primary), .authoring-actions > button:not(.primary)) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm)
}

/* Decorative action glyphs; labels remain the buttons' text content. */
:is(#refresh-report, #refresh-dashboard, #edit-report, #share-report, #pin-report, #pin-it-dashboard, #delete-report, #delete-draft, #close-authoring, #copy-samples, #ask-create-report, #ask-request, #ask-delete, .application-toolbar > button, .dashboard-actions button)::before {
  content: "";
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--action-glyph) center / contain no-repeat;
  mask: var(--action-glyph) center / contain no-repeat
}
#refresh-report, #refresh-dashboard { --action-glyph: var(--glyph-refresh); }
#edit-report, #dashboard-rename { --action-glyph: var(--glyph-pencil); }
#pin-report, #pin-application { --action-glyph: var(--glyph-pin); }
#share-report { --action-glyph: var(--glyph-share); }
#pin-it-dashboard { --action-glyph: var(--glyph-monitor); }
#assist-application { --action-glyph: var(--glyph-sparkles); }
#favorite-application { --action-glyph: var(--glyph-star); }
#favorite-application[aria-pressed="true"] { --action-glyph: var(--glyph-star-filled); }
#favorite-application[aria-pressed="true"]::before { color: #f4b740; }
#assist-application[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
#close-authoring { --action-glyph: var(--glyph-arrow-left); }
#copy-samples { --action-glyph: var(--glyph-sparkles); }
#dashboard-create { --action-glyph: var(--glyph-plus); }
#dashboard-default { --action-glyph: var(--glyph-star); }
#dashboard-delete { --action-glyph: var(--glyph-trash); }
#delete-report, #delete-draft, #ask-delete { --action-glyph: var(--glyph-trash); }
#ask-create-report { --action-glyph: var(--glyph-chart); }
#ask-request { --action-glyph: var(--glyph-send); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px
}

.section-heading p {
  font-size: 12px
}


.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 20px
}

.tile, .tile-preview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden
}

/* Icon and title share the first row; description, metric and link follow. */
.tile-body {
  padding: 20px 22px 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  align-content: start
}

.tile-body > * {
  grid-column: 1 / -1
}

.tile-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  color: var(--portal-accent);
  /* The badge tint follows the chosen icon color. */
  background: color-mix(in srgb, currentColor 12%, transparent);
  border-radius: 10px;
  font-size: 16px
}

.tile-body > .tile-icon {
  grid-column: 1;
  grid-row: 1
}

.tile-icon svg {
  width: 18px;
  height: 18px
}

.tile h3, .tile-preview-card h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.35;
  margin: 0
}

.tile-body > h3 {
  grid-column: 2;
  grid-row: 1;
  align-self: center
}

.tile p, .tile-preview-card p {
  font-size: 13px;
  line-height: 1.5;
  min-height: 40px;
  margin-top: 12px
}

.tile-total {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  margin: 16px 0 4px
}

.tile-caption {
  font-size: 12px;
  color: var(--muted)
}

.tile-open {
  justify-self: start;
  padding: 2px 0;
  border: 0;
  color: var(--portal-accent);
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  box-shadow: none
}

.tile-open:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px
}

/* Home empty state only: the shared markdown editor also toggles an "empty" class. */
#home-empty {
  padding: 56px 24px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center
}

#home-empty h2 {
  margin: 16px 0 6px
}

#home-empty p {
  max-width: 460px;
  margin: auto
}

.empty-illustration {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: var(--portal-accent);
  background: var(--portal-accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--portal-accent) 18%, transparent)
}

.empty-illustration svg {
  width: 26px;
  height: 26px
}

.report-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap
}

iframe {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  width: 100%;
  height: 630px
}

/* Each open report tab keeps its own view; only the selected one shows. */
.report-view:not(:has(iframe)):not(:empty) {
  padding: 48px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center
}

#error, #workspace-warning {
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 20px
}

#loading {
  padding: 30px
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0)
}

@media(max-width:1050px) {
  main {
    padding: 28px 24px
  }

  .header {
    gap: 28px
  }

  .page-heading {
    align-items: start
  }

  h1 {
    font-size: 24px
  }

  .tiles {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr))
  }
}

@media(max-width:680px) {
  .header {
    position: static;
    height: auto;
    min-height: 64px;
    padding: 12px 16px;
    gap: 12px 16px;
    flex-wrap: wrap
  }

  .brand {
    font-size: 17px;
    /* Keep the 59px profile control and 14px gap on the first row; a long Portal name truncates. */
    max-width: calc(100% - 74px)
  }

  .context {
    margin-left: auto;
    display: grid;
    gap: 4px;
    font-size: 10px
  }

  .context select {
    max-width: 170px;
    font-size: 12px;
    padding: 6px 8px
  }

  .shell {
    display: block
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-heading,
  .rail-note {
    display: none
  }

  .sidebar nav {
    grid-column: 1/-1;
    display: flex;
    gap: 8px;
    overflow: auto;
    margin: 0;
    padding: 2px 0 4px
  }

  /* Reports become compact chips in the horizontal library strip. */
  .report-nav-row {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface)
  }

  .report-nav-row:has(> .report-link.selected) {
    border-color: color-mix(in srgb, var(--portal-accent) 40%, var(--line))
  }

  .report-nav-row:has(> .report-link.selected)::before {
    display: none
  }

  .report-link {
    flex-shrink: 0;
    gap: 7px;
    font-size: 12px;
    padding: 5px 4px 5px 10px
  }

  .report-nav-row > .rename-icon {
    margin-right: 3px
  }

  .tabs {
    position: static;
    padding: 0 12px;
    height: 46px
  }

  main {
    padding: 26px 18px
  }

  .page-heading {
    display: block
  }

  .page-heading>button {
    margin-top: 18px
  }

  h1 {
    font-size: 24px
  }

  .page-heading p {
    font-size: 13px
  }

  .section-heading {
    align-items: start
  }

  .section-heading p {
    max-width: 190px
  }


  .tiles {
    grid-template-columns: 1fr;
    gap: 16px
  }

  .tile-body {
    padding: 18px
  }

  .tile p, .tile-preview-card p {
    min-height: 0
  }

  .report-meta {
    gap: 12px
  }

  iframe {
    height: 700px
  }
}

/* Transient toast (layoutStatus in portal.js): fixed, so it never moves the page. */
#layout-status {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1150;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none
}

#layout-status.is-visible {
  opacity: 1;
  transform: translate(-50%, 0)
}

#layout-status[data-kind="success"]::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: var(--color-success-text);
  -webkit-mask: var(--glyph-check) center / contain no-repeat;
  mask: var(--glyph-check) center / contain no-repeat
}

#layout-status[data-kind="error"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger)
}

@media (prefers-reduced-motion: no-preference) {
  #layout-status { transition: opacity 250ms ease, transform 250ms ease; }
}

/* Authoring stays inside the personal workspace; task implementation is hidden. */
.authoring-form { margin: 24px 0; padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); display: grid; gap: 14px; }
.authoring-form > label, #authoring-name-field > label { font-weight: 600; font-size: 13px; }
#authoring-name-field:not([hidden]) { display: grid; gap: 8px; }
.authoring-form input:not([type=checkbox]), .authoring-form textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.authoring-form input:not([type=checkbox]):hover { border-color: var(--line-strong); }
.authoring-form input:not([type=checkbox]):focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.authoring-form textarea { resize: vertical; min-height: 110px; }
.authoring-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.authoring-workspace { display: grid; gap: 24px; align-items: start; }
.authoring-workspace > * { min-width: 0; }
/* Side by side, the conversation keeps a readable width and the report takes the
   rest, so wide screens give the extra room to the report. Without a report to
   show (a new report), the page narrows to a centered conversation. */
main:has(> #authoring.has-preview:not([hidden])) { max-width: 2400px; }
#authoring.has-preview .authoring-workspace { grid-template-columns: clamp(300px, 40%, 820px) minmax(0, 1fr); }
#authoring:not(.has-preview) { max-width: 1040px; margin-inline: auto; }
.authoring-preview { margin-top: 24px; }
/* The preview is its own framed stage beside the conversation. */
#authoring.has-preview .authoring-preview:not(.is-maximized) { padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
#preview-heading > p { font-size: 13px; }
#preview-heading h2 { display: inline-flex; align-items: center; gap: 8px; }
#preview-pane:not(.is-current) #preview-heading h2::after { content: "Draft"; content: "Draft" / ""; padding: 1px 8px; border-radius: 999px; background: var(--portal-accent-soft); color: var(--portal-accent); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
#preview-heading > h3 { margin: 18px 0 0; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* A subtle stage so the tile reads as it will on Home. */
#preview-heading .preview-tile { margin: 10px 0 20px; }
#preview-renderer:has(iframe) { padding-top: 4px; }
/* The conversation and its composer are the shared Web UI components (see
   shared/conversation-composer.css); placement and Portal accents are decided here. */
/* Once there is a conversation, the pane fills the window below the page
   heading (--conversation-top is measured by portal.js): the log scrolls inside
   it and the composer stays in view, with no second page scroll. Messages keep
   a comfortable line length however wide the pane is. */
.authoring-log { position: relative; display: flex; flex-direction: column; min-height: 0; }
#authoring-conversation { max-height: max(460px, calc(100dvh - 600px)); overflow-y: auto; padding: 4px 2px; }
#conversation-pane.has-log:not(.is-maximized) { display: flex; flex-direction: column; box-sizing: border-box; height: calc(100dvh - var(--conversation-top, 236px) - 24px); min-height: 480px; }
#conversation-pane.has-log:not(.is-maximized) > * { flex-shrink: 0; }
/* Empty rows would still take a gap each; the alert stays rendered so it is announced. */
#conversation-pane > .authoring-actions:not(:has(> :not([hidden]))) { display: none; }
#conversation-pane > #authoring-error:empty { margin: -14px 0 0; }
:is(#conversation-pane.has-log, .is-maximized) > .authoring-log { flex: 1 1 auto; min-height: 140px; }
:is(#conversation-pane.has-log, .is-maximized) #authoring-conversation { flex: 1 1 auto; min-height: 0; max-height: none; }
@media (min-width: 1101px) {
  #authoring.has-preview #conversation-pane.has-log:not(.is-maximized) { position: sticky; top: calc(var(--header-height) + 60px); }
}
/* Stacked layouts put navigation above the editor; keep the pane about a screen tall. */
@media (max-width: 1100px) {
  #conversation-pane.has-log:not(.is-maximized) { min-height: min(680px, calc(100dvh - 32px)); }
}
/* Shown while the user has scrolled up and a reply arrives. */
.authoring-jump { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--line)); border-radius: 999px; color: var(--portal-accent); font-size: 12px; box-shadow: var(--shadow-sm); }
.authoring-jump::after { content: "↓"; }
:is(#authoring-conversation, #assistant-log) .task-conversation-message { max-width: min(92%, 640px); }
:is(#authoring-conversation, #assistant-log) .task-conversation-message.is-user {
  background: var(--portal-accent-soft);
  border-color: color-mix(in srgb, var(--portal-accent) 30%, var(--line));
}
:is(#authoring-conversation, #assistant-log) .task-conversation-message.is-assistant {
  background: var(--surface);
  border-inline-start: 3px solid color-mix(in srgb, var(--portal-accent) 55%, var(--line));
}
/* Prose spacing; a question's widget keeps its own. */
:is(#authoring-conversation, #assistant-log) .task-conversation-message-body :is(p, ul, ol, pre, blockquote):not(.assistant-question *, .mermaid *) { margin: 6px 0; }
:is(#authoring-conversation, #assistant-log) .task-conversation-message-body img { max-width: 100%; height: auto; border-radius: 8px; }
/* The assistant's question (assistant-questions.js): the shared widget inside a
   frame that names it as the assistant's, set apart from the Portal's own controls. */
.assistant-question {
  --color-accent: var(--action-bg); --color-border: var(--line); --color-surface: var(--surface); --color-surface-muted: var(--subtle);
  --color-text: var(--ink); --color-text-muted: var(--muted); --color-danger: var(--danger); --radius-small: 8px;
  margin: 10px 0; padding: 10px 12px 12px; border: 1px dashed color-mix(in srgb, var(--portal-accent) 45%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--portal-accent) 6%, var(--surface));
}
.assistant-question-caption { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.assistant-question-icon { display: inline-flex; color: var(--portal-accent); }
.assistant-question-icon svg { width: 14px; height: 14px; }
.assistant-question > .interactive-reply[data-widget-type] { margin: 8px 0 0; padding: 10px 12px; background: var(--surface); }
/* The report form's full-width text fields must not stretch the choices. */
.assistant-question :is(input[type=radio], input[type=checkbox]) { flex: none; width: auto; padding: 0; }
.assistant-question-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.assistant-question:has(> .interactive-reply.is-locked) .assistant-question-note { display: none; }
.assistant-question-fallback { margin: 8px 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--subtle); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-answer-sent { white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.conversation-attachment { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
.conversation-attachment:hover { border-color: var(--muted); }
.conversation-attachment svg { flex-shrink: 0; width: 13px; height: 13px; }
.conversation-attachment-image { display: block; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.conversation-attachment-image img { display: block; min-width: 48px; min-height: 48px; max-width: 220px; max-height: 160px; border: 1px solid var(--line); border-radius: 8px; background: var(--subtle); object-fit: cover; }
.composer-label { font-weight: 600; }
#authoring-composer.task-conversation-composer { padding: 0; }
#authoring-composer .task-conversation-editor-wrapper .follow-up-editor-container .markdown-editor { min-height: 96px; max-height: 320px; }
#authoring-composer .task-conversation-actions { flex-wrap: wrap; }
.composer-hint { margin-left: 4px; color: var(--muted); font-size: 12px; }
#authoring-composer .attached-files-list { max-height: 200px; }
#authoring-composer[aria-busy="true"] { opacity: .7; }
/* The shared read-only markdown style removes padding; a locked composer keeps its shape. */
#authoring-composer .follow-up-editor-container .markdown-editor[contenteditable="false"] { padding: 8px 50px 8px 10px; }
#authoring-composer-note { margin: -6px 2px 0; color: var(--muted); font-size: 12px; }
#image-editor-dialog { width: min(1100px, calc(100vw - 32px)); }
#image-editor-container { display: flex; align-items: center; justify-content: center; height: min(70vh, 720px); min-height: 320px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--muted); font-size: 13px; }
#image-editor-container > .coderflow-image-editor { align-self: stretch; flex: 1; min-height: 0; }
@media (max-width: 1100px) { #authoring.has-preview .authoring-workspace { grid-template-columns: minmax(0, 1fr); } }
/* The reply in progress: a bubble under the request with the current step,
   elapsed time, Stop and the steps so far. */
.authoring-pending { display: grid; gap: 6px; min-width: min(92%, 360px); box-sizing: border-box; }
.authoring-pending p { margin: 0; }
.authoring-pending-head { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.authoring-spinner { flex: 0 0 auto; width: 14px; height: 14px; box-sizing: border-box; border: 2px solid color-mix(in srgb, var(--portal-accent) 20%, var(--line)); border-top-color: var(--portal-accent); border-radius: 50%; animation: authoring-spin .9s linear infinite; }
@keyframes authoring-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .authoring-spinner, .report-activity.is-working { animation: none; } }
#authoring-step { color: var(--ink); overflow-wrap: anywhere; }
#authoring-still, #authoring-hint { color: var(--muted); font-size: 12px; }
.authoring-pending-foot { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#stop-authoring { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12px; }
#stop-authoring::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
#stop-authoring:hover { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
/* Steps: behind a disclosure in the reply in progress, and on each finished reply. */
.authoring-steps > summary, .reply-steps-toggle { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 2px 10px 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.5; cursor: pointer; list-style: none; }
.authoring-steps > summary::-webkit-details-marker { display: none; }
.authoring-steps > summary::before, .reply-steps-toggle::before { content: "›"; display: inline-block; transition: transform 150ms ease; }
.authoring-steps[open] > summary::before, .reply-steps-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.reply-steps-toggle:where(:hover), .authoring-steps > summary:hover { color: var(--ink); border-color: var(--line-strong); }
.authoring-steps-list { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--subtle); list-style: none; color: var(--muted); font-size: 12px; }
.authoring-steps-list li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); gap: 8px; padding: 2px 0; overflow-wrap: anywhere; }
.authoring-steps-list time { text-align: right; font-variant-numeric: tabular-nums; }
.authoring-steps-list li:is([data-kind="update"], [data-kind="thinking"]) { color: var(--ink); }
.reply-steps { margin-bottom: 6px; }
.reply-steps-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
/* What became of the preview a reply produced. */
.reply-outcome { display: flex; width: fit-content; margin: 8px 0 0; padding: 2px 10px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; }
.reply-outcome[data-outcome="active"] { background: color-mix(in srgb, var(--color-success-text) 12%, var(--surface)); color: var(--color-success-text); }
.reply-outcome[data-outcome="active"]::before { content: "✓\00a0"; }
.reply-outcome[data-outcome="preview"] { background: var(--portal-accent-soft); color: var(--portal-accent); }
/* A request that did not finish keeps its outcome beside it. */
.turn-marker { align-self: flex-end; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin: -4px 2px 0; color: var(--muted); font-size: 12px; }
.turn-marker-text::before { content: "⊘\00a0"; }
.turn-marker:is([data-status="failed"], [data-status="interrupted"]) .turn-marker-text { color: var(--danger); }
.turn-marker-retry { padding: 2px 12px; border-radius: 999px; font-size: 12px; }
/* Earlier conversations load in place above the current one, for reference. */
.earlier-control { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.earlier-load { padding: 4px 12px; border-radius: 999px; font-size: 12px; }
.earlier-status { color: var(--muted); font-size: 12px; }
.earlier-status:empty { display: none; }
.earlier-conversation { display: flex; flex-direction: column; gap: 12px; }
.earlier-empty { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.conversation-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.conversation-divider::before, .conversation-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* Report runs that continue after their editor closes. */
.report-activity { flex: none; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; }
.report-activity.has-reply { background: var(--portal-accent); }
.report-activity.is-unavailable { display: grid; place-items: center; width: 16px; height: 16px; color: var(--danger); border: 1px solid currentColor; font-size: 12px; font-style: normal; font-weight: bold; }
.report-activity.is-working { box-sizing: border-box; width: 10px; height: 10px; border: 2px solid color-mix(in srgb, var(--portal-accent) 25%, var(--line)); border-top-color: var(--portal-accent); animation: authoring-spin .9s linear infinite; }
.authoring-notice { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; align-items: center; gap: 10px; max-width: min(460px, calc(100vw - 40px)); padding: 10px 10px 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 13px; }
#authoring-notice-open { flex: none; border-color: var(--action-bg); background: var(--action-bg); color: var(--action-text); }
#authoring-notice-open:hover { background: var(--action-hover); }
.authoring-notice-close { flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 18px; font-weight: 400; }
#authoring-error { color: var(--danger); }
#preview-renderer iframe { width: 100%; min-height: 320px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
@media (max-width: 600px) { .authoring-form { padding: 16px; } .authoring-actions button { flex: 1 1 auto; } }
@media (max-width: 600px) { .sidebar .search { grid-column: 1 / -1; } }

/* Shared CoderFlow controls, using the Portal palette. */
:root { --color-text: var(--ink); --color-text-muted: var(--muted); --color-text-secondary: var(--muted); --color-border: var(--line); --color-surface: var(--surface); --color-surface-muted: var(--canvas); --color-surface-secondary: var(--subtle); --color-surface-hover: var(--subtle); --color-bg: var(--surface); --color-accent: var(--portal-accent); --color-accent-soft: var(--portal-accent-soft); --color-accent-muted: var(--portal-accent-soft); --color-primary: var(--portal-accent); --color-primary-muted: var(--portal-accent-soft); --color-danger: var(--danger); --color-success-text: #1e7e34; --radius-small: 8px; --radius-medium: 12px; }
:root[data-theme="dark"] { --color-success-text: #8fe3b0; }
#portal-logo { flex-shrink: 0; width: auto; max-width: 176px; height: 28px; object-fit: contain; }
.context .custom-select { min-width: 0; }
/* A compact switcher: the header frames the workspace rather than competing with it. */
.context .custom-select-trigger { min-height: 38px; padding: 6px 10px; border-radius: 10px; background: var(--canvas); font-size: 14px; }
.context .custom-select-trigger:hover { background: var(--surface); border-color: var(--line-strong); }
.context .env-trigger-avatar { border-radius: 6px; }
@media (min-width: 681px) {
  .context:has(.current-environment) { width: auto; max-width: clamp(240px, 28vw, 360px); }
}
.context .current-environment { display: flex; align-items: center; min-width: 0; max-width: 100%; padding: 6px 12px 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); color: var(--ink); font-weight: 500; cursor: help; }
.context .custom-select-trigger-text { display: flex; align-items: center; min-width: 0; }
.context .env-trigger-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context .custom-select-arrow { flex-shrink: 0; }
/* The wider menu is a separate popover, not an extension of the trigger. */
.context .custom-select-trigger.open { border-radius: var(--radius-small); }
.context .custom-select-dropdown {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
}
.context .custom-select-dropdown.flipped { transform: translateY(-8px); }
.context .env-option-name,
.context .env-option-desc { white-space: normal; overflow-wrap: anywhere; }
.context .env-option-desc { color: var(--muted); line-height: 1.5; font-weight: 400; }
.context .env-option-name { color: var(--ink); }
.context .custom-select-option.selected .env-option-name { color: var(--portal-accent); }
.context .custom-select-trigger { color: var(--ink); }
.custom-select-dropdown { position: fixed; z-index: 1000; }
.custom-select-trigger { font-weight: 500; }
@media(max-width: 640px) { #portal-logo { max-width: 150px; height: 26px; } }

/* Portal chrome and account controls share the same semantic palette. */
body { line-height: 1.5; }
input, textarea { color: var(--ink); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.workspace { min-width: 0; }
#nav-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; letter-spacing: 0; font-variant-numeric: tabular-nums; }
#reports > p, #asks > p { padding: 12px 10px; font-size: 12px; }
.profile-control { position: relative; flex-shrink: 0; }
.profile-toggle { display: flex; align-items: center; gap: 4px; border: 0; padding: 3px 6px 3px 3px; border-radius: 999px; background: transparent; }
.profile-toggle:hover, .profile-toggle[aria-expanded="true"] { background: var(--subtle); }
/* A thin CoderFlow gradient ring identifies the signed-in account. */
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid transparent; border-radius: 50%; background: linear-gradient(var(--portal-accent-soft), var(--portal-accent-soft)) padding-box, linear-gradient(135deg, #4073f3, #00d4ff) border-box; color: var(--portal-accent); font-size: 12px; font-weight: 700; letter-spacing: .5px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-chevron { color: var(--muted); transition: transform .15s ease; flex-shrink: 0; }
.profile-toggle[aria-expanded="true"] .profile-chevron { transform: rotate(180deg); }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 264px; max-width: calc(100vw - 32px); z-index: 1100; padding-bottom: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.profile-identity { padding: 14px 16px; background: var(--subtle); border-bottom: 1px solid var(--line); display: grid; gap: 3px; overflow-wrap: anywhere; line-height: 1.3; }
.profile-identity strong { font-size: 14px; font-weight: 600; }
.profile-identity > span { color: var(--muted); font-size: 12px; }
.profile-menu > button, .theme-row { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; text-align: left; border: 0; border-radius: 0; padding: 9px 16px; background: transparent; font-size: 14px; font-weight: 450; }
.profile-menu > button:hover { background: var(--subtle); }
.profile-menu > button > svg, .theme-row > svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.profile-divider { height: 1px; background: var(--line); margin: 4px 0; }
.theme-options { margin-left: auto; display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.theme-options button { display: grid; place-items: center; width: 28px; height: 26px; padding: 5px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.theme-options svg { width: 16px; height: 16px; }
.theme-options button[aria-pressed="true"] { color: var(--portal-accent); background: var(--surface); box-shadow: var(--shadow-sm); }
#account-error:empty { display: none; }
.profile-photo-section { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 24px 0; }
.account-avatar { width: 96px; height: 96px; font-size: 32px; }
.profile-photo-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.profile-photo-actions button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 0; font-size: 13px; }
#upload-photo { background: var(--portal-accent-soft); color: var(--portal-accent); }
#upload-photo:hover { background: color-mix(in srgb, var(--portal-accent) 16%, var(--surface)); }
#upload-photo svg { flex-shrink: 0; }
#remove-photo { background: transparent; color: var(--muted); }
#remove-photo:hover { color: var(--danger); }
.profile-cropper-container { width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; background: var(--canvas); border-radius: 8px; overflow: hidden; }
.profile-cropper-container > img { display: block; max-width: 100%; }
.profile-cropper-container cropper-canvas { width: 100%; aspect-ratio: 1; min-width: 0; min-height: 0; }
.profile-cropper-container cropper-selection, .profile-cropper-container cropper-shade { border-radius: 50%; }
.profile-cropper-container cropper-canvas:focus-visible { outline: 2px solid var(--muted); outline-offset: -2px; }
.profile-crop-actions { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
#profile-crop-section > p { margin-bottom: 12px; color: var(--muted); text-align: center; }
#account-error:not(:empty) { padding: 10px 20px; }
#account-error, #profile-error { color: var(--danger); font-size: 13px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; width: 480px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: #0a0e2766; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.dialog-heading button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: -4px -8px 0 0; font-size: 22px; font-weight: 400; line-height: 1; border: 0; color: var(--muted); background: transparent; }
.dialog-heading button:hover { color: var(--ink); background: var(--subtle); }
dialog h2 { font-size: 20px; letter-spacing: -.01em; }
dialog p { font-size: 13px; }
#dashboard-name { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
#dashboard-name:hover { border-color: var(--line-strong); }
#dashboard-name:focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
/* Match the IT dashboard/task.html rename treatment, using Portal theme tokens. */
.report-title-row { display: flex; align-items: center; gap: 8px; }
.rename-icon { flex: 0 0 32px; width: 32px; height: 32px; padding: 4px; margin: -6px; margin-left: 2px; border: none; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.rename-icon:hover { color: var(--portal-accent); background: var(--portal-accent-soft); }
.report-nav-row { position: relative; display: flex; align-items: center; min-width: 0; gap: 2px; border-radius: 8px; }
.report-nav-row:hover { background: var(--subtle); }
/* The selected report highlights its whole row, including inline actions. */
.report-nav-row:has(> .report-link.selected) { background: var(--portal-accent-soft); }
.report-nav-row:has(> .report-link.selected)::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--portal-accent); }
.report-nav-row > .report-link { flex: 1; min-width: 0; }
.report-nav-row > .rename-icon { flex-basis: 28px; width: 28px; height: 28px; margin: 0 4px 0 0; opacity: 0; }
.report-nav-row:hover > .rename-icon, .report-nav-row:focus-within > .rename-icon { opacity: 1; }
/* With a pointer, hidden actions overlay the row instead of narrowing every name. */
@media (hover: hover) and (min-width: 681px) {
  .report-nav-row > :is(.report-pin, .rename-icon, .application-favorite) { position: absolute; top: 50%; transform: translateY(-50%); }
  .report-nav-row > :is(.rename-icon, .application-favorite) { right: 4px; margin: 0; }
  .report-nav-row > .report-pin { right: 34px; }
  .report-nav-row:is(:hover, :focus-within) > .report-link { padding-right: 66px; }
  /* Shared reports from other people have no rename action beside the pin. */
  .report-nav-row.is-shared-report > .report-pin { right: 4px; }
  .report-nav-row.is-shared-report:is(:hover, :focus-within) > .report-link { padding-right: 36px; }
  /* A chosen favorite stays visible, so its name keeps clear of the star. */
  .report-nav-row:not(:hover, :focus-within):has(> .application-favorite.is-favorite) > .report-link { padding-right: 34px; }
}
.inline-rename { width: 100%; min-width: 0; }
.inline-rename input { font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; background: transparent; border: none; border-bottom: 1px solid var(--portal-accent); border-radius: 0; padding: 0 0 2px; margin: 0; width: 100%; min-width: 0; max-width: 400px; outline: none; transition: border-color 0.15s ease; caret-color: var(--portal-accent); }
.inline-rename input:focus { outline: none; box-shadow: none; border-bottom-color: var(--portal-accent); border-bottom-width: 2px; padding-bottom: 1px; }
.report-nav-row .inline-rename { padding: 8px 10px; font-size: 13px; font-weight: 500; }
.report-title-row .inline-rename { width: min(400px, 100%); }
.report-title-row .inline-rename input { font-size: 24px; font-weight: 700; }
#rename-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
#rename-error:empty { display: none; }
@media (hover: none) { .report-nav-row > .rename-icon { opacity: 1; } }
@media (max-width: 680px) { .report-nav-row > .rename-icon { opacity: 1; } .report-nav-row { flex-shrink: 0; } .report-nav-row:has(.inline-rename) { width: 240px; } }
.account-detail { display: flex; justify-content: space-between; gap: 16px; margin-top: 4px; padding: 16px 0 0; border-top: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.account-detail span { color: var(--muted); font-weight: 500; }
.profile-hint, .about-details { background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.about-details { margin-top: 24px; }
.about-details p { margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@media(max-width:680px) {
  .header { height: auto; gap: 14px; }
  .profile-control { margin-left: auto; }
  .context { order: 3; width: 100%; display: flex; margin: 0; }
  .context .custom-select { flex: 1; min-width: 0; }
  .search { min-width: 0; }
  dialog { padding: 22px; }
}

/* Keep report content prominent and management controls secondary. */
.page-heading > div:first-child { min-width: 0; }
.page-heading p { font-size: 13px; }
#report .page-heading { align-items: start; margin-bottom: 20px; }
#report-title, .tile h3, .tile-caption { overflow-wrap: anywhere; }
#report .eyebrow { color: var(--muted); margin-bottom: 6px; }
#report .authoring-actions { flex-shrink: 0; }
.tile { display: flex; flex-direction: column; }
.tile-body { flex: 1; }
@media(max-width:680px) {
  #report .authoring-actions { margin-top: 14px; }
  .section-heading { flex-wrap: wrap; align-items: center; }
  .section-heading > div { flex: 1 1 160px; }
}

.home-icon { width: 18px; height: 18px; flex-shrink: 0; }
.tab .home-icon { width: 16px; height: 16px; }

/* Sidebar controls stay available while the report library is collapsed. */
.sidebar-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sidebar-toolbar { display: flex; align-items: center; gap: 8px; }
/* Search shares the top row with the collapse toggle; both sections are filtered. */
.sidebar-toolbar .search { flex: 1; min-width: 0; }
.sidebar-collapsed .sidebar-toolbar .search { display: none; }
/* A divider starts each shown section after the first, so questions, requests,
   reports and applications read as separate groups however long each list is. */
.sidebar-content > section:not([hidden]) ~ section:not([hidden]) { border-top: 1px solid var(--line); padding-top: 8px; }
/* An empty list (no favorites yet) adds no space under its heading. */
.sidebar nav:empty { display: none; }
/* Each section heading collapses its list. The chevron hangs in the gutter, so
   names keep their width and stay aligned with the rows below. */
.nav-section-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; margin-left: -18px; padding: 3px 6px 3px 18px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.nav-section-toggle:hover:not(:disabled) { background: transparent; color: var(--ink); }
.nav-section-toggle:disabled { opacity: 1; }
.nav-section-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section-toggle #nav-count { flex: none; }
.nav-section-chevron { position: absolute; left: 5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; color: var(--muted); transition: transform .15s ease; }
.nav-section-toggle:hover:not(:disabled) .nav-section-chevron { color: var(--ink); }
.nav-section-toggle[aria-expanded="false"] .nav-section-chevron { transform: rotate(-90deg); }
/* While a search shows every section, collapsing waits until it is cleared. */
.nav-section-toggle:disabled .nav-section-chevron { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .nav-section-chevron { transition: none; } }
/* The compact strip has no headings, so its sections never collapse. */
@media (min-width: 681px) { .sidebar section.is-collapsed > nav { display: none; } }
/* An icon button beside the heading; its label is read by assistive technology
   and shown in the compact mobile strip. */
.nav-heading-action { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--portal-accent); font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.nav-heading-action:hover, .nav-heading-action:focus-visible { background: var(--portal-accent-soft); color: var(--portal-accent); }
.nav-heading-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
/* New folder sits beside New report at the end of the heading. With two
   actions, the heading packs them closer so the title keeps its room. */
#new-report-folder { margin-left: auto; }
@media (min-width: 681px) {
  #reports-heading { gap: 0; }
  #reports-heading > .nav-section-toggle { gap: 4px; padding-right: 0; }
  #reports-heading > .nav-heading-action { width: 24px; height: 24px; }
  #reports-heading #nav-count { padding: 0 4px; }
}
#reports > .reports-empty-action { margin: 0 2px 8px; width: calc(100% - 4px); }
#reports > .reports-empty-note { padding: 0 10px 12px; color: var(--muted); }
#home-create-report { margin-top: 16px; }
@media (max-width: 680px) {
  /* Section headings are hidden in the compact strip; keep the New action. */
  #reports-heading { display: contents; }
  #reports-heading > .nav-section-toggle { display: none; }
  :is(#create-report, #new-report-folder) { align-self: flex-start; width: auto; height: 30px; padding: 0 10px; margin-bottom: 6px; }
  :is(#create-report, #new-report-folder) .nav-heading-action-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  #reports > .reports-empty-action { width: auto; }
}
#sidebar-toggle { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; padding: 7px; color: var(--muted); background: transparent; border-color: transparent; }
#sidebar-toggle:hover { color: var(--ink); background: var(--subtle); border-color: var(--line); }
.shell.sidebar-collapsed { grid-template-columns: 52px minmax(0, 1fr); }
.sidebar-collapsed .sidebar { padding: 14px 8px; }
.sidebar-collapsed #sidebar-toggle svg { transform: rotate(180deg); }
#sidebar-resize { position: absolute; top: 0; bottom: 0; right: -4px; width: 9px; cursor: col-resize; touch-action: none; z-index: 5; }
/* Keep a generous hit area, with only a fine divider and a short grip visible. */
#sidebar-resize::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 4px;
  width: 1px;
  background: transparent;
}
#sidebar-resize::after {
  content: "";
  position: absolute;
  top: 144px;
  left: 2px;
  width: 5px;
  height: 32px;
  border-radius: 999px;
  background: var(--line);
  box-shadow: 0 0 0 3px var(--surface);
}
#sidebar-resize:focus-visible { outline: none; }
#sidebar-resize:hover::before,
#sidebar-resize:focus-visible::before,
.sidebar-resizing #sidebar-resize::before { background: var(--portal-accent); }
#sidebar-resize:hover::after,
#sidebar-resize:focus-visible::after,
.sidebar-resizing #sidebar-resize::after { background: var(--portal-accent); }
#sidebar-resize:focus-visible::after { outline: 2px solid var(--portal-accent); outline-offset: 3px; }
body.sidebar-resizing { cursor: col-resize; user-select: none; }
body.sidebar-resizing iframe { pointer-events: none; }
.report-link { min-width: 0; overflow-wrap: anywhere; }
/* The report list scrolls inside the sticky library rail. */
.sidebar-content { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -12px; padding: 0 12px 12px; }
@media (max-width: 680px) {
  .sidebar-content { display: flex; overflow: visible; margin: 0; padding: 0; }
  .sidebar-collapsed .sidebar { padding: 12px 16px; }
  #sidebar-resize { display: none; }
}


/* A restrained accent gives the Portal chrome hierarchy without competing with reports.
   Primary actions use the shared --action-* tokens, which reports also receive. */
:root {
  --portal-accent: #315cce; --portal-accent-soft: #edf2ff;
  --header-height: 60px;
  --line-strong: #cdd5e1;
  --focus-ring: color-mix(in srgb, var(--portal-accent) 28%, transparent);
  --shadow-sm: 0 1px 2px #1018280d;
  --shadow-md: 0 1px 2px #1018280a, 0 8px 24px -6px #10182824;
  --shadow-lg: 0 4px 12px -4px #1018281a, 0 18px 44px -10px #1018283d;
}
:root[data-theme="dark"] {
  --portal-accent: #a9c1ff; --portal-accent-soft: #253858;
  --line-strong: #46536d;
  --shadow-sm: 0 1px 2px #0000004d;
  --shadow-md: 0 1px 2px #0006, 0 8px 24px -6px #0009;
  --shadow-lg: 0 4px 12px -4px #0008, 0 18px 44px -10px #000b;
}
/* Decorative glyph masks (Lucide shapes); color comes from currentColor. */
:root {
  --glyph-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  --glyph-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --glyph-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z'/%3E%3Cpath d='m15 5 4 4'/%3E%3C/svg%3E");
  --glyph-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z'/%3E%3C/svg%3E");
  --glyph-arrow-left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 19-7-7 7-7'/%3E%3Cpath d='M19 12H5'/%3E%3C/svg%3E");
  --glyph-sparkles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z'/%3E%3Cpath d='M20 3v4M22 5h-4'/%3E%3C/svg%3E");
  --glyph-monitor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='20' height='14' x='2' y='3' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E");
  --glyph-share: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3Ccircle cx='6' cy='12' r='3'/%3E%3Ccircle cx='18' cy='19' r='3'/%3E%3Cpath d='m8.59 13.51 6.83 3.98M15.41 6.51l-6.82 3.98'/%3E%3C/svg%3E");
  --glyph-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M5 12h14M12 5v14'/%3E%3C/svg%3E");
  --glyph-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.53 2.3a.53.53 0 0 1 .94 0l2.31 4.68a2.12 2.12 0 0 0 1.6 1.16l5.16.76a.53.53 0 0 1 .3.9l-3.74 3.64a2.12 2.12 0 0 0-.61 1.88l.88 5.14a.53.53 0 0 1-.77.56l-4.62-2.43a2.12 2.12 0 0 0-1.97 0L6.4 21.01a.53.53 0 0 1-.77-.56l.88-5.14a2.12 2.12 0 0 0-.61-1.88L2.16 9.8a.53.53 0 0 1 .3-.9l5.16-.76a2.12 2.12 0 0 0 1.6-1.16z'/%3E%3C/svg%3E");
  --glyph-star-filled: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.53 2.3a.53.53 0 0 1 .94 0l2.31 4.68a2.12 2.12 0 0 0 1.6 1.16l5.16.76a.53.53 0 0 1 .3.9l-3.74 3.64a2.12 2.12 0 0 0-.61 1.88l.88 5.14a.53.53 0 0 1-.77.56l-4.62-2.43a2.12 2.12 0 0 0-1.97 0L6.4 21.01a.53.53 0 0 1-.77-.56l.88-5.14a2.12 2.12 0 0 0-.61-1.88L2.16 9.8a.53.53 0 0 1 .3-.9l5.16-.76a2.12 2.12 0 0 0 1.6-1.16z'/%3E%3C/svg%3E");
  --glyph-chart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18M8 16v-5m5 5V7m5 9V4'/%3E%3C/svg%3E");
  --glyph-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904zM6 12h16'/%3E%3C/svg%3E");
  --glyph-refresh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3Cpath d='M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16'/%3E%3Cpath d='M8 16H3v5'/%3E%3C/svg%3E");
  --glyph-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M10 11v6M14 11v6'/%3E%3C/svg%3E");
}
.tab.active { background: transparent; }
.tab.active button { color: var(--ink); font-weight: 600; }
.tile:hover, .tile:focus-within { border-color: color-mix(in srgb, var(--portal-accent) 40%, var(--line)); box-shadow: var(--shadow-md); }


/* Motion is brief and local; direct resizing always follows the pointer. */
.sidebar-animating .sidebar { overflow: clip; }
@media (prefers-reduced-motion: no-preference) {
  button, .report-link, .custom-select-trigger, .custom-select-option {
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }
  .tile { transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
  #sidebar-toggle svg { transition: transform 180ms ease; }
  #sidebar-resize::before, #sidebar-resize::after { transition: background-color 140ms ease; }
  .profile-menu:not([hidden]), .custom-select-dropdown.open, dialog[open] {
    animation: portal-reveal 140ms ease-out;
  }
  .sidebar-content:not([hidden]) { animation: portal-reveal 160ms ease-out; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .tile:hover { transform: translateY(-2px); }
}
@keyframes portal-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .custom-select-trigger, .custom-select-arrow, .profile-chevron { transition: none; }
}


/* Tabs use the same report identity as cards and the library. */
.report-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.report-icon svg { width: 16px; height: 16px; }
.tab { border-radius: 8px 8px 0 0; }
.tab:not(.active):hover, .tab:not(.active):focus-within { background: var(--portal-accent-soft); }
.tab:hover::after, .tab:focus-within::after { transform: scaleX(0.6); opacity: 0.5; }
.tab.active::after { transform: scaleX(1); opacity: 1; }
.tab .tab-select { min-width: 0; color: var(--muted); border-radius: 8px 8px 0 0; }
.tab .tab-select:hover { color: var(--ink); }
.tab.active .tab-select { color: var(--ink); }
.tab-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .close { width: 24px; height: 24px; padding: 0; margin: 0 6px 0 -4px; justify-content: center; border-radius: 6px; color: var(--muted); font-size: 16px; font-weight: 400; }
.tab.active .close { color: var(--muted); font-weight: 400; }
.tab .close:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.tab button:focus-visible { outline: 2px solid var(--portal-accent); outline-offset: -3px; }
/* Opens another tab of the report shown; it follows the last tab. */
.tabs > .tab-add { flex-shrink: 0; align-self: center; width: 28px; height: 28px; margin-left: 4px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; font-weight: 400; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.tabs > .tab-add:hover, .tabs > .tab-add:focus-visible { background: var(--portal-accent-soft); color: var(--portal-accent); }
@media (prefers-reduced-motion: no-preference) {
  .tab { transition: background-color 140ms ease; }
  .tab::after { transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1), opacity 250ms cubic-bezier(0.4, 0, 0.2, 1); }
}
@media (max-width: 680px) { .tab-label { max-width: 160px; } }

/* Expand panes in place so editor and sandboxed report state survive. */
.authoring-pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.authoring-pane-heading h2 { margin: 0; }
.authoring-pane-heading button { flex-shrink: 0; }
body.authoring-maximized { overflow: hidden; }
.authoring-maximized .authoring-workspace > :not(.is-maximized) { visibility: hidden; }
.authoring-workspace > .is-maximized {
  position: fixed; inset: 0; z-index: 100; margin: 0; padding: 24px;
  border: 0; border-radius: 0; background: var(--canvas);
  display: flex; flex-direction: column; gap: 12px; overflow: auto;
}
.is-maximized > * { flex-shrink: 0; }
.is-maximized > .authoring-pane-heading, .is-maximized > #preview-heading { position: sticky; top: -24px; z-index: 1; background: var(--canvas); padding: 12px 0; }
.is-maximized #preview-renderer { flex: 1 1 auto; min-height: 0; overflow: auto; }
#preview-error { color: var(--danger); }
@media (max-width: 600px) {
  .authoring-workspace > .is-maximized { padding: 16px; }
  .is-maximized > .authoring-pane-heading, .is-maximized > #preview-heading { top: -16px; }
}

.report-icon-picker { position: relative; margin: 8px 0; width: fit-content; }
/* Eight 44px icons a row, with room for a scrollbar; the icons scroll below the colors and search. */
.report-icon-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: min(440px, calc(100vw - 48px)); padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: min(440px, 65vh); overflow-y: auto; }
.report-icon-panel [role="status"]:empty { display: none; }
.report-heading-line { display: flex; align-items: center; gap: 10px; }
.report-heading-line #report-icon-picker, .report-heading-line #authoring-icon-picker { flex-shrink: 0; }
.report-heading-line .report-icon-picker { margin: 0; }
.report-heading-line .report-title-row { min-width: 0; }
.report-heading-line h1 { overflow-wrap: anywhere; }
.report-icon-picker summary { cursor: pointer; display: flex; align-items: center; gap: 6px; width: fit-content; padding: 7px 6px 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.report-icon-picker summary:hover { border-color: var(--line-strong); background: var(--subtle); }
.report-heading-line .report-icon-picker summary .report-icon svg { width: 18px; height: 18px; }
.report-icon-picker summary::after { content: ''; width: 6px; height: 6px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); margin: 0 4px 3px; }
.report-icon-picker p { color: var(--muted); font-size: 13px; }
.report-icon-panel .icon-picker { --icon-picker-tile: 44px; --icon-picker-gap: 6px; }

.pane-maximize-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; }
.pane-maximize-icon svg { width: 16px; height: 16px; }


/* Same fixed, in-place composer layout as the dashboard and task page. */
body.composer-maximize-open :has(#authoring-composer.composer-maximized) { transform: none; transition: none; }
#authoring-composer.composer-maximized {
  position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column;
  gap: 10px; margin: 0; padding: 12px 20px max(16px, env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-radius: 0; overflow: hidden;
}
#authoring-composer.composer-maximized::before { content: attr(data-maximize-label); flex: 0 0 auto; font-size: 12px; color: var(--muted); }
#authoring-composer.composer-maximized .task-conversation-input-row { flex: 1; min-height: 0; align-items: stretch; }
#authoring-composer.composer-maximized :is(.task-conversation-editor-wrapper, .follow-up-editor-container, .markdown-editor-wrapper) { flex: 1; min-height: 0; }
#authoring-composer.composer-maximized :is(.follow-up-editor-container, .markdown-editor-wrapper) { display: flex; flex-direction: column; }
#authoring-composer.composer-maximized .task-conversation-submit { top: auto; bottom: 12px; transform: none; }
#authoring-composer.composer-maximized .task-conversation-actions { flex: 0 0 auto; }
#authoring-composer.composer-maximized .attached-files-list { flex: 0 0 auto; max-height: 22vh; overflow-y: auto; }
@media (max-width: 680px) { #authoring-composer.composer-maximized { padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px)); } }

/* Match the dashboard pin, revealing the action alongside rename. */
.report-nav-row > .report-pin { opacity: 0; }
.report-pin { flex: 0 0 28px; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.report-pin svg { width: 15px; height: 15px; }
.report-pin:hover:not(:disabled), .report-pin:focus-visible { color: var(--portal-accent); background: var(--portal-accent-soft); }
.report-pin.is-pinned { color: var(--portal-accent); }
.report-pin.is-pinned svg { fill: currentColor; }

.report-nav-row:hover > .report-pin, .report-nav-row:focus-within > .report-pin { opacity: 1; }
@media (hover: none), (max-width: 680px) { .report-nav-row > .report-pin { opacity: 1; } }
.report-link[draggable="true"] { cursor: grab; }
.tab.is-pin-target { outline: 1px dashed var(--portal-accent); outline-offset: -2px; }
.tab.is-drop-target { background: var(--surface); outline: 2px solid var(--portal-accent); outline-offset: -2px; }
.tab.is-drop-target .tab-select { color: var(--portal-accent); }

#home.is-report-drop-target .tiles { outline: 1px dashed var(--portal-accent); outline-offset: 8px; }
#home.is-report-drop-target #home-empty { outline: 2px dashed var(--portal-accent); }
.home-insertion-marker { position: fixed; width: 4px; background: var(--portal-accent); z-index: 1000; pointer-events: none; color: var(--portal-accent); font-size: 12px; font-weight: 600; white-space: nowrap; padding-top: 4px; text-indent: 8px; border-radius: 3px; }

/* Width is saved as a column span; container queries also handle sidebar resizing.
   Wide screens add columns (tiles stay roughly 400-560px) instead of stretching
   three, so Home may use more of the window than other pages. */
main:has(> #home:not([hidden])) { max-width: 3300px; }
#home { container: home / inline-size; }
#home .tiles { --columns: 3; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); }
@container home (min-width: 1680px) { #home .tiles { --columns: 4; } }
@container home (min-width: 2100px) { #home .tiles { --columns: 5; } }
@container home (min-width: 2520px) { #home .tiles { --columns: 6; } }
@container home (max-width: 820px) { #home .tiles { --columns: 2; } }
@container home (max-width: 540px) {
  #home .tiles { --columns: 1; }
  .tile-resize { display: none; }
}

/* Home tile preview in the report conversation. */
.preview-tile { max-width: 30rem; margin-block: 1rem; }
.tile-body { overflow-wrap: anywhere; }

.tile-view { clear: both; min-width: 0; margin-block: 12px; }
/* Tile frames start small (not the 630px report-view default) and grow to
   their content, or start at their last measured height when re-rendered. */
.tile-view iframe { display: block; width: 100%; height: 80px; min-height: 80px; border: 0; }

.dashboard-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 4px; }
.dashboard-picker { flex: 0 1 auto; min-width: 140px; max-width: 480px; margin-left: -10px; }
#dashboard-name { width: 100%; box-sizing: border-box; font: inherit; color: var(--ink); background: var(--surface); }
#sample-context { margin: 0 0 22px; }
#dashboard-dialog { width: min(440px, calc(100vw - 48px)); }
#dashboard-dialog-description { color: var(--muted); }
#dashboard-dialog-error, #share-dialog-error, #delete-report-error { color: var(--danger, #b42318); }
/* Deleting cannot be undone, so its controls read as destructive. */
:is(#delete-report, #delete-draft, #ask-delete) { color: var(--danger); }
:is(#delete-report, #delete-draft, #ask-delete):hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
#delete-report-description { color: var(--muted); overflow-wrap: anywhere; }
#delete-report-error { margin-top: 12px; }
/* Surface-colored text keeps contrast on the light red and the dark theme's pink. */
#delete-report-submit:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--surface); }
#delete-report-submit:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, var(--ink)); border-color: color-mix(in srgb, var(--danger) 85%, var(--ink)); color: var(--surface); }
/* The owner's shared reports carry a small share mark on their icon. */
.report-link[data-shared] .report-icon { position: relative; }
.report-link[data-shared] .report-icon::after { content: ""; position: absolute; right: -5px; bottom: -4px; width: 10px; height: 10px; background: var(--portal-accent); -webkit-mask: var(--glyph-share) center / contain no-repeat; mask: var(--glyph-share) center / contain no-repeat; }
/* A report shared by someone else shows its icon without the picker. */
#report-icon-picker > .report-icon { display: flex; padding: 7px 9px; }
#report-icon-picker > .report-icon svg { width: 18px; height: 18px; }
.share-dialog-warning { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--subtle); color: var(--muted); }
#share-dialog-status { margin-top: 12px; }
#share-dialog-status:empty { display: none; }
#report .authoring-actions { max-width: 100%; min-width: 0; }
#pin-report { max-width: 100%; overflow-wrap: anywhere; }
#dashboard-dialog-description { overflow-wrap: anywhere; }

/* Keep the dashboard itself prominent and occasional actions tucked away. */
/* The picker reads as the page title and reveals its control on hover. */
.dashboard-picker .custom-select-trigger { min-height: 42px; padding: 4px 10px; border-color: transparent; border-radius: 10px; background: transparent; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.dashboard-picker .custom-select-trigger:hover, .dashboard-picker .custom-select-trigger.open { border-color: var(--line); background: var(--surface); }
.dashboard-picker .custom-select-trigger .report-icon svg { width: 20px; height: 20px; }
.dashboard-picker .custom-select-trigger { justify-content: flex-start; }
.dashboard-picker .custom-select-arrow { margin-left: 12px; }
.dashboard-picker .custom-select-trigger.open { border-radius: 10px; }
.dashboard-picker .custom-select-dropdown { min-width: 260px; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); transform: translateY(6px); }
.dashboard-picker .custom-select-dropdown.flipped { transform: translateY(-6px); }
.dashboard-picker .custom-select-trigger-text,
.dashboard-picker .custom-select-option { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dashboard-picker .custom-select-trigger-text > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-menu { position: relative; flex: 0 0 auto; }
.dashboard-menu > summary { cursor: pointer; list-style: none; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); }
.dashboard-menu > summary::-webkit-details-marker { display: none; }
.dashboard-menu > summary svg { width: 18px; height: 18px; }
.dashboard-menu > summary:hover, .dashboard-menu[open] > summary { color: var(--ink); border-color: var(--line); background: var(--surface); }
.dashboard-actions { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 212px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.dashboard-actions button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; white-space: nowrap; border: 0; border-radius: 8px; background: transparent; font-weight: 500; }
.dashboard-actions button::before { color: var(--muted); }
.dashboard-actions button:hover:not(:disabled) { background: var(--subtle); }
.dashboard-actions [role="separator"] { height: 1px; margin: 6px 4px; background: var(--line); }
#dashboard-delete { color: var(--danger); }
#dashboard-delete::before { color: currentColor; }
#dashboard-delete:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.dashboard-name-row { display: flex; align-items: center; gap: 10px; }
.dashboard-name-row #dashboard-name { flex: 1; min-width: 0; }
#dashboard-icon-field { flex: 0 0 auto; }
/* Refresh sits beside the actions menu as a second quiet icon button. */
#refresh-dashboard { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; box-shadow: none; color: var(--muted); }
#refresh-dashboard::before { width: 18px; height: 18px; }
#refresh-dashboard:hover:not(:disabled) { color: var(--ink); border-color: var(--line); background: var(--surface); }
#copy-samples { margin-left: auto; }
@media (max-width: 680px) {
  /* Keep the actions button beside the picker so its menu opens on screen. */
  .dashboard-picker { flex: 1 1 0; }
  .dashboard-actions { left: auto; right: 0; }
}

#dashboard-icon-picker .report-icon-picker { margin: 0; }
#dashboard-icon-picker summary { min-height: 40px; box-sizing: border-box; }
#dashboard-icon-picker .report-icon-panel { position: fixed; inset: auto; margin: 0; width: min(440px, calc(100vw - 24px)); box-sizing: border-box; }

/* Report and dashboard accents affect icons only; names and surfaces stay neutral. */
[data-icon-color="blue"] { color: #2563eb; }
[data-icon-color="teal"] { color: #0f766e; }
[data-icon-color="green"] { color: #15803d; }
[data-icon-color="amber"] { color: #a16207; }
[data-icon-color="purple"] { color: #7e22ce; }
[data-icon-color="rose"] { color: #be123c; }
:root[data-theme="dark"] [data-icon-color="blue"] { color: #93c5fd; }
:root[data-theme="dark"] [data-icon-color="teal"] { color: #5eead4; }
:root[data-theme="dark"] [data-icon-color="green"] { color: #86efac; }
:root[data-theme="dark"] [data-icon-color="amber"] { color: #fcd34d; }
:root[data-theme="dark"] [data-icon-color="purple"] { color: #d8b4fe; }
:root[data-theme="dark"] [data-icon-color="rose"] { color: #fda4af; }
.icon-colors { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.icon-colors button { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 6px; }
.icon-colors button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.icon-color-swatch { width: 18px; height: 18px; border-radius: 50%; background: currentColor; }

/* Shared personal IBM i logins and Portal secrets in Profile Settings use the
   IT dashboard's card layout, in the Portal theme. */
:is(.personal-ibmi-connection, .portal-secret) { padding: 12px 16px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg-secondary); }
:is(.personal-ibmi-connection, .portal-secret) + :is(.personal-ibmi-connection, .portal-secret) { margin-top: 8px; }
/* Details left and actions right, like the AI Providers cards. */
.profile-item-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.profile-item-details { flex: 1 1 240px; min-width: 0; }
.profile-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
:is(.profile-item-actions, .profile-item-editor) > button { padding: 6px 12px; font-size: 13px; }
.profile-item-editor > button { margin: 12px 8px 0 0; }
/* An open editor spans the card below the summary. */
.profile-item-editor { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
:is(.personal-ibmi-connection, .portal-secret) .form-row { margin: 12px 0 0; }
:is(.personal-ibmi-connection, .portal-secret) :is(label, input, .form-hint) { display: block; }
:is(.personal-ibmi-connection, .portal-secret) label { color: var(--muted); font-size: 13px; font-weight: 500; }
:is(.personal-ibmi-connection, .portal-secret) input { width: 100%; box-sizing: border-box; margin: 6px 0 0; }
:is(.personal-ibmi-connection, .portal-secret) .secret-input-shell { margin: 6px 0 0; }
:is(.personal-ibmi-connection, .portal-secret) .secret-input-shell > input { margin: 0; }
/* Show/hide button beside a masked secret field (shared Profile editors and AI provider dialogs), matching the input frame. */
.secret-input-shell { display: flex; align-items: stretch; gap: 8px; }
.secret-input-shell > input { flex: 1; min-width: 0; }
.secret-input-shell > input::-ms-reveal { display: none; }
.secret-visibility-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 38px; padding: 0 10px; border-color: var(--line-strong); color: var(--muted); }
.secret-visibility-toggle:hover:not(:disabled) { color: var(--ink); }

/* Profile Settings mirrors the IT dashboard modal: a fixed title bar, sticky
   tabs over a scrolling body, and a footer bar for the account form. */
#profile-dialog { padding: 0; overflow: hidden; }
#profile-dialog[open] { display: flex; flex-direction: column; }
#profile-dialog > .dialog-heading { flex-shrink: 0; align-items: center; margin: 0; padding: 16px 18px 16px 24px; border-bottom: 1px solid var(--line); }
#profile-dialog > .dialog-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
#profile-dialog > .dialog-heading button { margin: 0; }
/* Panels own the bottom padding so the account footer can sit flush against the dialog edge. */
.profile-dialog-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px; }
.profile-dialog-body > [role="tabpanel"] { padding-bottom: 24px; }
#profile-account-panel { padding-bottom: 0; }

/* Profile sections share one dialog and an accessible tab strip. */
.profile-tabs { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; padding-top: 16px; margin: 0 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.profile-tabs [role="tab"] { position: relative; padding: 10px 16px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.profile-tabs [role="tab"]:hover { background: transparent; color: var(--ink); }
.profile-tabs [aria-selected="true"] { color: var(--portal-accent); font-weight: 600; }
.profile-tabs [role="tab"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--portal-accent); transform: scaleX(0); }
.profile-tabs [role="tab"]:hover::after { transform: scaleX(.6); }
.profile-tabs [aria-selected="true"]::after { transform: scaleX(1); }
.profile-tabs [role="tab"]:focus-visible { outline-offset: -3px; border-radius: 6px 6px 0 0; }
@media (prefers-reduced-motion: no-preference) { .profile-tabs [role="tab"]::after { transition: transform 150ms ease; } }

/* Account and IBM i fields share quiet labels and crisp inputs. */
#profile-form > label, #personal-ibmi-manager .personal-ibmi-connection label { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
#profile-form > label { margin: 0 0 6px; }
#profile-form > input { display: block; width: 100%; margin-bottom: 16px; }
:is(#profile-form > input, #personal-ibmi-manager input, #portal-secrets-manager input) { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.4; }
:is(#profile-form > input, #personal-ibmi-manager input, #portal-secrets-manager input):hover:not(:disabled, :focus) { border-color: color-mix(in srgb, var(--portal-accent) 40%, var(--line-strong)); }
:is(#profile-form > input, #personal-ibmi-manager input, #portal-secrets-manager input):focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-accent) 16%, transparent); }
:is(#profile-form > input, #personal-ibmi-manager input, #portal-secrets-manager input):disabled { background: var(--canvas); color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { :is(#profile-form > input, #personal-ibmi-manager input, #portal-secrets-manager input) { transition: border-color 140ms ease, box-shadow 140ms ease; } }
#profile-form .dialog-actions { position: sticky; bottom: 0; z-index: 1; margin: 24px -24px 0; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); }
#profile-form .dialog-actions > button { min-width: 96px; justify-content: center; }
#personal-ai-description { margin-bottom: 16px; }
#personal-ai-error:empty { display: none; }
#personal-ibmi-manager > p:not(:empty), #portal-secrets-manager > p:not(:empty) { margin-bottom: 12px; }
/* Status covers successes and failures, so it stays neutral. */
:is(#personal-ibmi-manager, #portal-secrets-manager) > p[role="status"]:not(:empty) { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); color: var(--ink); }
:is(#personal-ibmi-manager, #portal-secrets-manager) .form-hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
:is(#personal-ibmi-manager, #portal-secrets-manager) .btn-primary { border-color: var(--action-bg); box-shadow: inset 0 1px 0 #ffffff1f, var(--shadow-sm); }
:is(#personal-ibmi-manager, #portal-secrets-manager) .btn-primary:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
@media (max-width: 680px) {
  #profile-dialog > .dialog-heading { padding: 14px 12px 14px 16px; }
  .profile-dialog-body { padding: 0 16px; }
  .profile-dialog-body > [role="tabpanel"] { padding-bottom: 16px; }
  #profile-account-panel { padding-bottom: 0; }
  #profile-form .dialog-actions { margin: 24px -16px 0; padding: 12px 16px; }
  .profile-tabs [role="tab"] { padding: 9px 10px; }
}
#profile-dialog [role="tabpanel"] > p, #personal-ibmi-manager p, #portal-secrets-manager p { font-size: 14px; line-height: 1.5; }
:is(#personal-ibmi-manager, #portal-secrets-manager) h4 { margin: 0 0 2px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
:is(#personal-ibmi-manager, #portal-secrets-manager) .profile-item-details > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
:is(#personal-ibmi-manager, #portal-secrets-manager) .profile-item-editor > p.form-hint { margin: 0; }
:is(#personal-ibmi-manager, #portal-secrets-manager) h3 { display: none; }
#profile-dialog .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Application frames stay mounted even when their tab is hidden. */
.application-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.application-toolbar h2 { margin-right: auto; }
.application-panel iframe { width: 100%; height: calc(100vh - 220px); min-height: 420px; border: 0; background: white; }
/* Assistant beside a running application; stacks under it on narrow screens. */
.application-body { display: flex; gap: 16px; align-items: stretch; }
#application-frames { flex: 1 1 auto; min-width: 0; }
#application-assistant { flex: 0 0 340px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 220px); min-height: 420px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
#application-assistant[hidden] { display: none; }
.assistant-header { display: flex; align-items: center; gap: 4px; }
.assistant-header h3 { margin: 0 auto 0 0; font-size: 16px; }
#maximize-assistant { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); }
/* Maximized: the assistant fills the window like a maximized report pane, with
   a readable column. Selecting on screen restores it first. */
body.assistant-maximized { overflow: hidden; }
#application-assistant.is-maximized { position: fixed; inset: 0; z-index: 100; max-height: none; min-height: 0; margin: 0;
  padding: 24px max(24px, calc((100vw - 900px) / 2)); border: 0; border-radius: 0; box-shadow: none; background: var(--canvas); }
#application-assistant.is-maximized #assistant-log { min-height: 120px; }
@media (max-width: 600px) { #application-assistant.is-maximized { padding: 16px; } }
#close-assistant { border: 0; background: transparent; font-size: 20px; line-height: 1; padding: 2px 8px; color: var(--muted); }
.assistant-hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.assistant-select { display: flex; gap: 8px; }
#assistant-pick[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
#assistant-selection { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
#assistant-selection:empty { display: none; }
#assistant-selection li { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; background: var(--subtle); }
#assistant-selection li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
#assistant-selection li button { border: 0; background: transparent; padding: 0 4px; font-size: 14px; line-height: 1; color: var(--muted); }
#assistant-log { flex: 1 1 auto; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#assistant-log:empty { display: none; }
#assistant-log .task-conversation-message { font-size: 14px; }
#assistant-log .task-conversation-message-body { overflow-wrap: anywhere; }
#assistant-log .task-conversation-message-body table { display: block; overflow-x: auto; }
.assistant-message { padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.assistant-message.notice { border: 1px solid var(--line); background: var(--surface); }
.assistant-message.error { color: var(--danger); border: 1px solid currentColor; background: var(--surface); }
.assistant-followup { align-self: flex-start; font-size: 13px; padding: 5px 10px; }
#assistant-starters { display: flex; flex-wrap: wrap; gap: 6px; }
#assistant-starters:empty { display: none; }
#assistant-starters button { font-size: 13px; padding: 6px 10px; border-radius: 999px; text-align: left; }
#assistant-composer { margin: 0; }
#assistant-composer .follow-up-editor-container { min-height: 72px; }
.assistant-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.assistant-actions button { flex: 1 1 auto; }
#assistant-status { margin: 0; min-height: 1em; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .application-body { flex-direction: column; }
  #application-assistant { flex-basis: auto; max-height: none; min-height: 0; }
}
.application-notice { padding: 12px 16px; border: 1px solid currentColor; border-radius: 8px; font-size: 14px; }
.application-panel[hidden] { display: none; }
/* Folders open like an accordion, chevron last, so folder, application and
   report icons share one column. Contents indent under their folder. */
#applications summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
#applications summary::-webkit-details-marker { display: none; }
#applications summary:hover { background: var(--subtle); }
#applications summary .report-icon { font-size: 17px; }
#applications summary .report-icon[data-icon-color="default"] { color: var(--accent); }
#applications details > :not(summary) { margin-left: 14px; }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-chevron { display: inline-flex; color: var(--muted); transition: transform .15s ease; }
.folder-chevron svg { width: 14px; height: 14px; }
#applications details[open] > summary .folder-chevron { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .folder-chevron { transition: none; } }
.nav-subheading { margin: 8px 10px 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
@media (max-width: 680px) { .nav-subheading { display: none; } }
/* Report folders use the application folder look; reports and folders indent
   under their folder. Folder move/rename/delete and a report's Move action
   appear like its pin. */
.report-folder-toggle[aria-expanded="true"] .folder-chevron { transform: rotate(90deg); }
.report-folder-toggle:disabled { opacity: 1; }
.report-folder-toggle:disabled .folder-chevron { visibility: hidden; }
.report-folder-count { flex: none; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
/* Like report rows, folders never widen the sidebar list beyond its width. */
.report-folder, .report-folder-items { min-width: 0; }
.report-folder-items { display: grid; gap: 1px; margin-left: 14px; }
.report-folder-empty { margin: 0; padding: 6px 10px; color: var(--muted); font-size: 12px; }
:is(.report-nav-row, #reports-heading).is-folder-drop-target { background: var(--portal-accent-soft); outline: 2px solid var(--portal-accent); outline-offset: -2px; border-radius: 8px; }
/* Reordering marks the gap the dragged report would fill, and dims its own row. */
.report-nav-row:is(.is-drop-before, .is-drop-after)::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 2px; background: var(--portal-accent); pointer-events: none; }
.report-nav-row.is-drop-before::after { top: -2px; }
.report-nav-row.is-drop-after::after { bottom: -2px; }
:is(.report-nav-row, .report-folder).is-drag-source { opacity: .5; }
.report-move, .report-folder-delete { flex: 0 0 28px; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; opacity: 0; }
.report-move svg, .report-folder-delete svg { width: 15px; height: 15px; }
.report-move:hover:not(:disabled), .report-move:focus-visible { color: var(--portal-accent); background: var(--portal-accent-soft); }
.report-folder-delete:hover:not(:disabled), .report-folder-delete:focus-visible { color: var(--danger); background: var(--subtle); }
.report-nav-row:is(:hover, :focus-within) > :is(.report-move, .report-folder-delete) { opacity: 1; }
@media (hover: none), (max-width: 680px) { .report-nav-row > :is(.report-move, .report-folder-delete) { opacity: 1; } }
@media (hover: hover) and (min-width: 681px) {
  .report-nav-row > :is(.report-move, .report-folder-delete) { position: absolute; top: 50%; transform: translateY(-50%); right: 34px; }
  /* From the right: rename, move, pin. Other people's reports have no rename. */
  .report-nav-row:has(> .report-move) > .report-pin { right: 64px; }
  .report-nav-row:has(> .report-move):has(> .report-pin):is(:hover, :focus-within) > .report-link { padding-right: 96px; }
  .report-nav-row.is-shared-report > .report-move { right: 4px; }
  .report-nav-row.is-shared-report:has(> .report-move) > .report-pin { right: 34px; }
  .report-nav-row.is-shared-report:has(> .report-move):has(> .report-pin):is(:hover, :focus-within) > .report-link { padding-right: 66px; }
  /* From the right: rename, delete, move. They take the place of the count and
     chevron, so the folder name keeps its room; the icon still shows if it is open. */
  .report-folder-row > .report-move { right: 64px; }
  .report-folder-row:has(> .report-move):is(:hover, :focus-within) > .report-link { padding-right: 96px; }
  .report-folder-row:is(:hover, :focus-within) > .report-folder-toggle :is(.report-folder-count, .folder-chevron) { display: none; }
}
#report-folder-dialog-error { margin-top: 12px; color: var(--danger, #b42318); }
/* The compact strip lists an open folder's reports right after its chip. */
@media (max-width: 680px) {
  .report-folder, .report-folder-items { display: contents; }
  .report-folder.is-drag-source .report-nav-row { opacity: .5; }
  .report-folder-empty { display: none; }
  .report-nav-row:is(.is-drop-before, .is-drop-after)::after { top: 4px; bottom: 4px; width: 2px; height: auto; }
  .report-nav-row.is-drop-before::after { left: -5px; right: auto; }
  .report-nav-row.is-drop-after::after { left: auto; right: -5px; }
}
/* Same size and behavior as the pin: adding a favorite appears on hover, and a
   chosen favorite stays visible as a filled star. */
.application-favorite { flex: 0 0 28px; width: 28px; height: 28px; margin-right: 4px; padding: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.application-favorite svg { width: 15px; height: 15px; }
.application-favorite:hover:not(:disabled), .application-favorite:focus-visible { color: var(--portal-accent); background: var(--portal-accent-soft); }
.application-favorite.is-favorite { color: #b45309; }
:root[data-theme="dark"] .application-favorite.is-favorite { color: #fcd34d; }
.report-nav-row > .application-favorite:not(.is-favorite) { opacity: 0; }
.report-nav-row:is(:hover, :focus-within) > .application-favorite { opacity: 1; }
/* Touch and narrow layouts have no hover, so the add-favorite star always shows. */
@media (hover: none), (max-width: 680px) { .report-nav-row > .application-favorite:not(.is-favorite) { opacity: 1; } }

/* Application tiles are launchers that show their live state. */
.tile p.tile-app-status { display: flex; align-items: center; gap: 8px; min-height: 0; margin-top: 10px; font-size: 12px; color: var(--muted); }
.tile p.tile-app-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tile p.tile-app-status[data-state="open"] { color: var(--ink); }
.tile p.tile-app-status[data-state="open"]::before { background: #16a34a; box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 20%, transparent); }
.tile p.tile-app-status[data-state="ended"]::before { background: #d97706; }
:root[data-theme="dark"] .tile p.tile-app-status[data-state="open"]::before { background: #4ade80; }
:root[data-theme="dark"] .tile p.tile-app-status[data-state="ended"]::before { background: #fbbf24; }
/* A placement the user can no longer open: no name or content, only the way to remove it. */
.tile.tile-unavailable { border-style: dashed; background: var(--subtle); }
.tile.tile-unavailable .tile-icon { opacity: .7; }
.tile.tile-unavailable h3 { color: var(--muted); }
/* Dropping from the sidebar: a slot after the last tile, and frames inside
   tiles must not swallow the drag. */
.tile-drop-slot { display: grid; place-items: center; min-height: 140px; padding: 16px; border: 2px dashed var(--portal-accent); border-radius: var(--radius); background: var(--portal-accent-soft); color: var(--portal-accent); font-size: 13px; font-weight: 600; text-align: center; }
body.is-sidebar-dragging #tiles iframe { pointer-events: none; }

/* Ask: questions answered in the conversation studio. There is no preview;
   answers carry their sources, and can become a report or a request for IT. */
#authoring.is-ask #preview-pane { display: none; }
/* Questions make long titles; the Back action stays on one line beside them. */
#authoring.is-ask #authoring-title { font-size: 21px; }
#authoring.is-ask #close-authoring { flex-shrink: 0; white-space: nowrap; }
#authoring.is-ask .report-heading-line #authoring-icon-picker > .report-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--portal-accent-soft); color: var(--portal-accent); }
#authoring.is-ask .report-heading-line #authoring-icon-picker > .report-icon svg { width: 20px; height: 20px; }
#authoring.is-ask #authoring-conversation .task-conversation-message.is-assistant { max-width: min(96%, 760px); }
.ask-intro { display: grid; gap: 8px; padding: 2px 2px 4px; }
.ask-intro h2 { margin: 0; font-size: 19px; }
.ask-intro p { max-width: 68ch; }
.ask-requests { margin: -4px 2px 0; font-size: 12px; overflow-wrap: anywhere; }
.ask-requests::before { content: "✓ "; color: #16a34a; font-weight: 700; }
#asks > .asks-more { margin: 2px 6px 6px; padding: 3px 8px; border: 0; background: transparent; color: var(--portal-accent); font-size: 12px; font-weight: 600; }
#asks > .asks-more:hover { background: var(--portal-accent-soft); }
#asks > .reports-empty-action { margin: 0 2px 8px; width: calc(100% - 4px); }

/* Answers: tables and the sources disclosure. */
#authoring.is-ask .task-conversation-message-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
#authoring.is-ask .task-conversation-message-body :is(th, td) { padding: 5px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
#authoring.is-ask .task-conversation-message-body th { background: var(--subtle); font-weight: 600; }
/* Charts (answer-charts.js): a framed figure once drawn; until then, or if it
   cannot be drawn, the chart source stays readable line by line. */
#authoring-conversation .task-conversation-message-body .mermaid { margin: 8px 0; }
#authoring-conversation .task-conversation-message-body .mermaid:not(.is-chart) { padding: 8px 10px; border-radius: 8px; background: var(--subtle); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
#authoring-conversation .task-conversation-message-body .mermaid.is-chart { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: center; }
/* Mermaid sizes each label in its own off-screen container, where text wraps
   only at spaces and label paragraphs have no margin. The answer's prose rules
   (overflow-wrap: anywhere, paragraph margins) would re-flow labels into boxes
   sized without them: Mermaid 12 puts single words in a 120px wrapping box, so a
   longer word broke mid-word and lost its end. */
#authoring-conversation .task-conversation-message-body .mermaid svg { width: min(100%, 520px); max-width: 100%; height: auto; overflow-wrap: normal; word-break: normal; }
/* A chart sizes its answer to the full message width, not to the answer's text. */
#authoring-conversation .task-conversation-message:has(.mermaid.is-chart) { width: 100%; }
/* Images in answers: a light figure ground, so a transparent image drawn for a
   white page stays readable in dark appearance; each opens at full size. */
#authoring-conversation .answer-image { display: block; width: fit-content; max-width: 100%; margin: 8px 0; }
#authoring-conversation .answer-image img { display: block; max-width: 100%; height: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
#authoring-conversation .answer-image:focus-visible { outline: 2px solid var(--portal-accent); outline-offset: 2px; border-radius: 8px; }
/* Percentages sit on slices of any color; a dark halo keeps them legible. */
#authoring-conversation .mermaid.is-chart .slice { paint-order: stroke; stroke: #0b0b0b8c; stroke-width: 3px; stroke-linejoin: round; }
.answer-sources { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.answer-sources > summary { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 2px 10px 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.5; cursor: pointer; list-style: none; }
.answer-sources > summary::-webkit-details-marker { display: none; }
.answer-sources > summary::before { content: "›"; display: inline-block; transition: transform 150ms ease; }
.answer-sources[open] > summary::before { transform: rotate(90deg); }
.answer-sources > summary:hover { color: var(--ink); border-color: var(--line-strong); }
#authoring-conversation .answer-sources > ol { display: grid; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.answer-sources li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.answer-source-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--portal-accent-soft); color: var(--portal-accent); }
.answer-source-icon svg { width: 14px; height: 14px; }
.answer-sources li > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; font-size: 12.5px; line-height: 1.45; }
.answer-sources strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.answer-source-kind { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
:is(.answer-source-detail, .answer-sources time) { flex-basis: 100%; color: var(--muted); overflow-wrap: anywhere; }
.answer-sources time { font-size: 11.5px; }

/* Home: one line to start a question. */
.home-ask { display: flex; align-items: center; gap: 10px; max-width: 980px; margin: 0 0 18px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.home-ask:focus-within { border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.home-ask-icon { display: inline-flex; flex: none; color: var(--portal-accent); }
.home-ask-icon svg { width: 18px; height: 18px; }
.home-ask input { flex: 1; min-width: 0; padding: 8px 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 15px; }
.home-ask button { flex: none; padding-inline: 20px; }
/* The Ask button stays quiet until there is a question to send. */
.home-ask input:placeholder-shown + .primary { background: var(--portal-accent-soft); border-color: transparent; color: var(--portal-accent); box-shadow: none; }
.home-ask input:placeholder-shown + .primary:hover { border-color: color-mix(in srgb, var(--portal-accent) 35%, transparent); }
@media (max-width: 680px) {
  /* As for reports, the compact strip keeps the New action without the heading. */
  #asks-heading { display: contents; }
  #asks-heading > .nav-section-toggle { display: none; }
  #new-ask { align-self: flex-start; width: auto; height: 30px; padding: 0 10px; margin-bottom: 6px; }
  #new-ask .nav-heading-action-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  #asks > .reports-empty-action { width: auto; }
  /* Show all stays on one line, so it does not stretch the question chips. */
  #asks > .asks-more { flex: none; white-space: nowrap; }
  .home-ask { margin-bottom: 14px; }
}

/* My Requests (requests.js, request-intake.js). Status tones follow the shared
   request-display.js vocabulary; no counts appear anywhere. */
#requests-list > p, .requests-nav-note { padding: 8px 10px 0; font-size: 12px; }
.requests-nav-retry { margin: 4px 10px 8px; padding: 3px 10px; border-radius: 999px; font-size: 12px; justify-self: start; }
.request-number-icon { width: 16px; color: var(--muted); font-weight: 650; font-size: 13px !important; }
/* Request rows have no pin or rename actions to make room for. */
#requests-list .report-nav-row:is(:hover, :focus-within) > .report-link { padding-right: 10px; }
.request-link.selected .request-number-icon { color: var(--portal-accent); }
.request-status { display: inline-flex; align-items: center; flex: none; padding: 1px 9px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.request-status[data-tone="neutral-accent"], .request-status[data-tone="accent"] { background: var(--portal-accent-soft); color: var(--portal-accent); }
.request-status[data-tone="warning"] { background: color-mix(in srgb, #d97706 14%, var(--surface)); color: color-mix(in srgb, #b45309 85%, var(--ink)); }
.request-status[data-tone="success"], .request-status[data-tone="done"] { background: color-mix(in srgb, var(--color-success-text) 12%, var(--surface)); color: var(--color-success-text); }
.request-status[data-tone="muted"] { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
#requests, #request { max-width: 1180px; margin-inline: auto; }
#requests .page-heading > button { flex: none; }
.requests-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.requests-show { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.requests-show legend { float: left; margin: 0 8px 0 6px; padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.requests-show label { position: relative; display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.requests-show input { position: absolute; opacity: 0; pointer-events: none; }
.requests-show label:has(input:checked) { background: var(--portal-accent-soft); color: var(--portal-accent); }
.requests-show label:has(input:focus-visible) { outline: 2px solid var(--portal-accent); outline-offset: 1px; }
.requests-search { flex: 1 1 260px; max-width: 420px; }
#requests-search { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
#requests-search:focus-visible, .request-field :is(input, textarea):focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
#requests-status:empty, #request-state:empty, .request-error:empty { display: none; }
#requests-status, #request-state { margin: 6px 0 12px; }
.requests-retry { margin-left: 4px; padding: 3px 12px; border-radius: 999px; font-size: 12px; }
.request-rows { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.request-rows:empty { display: none; }
.request-rows > li + li { border-top: 1px solid var(--line); }
.request-row { display: grid; gap: 4px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.request-row:hover { background: var(--subtle); }
.request-row:focus-visible { outline: 2px solid var(--portal-accent); outline-offset: -2px; }
.request-row-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.request-row-title { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.request-row.has-unread .request-row-title { font-weight: 700; }
.request-row-meta { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.request-new-update { display: inline-flex; align-items: center; gap: 6px; color: var(--portal-accent); font-weight: 650; }
.request-new-update .report-activity { margin: 0; }
.requests-empty { padding: 48px 24px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 70%, transparent); text-align: center; }
.requests-empty h2 { margin: 16px 0 6px; }
.requests-empty p { max-width: 460px; margin: auto; }
.requests-empty .primary { margin-top: 16px; }
.requests-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.request-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid color-mix(in srgb, #d97706 40%, var(--line)); border-radius: 10px; background: color-mix(in srgb, #d97706 8%, var(--surface)); color: var(--ink); font-size: 13px; }
.request-notice > span { flex: 1 1 260px; }
.request-frozen { flex-basis: 100%; max-height: 120px; margin: 0; padding: 6px 10px; overflow: auto; border-left: 3px solid var(--line-strong); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.request-error { color: var(--danger); font-size: 13px; }
.request-back { display: inline-block; margin-bottom: 12px; color: var(--portal-accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.request-back:hover { text-decoration: underline; }
.request-heading { align-items: start; }
#request-detail-title { overflow-wrap: anywhere; }
:is(#request-detail-title, #requests-title, #request-callout-title):focus { outline: none; }
.request-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; font-size: 13px; }
.request-danger-text { border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--danger) !important; font-weight: 600; }
.request-danger-text:hover { background: color-mix(in srgb, var(--danger) 8%, transparent) !important; }
.request-danger.primary { background: var(--danger); border-color: var(--danger); }
.request-danger.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); border-color: transparent; }
.request-jump { margin: 0 0 12px; padding: 4px 14px; border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--line)); border-radius: 999px; color: var(--portal-accent); font-size: 12px; }
.request-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "main side"; gap: 20px; align-items: start; }
.request-main { grid-area: main; display: grid; gap: 16px; min-width: 0; }
.request-side { grid-area: side; position: sticky; top: calc(var(--header-height) + 64px); display: grid; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.request-side > summary { margin-bottom: 8px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); list-style: none; cursor: default; }
.request-side > summary::-webkit-details-marker { display: none; }
.request-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13px; }
.request-facts dt { color: var(--muted); }
.request-facts dd { margin: 0; overflow-wrap: anywhere; }
.request-context-panel, .request-history { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
:is(.request-context-details, .request-history) > summary { color: var(--ink); font-weight: 600; cursor: pointer; }
.request-history ol { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.request-history li + li { margin-top: 4px; }
.request-history p { margin-top: 6px; font-size: 12px; }
.request-context-source { margin: 8px 0 4px; font-size: 12.5px; overflow-wrap: anywhere; }
.request-warning { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, #d97706 10%, var(--surface)); color: var(--ink); font-size: 12.5px; }
.request-warning::before { content: "⚠\00a0"; }
.request-context-text { max-height: 320px; margin-top: 8px; padding: 10px 12px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--ink); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-context-text:focus-visible { outline: 2px solid var(--portal-accent); outline-offset: 1px; }
.request-callout { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-inline-start: 4px solid var(--portal-accent); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.request-callout[data-tone="success"], .request-callout[data-tone="done"] { border-inline-start-color: var(--color-success-text); }
.request-callout[data-tone="warning"] { border-inline-start-color: #d97706; }
.request-callout[data-tone="muted"], .request-callout[data-tone="neutral"] { border-inline-start-color: var(--line-strong); }
.request-callout h2 { margin: 0; font-size: 16px; }
.request-callout-body { display: grid; gap: 10px; }
.request-callout-body:empty { display: none; }
.request-callout-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.request-attributed > strong, .request-labelled > strong { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.request-text { color: var(--ink); overflow-wrap: anywhere; }
.request-text > :first-child { margin-top: 0; }
.request-text > :last-child { margin-bottom: 0; }
.request-text :is(p, ul, ol, pre, blockquote) { margin: 6px 0; color: var(--ink); }
.request-recorded { color: var(--muted); font-size: 12.5px; font-style: italic; }
.request-conversation { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.request-conversation > h2 { margin: 0; font-size: 16px; }
.request-log { display: flex; flex-direction: column; gap: 12px; }
.request-log:empty { display: none; }
:is(#request-log, #request-original) .task-conversation-message { max-width: min(92%, 680px); }
:is(#request-log, #request-original) .task-conversation-message.is-user { align-self: flex-end; background: var(--portal-accent-soft); border-color: color-mix(in srgb, var(--portal-accent) 30%, var(--line)); }
:is(#request-log, #request-original) .task-conversation-message.is-assistant { background: var(--surface); border-inline-start: 3px solid color-mix(in srgb, var(--portal-accent) 55%, var(--line)); }
#request-original { display: flex; flex-direction: column; }
.request-author { margin-right: auto; color: var(--ink); font-size: 12px; font-weight: 600; }
.request-it-tag { padding: 0 6px; border-radius: 999px; background: var(--subtle); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.request-assisted-tag { padding: 0 6px; border-radius: 999px; border: 1px dotted var(--line); color: var(--muted); font-size: 10.5px; font-weight: 600; }
.request-reference-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.request-reference-kind { color: var(--muted); font-size: 12px; }
.request-event { display: grid; gap: 6px; padding: 2px 0 2px 12px; border-inline-start: 2px solid var(--line); font-size: 13px; }
.request-event-head { color: var(--muted); }
.request-event-created { display: block; padding-left: 0; border: 0; color: var(--muted); font-size: 12px; text-align: center; }
.request-separator { color: var(--portal-accent); font-weight: 600; }
.request-separator::before, .request-separator::after { border-top-color: color-mix(in srgb, var(--portal-accent) 45%, var(--line)); }
#request-reply-section { display: grid; gap: 8px; }
#request-reply-composer.task-conversation-composer { padding: 0; }
#request-reply-composer .follow-up-editor-container .markdown-editor { min-height: 72px; max-height: 280px; }
#request-reply-composer .task-conversation-actions { flex-wrap: wrap; justify-content: space-between; }
#request-reply-send { margin-left: auto; }
#request-dialog { width: min(640px, calc(100vw - 32px)); }
:is(#request-reopen-dialog, #request-withdraw-dialog) { width: min(520px, calc(100vw - 32px)); }
.request-field { display: grid; gap: 6px; margin-top: 14px; }
.request-field label { font-weight: 600; font-size: 13px; }
.request-field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.request-field :is(input, textarea) { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.request-field textarea { resize: vertical; min-height: 96px; }
.request-field :is(input, textarea)[readonly] { background: var(--subtle); color: var(--muted); }
.request-field :is(input, textarea)[aria-invalid="true"] { border-color: var(--danger); }
.field-hint, .request-count { color: var(--muted); font-size: 12px; }
.request-count.is-over, .request-field-error { color: var(--danger); font-size: 12px; font-weight: 600; }
.request-included { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.request-included h3 { margin: 0 0 6px; font-size: 13px; }
.request-included summary { margin-top: 6px; color: var(--portal-accent); font-size: 13px; font-weight: 600; cursor: pointer; }
#request-context-expiry, #request-context-status { margin-top: 6px; font-size: 12.5px; }
#request-context-status:empty, #request-context-expiry:empty { display: none; }
#request-duplicate { margin-top: 12px; font-size: 12.5px; }
#request-dialog .request-notice { margin: 14px 0 0; }
#request-dialog-error, :is(#request-reopen-error, #request-withdraw-error) { margin-top: 12px; }
@media (max-width: 680px) {
  /* The compact strip keeps New request first, then All requests and recent chips. */
  #requests-heading { display: contents; }
  #requests-heading > .nav-section-toggle { display: none; }
  /* Plan §3.7: New request is a 44 px touch target. */
  #new-request { align-self: flex-start; width: auto; height: auto; min-height: 44px; padding: 0 12px; margin-bottom: 6px; }
  #new-request .nav-heading-action-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .requests-nav-note { display: none; }
  /* Title (two lines), then the meta line led by New update, then the status. */
  .request-row-top { display: contents; }
  .request-row-meta { order: 2; }
  .request-row .request-status { order: 3; justify-self: start; }
  .request-row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .requests-controls { flex-direction: column; align-items: stretch; }
  .requests-search { max-width: none; }
  .request-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main"; }
  .request-side { position: static; padding: 12px 14px; }
  .request-side > summary { margin: 0; color: var(--ink); font-size: 13px; letter-spacing: 0; text-transform: none; cursor: pointer; list-style: revert; }
  .request-callout-actions > button, #request-reply-send, #requests-new, .requests-empty .primary, #requests-more { flex: 1 1 100%; min-height: 44px; }
  .request-conversation { padding: 14px; }
  :is(#request-dialog, #request-reopen-dialog, #request-withdraw-dialog) .dialog-actions { flex-wrap: wrap; }
  :is(#request-dialog, #request-reopen-dialog, #request-withdraw-dialog) .dialog-actions > button { flex: 1 1 auto; min-height: 44px; }
}

/* Request files share the conversation attachment list and wrap on narrow screens. */
.request-attachment-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.request-attachment-controls + .attached-files-list { margin: 8px 0; }
#request-reply-attachments-hint, #request-note-attachments-hint, #request-dialog-attachments-hint { display: block; font-size: 12px; margin: 6px 0; }
#request-description-field .follow-up-editor-container .markdown-editor { min-height: 120px; max-height: 320px; padding: 9px 12px; }
#request-description-field .follow-up-editor-container .markdown-editor-source-container { margin-right: 0; }
#request-description-field .follow-up-editor-container .markdown-editor[contenteditable="false"] { background: var(--subtle); color: var(--muted); }
#request-description-field .task-conversation-editor-wrapper:has([aria-invalid="true"]) { border-color: var(--danger); }
#request-description-field .request-attachment-controls { margin-top: 2px; }
#request-description-field .attached-files-list { margin: 0; }
#request-dialog-attachments-hint { margin: 0; color: var(--muted); }
.request-timeline .conversation-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.request-timeline .conversation-attachment { overflow-wrap: anywhere; }

/* Automations (automations.js): scheduled questions. Lists, pills and fields
   reuse the My Requests styles above. */
#automations, #automation { max-width: 1180px; margin-inline: auto; }
#automations .page-heading > button { flex: none; }
#automations-list > p { padding: 8px 10px 0; font-size: 12px; }
#automations-list .report-nav-row:is(:hover, :focus-within) > .report-link { padding-right: 10px; }
.automation-off { flex: none; margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 11.5px; font-style: normal; font-weight: 600; }
#automations-status:empty, #automation-history-status:empty { display: none; }
#automations-status { margin: 6px 0 12px; }
:is(#automations-title, #automation-title):focus { outline: none; }
#automation-title { overflow-wrap: anywhere; }
.automation-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 20px; align-items: start; }
.automation-form { display: grid; gap: 4px; padding: 4px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.automation-form select, .automation-form input[type="time"] { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.automation-form :is(select, input, textarea):focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.automation-form :is(select, input, textarea):disabled { background: var(--subtle); color: var(--muted); }
/* The shared select and Markdown editor, sized like the form's other fields.
   Dialog fields, such as the folder dialog's pickers, share the select sizing. */
:is(.automation-form, .request-field) .custom-select-trigger { min-height: 38px; padding: 6px 10px; color: var(--ink); font-size: 14px; font-weight: 400; }
:is(.automation-form, .request-field) .custom-select-trigger:focus-visible { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
:is(.automation-form, .request-field) .custom-select.disabled .custom-select-trigger { opacity: 1; background: var(--subtle); color: var(--muted); }
:is(.automation-form, .request-field) .custom-select-option { padding: 9px 12px; font-size: 14px; }
#automation-question-composer .follow-up-editor-container .markdown-editor { max-height: 320px; padding: 10px 12px; font-size: 14px; }
#automation-question-composer .markdown-editor-source-container { margin-right: 0; }
#automation-question-composer .markdown-editor p { color: inherit; }
#automation-question-composer:has(.markdown-editor[contenteditable="false"]) { background: var(--subtle); }
#automation-question-composer .markdown-editor[contenteditable="false"] { color: var(--muted); }
.automation-when { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 18px 0 4px; padding: 4px 16px 16px; border: 1px solid var(--line); border-radius: 10px; }
.automation-when legend { padding: 0 6px; font-size: 13px; font-weight: 650; }
.automation-when > #automation-days-field, .automation-when > .automation-hours { grid-column: 1 / -1; }
.automation-hours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.automation-hours > .field-hint { grid-column: 1 / -1; margin-top: 6px; }
.automation-hours[hidden], .automation-when > [hidden] { display: none; }
.automation-field-label { font-weight: 600; font-size: 13px; }
.automation-day-picker { display: flex; flex-direction: column; gap: 8px; }
.automation-day-shortcuts, .automation-day-options { display: flex; flex-wrap: wrap; gap: 6px; }
.automation-day-shortcuts button { padding: 3px 12px; border-radius: 999px; font-size: 12px; }
.automation-day-option { position: relative; cursor: pointer; }
.automation-day-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.automation-day-option span { display: inline-block; min-width: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: center; font-size: 13px; }
.automation-day-option input:checked + span { border-color: var(--portal-accent); background: var(--portal-accent-soft); color: var(--portal-accent); font-weight: 650; }
.automation-day-option input:focus-visible + span { outline: 2px solid var(--portal-accent); outline-offset: 2px; }
.automation-day-option input:disabled + span { opacity: .55; cursor: default; }
.automation-day-picker .form-hint { color: var(--muted); font-size: 12px; }
.automation-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; font-weight: 600; }
.automation-check input { width: 16px; height: 16px; accent-color: var(--portal-accent); }
#automation-error { margin-top: 12px; }
.automation-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.automation-history { position: sticky; top: calc(var(--header-height) + 64px); }
.automation-runs { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.automation-run, .automation-run-empty { display: grid; gap: 6px; padding: 10px 0; }
.automation-run + .automation-run { border-top: 1px solid var(--line); }
.automation-run-empty { color: var(--muted); font-size: 13px; }
.automation-run-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.automation-run-when { color: var(--ink); font-size: 13px; }
.automation-run-error { margin: 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.automation-run-open { justify-self: start; padding: 4px 14px; border-radius: 999px; font-size: 12.5px; }
#automation-delete-dialog { width: min(520px, calc(100vw - 32px)); }
#automation-delete-dialog .field-hint { display: block; margin: 6px 0 0 24px; }
@media (max-width: 900px) {
  .automation-layout { grid-template-columns: minmax(0, 1fr); }
  .automation-history { position: static; }
}
@media (max-width: 680px) {
  /* As for Ask, the compact strip keeps the New action without the heading. */
  #automations-heading { display: contents; }
  #automations-heading > .nav-section-toggle { display: none; }
  #new-automation { align-self: flex-start; width: auto; height: 30px; padding: 0 10px; margin-bottom: 6px; }
  #new-automation .nav-heading-action-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .automation-when, .automation-hours { grid-template-columns: minmax(0, 1fr); }
  .automation-form { padding: 4px 14px 16px; }
  .automation-form-actions > button, #automations-new, #automation-run { flex: 1 1 auto; min-height: 44px; }
}
#ask-scheduled::before { content: none; }

/* Ask CoderFlow's spotlight (shared/ask-coderflow-highlight.css, loaded with
   ask-point.js on arrival from an Ask link) in the Portal's palette, light and
   dark. The ring keeps 3:1 against the dimmed page and the control (light
   #1f44b0: 3.3:1 and 8.4:1; dark #6d8ff2: 5.7:1 and 5.1:1); the tip's ink on
   surface is 14.1:1 light and 13.1:1 dark (WCAG AA). */
.ask-cf-spotlight {
  --color-accent: #1f44b0;
  --color-accent-rgb: 31, 68, 176;
  --color-surface: var(--surface);
  --color-text: var(--ink);
  --color-border: var(--line);
  --radius-medium: 10px;
  --shadow-card: var(--shadow);
}
:root[data-theme="dark"] .ask-cf-spotlight { --color-accent: #6d8ff2; --color-accent-rgb: 109, 143, 242; }
