/*
 * Stopan styles - the macOS Stickies look of g0no (pastel paper with a
 * darker title strip, square corners and a soft shadow on a neutral desk
 * under a translucent menu bar), applied to a service desk. See specs/ui.md.
 */

:root {
  --desk: #e7e4dd;
  --desk-ink: #3b3934;
  --desk-ink-soft: #77736a;
  --menubar-bg: rgba(250, 249, 246, 0.78);
  --menubar-border: rgba(0, 0, 0, 0.08);
  --menubar-ink: #1d1d1f;

  --ink: #2b2a26;
  --ink-soft: rgba(43, 42, 38, 0.62);
  --rule: rgba(43, 42, 38, 0.14);
  --field-bg: rgba(255, 255, 255, 0.55);
  --field-border: rgba(43, 42, 38, 0.18);

  --accent: #0a64d6;
  --accent-ring: rgba(10, 100, 214, 0.28);
  --danger: #b3261e;
  --expense: #b3261e;

  --shadow: 0 1px 1px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.13);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.08), 0 14px 30px rgba(0, 0, 0, 0.2);

  --menu-bg: rgba(250, 249, 246, 0.97);
  --menu-ink: #1d1d1f;
  --menu-ink-soft: rgba(0, 0, 0, 0.5);
  --search-bg: rgba(0, 0, 0, 0.06);
  --search-bg-focus: rgba(255, 255, 255, 0.9);
  --tool-hover: rgba(0, 0, 0, 0.08);

  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* Dark desk: follows the system unless the sun/moon switch chose a theme
   (data-theme on <html>, from the "theme" cookie). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #2a2a2c;
    --desk-ink: #ecebe8;
    --desk-ink-soft: #a7a5a0;
    --menubar-bg: rgba(40, 40, 42, 0.78);
    --menubar-border: rgba(255, 255, 255, 0.08);
    --menubar-ink: #f2f2f2;
    --menu-bg: rgba(44, 44, 46, 0.97);
    --menu-ink: #f2f2f2;
    --menu-ink-soft: rgba(255, 255, 255, 0.55);
    --search-bg: rgba(255, 255, 255, 0.1);
    --search-bg-focus: rgba(255, 255, 255, 0.16);
    --tool-hover: rgba(255, 255, 255, 0.12);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 34px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --desk: #2a2a2c;
  --desk-ink: #ecebe8;
  --desk-ink-soft: #a7a5a0;
  --menubar-bg: rgba(40, 40, 42, 0.78);
  --menubar-border: rgba(255, 255, 255, 0.08);
  --menubar-ink: #f2f2f2;
  --menu-bg: rgba(44, 44, 46, 0.97);
  --menu-ink: #f2f2f2;
  --menu-ink-soft: rgba(255, 255, 255, 0.55);
  --search-bg: rgba(255, 255, 255, 0.1);
  --search-bg-focus: rgba(255, 255, 255, 0.16);
  --tool-hover: rgba(255, 255, 255, 0.12);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 34px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* Paper colours, as in Stickies' Color menu. Paper keeps them in dark mode. */
.sticky--yellow { --paper: #fff6a8; --bar: #f5e270; }
.sticky--blue   { --paper: #cfe7fc; --bar: #a9d1f5; }
.sticky--green  { --paper: #d4f4c6; --bar: #ade5a0; }
.sticky--pink   { --paper: #fcd4e6; --bar: #f4b0cf; }
.sticky--purple { --paper: #e3d8fc; --bar: #c9b9f5; }
.sticky--gray   { --paper: #efeeea; --bar: #d8d6cf; }

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--desk-ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

form.button_to {
  display: inline;
  margin: 0;
}

/* ---------- menu bar ---------- */

.menubar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 36px;
  padding: 0 16px;
  background: var(--menubar-bg);
  border-bottom: 1px solid var(--menubar-border);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: var(--menubar-ink);
  font-size: 13px;
}

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

/* Brand: the sticky icon (public/icon.svg) and the name. */
.menubar__brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.menubar__brand img {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.menubar__brand:hover img {
  transform: rotate(-6deg);
  transition: transform 0.15s ease;
}

/* Sections: pills with a paper colour square. */
.menubar__nav {
  display: flex;
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  opacity: 0.78;
}

.nav-link:hover {
  background: var(--tool-hover);
  opacity: 1;
}

.nav-link[aria-current] {
  background: var(--tool-hover);
  font-weight: 600;
  opacity: 1;
}

.nav-link:focus-visible {
  outline: 3px solid var(--accent-ring);
}

.nav-link__dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: inset 0 2px 0 var(--bar);
}

.menubar__button:hover {
  text-decoration: underline;
}

.menubar__right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  min-width: 0;
}

.menubar__user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.75;
}

.menubar__button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--search-bg);
  color: var(--desk-ink-soft);
}

.search-field:focus-within {
  background: var(--search-bg-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search-field__input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--desk-ink);
  font: 13px var(--font);
  outline: none;
}

.icon {
  flex: none;
  vertical-align: -2px;
}

/* Sun/moon switch and text size menu. */
.prefs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  list-style: none;
  cursor: pointer;
}

