/* The pages that are not the chat: the Vorgang list, the settings and the login.
 *
 * Login keeps the classic centred card. It has no navigation to put in a rail,
 * and it is the surface that most resembles the forms catalogue — which is
 * where the family resemblance between the two services now lives.
 */

/* The column as the conversation lays it out: a header across its whole
 * width, and below it the content held to the measure and centred once the
 * column outgrows it. */
.pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  width: 100%;
}

/* The conversation's header, on every page of the column: the same height,
 * the same gutter, the same rule under it, so changing pages does not move
 * the line the eye runs along. */
.pane-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--head-h);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}

.pane-lead { margin: .3rem 0 0; color: var(--gray); font-size: .9rem; }

/* The inset is chat.css's: the percentage resolves against this box, which
 * spans the column. */
.pane-scroll {
  container-type: inline-size;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem max(var(--gutter), (100% - var(--measure-max)) / 2) 2rem;
  scroll-padding-block: 1rem;
}

.pane-section {
  margin: 1.6rem 0 .7rem;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray);
}

.newtask {
  container-type: inline-size;
  padding: 1rem;
  background: var(--paper-2);
  border-top: 4px solid var(--blue);
}

.field-action { margin-bottom: 0; }

/* The Aufgabenarten, as square tiles, three to a row, filling the form. The radio in
 * each stays in the page for the keyboard and screen readers; only its dot is
 * hidden, and the tile itself shows the choice. */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.tiles legend {
  margin-bottom: .35rem;
  padding: 0;
  font-size: .85rem;
  color: var(--gray);
}

.tile {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 0;
  padding: .8rem;
  overflow: hidden;
  text-align: center;
  color: var(--anthracite);
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
}

/* Hover in light blue, the choice in dark blue with the tile inverted. The
 * border is 2px in both, with the padding taking the difference, so neither
 * moves the tile's contents. */
.tile:hover {
  border: 2px solid var(--light);
  padding: calc(.8rem - 1px);
}

.tile:hover .tile-icon { color: var(--light); }

.tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tile-icon { width: 2.4em; height: 2.4em; color: var(--gray); }
.tile-label { font-weight: bold; font-size: 1rem; line-height: 1.25; }

.tile-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  font-size: .78rem;
  line-height: 1.35;
  color: var(--gray);
}

.tile:has(input:checked) {
  color: var(--paper);
  background: var(--blue);
  border: 2px solid var(--blue);
  padding: calc(.8rem - 1px);
}

.tile:has(input:checked) .tile-icon,
.tile:has(input:checked) .tile-text { color: var(--paper); }

.tile:has(input:focus-visible) {
  outline: 4px solid var(--light);
  outline-offset: 2px;
}

@container (max-width: 34rem) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Every Vorgang, a page at a time, under the same day headings as the rail. */
.vorgaenge-day {
  margin: .9rem 0 0;
  padding: .45rem 0 .2rem;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  font-weight: normal;
  color: var(--gray);
}

.vorgaenge-list { list-style: none; margin: 0; padding: 0; }

.vorgaenge-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title meta"
    ".    path  path";
  align-items: center;
  column-gap: .6rem;
  padding: .45rem .5rem;
}

.vorgaenge-row:hover { background: var(--tint-input); }
.vorgaenge-row > .icon { grid-area: icon; color: var(--gray); }
.vorgaenge-title { grid-area: title; text-decoration: none; }
.vorgaenge-title:hover { text-decoration: underline; }

.vorgaenge-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--gray);
  white-space: nowrap;
}

.vorgaenge-path {
  grid-area: path;
  font-family: ui-monospace, monospace;
  font-size: .75rem;
  color: var(--gray);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}

.pager-where { color: var(--gray); }

/* -- settings ------------------------------------------------------------- */

/* Three sections, each under the quiet uppercase heading the start page uses:
 * the account, its password, and how the interface behaves. */
.settings-section + .settings-section { margin-top: 2.2rem; }
.settings-section > .pane-section { margin-top: 0; }

/* The account as three facts side by side, small label over value. */
.account {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem 1.5rem;
  margin: 0;
}

.account dt { font-size: .8rem; color: var(--gray); }
.account dd { margin: .1rem 0 0; overflow-wrap: anywhere; }

/* The three password fields in one row, as wide as the content, so the form
 * does not leave most of the column empty; stacked when it is narrow. */
.password-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem 1.2rem;
}

.password-fields .field { margin-bottom: 0; }

.settings-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1.5rem;
  margin-top: 1rem;
}

.settings-foot .hint { margin: 0; font-size: .85rem; }
/* Right, where the eye ends a form, also when the hint takes the whole line. */
.settings-foot button { margin-left: auto; }

