:root {
  color-scheme: light dark;

  --bg: #F3F3F3;
  --surface: #FFFFFF;
  --surface-sunken: #F7F7F8;
  --border: #DEE1E6;
  --text: #1C2024;
  --muted: #5A6472;
  --accent: #FFCA35;
  --accent-hover: #F5BC1C;
  --accent-ink: #1C2024;
  --accent-soft: #FFF4D1;
  --danger: #B42318;
  --danger-soft: #FEF3F2;
  --danger-line: #D92D20;
  --warning: #B54708;
  --warning-soft: #FFF4E0;
  --warning-line: #F79009;
  --success: #1B7F4B;
  --success-soft: #ECFDF3;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  --topbar-height: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171A;
    --surface: #1E2126;
    --surface-sunken: #24282E;
    --border: #363C44;
    --text: #ECEEF1;
    --muted: #A3ACB8;
    --accent-hover: #FFD45C;
    --accent-soft: #3A3115;
    --danger: #FDA29B;
    --danger-soft: #3A1714;
    --warning: #FEC84B;
    --warning-soft: #36260B;
    --success: #6CD6A0;
    --success-soft: #11301F;
    --shadow: none;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Something scrolled into view must not end up under the top bar. */
html {
  scroll-padding-top: var(--topbar-height);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

h1, h2, h3, p, ul, fieldset {
  margin: 0;
  padding: 0;
}

h2 {
  font-size: 17px;
  font-weight: 600;
}

h3 {
  font-size: 15px;
  font-weight: 600;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Top bar: it stays at the top while the page scrolls, so the other pages are always a click away.
   The page buttons sit in the middle whatever the width of the two sides. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: var(--topbar-height);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--accent);
}

.brand-sub {
  font-weight: 400;
  color: var(--muted);
}

/* The page being shown is the yellow one; the others are neutral. */
.page-nav {
  display: flex;
  gap: 8px;
}

.topbar-actions {
  display: flex;
  justify-self: end;
  gap: 8px;
}

.banner {
  max-width: 1240px;
  margin: 16px auto 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

/* Layout. The tickets are 880px wide at most, and the New ticket panel shows beside them only
   when they can have all of it: see "No room for the New ticket panel" below. */

.layout {
  container-type: inline-size;
  display: grid;
  /* The panel's column gives way too, so the list across both never overflows the page. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  align-items: start;
  gap: 20px;
  max-width: 1288px;
  margin: 0 auto;
  padding: 20px 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-composer {
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  padding: 16px;
}

/* New ticket when the side panel is out of sight: a yellow button floating at the top in the
   middle, which opens the full editor. Without room for the panel, see below. */
.new-ticket-float {
  display: none;
  z-index: 9;
  box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
}

.composer-out-of-sight .new-ticket-float {
  display: block;
  position: fixed;
  top: calc(var(--topbar-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
}

/* Ticket list */

.tickets-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.count {
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 600;
}

.count:empty {
  display: none;
}

/* The filters have a row of their own under the title, so nothing moves as the count or the
   buttons change; Archive goes to its end. */
.controls {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  gap: 12px;
}

.field-inline {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* The filters of the list: a button each, which says what is chosen and opens the choices
   (app.js). A filter in use is yellow. */
.filter-button {
  position: relative;
  width: 100%;
  min-width: 130px;
  max-width: 240px;
  padding: 7px 30px 7px 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-button:hover {
  background: var(--surface-sunken);
}

.filter-button::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-70%) rotate(45deg);
}

.filter-button.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

/* The choices, under the button. Hidden until placed: the place needs the size, known once open. */
.filter-popover {
  position: fixed;
  inset: auto;
  width: min(280px, calc(100vw - 16px));
  max-height: min(440px, calc(100vh - 16px));
  margin: 0;
  padding: 10px 10px 10px 12px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 24 40 / 18%);
  color: var(--text);
  font-size: 14px;
}

.filter-popover:not(.is-placed) {
  visibility: hidden;
}

.filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.filter-title {
  font-weight: 600;
}

.filter-head .link-button:disabled {
  cursor: default;
  opacity: 0.5;
  text-decoration: none;
}

.filter-hint {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.filter-options {
  display: grid;
  gap: 2px;
}

/* Opened: From and To, a date field each, its calendar a click away. */
.filter-dates {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.filter-date {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.filter-date input {
  width: 100%;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 2px 8px;
  border-radius: 6px;
}

.filter-option-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-option.is-included {
  background: var(--accent-soft);
  font-weight: 600;
}

/* The urgency's name is in a badge of its own, which a line drawn on the row would not cross. */
.filter-option.is-excluded :is(.filter-option-name, .urgency-name) {
  color: var(--muted);
  text-decoration: line-through;
}

.filter-option.is-excluded .dot {
  opacity: 0.5;
}

.filter-choice {
  flex: none;
  width: 30px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
}

.filter-choice:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.filter-include[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.filter-exclude[aria-pressed="true"] {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* The Archive button, level with the filters and as tall, at the end of their row. */
.controls .archive-open {
  align-self: flex-end;
  margin-left: auto;
  padding: 7px 14px;
  font-size: 14px;
}

/* Every column grows and shrinks with the list: app.js gives each its share of the width. */
.ticket-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* The list makes room as it gets narrower, one step at a time (app.js, widths in the settings). */
.ticket-table.is-date-only .cell-time,
.ticket-table.is-without-category :is(th[data-sort="category"], .cell-category),
.ticket-table.is-without-status :is(th[data-sort="status"], .cell-status) {
  display: none;
}

.ticket-table th {
  padding: 0;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.sort-button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.sort-button:focus-visible {
  outline-offset: -2px;
}

.sort-button:hover,
th[aria-sort] .sort-button {
  color: var(--text);
}

/* Fixed width, so the column does not shift when the arrow changes. */
.sort-button::after {
  content: "↕" / "";
  display: inline-block;
  width: 1em;
  margin-left: 4px;
  opacity: 0.5;
  text-align: center;
}

th[aria-sort="ascending"] .sort-button::after {
  content: "▲" / "";
  opacity: 1;
}

th[aria-sort="descending"] .sort-button::after {
  content: "▼" / "";
  opacity: 1;
}

.ticket-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ticket-table tbody tr:last-child td {
  border-bottom: 0;
}

/* A strip of the urgency colour makes the list scannable before reading it. */
.ticket-table tbody td:first-child {
  box-shadow: inset 3px 0 0 var(--urgency);
}

.ticket-table tbody tr.is-new td {
  animation: new-ticket 2.5s ease-out;
}

@keyframes new-ticket {
  from {
    background: var(--accent-soft);
  }
}

.cell-number,
.cell-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cell-title {
  overflow-wrap: anywhere;
}

/* On the board the title stands out from the card; in the list it is just one more column. */
.card .ticket-title {
  font-weight: 600;
}

/* A ticket opens in place when clicked (see the quick view below), and its title opens the full view. */

.ticket-table tbody tr {
  cursor: pointer;
}

.ticket-toggle {
  cursor: pointer;
}

.ticket-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ticket-table tbody :is(tr.is-open, tr.quick-row) td {
  background: var(--surface-sunken);
}

/* The ticket and its quick view, in the row under it, read as one. */
.ticket-table tbody tr.is-open td {
  border-bottom: 0;
}

.ticket-table tbody tr.quick-row {
  cursor: auto;
}

/* The urgency's strip turns the corner under the quick view: the open ticket ends with a line of
   its colour. */
.ticket-table tbody tr.quick-row td {
  padding-top: 0;
  box-shadow: inset 3px 0 0 var(--urgency), inset 0 -3px 0 var(--urgency);
}

.ticket-table tbody tr.is-completed :is(.cell-status, .ticket-title) {
  color: var(--muted);
}

/* Its width comes from the row: a long comment line must not widen the table. */
.quick-view {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  contain: inline-size;
}

/* Paragraphs of the description stay on lines of their own, and only two lines show. */
.quick-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 14px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* The comments on the left; View ticket at the bottom right, on their last line. */
.quick-footer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 6px;
}

/* A light line sets the comments apart from the description. */
.quick-footer.has-comments {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.quick-comments {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.quick-comments-all {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.quick-comments-all:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quick-comment-list {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.quick-comment {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.quick-comment-date {
  margin-right: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.quick-note {
  color: var(--muted);
}

.quick-note.is-error {
  color: var(--danger);
}

.ticket-description {
  margin-top: 4px;
  font-weight: 400;
}

.attachment-count,
.comment-count,
.link-mark {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.ticket-attachments {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.ticket-attachments a {
  color: inherit;
  overflow-wrap: anywhere;
}

.attachment-size {
  flex: none;
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

/* A stored description. Spaces are kept as typed: see descriptionHtml in app.js. */

.rich-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A blank line in the editor is stored as an empty paragraph, which would otherwise collapse. */
.rich-text p:empty {
  min-height: 1.45em;
}

.rich-text :is(ul, ol) {
  margin: 0;
  padding-left: 1.5em;
  list-style: revert;
}

.rich-text blockquote {
  margin: 4px 0;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.rich-text pre {
  margin: 4px 0;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: 6px;
  font: 13px/1.45 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

.rich-text a {
  color: inherit;
}

.rich-text img {
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}

.rich-text .ql-indent-1 { padding-left: 2em; }
.rich-text .ql-indent-2 { padding-left: 4em; }
.rich-text .ql-indent-3 { padding-left: 6em; }
.rich-text .ql-indent-4 { padding-left: 8em; }
.rich-text .ql-indent-5 { padding-left: 10em; }
.rich-text .ql-indent-6 { padding-left: 12em; }
.rich-text .ql-indent-7 { padding-left: 14em; }
.rich-text .ql-indent-8 { padding-left: 16em; }

/* Links between tickets. A mention, #12, in a description (also while it is written) and, when the
   ticket exists, in a comment: it opens the ticket's card. */

.ticket-mention {
  padding: 0 3px;
  background: var(--accent-soft);
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.ticket-mention.is-live {
  cursor: pointer;
}

.ticket-mention.is-live:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ticket-mention.is-archived {
  background: var(--surface-sunken);
  color: var(--muted);
}

.ticket-mention.is-deleted {
  background: none;
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

/* A ticket at a glance, next to its mention or its link: above everything, dialogs included. */
.ticket-card {
  position: fixed;
  inset: auto;
  width: min(360px, calc(100vw - 16px));
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 24 40 / 18%);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  white-space: normal;
}

.ticket-card-head {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.ticket-card-number {
  margin-right: 6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ticket-card-title {
  font-weight: 600;
}

.ticket-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ticket-card-status.is-archived {
  font-weight: 600;
}

.ticket-card-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 8px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.ticket-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* The tickets to choose from, under the # just typed or the Requires box. */
.ticket-listbox {
  position: fixed;
  inset: auto;
  width: min(420px, calc(100vw - 16px));
  max-height: 290px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 24 40 / 18%);
  color: var(--text);
  list-style: none;
}

.ticket-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

.ticket-option:hover {
  background: var(--surface-sunken);
}

.ticket-option[aria-selected="true"] {
  background: var(--accent-soft);
}

.ticket-option[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
}

.ticket-option-number {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ticket-option-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-option-note {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

/* Requires, in the ticket form. */
.prerequisite-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.prerequisite-list:empty {
  display: none;
}

.prerequisite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding-left: 10px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 400;
}

.prerequisite-number {
  flex: none;
  font-weight: 600;
}

.prerequisite-title {
  min-width: 0;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prerequisite.is-deleted .prerequisite-title {
  color: var(--muted);
  font-style: italic;
}

.prerequisite .icon-button {
  width: 26px;
  height: 26px;
  border-radius: 999px;
}

/* In the side panel, and on the board, Requires is a line that shows only what Expand has set. */
.composer .prerequisites:not(.has-items),
.composer :is(.prerequisite-search, .prerequisite-title, .prerequisites .optional) {
  display: none;
}

.composer .prerequisites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.composer .prerequisite-list {
  margin: 0;
}

/* Links, in the full view: what the ticket requires, what requires it, what it mentions and what
   mentions it. Each one opens its card. */
.view-links {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
}

.view-links dt {
  padding-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.view-links dd {
  margin: 0;
}

.link-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 2px 6px;
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.link-entry:hover {
  background: var(--surface-sunken);
}

.link-entry:hover .link-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-number {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.link-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.link-status {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.link-entry.is-finished :is(.link-number, .link-title) {
  color: var(--muted);
}

@media (max-width: 640px) {
  .view-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .view-links dd {
    margin-bottom: 6px;
  }
}

.urgency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.empty {
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}

/* Board: it fills the window, so a column takes a drop along its whole height. */

.board-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.board-page .banner {
  align-self: stretch;
  margin-inline: 24px;
}

/* The guide on the left, the order of the cards on the right, on one line while there is room. */
.board-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 12px 24px 0;
}

.board-guide {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.board-order {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.board-order select {
  width: auto;
  padding: 4px 8px;
  color: var(--text);
  font-size: 14px;
}

/* The order and the Archive button share the right of the line. */
.board-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.board-tools .archive-open,
.board-tools .git-refresh {
  padding: 4px 12px;
  font-size: 14px;
}

/* What Refresh git found, under the bar, until the next one. */
.board-git-message {
  margin: 8px 24px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.board-git-message.is-error {
  color: var(--danger);
}

/* Columns share the width, none narrower than 230px: past that the board scrolls sideways. */
.board {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 12px 24px 20px;
  overflow-x: auto;
}

.board-column {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 230px;
}

/* At its soft limit, or full at its hard limit (Settings, Board): the column takes the color,
   its number grows and its sign shows. The number has the size of its case. */
.board-column.is-over-soft {
  border-color: var(--warning-line);
  background: var(--warning-soft);
  box-shadow: inset 0 3px 0 var(--warning-line);
}

.board-column.is-full {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  box-shadow: inset 0 3px 0 var(--danger-line);
}

.board-column.is-over-soft .board-column-title {
  color: var(--warning);
}

.board-column.is-full .board-column-title {
  color: var(--danger);
}

.board-column .count,
.board-column .fill-sign {
  font-size: var(--board-count-size, 13px);
}

.board-column.is-over-soft .count,
.board-column.is-over-soft .fill-sign {
  font-size: var(--board-count-soft, 16px);
}

.board-column.is-full .count,
.board-column.is-full .fill-sign {
  font-size: var(--board-count-hard, 20px);
}

.count.is-over-soft {
  background: var(--warning-line);
  color: #1C2024;
}

.count.is-full {
  background: var(--danger-line);
  color: #FFFFFF;
}

.fill-sign {
  margin-left: 4px;
  line-height: 1;
}

/* A card dragged over a full column: it will not take it. */
.board-column.is-drop-refused {
  outline: 2px dashed var(--danger-line);
  outline-offset: -1px;
}

.board-column.is-drop-target {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--accent-soft);
}

.board-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 12px;
}

/* The name stays centered on its number, whatever size the number has. */
.board-column-title {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.board-column-title .count,
.board-column-title .fill-sign {
  flex: none;
}

.column-toggle {
  display: grid;
  place-items: center;
  height: 30px;
}

.column-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Shrunk: a strip with the button on top and the name down the side. */
.board-column.is-collapsed {
  flex: none;
  width: 48px;
  min-width: 0;
}

.board-column.is-collapsed .board-column-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.board-column.is-collapsed .column-toggle {
  order: -1;
}

.board-column.is-collapsed .board-column-title {
  flex: none;
  writing-mode: vertical-rl;
  white-space: nowrap;
}

.board-column.is-collapsed .count {
  margin: 8px 0 0;
  padding: 6px 1px;
  text-combine-upright: all;
}

.board-column.is-collapsed .fill-sign {
  margin: 6px 0 0;
}

.board-column.is-collapsed .count-limit {
  display: none;
}

/* New ticket, at the top of the first column */

.board-composer-toggle,
.board-column-action {
  padding: 0 8px 8px;
}

.button.new-ticket-toggle {
  width: 100%;
  border-style: dashed;
}

.board-composer {
  margin: 0 8px 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.board-cards {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 0 8px 8px;
}

.card {
  position: relative;
  padding: 8px 10px 8px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: inset 3px 0 0 var(--urgency);
  cursor: grab;
  overflow-wrap: anywhere;
}

.card.is-new {
  animation: new-ticket 2.5s ease-out;
}

.card.is-dragging {
  opacity: 0.4;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
}

.card-number {
  font-variant-numeric: tabular-nums;
}

.card-status {
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 14px;
}

/* Completed cards only: to the archive, at the bottom right. */
.card-archive {
  display: block;
  margin: 8px 0 0 auto;
}

/* With a mouse the cards are dragged: the same move only shows up for the keyboard. */
@media (hover: hover) and (pointer: fine) {
  .card-status:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
  }
}

/* Forms */

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

.composer-head .button {
  padding: 3px 10px;
  font-size: 13px;
}

.field {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

.field legend {
  padding: 0;
  margin-bottom: 4px;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 400;
}

.field input, .field select, .field textarea {
  margin-top: 4px;
  font-size: 15px;
}

textarea {
  display: block;
  resize: vertical;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

.pill:hover {
  background: var(--surface-sunken);
}

.pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--text);
  font-weight: 600;
}

.pill:has(input:focus-visible) {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Hidden visually only: the radio keeps keyboard access and required validation. */
.pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.button {
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.button:hover {
  background: var(--surface-sunken);
}

a.button {
  color: inherit;
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.button.wide {
  width: 100%;
}

.button.small {
  padding: 3px 10px;
  font-size: 13px;
}

.button.danger {
  color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-soft);
}

.button.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
}

.button.danger-solid:hover {
  background: var(--danger);
  filter: brightness(1.1);
}

.muted {
  color: var(--muted);
}

.error {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

/* Editor: Quill's theme, in this site's colours */

.ql-toolbar.ql-snow {
  margin-top: 4px;
  padding: 4px;
  background: var(--surface-sunken);
  border-color: var(--border);
  border-radius: 6px 6px 0 0;
  font-family: inherit;
}

.ql-toolbar.ql-snow .ql-formats {
  margin-right: 4px;
}

.ql-container.ql-snow {
  background: var(--surface);
  border-color: var(--border);
  border-radius: 0 0 6px 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
}

.ql-editor {
  min-height: 130px;
  max-height: 320px;
  padding: 8px 10px;
}

.ql-editor:focus-visible {
  outline-offset: -2px;
}

.ql-editor img {
  max-width: 100%;
}

/* The tools live in the expanded composer: on the side the description is a plain box. */
.composer .ql-toolbar.ql-snow {
  display: none;
}

.composer .ql-toolbar.ql-snow + .ql-container.ql-snow {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 6px;
}

.ql-snow .ql-stroke,
.ql-snow .ql-stroke-miter {
  stroke: var(--text);
}

.ql-snow .ql-fill {
  fill: var(--text);
}

.ql-snow .ql-picker,
.ql-snow .ql-picker-options {
  color: var(--text);
}

.ql-snow .ql-picker-options {
  background: var(--surface);
}

.ql-snow.ql-toolbar :is(button, .ql-picker-label, .ql-picker-item):is(:hover, :focus, .ql-active, .ql-selected) {
  color: var(--text);
}

.ql-snow.ql-toolbar :is(button, .ql-picker-label, .ql-picker-item):is(:hover, :focus, .ql-active, .ql-selected) :is(.ql-stroke, .ql-stroke-miter) {
  stroke: var(--text);
}

.ql-snow.ql-toolbar :is(button, .ql-picker-label, .ql-picker-item):is(:hover, :focus, .ql-active, .ql-selected) .ql-fill {
  fill: var(--text);
}

.ql-snow.ql-toolbar :is(button, .ql-picker-label):is(.ql-active, :hover) {
  background: var(--accent-soft);
  border-radius: 4px;
}

.ql-snow .ql-tooltip {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
  color: var(--text);
  z-index: 1;
}

.ql-snow .ql-tooltip input[type="text"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.ql-snow a,
.ql-snow .ql-tooltip a {
  color: inherit;
}

.ql-snow .ql-tooltip::before { content: "Visit:"; }
.ql-snow .ql-tooltip[data-mode="link"]::before { content: "Address:"; }
.ql-snow .ql-tooltip a.ql-action::after { content: "Edit"; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Save"; }
.ql-snow .ql-tooltip a.ql-remove::before { content: "Remove"; }

.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before { content: "Normal"; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="13px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="13px"]::before { content: "Small"; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="20px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="20px"]::before { content: "Large"; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="28px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="28px"]::before { content: "Huge"; }

/* Files added to the ticket being written */

.attachment-list {
  display: grid;
  gap: 4px;
  margin: -4px 0 12px;
}

.attachment-list:empty {
  display: none;
}

.attachment {
  display: flex;
  align-items: center;
  padding-left: 10px;
  background: var(--surface-sunken);
  border-radius: 6px;
  font-size: 14px;
}

.attachment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  margin-top: 8px;
  color: var(--success);
  font-size: 14px;
  font-weight: 600;
}

.status:empty {
  display: none;
}

/* Dialogs */

dialog {
  max-height: calc(100dvh - 32px);
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}

/* Expanded composer: the description takes all the height the other fields leave. */

.composer-dialog {
  width: min(1100px, calc(100vw - 32px));
  height: min(900px, calc(100dvh - 32px));
}

.composer-dialog[open] {
  display: flex;
  flex-direction: column;
}

.composer-dialog form {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  grid-template-rows: auto auto minmax(160px, 1fr);
  column-gap: 16px;
}

.composer-dialog form > * {
  grid-column: 1 / -1;
}

/* Type, category and urgency, on one row. */
.composer-dialog form > .field-side {
  grid-column: auto;
}

.composer-dialog .field-description {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.composer-dialog .ql-container {
  flex: 1;
  min-height: 0;
}

.composer-dialog .ql-editor {
  max-height: none;
}

.composer-dialog .button.wide {
  justify-self: end;
  width: auto;
  min-width: 200px;
}

/* A whole ticket, to read: as wide as the full editor. */

.view-dialog {
  width: min(1100px, calc(100vw - 32px));
}

.view-dialog[open] {
  display: flex;
  flex-direction: column;
}

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

.view-body {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 0;
  border-block: 1px solid var(--border);
}

.view-section {
  margin: 20px 0 6px;
}

/* The full view in parts: the ticket, its links (when it has some) and its comments, a line
   between each. */
.view-part {
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.view-body .ticket-attachments {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Some buttons carry a name, up to 60 characters: it wraps rather than widen the dialog. */
.dialog-actions .button {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.comment-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment {
  padding: 8px 12px;
  background: var(--surface-sunken);
  border-radius: 6px;
}

.comment-date {
  color: var(--muted);
  font-size: 12px;
}

/* Comments are plain text: line breaks stay as typed. */
.comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment.is-new {
  animation: new-ticket 2.5s ease-out;
}

/* Above the comments: their count, the box for a new one, a line. With two comments or more the
   count is a button that turns their order round, and says which order it is. */

.view-comments > .view-section {
  margin-bottom: 8px;
}

.comments-sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.comments-sort:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comments-sort-order {
  color: var(--muted);
  font-weight: 400;
}

.comments-sort-icon {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
}

/* Two lines to start with, then it grows with the text (where the browser can). */
.comment-form textarea {
  min-height: calc(2lh + 16px);
  max-height: 50vh;
  field-sizing: content;
}

/* The hint goes as soon as the box is clicked, not at the first letter typed. */
.comment-form textarea:focus::placeholder {
  color: transparent;
}

.comment-form .error {
  margin: 6px 0 0;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.comment-rule {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Are you sure? */

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
}

.confirm-message {
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.confirm-dialog .field {
  margin: 14px 0 0;
}

/* The tickets a confirmation is about: those requiring the ticket, those mentioning it. */
.confirm-details {
  margin-top: 10px;
}

.confirm-details h3 {
  margin-bottom: 2px;
  font-size: 13px;
}

.confirm-details ul {
  margin: 0;
  padding-left: 20px;
  overflow-wrap: anywhere;
}

/* The archive: a few lines per ticket, in one to three columns as the window allows. */

.archive-dialog {
  width: min(1100px, calc(100vw - 32px));
}

.archive-dialog[open] {
  display: flex;
  flex-direction: column;
}

.archive-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.archive-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .archive-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .archive-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Number and title on top, the day and Unarchive at the bottom, in tickets of a row as tall as the
   tallest one. */
.archive-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-content: space-between;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: 6px;
}

.archive-number,
.archive-title {
  align-self: baseline;
}

.archive-number {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.archive-title {
  grid-column: 2 / -1;
  overflow-wrap: anywhere;
}

.archive-date {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
}

.archive-item .button {
  grid-column: 3;
}

/* The history of a ticket: newest first, a block per change, with when and who. */

.history-dialog {
  width: min(820px, calc(100vw - 32px));
}

.history-dialog[open] {
  display: flex;
  flex-direction: column;
}

.history-ticket {
  margin: 0 0 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.history-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-entry {
  padding: 8px 12px;
  background: var(--surface-sunken);
  border-radius: 6px;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-author {
  color: var(--text);
  font-weight: 600;
}

.history-changes {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
}

.history-changes dt {
  color: var(--muted);
  font-size: 14px;
}

.history-changes dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.history-old {
  color: var(--muted);
  text-decoration: line-through;
}

.history-old .urgency-name {
  text-decoration: line-through;
}

.history-new {
  font-weight: 600;
}

.history-note,
.history-listed,
.history-comment {
  margin: 0;
}

.history-note {
  color: var(--muted);
  font-size: 14px;
}

.history-entry > .history-note + .history-note,
.history-changes + .history-note {
  margin-top: 6px;
}

/* Text: line breaks as in the description or the comment. */
.history-diff,
.history-comment {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.history-diff del,
.history-diff ins {
  border-radius: 3px;
}

.history-diff del {
  background: var(--danger-soft);
  color: var(--danger);
}

/* A word replaced: a hair of space between the old and the new. */
.history-diff del + ins {
  margin-left: 2px;
}

.history-diff ins {
  background: var(--success-soft);
  color: var(--success);
  text-decoration: none;
}

.history-diff + .history-note {
  margin-top: 4px;
}

.history-comment {
  padding-left: 10px;
  border-left: 3px solid var(--border);
}

@media (max-width: 640px) {
  .history-changes {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .history-changes dd + dt {
    margin-top: 6px;
  }
}

/* Settings */

.settings {
  width: min(1040px, calc(100vw - 32px));
}

/* On a phone the tabs do not all fit: they scroll sideways. The line under them is a shadow, which
   the selected tab's own line covers: a line past the edge of a scrolling box would be cut. */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  box-shadow: inset 0 -1px var(--border);
}

.settings-tab {
  flex: none;
  padding: 8px 14px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.settings-tab:hover {
  color: var(--text);
}

.settings-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.settings-panel {
  padding-top: 12px;
}

.list-steps {
  display: grid;
  gap: 10px;
  max-width: 440px;
  margin: 14px 0;
}

.list-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-step-width {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.list-step input {
  width: 100px;
}

/* Board: the sizes of the number of tickets, each with how it looks, then the limits of each
   column. */
.board-settings h3 {
  margin-top: 14px;
}

.count-sizes {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin: 10px 0 14px;
}

.count-size {
  display: grid;
  grid-template-columns: 1fr auto 72px;
  align-items: center;
  gap: 12px;
}

.count-size input,
.board-limits input {
  width: 90px;
}

.count-preview {
  display: flex;
  align-items: center;
  font-weight: 600;
}

.count-preview .count {
  margin-left: 0;
}

.board-limits {
  margin: 10px 0 14px;
  border-collapse: collapse;
}

.board-limits th,
.board-limits td {
  padding: 6px 14px 6px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.board-limits thead th {
  color: var(--muted);
  font-size: 13px;
}

.board-limits tbody th {
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* Permissions: a row per permission, a checkbox per role. */
.permissions {
  margin: 14px 0;
  border-collapse: collapse;
}

.permissions th,
.permissions td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.permissions thead th {
  color: var(--muted);
  font-size: 13px;
}

.permissions thead th + th,
.permissions td {
  text-align: center;
}

.permission-detail {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.permissions input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.settings-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 14px 0;
}

.hint {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.rows {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.row input[type="color"] {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.row .symbol-button {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font: 18px/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.row .symbol-button:hover {
  background: var(--surface-sunken);
}

/* The choice of symbols, under the button of a type. */
.symbol-picker {
  position: fixed;
  inset: auto;
  width: min(360px, calc(100vw - 16px));
  margin: 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 24 40 / 18%);
  color: var(--text);
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
}

.symbol-option {
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: 20px/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.symbol-option:hover:not(:disabled) {
  background: var(--surface-sunken);
}

.symbol-option.is-current {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Another type's symbol. */
.symbol-option:disabled {
  cursor: default;
  opacity: 0.25;
}

.symbol-picker .hint {
  margin: 8px 0 6px;
}

.symbol-custom {
  display: flex;
  gap: 6px;
}

.symbol-custom input {
  flex: 1;
  min-width: 0;
}

.symbol-picker .error {
  margin: 6px 0 0;
}

/* Completed and Archived: always there, only their place can change. */
.row.is-fixed input[type="text"] {
  background: var(--surface-sunken);
  color: var(--muted);
  cursor: default;
}

/* Deleting an entry that tickets use */

.choices {
  display: grid;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.choice input[type="radio"] {
  margin: 0;
}

.choice select {
  flex: 1;
  min-width: 140px;
  width: auto;
}

/* The urgency as its dot: the name stays for screen readers, and shows on hover. */
.visually-hidden,
.ticket-table.is-urgency-dot :is(.urgency-name, .sort-label) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon-button {
  flex: none;
  width: 30px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  background: var(--surface-sunken);
  color: var(--text);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.3;
}

/* A new entry's ✓, where the arrows of the others are: it creates the entry. */
.icon-button.confirm {
  width: 64px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.icon-button.confirm:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Narrower screens */

/* No room for the New ticket panel: the layout is narrower than its full 1240px, so the tickets
   could not be 880px wide beside it, or the window is too low for the whole form. The tickets take
   the place of both, up to 880px, and the floating button gets a band of its own above them. It
   shares their row of the grid, so it stays in sight over the list while the page scrolls.
   The two blocks hold the same rules: a container query cannot also ask about the window. */
@container (width < 1240px) {
  .side-composer {
    display: none;
  }

  .tickets {
    grid-area: 1 / 1 / 2 / -1;
    justify-self: center;
    width: 100%;
    max-width: 880px;
    margin-top: 42px;
  }

  .new-ticket-float,
  .composer-out-of-sight .new-ticket-float {
    display: block;
    grid-area: 1 / 1 / 2 / -1;
    justify-self: center;
    position: sticky;
    top: calc(var(--topbar-height) + 10px);
    left: auto;
    margin-top: -8px;
    transform: none;
  }

  /* A ticket scrolled into view does not end up under the button. */
  .ticket-table tbody tr {
    scroll-margin-top: 56px;
  }
}

/* Too low for the whole New ticket panel (its top, 600 pixels of form, room for a message): the
   floating button takes its place. */
@media (max-height: 732px) {
  .side-composer {
    display: none;
  }

  .tickets {
    grid-area: 1 / 1 / 2 / -1;
    justify-self: center;
    width: 100%;
    max-width: 880px;
    margin-top: 42px;
  }

  .new-ticket-float,
  .composer-out-of-sight .new-ticket-float {
    display: block;
    grid-area: 1 / 1 / 2 / -1;
    justify-self: center;
    position: sticky;
    top: calc(var(--topbar-height) + 10px);
    left: auto;
    margin-top: -8px;
    transform: none;
  }

  /* A ticket scrolled into view does not end up under the button. */
  .ticket-table tbody tr {
    scroll-margin-top: 56px;
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 8px;
    padding: 0 16px;
  }

  /* Room for the page buttons: the mark and TREX are enough to say where this is. */
  .brand-sub {
    display: none;
  }

  .banner {
    margin: 12px 16px 0;
  }

  .layout {
    padding: 16px;
    gap: 16px;
  }

  .controls,
  .field-inline {
    width: 100%;
  }

  .filter-button {
    max-width: none;
  }

  .settings-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .board-bar {
    margin: 12px 16px 0;
  }

  .board-git-message {
    margin-inline: 16px;
    text-align: left;
  }

  /* One column under the other: a shrunk one is just its head, and its button turns to match. */
  .board {
    flex-direction: column;
    padding: 12px 16px 16px;
  }

  .board-column,
  .board-column.is-collapsed {
    flex: none;
    width: auto;
    min-width: 0;
  }

  .board-column.is-collapsed .board-column-head {
    flex-direction: row;
    padding: 8px 8px 8px 12px;
  }

  .board-column.is-collapsed .column-toggle {
    order: 0;
  }

  .board-column.is-collapsed .board-column-title {
    flex: 1;
    writing-mode: horizontal-tb;
  }

  .board-column.is-collapsed .count {
    margin: 0 0 0 4px;
    padding: 1px 8px;
  }

  .board-column.is-collapsed .fill-sign {
    margin: 0 0 0 4px;
  }

  .board-column.is-collapsed .count-limit {
    display: inline;
  }

  .column-toggle {
    transform: rotate(90deg);
  }

  .composer-dialog form {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto minmax(200px, 1fr);
  }

  .composer-dialog .button.wide {
    justify-self: stretch;
  }

  /* The table becomes one card per ticket, so nothing scrolls sideways. */
  .ticket-table,
  .ticket-table thead,
  .ticket-table tbody {
    display: block;
  }

  /* The headers stay: they are the only way to sort. */
  .ticket-table thead tr {
    display: flex;
    flex-wrap: wrap;
    padding: 0 8px;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--border);
  }

  .ticket-table th {
    width: auto;
    border: 0;
    white-space: nowrap;
  }

  .sort-button {
    padding: 8px 6px;
  }

  .ticket-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--urgency);
  }

  .ticket-table tbody tr:last-child {
    border-bottom: 0;
  }

  /* An open ticket and its quick view are one card. */
  .ticket-table tbody :is(tr.is-open, tr.quick-row) {
    background: var(--surface-sunken);
  }

  .ticket-table tbody tr.is-open {
    padding-bottom: 10px;
    border-bottom: 0;
  }

  .ticket-table tbody tr.quick-row {
    padding-top: 0;
    box-shadow: inset 3px 0 0 var(--urgency), inset 0 -3px 0 var(--urgency);
  }

  .ticket-table tbody tr.quick-row td {
    flex: 1 1 100%;
    box-shadow: none;
  }

  .ticket-table td,
  .ticket-table tbody td:first-child {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .cell-status,
  .cell-category,
  .cell-date {
    color: var(--muted);
    font-size: 13px;
  }

  .cell-number,
  .cell-urgency,
  .cell-status,
  .cell-category,
  .cell-date {
    white-space: nowrap;
  }

  /* The title has a line of its own. */
  .cell-title {
    width: 100%;
  }
}

/* Who is logged in, beside Settings and Sign out. On a phone the name gives way to the buttons. */

.signed-in {
  align-self: center;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .signed-in {
    display: none;
  }
}

/* Login page */

.login {
  display: grid;
  justify-items: center;
  padding: 48px 16px;
}

.login-panel {
  width: min(100%, 380px);
  padding: 24px;
}

.login-panel h2 {
  margin: 0 0 16px;
}

.login-error {
  margin: 0 0 16px;
}

input[type="password"] {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 400;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

a.signed-in {
  color: var(--muted);
  text-decoration: none;
}

a.signed-in:hover {
  color: var(--text);
  text-decoration: underline;
}

.login-intro {
  margin: 0 0 16px;
}

.login-back {
  margin: 16px 0 0;
  font-size: 14px;
  text-align: center;
}

.login-back a {
  color: var(--muted);
}

/* Users: the accounts of the people outside ADEO, managed by colleagues. */

.users-dialog {
  width: min(720px, calc(100vw - 32px));
}

.users-intro {
  margin: 0 0 12px;
  font-size: 14px;
}

.users-add {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.users-add .field {
  flex: 1;
  margin-bottom: 0;
}

.users-secret {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.users-secret p {
  margin: 0;
}

.users-secret .muted {
  margin-top: 6px;
  color: var(--accent-ink);
  font-size: 13px;
}

.users-password-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.users-password {
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 4px;
  color: var(--text);
  font-size: 16px;
  user-select: all;
}

.users-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.users-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: 6px;
}

.users-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.users-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.users-meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.users-warning {
  color: var(--danger);
}

.users-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.users-dev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.users-dev input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* A button that reads as a link: Change or Add email beside the address. */
.link-button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--text);
}

.users-email-edit {
  display: flex;
  gap: 6px;
  align-items: center;
}

.users-email-edit input {
  flex: 1;
  min-width: 0;
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.users-add {
  flex-wrap: wrap;
}

.users-add .field {
  min-width: 200px;
}

input[type="email"] {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 400;
}

@media (max-width: 520px) {
  .users-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .users-actions {
    justify-content: flex-start;
    margin-top: 6px;
  }
}

/* With Sign out, and Users for colleagues, the top bar no longer fits one row on a phone: the
   buttons on the right go to a second row. Everything placed under the bar follows
   --topbar-height. The login and password pages have no buttons there and keep one row. */

.topbar-actions .button {
  white-space: nowrap;
}

@media (max-width: 560px) {
  :root:has(.topbar-actions) {
    --topbar-height: 100px;
  }

  .topbar:has(.topbar-actions) {
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr 1fr;
    row-gap: 0;
  }

  .topbar:has(.topbar-actions) .page-nav {
    justify-self: end;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    align-self: start;
  }
}

/* A ticket's type: its symbol before the title, wherever the title shows, in color where the
   system has color emoji. Its name shows in the full view (.type-badge), and on hover. */

.type-symbol {
  margin-right: 0.3em;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  font-style: normal;
  font-weight: 400;
}

.type-badge {
  color: var(--text);
  font-weight: 600;
}

/* Projects: the site's first page lists them; in a project, its name is the brand, and leads back. */

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-link .brand-mark {
  flex: none;
}

.brand-link:hover .brand-name {
  text-decoration: underline;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  min-width: 0;
}

.projects-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px;
}

.projects-panel {
  padding: 20px;
}

.projects-panel h2 {
  margin: 0 0 12px;
}

.projects-notice {
  margin: 0 0 12px;
}

.project-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-link {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.project-link:hover,
.project-link:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-name {
  font-size: 16px;
  font-weight: 600;
}

.project-meta {
  color: var(--muted);
  font-size: 13px;
}

/* The projects page: a new project, for colleagues. */

.projects-new {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.projects-new h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.projects-new > p {
  margin: 0 0 12px;
  font-size: 13px;
}

.projects-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.projects-add .field {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.projects-new .projects-made {
  margin: 12px 0 0;
  font-size: 14px;
}

/* The full view's tabs: the ticket, and what git says about it. */

.view-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.view-tab {
  margin-bottom: -1px;
  padding: 6px 12px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.view-tab:hover {
  color: var(--text);
}

.view-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.view-tabs + .view-body {
  border-top: 0;
}

.view-git {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.view-git[hidden] {
  display: none;
}

.git-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.git-status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.git-status strong {
  color: var(--text);
}

.git-message {
  margin: 10px 0 0;
  font-size: 14px;
}

.git-group .view-section {
  margin-top: 16px;
}

.git-items {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.git-item {
  display: grid;
  gap: 2px;
}

.git-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}

.git-line a {
  overflow-wrap: anywhere;
}

.git-key {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-sunken);
  font-size: 12px;
}

.git-meta {
  color: var(--muted);
  font-size: 13px;
}

.git-state {
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.git-state.is-open,
.git-state.is-draft {
  background: var(--success-soft);
  color: var(--success);
}

.git-state.is-merged {
  background: var(--accent-soft);
  color: var(--text);
}

.git-state.is-closed,
.git-state.is-deleted {
  background: var(--danger-soft);
  color: var(--danger);
}

.history-source {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-sunken);
  font-size: 12px;
}

/* Settings, Git */

.git-settings {
  display: grid;
  gap: 12px;
  max-width: 480px;
  margin: 14px 0;
}

.git-settings .hint {
  margin: 0;
}

.git-actions {
  display: flex;
  gap: 8px;
}

.git-result {
  margin: 0;
  font-size: 14px;
}

/* Users: the projects a client can open. */

.users-projects {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.users-project {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}