.tool-button::-webkit-details-marker {
  display: none;
}

.tool-button:hover,
.filter[open] > .tool-button {
  background: var(--tool-hover);
}

.tool-button:focus-visible {
  outline: 3px solid var(--accent-ring);
}

/* Show the moon in light mode, the sun in dark mode. */
.theme-toggle--to-light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle--to-light {
    display: inline-flex;
  }

  :root:not([data-theme="light"]) .theme-toggle--to-dark {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle--to-light {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle--to-dark {
  display: none;
}

.scale-buttons {
  display: inline-flex;
  align-items: baseline;
  margin-left: 2px;
}

.scale-button {
  min-width: 20px;
  padding: 0 3px;
  font-weight: 500;
  line-height: 24px;
  opacity: 0.6;
}

.scale-button--normal { font-size: 11px; }
.scale-button--big { font-size: 14px; }
.scale-button--extra { font-size: 17px; }

.scale-button:hover,
.scale-button[aria-pressed="true"] {
  opacity: 1;
}

.scale-button[aria-pressed="true"] {
  background: var(--tool-hover);
  font-weight: 700;
}

/* Text size: the whole page scales, like a larger text setting. */
:root[data-scale="big"] body {
  zoom: 1.15;
}

:root[data-scale="extra"] body {
  zoom: 1.3;
}

/* Turbo Drive's loading bar, shown when a visit takes a moment. */
.turbo-progress-bar {
  height: 2px;
  background: var(--accent);
}

/* ---------- desk ---------- */

.desk {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.desk__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.desk__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- flash ---------- */

/* Messages are small stickies pinned to the top right of the desk. */
.flash-stack {
  position: fixed;
  top: 48px;
  right: 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
}

.flash {
  animation: flash-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.flash.is-leaving {
  opacity: 0;
  transform: translateX(24px);
}

.flash__text {
  margin: 0;
  padding: 10px 14px 12px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.flash--alert .flash__text {
  color: #7a1712;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flash,
  .flash.is-leaving {
    animation: none;
    transform: none;
  }
}

/* ---------- sticky paper ---------- */

.sticky {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.sticky__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 0 8px;
  background: var(--bar);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 3px 3px 0 0;
  font-size: 11px;
  color: var(--ink-soft);
}

.sticky__caption {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The small square boxes in a Stickies title bar. */
.sticky__box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.32);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  color: rgba(0, 0, 0, 0.6);
  font: 10px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.sticky__box:hover {
  background: rgba(255, 255, 255, 0.6);
  color: rgba(0, 0, 0, 0.85);
}

.sticky__box--spacer {
  visibility: hidden;
}

.sticky__box--icon .icon {
  vertical-align: 0;
}

.form-errors {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
  font-size: 14px;
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ledger td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.ledger tr:last-child td {
  border-bottom: 0;
}

.ledger .date,
.ledger .size {
  width: 1%;
  color: var(--ink-soft);
  white-space: nowrap;
}

.ledger .num {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ledger .text {
  overflow-wrap: anywhere;
}

.ledger .comment {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.ledger .action {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.ledger a {
  overflow-wrap: anywhere;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: 500 13px/1.4 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.95);
}

.btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: #0857bd;
}

.btn:focus-visible,
.link-button:focus-visible,
.sticky__box:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: 13px var(--font);
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.field-input,
.auth input[type="email"],
.auth input[type="password"],
.auth input[type="text"] {
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
  font: 14px/1.4 var(--font);
}

.field-input:focus,
.auth input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  outline: none;
}

.field-input--date { flex: 0 0 10.5em; }
.field-input--amount { flex: 0 0 7.5em; }
.field-input--comment { flex: 1 1 12em; }

.field-file {
  flex: 1 1 14em;
  min-width: 0;
  font: 13px var(--font);
  color: var(--ink-soft);
}

.field-file::file-selector-button {
  margin-right: 10px;
  padding: 5px 12px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: 500 13px/1.4 var(--font);
  cursor: pointer;
}

.field-file::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.95);
}

/* ---------- sign-in and other account pages ---------- */

.auth {
  max-width: 380px;
  margin: 40px auto 0;
}

.auth__body {
  padding: 20px 24px 22px;
}

.auth h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}

.auth .field {
  margin-bottom: 12px;
}

.auth .field br {
  display: none;
}

.auth label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

.auth input[type="email"],
.auth input[type="password"],
.auth input[type="text"] {
  width: 100%;
}

.auth input[type="checkbox"] + label {
  display: inline;
  margin: 0 0 0 4px;
}

.auth .field em,
.auth .field i {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
}

.auth .actions {
  margin: 16px 0 14px;
}

.auth input[type="submit"] {
  width: 100%;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: 600 14px var(--font);
  cursor: pointer;
}

.auth input[type="submit"]:hover {
  background: #0857bd;
}

.auth__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  font-size: 13px;
}

#error_explanation {
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
  font-size: 13px;
}

#error_explanation h2 {
  margin: 0 0 4px;
  font-size: 13px;
}