/* One setting per row: its name and what it is for on the left, the choices
 * on the right, a hairline between rows. A named group rather than a fieldset,
 * because a legend will not take part in a grid. */
.setting {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: .6rem 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

/* The rule under the last row, drawn by the footer that follows it. */
.setting + .settings-foot { margin-top: 0; padding-top: 1rem; border-top: 1px solid var(--line); }

.setting-name { margin: 0 0 .25rem; font-size: .98rem; }
.setting-about p { margin: 0; font-size: .85rem; line-height: 1.45; color: var(--gray); }

.setting-options {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* A radio button or a tick box with its label beside it, and what the choice
 * does under the label. The control is the browser's own, in the blue of every
 * other control here, and a little larger than its default so the pointer
 * finds it. The whole line is the label, so the text is a target too. */
.option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: .6rem;
  align-items: start;
  margin: 0;
  font-size: .95rem;
  color: var(--anthracite);
  cursor: pointer;
}

.option input {
  width: 1.05rem;
  height: 1.05rem;
  margin: .22rem 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.option input:focus-visible { outline-offset: 1px; }
.option-label { display: block; }
.option-hint { display: block; font-size: .82rem; line-height: 1.4; color: var(--gray); }

.settings-ok {
  margin: 0 0 1rem;
  padding: .55rem .8rem;
  background: var(--tint-document);
  border-left: 4px solid var(--green);
}

.settings-section .error { margin: 0 0 1rem; }

@container (max-width: 40rem) {
  .account,
  .password-fields,
  .setting { grid-template-columns: minmax(0, 1fr); }
}

/* -- login --------------------------------------------------------------- */

body.page-plain { background: var(--desk); }

.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 26rem;
  padding: 2rem;
  background: var(--paper);
  border-top: 6px solid var(--blue);
}

.login-logo { width: 190px; height: auto; display: block; margin-bottom: 1.4rem; }
.login-lead { margin: .3rem 0 1.2rem; color: var(--gray); font-size: .9rem; }
.login-card button { width: 100%; justify-content: center; }
.login-card .error { margin-bottom: .8rem; }

/* -- the search page -------------------------------------------------------- */

/* The form as one card: the field across the top, the choices under it. */
.search-card {
  margin-bottom: 1.4rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--paper-2);
  border-top: 4px solid var(--blue);
}

.search-field {
  display: flex;
  align-items: stretch;
  position: relative;
}

.search-field > .icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

.search-field input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: .7rem .8rem .7rem 2.5rem;
  font-size: 1.05rem;
}

.search-field button { flex: none; padding-inline: 1.3rem; }

.search-filters {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .7rem 1rem;
  align-items: start;
  margin-top: 1rem;
}

/* Each filter is a row: its name on the left, its choices on the right. */
.search-filter { display: contents; }

.search-filter-name {
  padding-top: .4rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray);
}

.search-filter > .search-hint { grid-column: 2; margin-top: -.35rem; }

/* The modes, and beside them every word for Stichwort. */
.search-mode-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; }
.search-all-words.is-off { visibility: hidden; }
/* Two lines kept for what the chosen mode does, so a longer one in a narrow
 * column does not push the form down. */
#search-mode-about { min-height: 3.1em; }

/* The mode: three parts of one control, the chosen one filled. */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  justify-self: start;
}

.segment {
  margin: 0;
  font-size: .9rem;
  color: var(--anthracite);
  cursor: pointer;
}

.segment span { display: block; padding: .35rem .9rem; }
.segment + .segment span { border-left: 1px solid var(--line-strong); }
.segment:hover span { background: var(--tint-input); }
.segment:has(input:checked) span { color: var(--paper); background: var(--blue); font-weight: bold; }
.segment:has(input:focus-visible) span { outline: 3px solid var(--light); outline-offset: -3px; }

/* The areas, and every word for Stichwort: plain checkboxes with their labels. */
.search-checks { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; padding-top: .35rem; }

.search-check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .9rem;
  color: var(--anthracite);
  cursor: pointer;
}

.search-check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--blue); }

.search-hint { margin: .3rem 0 0; font-size: .8rem; color: var(--gray); }
.search-status { margin: 0 0 .6rem; font-size: .9rem; color: var(--gray); }

/* -- the hits --------------------------------------------------------------- */

/* The sources as tabs over one list, the open one underlined in blue. */
.search-tabs {
  display: flex;
  overflow-x: auto;
  margin-bottom: .8rem;
  border-bottom: 1px solid var(--line);
}

.search-tab {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex: none;
  padding: .5rem .9rem .4rem;
  font-size: .9rem;
  font-weight: normal;
  color: var(--anthracite);
  background: none;
  border-bottom: 3px solid transparent;
}

.search-tab:hover { background: var(--tint-input); }
.search-tab[aria-selected="true"] { color: var(--blue); font-weight: bold; border-bottom-color: var(--blue); }