#error_explanation ul {
  margin: 0;
  padding-left: 18px;
}

/* ---------- confirm dialog ---------- */

.confirm {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  box-shadow: var(--shadow-lift);
}

.confirm:not([open]) {
  display: none;
}

.confirm::backdrop {
  background: rgba(20, 20, 22, 0.45);
}

.confirm__body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 14px;
  padding: 18px 20px 16px;
}

.confirm__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font: 700 20px/1 var(--font);
}

.confirm__title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.confirm__message {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.confirm__actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
}

.btn--destructive {
  border-color: transparent;
  background: var(--danger);
  color: #fff;
}

.btn--destructive:hover {
  background: #96201a;
}

.auth__hint {
  margin: -8px 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
}

.auth__meta {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.auth h2 .icon {
  vertical-align: -1px;
}

/* ---------- admin ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  padding: 14px 16px 12px;
  border-top: 6px solid var(--bar);
}

.stat__value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat__label {
  color: var(--ink-soft);
  font-size: 12px;
}

.panel {
  margin-bottom: 24px;
}

.panel--narrow {
  max-width: 480px;
  margin: 0 auto;
}

.panel__body {
  padding: 14px 18px 18px;
}

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

.panel__head .section-title {
  margin: 0;
}

.panel__empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.table-scroll {
  overflow-x: auto;
}

.ledger th {
  padding: 6px 4px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ledger th.num {
  text-align: right;
}

.ledger .action form.button_to {
  margin-left: 10px;
}

.tag-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(10, 100, 214, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-form .field {
  margin-bottom: 12px;
}

.admin-form label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

.admin-form .field-input {
  width: 100%;
}

.admin-form .field--check label {
  display: inline;
  margin-left: 4px;
  color: var(--ink);
}

.field-hint {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

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

/* ---------- service desk: shared pieces ---------- */

.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  z-index: 200;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
}

.skip-link:focus {
  top: 6px;
}

.menubar__user {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  opacity: 0.85;
}

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

.menubar__role {
  color: var(--desk-ink-soft);
  font-size: 11px;
}

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

.btn {
  gap: 6px;
}

.btn--block {
  width: 100%;
  margin-top: 4px;
}

.select {
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
  font: 14px/1.4 var(--font);
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  outline: none;
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

.form-errors__title {
  margin: 0 0 4px;
  font-weight: 600;
}

/* Status and priority pills: paper colour plus text, never colour alone. */
.pill {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: inset 0 -2px 0 var(--bar);
  color: #2b2a26;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pill--urgent {
  border-color: rgba(179, 38, 30, 0.45);
  color: #8d1c16;
}

.pill--urgent::before {
  content: "!";
  margin-right: 4px;
}

.pill--low {
  font-weight: 500;
}

.role-pill,
.role-tag,
.internal-tag,
.state-tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.role-pill,
.role-tag {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-soft);
}

.role-pill--agent,
.role-pill--admin {
  background: rgba(10, 100, 214, 0.12);
  color: var(--accent);
}

.internal-tag {
  background: rgba(179, 38, 30, 0.1);
  color: #8d1c16;
}

.state-tag {
  margin-left: 6px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink-soft);
}

.is-deactivated td {
  color: var(--ink-soft);
}

.callout {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--bar, #f5e270);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  font-size: 14px;
}

.desk > .callout {
  background: var(--search-bg);
  color: var(--desk-ink);
}

.panel--form {
  max-width: 720px;
  margin: 0 auto 24px;
}

.panel__title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel__intro {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 24px;
}

.two-columns--wide-left {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

/* ---------- forms ---------- */

.stack-form .field {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.stack-form label,
.properties-form label,
.filters__field label,
.composer__status label,
.checklist legend {
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.stack-form .field-input,
.stack-form .select {
  width: 100%;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 16px;
}

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

.form-actions--start {
  justify-content: flex-start;
  margin-top: 14px;
}

.checklist {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.checklist legend {
  padding: 0;
}

.checklist .check {
  margin-right: 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 14px;
}

.inline-form__label {
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---------- ticket lists ---------- */

.queue {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

.view-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--desk-ink);
  font-size: 14px;
}

.view-link:hover {
  background: var(--tool-hover);
  text-decoration: none;
}

.view-link[aria-current] {
  background: var(--tool-hover);
  font-weight: 600;
}

.view-link:focus-visible,
.tab:focus-visible,
.ticket-link:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
}

.view-link__count,
.tab__count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--search-bg);
  color: var(--desk-ink-soft);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.queue__list {
  margin-bottom: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.filters .search-field {
  flex: 1 1 220px;
  height: 32px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
}

.filters .search-field__input {
  color: var(--ink);
  font-size: 14px;
}

.filters__field {
  display: flex;
  flex-direction: column;
}

.filters__field label {
  font-size: 11px;
}

.filters__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters__clear {
  font-size: 13px;
}

.filters--compact {
  align-items: flex-end;
}

.tickets-table td {
  vertical-align: middle;
}

.ticket-row--urgent td:first-child {
  box-shadow: inset 4px 0 0 #d6453b;
}

.ticket-row--high td:first-child {
  box-shadow: inset 4px 0 0 #a58be8;
}

.ticket-number {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.tickets-table .ticket-number {
  padding-left: 10px;
}

.ticket-link {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.ticket-row__requester {
  color: var(--ink-soft);
  font-size: 12px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.pagination__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.list-search {
  display: flex;
  gap: 8px;
  margin: 0;
}

.list-search .search-field {
  width: 240px;
  height: 32px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
}

.list-search .search-field__input {
  color: var(--ink);
  font-size: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  color: inherit;
  font-size: 14px;
}

.tab:hover {
  background: rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.tab[aria-current] {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.admin-tabs .tab {
  color: var(--desk-ink);
}

.admin-tabs .tab:hover,
.admin-tabs .tab[aria-current] {
  background: var(--tool-hover);
}

/* ---------- ticket page ---------- */

.ticket-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-areas:
    "head head"
    "main side";
  gap: 4px 24px;
  align-items: start;
}

.ticket-head {
  grid-area: head;
  margin-bottom: 14px;
}

.ticket-main {
  grid-area: main;
  min-width: 0;
}

.ticket-side {
  grid-area: side;
  position: sticky;
  top: 52px;
}

.ticket-head__crumbs {
  margin: 0 0 4px;
  color: var(--desk-ink-soft);
  font-size: 13px;
}

.ticket-head__crumbs .ticket-number {
  color: inherit;
}

.ticket-head__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ticket-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  color: var(--desk-ink-soft);
  font-size: 13px;
}

.side-panel {
  margin-bottom: 16px;
}

.side-panel .panel__body {
  padding: 12px 14px 14px;
}

.properties-form .field {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.properties-form .select {
  width: 100%;
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 14px;
}

.facts dt {
  color: var(--ink-soft);
  font-size: 13px;
}

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

.facts--dates {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.side-panel .button_to {
  display: block;
  margin-top: 12px;
}

.message {
  margin-bottom: 0;
}

.message__body {
  padding: 12px 16px 14px;
}

.message__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

.message__meta strong {
  color: var(--ink);
}

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

.ticket-text p {
  margin: 0 0 8px;
}

.ticket-text p:last-child {
  margin-bottom: 0;
}

.message--internal {
  outline: 2px dashed rgba(179, 38, 30, 0.35);
  outline-offset: -2px;
}

.message--internal .sticky__bar {
  color: #8d1c16;
  font-weight: 600;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-size: 13px;
}

.file-link:hover {
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.file-link__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-link__size {
  color: var(--ink-soft);
  font-size: 12px;
}

.section-heading {
  margin: 22px 0 10px;
  color: var(--desk-ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* The timeline: a thin rule with messages as stickies and changes as
   quiet lines. */
.timeline {
  position: relative;
  margin: 0 0 20px;
  padding: 0 0 0 22px;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--menubar-border);
}

.timeline__item {
  position: relative;
  margin-bottom: 14px;
  scroll-margin-top: 60px;
}

.timeline__item--message::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -19px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--desk);
  border-radius: 50%;
  background: var(--desk-ink-soft);
}

.timeline__item:target .message {
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow);
}

.timeline__item--event {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--desk-ink-soft);
  font-size: 13px;
}

.timeline__icon {
  position: absolute;
  left: -22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--desk);
  color: var(--desk-ink-soft);
}

.timeline__text {
  color: var(--desk-ink);
}

.timeline__time {
  color: var(--desk-ink-soft);
}

.timeline__item--internal .internal-tag {
  font-size: 10px;
}

/* Composer: blue paper for a public reply, pink for an internal note. */
.composer {
  margin-bottom: 24px;
}

.composer__form {
  padding: 12px 16px 14px;
}

.composer__mode {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mode-option:has(input:checked) {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.mode-option:has(input:focus-visible) {
  outline: 3px solid var(--accent-ring);
}

.mode-option--internal:has(input:checked) {
  color: #8d1c16;
}

.composer__body {
  width: 100%;
  min-height: 110px;
  resize: vertical;
}

.composer__hint {
  display: none;
  margin: 0 0 8px;
  color: #8d1c16;
  font-size: 13px;
}

.composer.is-internal .composer__hint--internal {
  display: block;
}

.composer.is-internal .composer__body {
  border-style: dashed;
  border-color: rgba(179, 38, 30, 0.45);
}

.composer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 16px;
}

.composer__files {
  display: flex;
  flex: 1 1 260px;
  flex-direction: column;
  margin: 0;
}

.composer__status {
  display: flex;
  flex-direction: column;
}

.composer__submit {
  margin-left: auto;
}

.composer.is-internal .btn--primary {
  background: #b3261e;
}

.composer.is-internal .btn--primary:hover {
  background: #96201a;
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .ticket-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "side"
      "main";
  }

  .ticket-side {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 16px;
  }

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

@media (max-width: 760px) {
  .queue {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .queue__views ul {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .view-link {
    white-space: nowrap;
  }

  .col-org,
  .col-priority,
  .col-assignee,
  .col-updated {
    display: none;
  }
}

@media (max-width: 560px) {
  .desk {
    padding-top: 16px;
  }

  .menubar {
    flex-wrap: wrap;
    gap: 6px 14px;
    height: auto;
    padding: 6px 16px;
  }

  .menubar__name,
  .menubar__user {
    display: none;
  }

  .nav-link {
    padding: 0 7px;
  }

  .desk__header {
    flex-wrap: wrap;
  }

  .flash-stack {
    top: 72px;
  }

  .list-search,
  .list-search .search-field {
    width: 100%;
  }

  .list-search .search-field {
    flex: 1;
  }

  .composer__submit {
    width: 100%;
  }

  .composer__submit .btn {
    width: 100%;
  }

  .timeline {
    padding-left: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* The inherited file input grows along a row; inside a column of fields it
   must keep its own height. */
.field .field-file {
  flex: none;
}