.search-count {
  padding: 0 .4rem;
  font-size: .75rem;
  font-weight: normal;
  color: var(--anthracite);
  background: var(--soft);
}

.search-hits { margin: 0; padding: 0; list-style: none; }

/* A card per hit: its kind's colour on the left edge and in the icon, as in
 * the file column; what it is in the middle; what to do with it on the right. */
.search-hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .2rem .8rem;
  align-items: start;
  margin-bottom: .5rem;
  padding: .7rem .8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--file-text);
}

/* The kind's colour, restated: the card's own border rule comes later than
 * the file column's and would otherwise win. */
.search-hit.file-tone-pdf { border-left-color: var(--file-pdf); }
.search-hit.file-tone-document { border-left-color: var(--file-document); }
.search-hit.file-tone-spreadsheet { border-left-color: var(--file-spreadsheet); }
.search-hit.file-tone-presentation { border-left-color: var(--file-presentation); }
.search-hit.file-tone-archive { border-left-color: var(--file-archive); }
.search-hit.file-tone-mail { border-left-color: var(--file-mail); }
.search-hit.file-tone-image { border-left-color: var(--file-image); }

.search-hit:hover {
  border-top-color: var(--line-strong);
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
}
.search-hit-open { background: var(--tint-input); }

.search-hit-icon { width: 1.5rem; height: 1.5rem; margin-top: .1rem; }

.search-hit-title { margin: 0; font-weight: bold; overflow-wrap: anywhere; }

.search-hit-meta,
.search-hit-path {
  margin: .1rem 0 0;
  font-size: .8rem;
  color: var(--gray);
  overflow-wrap: anywhere;
}

.search-hit-path { font-family: ui-monospace, monospace; font-size: .76rem; }

.search-hit-snippet {
  margin: .45rem 0 0;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--anthracite);
}

.search-hit-snippet mark {
  padding: 0 .1rem;
  color: inherit;
  background: var(--tint-mark);
}

.search-hit-actions { display: flex; flex-direction: column; gap: .35rem; }
/* The kind's colour is for the file's own icon; a button's icon is the colour
 * of its words, as on every other button. */
.search-hit-actions .icon { color: currentColor; }
.search-hit-actions button { justify-content: flex-start; padding: .3rem .7rem; font-size: .82rem; }

/* -- the research page ------------------------------------------------------ */

#research-question { width: 100%; margin: 0; resize: vertical; font-size: 1rem; }
.research-submit { display: flex; justify-content: flex-end; margin-top: .9rem; }

/* An answer: one quiet frame, the answer's box the only colour in it. Inside
 * an entry of the list the frame goes; the entry is frame enough. */
.research-result {
  margin-bottom: 1.4rem;
  padding: 1rem 1.2rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
}

.research-run-panel .research-result {
  margin: 0;
  padding: .3rem 0 .9rem;
  border: none;
  background: none;
}

/* While it runs: the chat's running light along the frame's foot. */
.research-result.is-working { position: relative; border-bottom-color: transparent; }

.research-result.is-working::before,
.research-result.is-working::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  pointer-events: none;
}

.research-result.is-working::before { background: var(--soft); }

.research-result.is-working::after {
  background: var(--spectrum);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 35%, black 65%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 35%, black 65%, transparent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: lauflicht 2.4s infinite;   /* chat.css */
}

@media (prefers-reduced-motion: reduce) {
  .research-result.is-working::after {
    animation: none;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

.research-activity { margin: .5rem 0 0; font-size: 1rem; }
.research-clock { font-variant-numeric: tabular-nums; color: var(--gray); }
.research-spent { margin: .8rem 0 0; font-size: .78rem; color: var(--gray); font-variant-numeric: tabular-nums; }

.research-question { margin: 0; font-weight: bold; font-style: italic; white-space: pre-wrap; }

/* What came of it, as glyph and word: green for an answer, red for not
 * found, grey for a run that failed or was stopped, blue while it runs. */
.research-kind,
.research-run-state {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
}

.research-kind {
  margin-top: .6rem;
  font-size: .72rem;
  font-weight: bold;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.research-mark-icon { width: 1.1em; height: 1.1em; flex: none; }
.research-kind .research-mark-icon { width: 1.35em; height: 1.35em; }
.research-tone-answered { color: var(--green); }
.research-tone-missing { color: var(--red); }
.research-tone-none { color: var(--gray); }
.research-tone-working { color: var(--blue); }

/* The answer itself, set apart on a tint: what a reader in a hurry, or a
 * program, takes away. What explains it follows in ordinary text. */
.research-answer-block {
  margin-top: .8rem;
  padding: .6rem .9rem .75rem;
  background: var(--tint-document);
}

.research-answer-block.research-tone-missing { background: var(--tint-error); }
.research-answer-block .research-kind { margin-top: 0; }
.research-text { margin: .25rem 0 0; font-size: 1.2rem; font-weight: bold; line-height: 1.4; color: var(--anthracite); white-space: pre-wrap; }
/* A found file in the answer's box: icon, kind and place, buttons beside. */
.research-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .2rem .7rem;
  align-items: center;
  margin-top: .6rem;
  padding-top: .6rem;
  border-top: 1px solid rgba(0, 0, 0, .08);
}

.research-file-icon { width: 2rem; height: 2rem; }
.research-file-kind { margin: 0; font-size: .82rem; font-weight: bold; color: var(--anthracite); }
.research-file .search-hit-actions { flex-direction: row; }
.research-file .search-hit-actions .icon { color: currentColor; }
.research-result .research-file.search-hit-open { background: none; }

.research-explanation { margin: .8rem 0 0; line-height: 1.55; white-space: pre-wrap; }
.research-detail { margin: .4rem 0 0; color: var(--anthracite); }
.research-again { margin-top: .8rem; }

.research-sources {
  margin: 1.2rem 0 0;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray);
}

/* The sources as a plain list, not cards: space between them and no lines,
 * the file's kind in its icon only, the buttons small. */
.research-result .search-hits { margin-top: .3rem; }

.research-result .search-hit {
  margin: 0 0 .9rem;
  padding: .3rem 0;
  background: none;
  border: none;
}

.research-result .search-hit:last-child { margin-bottom: 0; }
.research-result .search-hit-open { background: var(--tint-input); }
.research-result .search-hit-icon { width: 1.25rem; height: 1.25rem; }
.research-result .search-hit-actions { flex-direction: row; }

/* A source's quotation is evidence, not part of the answer: small and quiet. */
.search-hit-quote {
  margin: .35rem 0 0;
  padding-left: .6rem;
  border-left: 2px solid var(--line);
  font-size: .8rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--gray);
}

/* The questions asked before: a line each, opening in place. */
.research-runs { margin: .4rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.research-run { border-bottom: 1px solid var(--line); }

.research-run-row { display: flex; align-items: center; }
.research-run-row > .research-run-open { flex: 1; min-width: 0; }

/* The bin: quiet until pointed at. */
.research-run-delete {
  flex: none;
  padding: .35rem .5rem;
  color: var(--gray);
  background: none;
}

.research-run-delete:hover:not(:disabled) { color: var(--red); background: var(--tint-error); }
.research-run-delete:disabled { color: var(--line); background: none; }

.research-list-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-top: .8rem;
}

.research-pager { display: flex; align-items: center; gap: .6rem; }
.research-pager:empty { display: none; }
.research-page-at { font-size: .82rem; color: var(--gray); }
.research-list-foot .secondary { padding: .3rem .7rem; font-size: .82rem; }
#research-clear { margin-left: auto; }
.research-none { padding: .5rem .6rem; }

/* The status gets a column of its own width, so its glyphs line up on the
 * left, one under the other, whatever the word beside them. */
.research-run-open {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 8.5rem auto;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .5rem .6rem;
  font-size: .88rem;
  font-weight: normal;
  text-align: left;
  color: var(--anthracite);
  background: none;
}

.research-run-open:hover { background: var(--paper-2); }
.research-run-open[aria-expanded="true"] .research-run-question { font-weight: bold; }
/* Closed it points right, open down. */
.research-run-chevron { width: 1.35rem; height: 1.35rem; color: var(--blue); transform: rotate(-90deg); transition: transform .15s; }
.research-run-open[aria-expanded="true"] .research-run-chevron { transform: none; }
.research-run-panel { padding: 0 .6rem 0 2.55rem; }
@media (prefers-reduced-motion: reduce) { .research-run-chevron { transition: none; } }

.research-run-question { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.research-run-state,
.research-run-date { font-size: .78rem; }
.research-run-state { justify-self: start; }
.research-run-date { color: var(--gray); white-space: nowrap; }

/* Narrow: the actions go under the text. */
@container (max-width: 34rem) {
  .search-hit { grid-template-columns: auto minmax(0, 1fr); }
  .search-hit-actions { grid-column: 2; flex-direction: row; }
  .search-filters { grid-template-columns: minmax(0, 1fr); }
  .search-filter > .search-hint { grid-column: 1; margin-top: 0; }
  .research-run-open { grid-template-columns: auto minmax(0, 1fr) 8.5rem; }
  .research-run-panel { padding-left: 0; }
  .research-file { grid-template-columns: auto minmax(0, 1fr); }
  .research-file .search-hit-actions { grid-column: 2; }
  .research-run-date { display: none; }
}
