/* ---- Tokens ---- */

/* Colours gantt.js reads with getComputedStyle for its canvas: registered as colours, so they
   compute to plain rgb() instead of the light-dark() text (which a canvas does not take). */
@property --bg {
  syntax: '<color>';
  inherits: true;
  initial-value: #fff;
}

@property --fg {
  syntax: '<color>';
  inherits: true;
  initial-value: #1d1d1f;
}

@property --muted {
  syntax: '<color>';
  inherits: true;
  initial-value: #8a8a8e;
}

@property --line {
  syntax: '<color>';
  inherits: true;
  initial-value: #e3e3e6;
}

@property --head {
  syntax: '<color>';
  inherits: true;
  initial-value: #f5f5f7;
}

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #2357d9;
}

@property --magenta {
  syntax: '<color>';
  inherits: true;
  initial-value: #c8168c;
}

/* Light or dark: follows the system unless the toggle set data-theme on <html> (see theme.js). */
:root {
  color-scheme: light dark;
  --bg: light-dark(#fff, #18181a);
  --fg: light-dark(#1d1d1f, #ececee);
  --muted: light-dark(#8a8a8e, #8d8d93);
  --line: light-dark(#e3e3e6, #2e2e32);
  --head: light-dark(#f5f5f7, #222225);
  --hover: light-dark(#f0f0f2, #26262a);
  --accent: light-dark(#2357d9, #7ea2ff);
  --magenta: light-dark(#c8168c, #ff5cc6);
  --violet: light-dark(#7445d6, #b79cf2);
  --aqua: light-dark(#0a7d99, #6ad9f2);
  --red: light-dark(#c62828, #f28b82);
  --green: light-dark(#2e7d32, #93d9a0);
  --orange: light-dark(#c25e00, #ffb168);
  --danger: #d33; /* destructive actions (delete, remove) and errors */
  --notice: #e0a100; /* hints that are no error */
  /* Colour per project-tree type (read by gantt.js for the row tints; see .type-*). */
  --color-exhibition: #f2c94c;
  --color-location: #9cc8f5;
  --color-project: #93d9a0;
  --color-request: #f2a7d8;
  --color-inventory: #b79cf2;
  --color-shopping: #6ad9f2;
  --color-item: #f28b82;
  /* Gantt items (tasks): the request colour of the tree, dark text in both themes; hatching
     where two tasks of one team member run at the same time (read by gantt.js). */
  --gantt-item: var(--color-request);
  --gantt-item-fg: #1d1d1f;
  --gantt-overlap: #e5484d;
  --row-h: 28px; /* table rows: as high as the project tree rows */
  --logo-filter: none; /* the logo is black: inverted in dark mode */
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --logo-filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --logo-filter: invert(1);
  }
}

/* ---- Base ---- */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font:
    15px/1.4 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
}

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

[hidden] {
  display: none !important;
}

/* Material icons (see icons.js): in the text colour, as big as the text unless set. */
.icon {
  flex: none;
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -0.125em;
}

/* ---- Header ---- */

/* Logo and search left, the view buttons in the middle, status and the smiley right (the outer
   parts share the rest of the width equally). */
.bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bar-left {
  grid-column: 1;
}

.bar-right {
  grid-column: 3;
  justify-content: flex-end;
}

/* The logo: opens the menu. */
.logo-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.logo-btn:hover,
.logo-btn[aria-expanded='true'] {
  background: var(--hover);
}

.logo-btn img {
  filter: var(--logo-filter);
}

/* Search (no function yet). */
.search-field {
  flex: 0 1 260px;
  min-width: 80px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}

.search-field:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: -1px;
}

.status {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
}

/* Views of the Main page, one pressed (see app.js): all buttons as wide as the widest, each an
   icon above its name, in the view's colour (the icon always, the whole button while pressed). */
.view-switch {
  grid-column: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.view-switch button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 62px;
  min-width: 72px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.view-switch button + button {
  border-left: 0;
}

.view-switch button:first-child {
  border-radius: 6px 0 0 6px;
}

.view-switch button:last-child {
  border-radius: 0 6px 6px 0;
}

.view-switch button:hover {
  background: var(--hover);
}

.view-switch button[aria-pressed='true'] {
  background: color-mix(in srgb, var(--view-color) 16%, var(--bg));
  box-shadow: inset 0 -3px 0 var(--view-color);
  color: var(--view-color);
}

.view-icon {
  width: 22px;
  height: 22px;
  color: var(--view-color);
}

/* Square buttons: the smiley (header, opens the aside), theme toggle (menu). */
.bar-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.bar-btn:hover,
.bar-btn[aria-expanded='true'] {
  background: var(--hover);
}

.bar-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--fg);
}

/* Theme toggle: shows the icon of the mode it switches to (data-mode: the current one). */

.theme-toggle > span {
  display: grid;
  place-items: center;
  color: var(--fg);
}

.theme-toggle[data-mode='light'] .theme-icon-light,
.theme-toggle[data-mode='dark'] .theme-icon-dark {
  display: none;
}

/* ---- Menu (sidebar, opened with the logo) ---- */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / 0.3);
}

/* Slides in from the left over the page; the backdrop, Escape or a choice closes it. */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: 260px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 4px 0 24px rgb(0 0 0 / 0.18);
  transform: translateX(-100%);
  visibility: hidden;
  transition:
    transform 0.2s ease,
    visibility 0.2s;
}

.sidebar.open {
  transform: none;
  visibility: visible;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 61px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

/* Menu: Log out (no function yet), right of the theme toggle. */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.logout-btn:hover {
  background: var(--hover);
}

.logout-btn .icon {
  width: 18px;
  height: 18px;
}

.sidebar-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-label {
  padding: 10px 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--fg);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.sidebar-item:hover {
  background: var(--hover);
}

.sidebar-item[aria-current='page'] {
  background: color-mix(in srgb, var(--item-color, var(--accent)) 16%, var(--bg));
  color: var(--item-color, var(--accent));
  font-weight: 600;
}

.sidebar-item .icon {
  width: 20px;
  height: 20px;
  color: var(--item-color, var(--muted));
}

/* "Tables": expands and collapses the list of tables below it. */
.sidebar-group .chevron {
  margin-left: auto;
  transition: transform 0.15s;
}

.sidebar-group[aria-expanded='true'] .chevron {
  transform: rotate(90deg);
}

.sidebar-sub .sidebar-item {
  height: 32px;
  padding-left: 40px;
  font-size: 13px;
}

/* ---- Aside (right, opened with the smiley button; see aside.js) ---- */

/* The smiley: magenta while hovered or open, and it wiggles when hovered. */
.aside-btn .icon {
  transition: color 0.15s;
}

.aside-btn:hover .icon,
.aside-btn[aria-expanded='true'] .icon {
  color: var(--magenta);
}

@media (prefers-reduced-motion: no-preference) {
  .aside-btn:hover .icon {
    animation: wiggle 0.6s ease-in-out;
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-16deg) scale(1.1);
  }
  50% {
    transform: rotate(12deg) scale(1.1);
  }
  75% {
    transform: rotate(-6deg);
  }
}

/* Like the menu, from the right: its nav (AI, Chat, History) and × at the top. */
.sidebar-right {
  right: 0;
  left: auto;
  width: 360px;
  max-width: 100vw;
  border-right: 0;
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px rgb(0 0 0 / 0.18);
  transform: translateX(100%);
}

.aside-nav {
  display: flex;
  gap: 4px;
}

.aside-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.aside-tab:hover {
  background: var(--hover);
  color: var(--fg);
}

.aside-tab[aria-current='page'] {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
  color: var(--accent);
}

.aside-tab .icon {
  width: 18px;
  height: 18px;
}

.aside-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* What a view will show (none has content yet). */
.aside-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  text-align: center;
  color: var(--muted);
}

.aside-info .icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.aside-info h2 {
  margin: 0;
  font-size: 16px;
  color: var(--fg);
}

.aside-info p {
  max-width: 260px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- Resizable splits (see split.js) ---- */

.split {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.split-row {
  flex-direction: row;
}

.split-col {
  flex-direction: column;
}

/* The first child gets its size from split.js, the last one takes the rest. */
.split > :first-child,
.split > :last-child {
  min-width: 0;
  min-height: 0;
}

.split > :first-child {
  flex: 0 0 50%;
}

.split > :last-child {
  flex: 1 1 0;
}

.gutter {
  flex: none;
  background: var(--line);
  touch-action: none;
}

.split-row > .gutter {
  width: 6px;
  cursor: col-resize;
}

.split-col > .gutter {
  height: 6px;
  cursor: row-resize;
}

.gutter:hover,
.gutter.hover,
.gutter:focus-visible,
.resizing > .gutter {
  background: var(--accent);
  outline: none;
}

.resizing {
  user-select: none;
}

/* Round handle where the gutters of two splits cross: drags both (see initCrossHandle). It
   lives in one of the gutters and sits on the middle of both. */
.gutter:has(> .split-handle) {
  position: relative;
}

.split-handle {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 22px;
  height: 22px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--muted);
  transform: translate(-50%, -50%);
  cursor: move;
  touch-action: none;
}

.split-handle:hover,
.resizing > .gutter > .split-handle {
  background: var(--accent);
}

/* ---- Main page layout ---- */

#main {
  /* Shared by the lists and the gantts next to them (read by gantt.js): rows must line up. */
  --timeline-h: 48px;
  --gantt-row-h: 28px;
  /* Names of the selected gantt item's members, listed below it: height per name, and the
     space below the last one. The item's row is that much higher in the gantt and the tree. */
  --gantt-name-h: 18px;
  --gantt-names-pad: 4px;
}

/* No scrollbars anywhere (wheel, touch and keyboard still scroll; the tree and the grid or
   gantt next to it scroll together). */
#main,
#main * {
  scrollbar-width: none;
}

#main ::-webkit-scrollbar {
  display: none;
}

.pane {
  overflow: auto;
}

/* Left: the filter bar on top (in every view), below it the top | bottom split. */
.main-left {
  display: flex;
  flex-direction: column;
}

/* Top: the item list and the items table (Rentals view) or the people list and its gantt
   (Timing view). Other views close it (it slides up, then is hidden, see setTop in app.js);
   the transition only runs while switching, not while dragging the gutter. */
.main-top {
  display: flex;
  flex-direction: column;
}

.main-top > * {
  flex: 1;
  min-height: 0;
}

.main-split.animating > .main-top {
  transition: flex-basis 0.3s ease;
}

.main-split.top-closed > .main-top {
  flex-basis: 0 !important;
  overflow: hidden;
}

/* Right of the project tree: the request grid or (Timing view) the project gantt. */
.main-right {
  display: flex;
}

.main-right > * {
  flex: 1;
  min-width: 0;
}

/* Overview: nothing right of the tree, it takes the whole width (over the split's share). */
.main-bottom.tree-only > .pane-list {
  flex: 1 1 0 !important;
  max-width: none !important; /* not the split's limit for the second pane */
}

.main-bottom.tree-only > .gutter,
.main-bottom.tree-only > .main-right {
  display: none;
}

/* Timing view: the tree and the project gantt next to it have no header; the people list and
   its gantt above show the column titles and the timeline. */
.main-bottom.no-head {
  --timeline-h: 0px;
}

.main-bottom.no-head .tree > .list-head {
  display: none;
}

/* ---- Filter bar (above the tree and its gantt or grid; see levelFilter.js) ---- */

/* One row of groups from the left (too narrow: it scrolls sideways, with shift+wheel). Empty
   (no request filters, e.g. Rentals and Shopping views): not shown. */
.pane-filter {
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
  gap: 8px 16px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.pane-filter:empty {
  display: none;
}

/* One group per level: its button, the name select below it (as wide as the select). */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group > .filter-btn {
  white-space: nowrap;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.filter-btn:hover {
  background: var(--hover);
}

.filter-btn[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--type-color) 70%, var(--line));
  background: color-mix(in srgb, var(--type-color) 16%, var(--bg));
  color: var(--fg);
}

.filter-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border: 2px solid var(--type-color);
  border-radius: 50%;
}

.filter-btn[aria-pressed='true'] .filter-dot {
  background: var(--type-color);
}

.filter-select {
  width: 120px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  color: var(--muted);
}

.filter-select.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Level hidden: the select keeps its choice but does not filter. */
.filter-select:disabled {
  opacity: 0.45;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Request filters (roles, inventory, shopping): the power button top left, the two rows of
   bubbles right of it. */
.request-filter {
  flex: none;
  flex-direction: row;
  align-items: flex-start;
  min-height: 28px;
}

/* Centred on the first row of bubbles (28 px row, 24 px button). */
.request-filter > .power-btn {
  margin-top: 2px;
}

/* On/off button: power icon and the requests' name, in the type's colour while they are shown. */
.power-btn {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}

.power-btn:hover {
  background: var(--hover);
}

.power-btn[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--type-fg) 60%, var(--line));
  background: color-mix(in srgb, var(--type-fg) 14%, var(--bg));
  color: var(--type-fg);
}

.power-btn .icon {
  font-size: 15px;
}

/* One bubble per value (also in the new team request popover). */
.role-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Filter bar: the bubbles in two rows (--bubble-cols per row, set in projectTree.js), each as
   high as a level filter's button and select, so they line up. */
.role-bubbles.bubble-rows {
  display: grid;
  grid-template-columns: repeat(var(--bubble-cols), auto);
  grid-auto-rows: 28px;
  align-items: center;
  gap: 6px 4px;
}

/* Pressed: in the colour of the requests in the tree (roles magenta, inventory categories
   violet, shopping categories aqua). */
.role-bubble {
  --bubble-color: var(--magenta);
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.category-bubble {
  --bubble-color: var(--violet);
}

.shopping-bubble {
  --bubble-color: var(--aqua);
}

.role-bubble[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--bubble-color) 60%, var(--line));
  background: color-mix(in srgb, var(--bubble-color) 14%, var(--bg));
  color: var(--bubble-color);
}

.role-bubble:hover:not(:disabled) {
  background: var(--hover);
}

/* Switched off: the bubbles keep their state but are faded and locked. */
.request-filter.off .role-bubbles {
  opacity: 0.45;
}

.request-filter.off .role-bubble {
  cursor: default;
}

/* ---- Tree and lists (Main page; see projectTree.js, itemList.js, teamList.js) ---- */

/* Colour per project-tree type: tree bars, row tints and filter buttons. --type-fg: text in
   the type's colour (readable on the background). */
.type-exhibition {
  --type-color: var(--color-exhibition);
}

.type-location {
  --type-color: var(--color-location);
}

.type-project {
  --type-color: var(--color-project);
}

.type-request {
  --type-color: var(--color-request);
  --type-fg: var(--magenta);
}

.type-inventory {
  --type-color: var(--color-inventory);
  --type-fg: var(--violet);
}

.type-shopping {
  --type-color: var(--color-shopping);
  --type-fg: var(--aqua);
}

/* Items (Rentals view, item list on top). */
.type-item {
  --type-color: var(--color-item);
  --type-fg: var(--red);
}

/* Group rows (Rentals and Shopping views, grouped by a column of the request table). */
.type-group {
  --type-color: var(--muted);
  --type-fg: var(--fg);
}

/* Sticky header of a list; as tall as the gantt timeline so rows line up. */
.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: var(--timeline-h);
  padding: 0 12px 6px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.tree {
  --tree-id-w: 0px; /* ID column of a numbered tree */
  --tree-bar: 8px;
  /* Each level starts where the parent's bar ends, so the bars touch at the corners. */
  --tree-indent: var(--tree-bar);
}

/* The tree's header has the rows' gap, so its column titles sit over their columns. */
.tree > .list-head {
  gap: 6px;
}

.tree-row {
  --level: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--gantt-row-h);
  padding-left: calc(var(--tree-id-w) + var(--level) * var(--tree-indent) + var(--tree-bar) + 10px);
  padding-right: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

/* Bar in the type's colour, indented like the row (--level is set per row), right of the ID
   column of a numbered tree. */
.tree-row::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--tree-id-w) + var(--level) * var(--tree-indent));
  width: var(--tree-bar);
  background: var(--type-color);
}

/* Hover (also while the pointer is over the row in the gantt) and selection: type tints, the
   same strengths as in gantt.js. */
.tree-row:hover,
.tree-row.hovered {
  background: color-mix(in srgb, var(--type-color) 10%, transparent);
}

.tree-row.selected {
  background: color-mix(in srgb, var(--type-color) 24%, transparent);
}

.tree-row.selected:hover,
.tree-row.selected.hovered {
  background: color-mix(in srgb, var(--type-color) 34%, transparent);
}

.tree-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The project a dragged item would be added to (Rentals view): its tree row and its line in the
   table next to it, as one band with a dashed green outline (top and bottom along both, left on
   the tree row, right on the line's last cell; see .pane-grid tr.drop-target). */
:root {
  --drop-dash-h: repeating-linear-gradient(90deg, var(--green) 0 6px, transparent 6px 10px);
  --drop-dash-v: repeating-linear-gradient(180deg, var(--green) 0 6px, transparent 6px 10px);
  --drop-tint: color-mix(in srgb, var(--green) 16%, var(--bg));
}

.tree-row.drop-target {
  background:
    var(--drop-dash-h) top / 100% 2px no-repeat,
    var(--drop-dash-h) bottom / 100% 2px no-repeat,
    var(--drop-dash-v) left / 2px 100% no-repeat,
    var(--drop-tint);
}

/* Rows that neither expand nor select (group rows without children). */
.tree-row.static {
  cursor: default;
}

.tree-row.type-group .tree-label {
  font-weight: 600;
}

/* Row of the selected gantt item while its members are listed below it (--name-lines is set
   per row, see setNameLines in projectTree.js); the row's own content stays at the top. */
.tree-row.tall {
  align-items: flex-start;
  height: calc(
    var(--gantt-row-h) + var(--name-lines) * var(--gantt-name-h) + var(--gantt-names-pad)
  );
  line-height: calc(var(--gantt-row-h) - 1px);
}

/* ID column of a numbered tree (Rentals view, item list): at the left edge before the bars
   (in the header at the bottom, like the other titles). */
.tree.numbered {
  --tree-id-w: 40px;
}

.tree.numbered > .list-head {
  padding-left: calc(var(--tree-id-w) + 12px);
}

.tree-id {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--tree-id-w);
  height: calc(var(--gantt-row-h) - 1px);
  padding: 0 4px 0 8px; /* as the ID column of the tables */
  line-height: calc(var(--gantt-row-h) - 1px);
  text-align: left;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.list-head .tree-id {
  top: auto;
  bottom: 6px;
  height: auto;
  line-height: normal;
  font-size: inherit;
}

/* Click target for expand/collapse (the rest of the row selects). */
.tree-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  margin-left: -4px;
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.12s;
}

.tree-toggle:not(:empty):hover {
  color: var(--fg);
}

.tree-node:not(.open) > .tree-row .tree-toggle {
  transform: rotate(-90deg);
}

.tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column after the name: term of the request's main role, then its extra roles in grey (at
   most two, then a +: see roleCell in projectTree.js). As wide as the widest such cell. */
.tree-role {
  flex: none;
  width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  color: var(--magenta);
}

/* Inventory requests: the category of their item instead of a role. */
.tree-category {
  font-weight: 600;
  color: var(--type-fg);
}

.list-head .tree-role {
  font-weight: 600;
  color: var(--muted);
}

.tree-role-extra {
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Last column: a team request's number of tasks, as a button that goes through them. */
.tree-tasks {
  flex: none;
  width: 36px;
  text-align: center;
}

/* In a higher row the button stays in the middle of the row's first line. */
.tree-row.tall .tree-tasks {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--gantt-row-h) - 1px);
}

/* With Role and Tasks columns (Timing view: tree and people list), the Tasks column ends at
   the right edge. */
.tree.with-team > .list-head,
.tree.with-team .tree-row {
  padding-right: 0;
}

.task-count {
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  line-height: 1; /* not the row's: the number stays centred in the button */
  cursor: pointer;
}

/* At least one of the request's tasks has nobody assigned. */
.task-count.unstaffed {
  color: var(--danger);
}

.task-count:hover:not(:disabled) {
  background: var(--hover);
}

.task-count:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Image column (Rentals and Shopping views: tree and item list): a small picture. */
.tree-image {
  flex: none;
  width: 40px;
  display: flex;
  justify-content: center;
}

.tree-image img {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.list-head .tree-image {
  display: block;
  text-align: center;
}

.tree-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* People list (Timing view, top left): name, then the tree's Role and Tasks columns, with the
   tree's gaps so the columns line up; the Tasks column ends at the right edge. */
.list-head.team-head {
  gap: 6px;
  padding-right: 0;
}

/* Timing view: the team list's header and the timeline make room for the weather band (gantt.js
   draws it); a line in the header continues the band's lower edge. */
.main-team {
  --weather-h: 34px;
  --timeline-h: 82px; /* the timeline's 48px below the band */
}

.main-team .team-head {
  background-image: linear-gradient(var(--line), var(--line));
  background-repeat: no-repeat;
  background-position: 0 calc(var(--weather-h) - 1px);
  background-size: 100% 1px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--gantt-row-h);
  padding: 0 0 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.team-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.team-name {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* A member's name: dragged onto a task in the project gantt to assign that member. */
.member-bubble {
  min-width: 0;
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  user-select: none;
}

.member-bubble:hover {
  background: var(--hover);
}

/* ---- Tables (see table.js) ---- */

/* Sized like the project tree: 13 px text, 28 px rows. */
.grid {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.grid th,
.grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.grid td {
  height: var(--row-h);
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.grid tbody tr:hover td {
  background: var(--hover);
}

.grid td.id {
  color: var(--muted);
  font-size: 11px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

/* Header: on the page's background (no grey band), muted small titles, a line below; columns
   are only told apart by a short divider beside the title. Two rows: the title with the column
   tools (on hover), the value search. */
.grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-right-color: transparent;
}

.grid th::after {
  content: '';
  position: absolute;
  top: 9px; /* beside the title */
  right: 0;
  height: 14px;
  border-right: 1px solid var(--line);
  pointer-events: none;
}

.grid th:hover,
.grid th:focus-within {
  color: var(--fg);
}

.th-title {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 6px 0 8px;
}

/* Fixed columns: the title is plain text (no field select). */
.th-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Last column: the + that adds a column, sticky at the table's right edge (right after the
   last column while the table is narrower than its pane). Its body cells stay empty. */
.grid th.add-col {
  position: sticky;
  right: 0;
  z-index: 3;
  padding: 4px 0 0;
  box-shadow: -1px 0 0 var(--line);
}

.grid th.add-col::after {
  content: none;
}

.grid td.add-col {
  padding: 0;
  border-right: 0;
}

.btn-add-col {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.btn-add-col:hover {
  background: var(--hover);
  color: var(--fg);
}

/* Column tools in the title line: the move handle left of the title, group, sort and remove
   right of it. Shown while the header is hovered or focused (taking no room otherwise); an
   active one (grouped, sorted) stays, in the accent colour. */
.th-tool {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.th-tool:hover {
  background: var(--hover);
  color: var(--fg);
}

.th-tool:not(.active) {
  display: none;
}

.grid th:hover .th-tool,
.grid th:focus-within .th-tool {
  display: grid;
}

.th-tool.active {
  color: var(--accent);
}

.th-tool.btn-move {
  margin-left: -6px;
  cursor: grab;
  touch-action: none;
}

/* Value search (second header row): some space below it (its chips have their own). */
.th-filter {
  padding-bottom: 6px;
}

.th-filter:has(.combo-chips:not(:empty)) {
  padding-bottom: 0;
}

/* Column select: a search field styled as the column title. */
.th-field {
  flex: 1;
  min-width: 0;
}

.th-field .combo-input,
.th-field .combo-ghost {
  padding: 0;
  font-weight: 600;
  text-overflow: ellipsis;
}

.th-field .combo-input {
  color: inherit;
}

.th-field .combo-input:not(:focus) {
  cursor: pointer;
}

.resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  z-index: 1;
  cursor: col-resize;
  touch-action: none;
}

.resizer:hover {
  background: var(--accent);
}

th.dragging {
  opacity: 0.5;
}

th.drop-target {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Sticky columns: ID and the first data column. */
.sticky-1,
.sticky-2 {
  position: sticky;
  z-index: 1;
}

.sticky-1 {
  left: 0;
}

.sticky-2 {
  left: var(--id-width);
  box-shadow: 1px 0 0 var(--line);
}

.grid th.sticky-1,
.grid th.sticky-2 {
  z-index: 3;
}

/* Group header rows. */
.group-row td {
  overflow: visible; /* keeps the sticky label working */
  background: var(--head);
  font-size: 12px;
  font-weight: 600;
}

.group-row span {
  position: sticky;
  left: 8px;
}

/* Request grid (Main page, right of the project tree; see requestGrid.js). Rows without a
   document (group rows of the tree or the item list) cannot be selected. */
.pane-grid tbody tr {
  cursor: pointer;
  user-select: none;
}

.pane-grid tbody tr.static {
  cursor: default;
}

/* Hover and selection: the tree's type tints (shown in both at once); opaque, as the sticky
   cells cover the others while scrolling sideways. */
.pane-grid tbody tr:hover td,
.pane-grid tbody tr.hovered td {
  background: color-mix(in srgb, var(--type-color) 10%, var(--bg));
}

.pane-grid tbody tr.selected td {
  background: color-mix(in srgb, var(--type-color) 24%, var(--bg));
}

.pane-grid tbody tr.selected:hover td,
.pane-grid tbody tr.selected.hovered td {
  background: color-mix(in srgb, var(--type-color) 34%, var(--bg));
}

.pane-grid tbody tr.drop-target td {
  background:
    var(--drop-dash-h) top / 100% 2px no-repeat,
    var(--drop-dash-h) bottom / 100% 2px no-repeat,
    var(--drop-tint);
}

.pane-grid tbody tr.drop-target td:last-child {
  background:
    var(--drop-dash-h) top / 100% 2px no-repeat,
    var(--drop-dash-h) bottom / 100% 2px no-repeat,
    var(--drop-dash-v) right / 2px 100% no-repeat,
    var(--drop-tint);
}

/* ---- Search fields (see combo.js) ---- */

/* Grey completion behind the text; multiple fields list their chosen values below as chips. */
.combo {
  min-width: 0;
}

.combo-field {
  position: relative;
  overflow: hidden;
}

.combo-input,
.combo-ghost {
  height: 24px;
  padding: 0 8px;
  font: inherit;
  font-weight: 400;
  line-height: 24px;
}

.combo-input {
  position: relative; /* above the completion */
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--fg);
  outline: none;
}

.combo-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.combo-input:focus {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.combo-ghost {
  position: absolute;
  inset: 0 auto 0 0;
  white-space: pre;
  color: var(--muted);
  pointer-events: none;
}

.combo-typed {
  color: transparent;
}

/* Chosen values, each with an × that removes it. */
.combo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px; /* clear of the field above */
}

.combo-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 20px;
  padding: 0 2px 0 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.combo-chip-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.combo-chip-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.combo-chip-x:hover {
  background: color-mix(in srgb, var(--accent) 25%, var(--bg));
}

/* The value list: below the field, over everything (fixed, so the table does not clip it). */
.combo-list {
  position: fixed;
  z-index: 50;
  max-width: 360px;
  max-height: 280px;
  overflow: auto;
  padding: 4px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.18);
  font-size: 13px;
}

.combo-option,
.combo-none {
  height: 24px;
  padding: 0 10px;
  overflow: hidden;
  line-height: 24px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.combo-option {
  cursor: pointer;
}

.combo-option:hover {
  background: var(--hover);
}

/* The one Enter takes. */
.combo-option.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
}

.combo-option.chosen {
  font-weight: 600;
  color: var(--accent);
}

.combo-option > .icon {
  margin-right: 4px;
}

.combo-option.all,
.combo-none {
  color: var(--muted);
  font-style: italic;
}

/* ---- Gantts (Timing view: right of the people list and the tree; see gantt.js) ---- */

/* font-weight: inherited by the popovers shown in a gantt. */
.pane-team-gantt,
.pane-gantt {
  position: relative;
  overflow: hidden;
  font-weight: 600;
}

.gantt {
  display: block;
  touch-action: none;
}

.gantt.over-timeline,
.gantt.zooming {
  cursor: zoom-in;
}

.gantt.over-row,
.gantt.over-item,
.gantt.over-name {
  cursor: pointer;
}

.gantt.can-create {
  cursor: crosshair;
}

.gantt.can-move {
  cursor: move;
}

.gantt.can-resize {
  cursor: ew-resize;
}

/* ---- Details of the selected row (Main page, right; see details.js) ---- */

.pane-details {
  padding: 12px 16px;
}

/* Top of a project's details: "+ Team request" (Timing view, magenta) or "+ Shopping request"
   (Shopping view, aqua); the new-request popover opens left of it (see app.js). */
.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.add-request {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 12px 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--add-color);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.add-request:hover {
  background: color-mix(in srgb, var(--add-color) 82%, var(--fg));
}

.add-request .icon {
  font-size: 18px;
}

.add-request.team {
  --add-color: var(--magenta);
}

.add-request.shopping {
  --add-color: var(--aqua);
}

/* A request's state: a button per state, the current one filled with its colour. */
.details-states {
  margin-bottom: 12px;
}

.details-state-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.state-btn {
  --state-color: var(--muted);
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.state-btn:hover:not(:disabled) {
  border-color: var(--state-color);
}

.state-btn[aria-pressed='true'] {
  border-color: var(--state-color);
  background: var(--state-color);
  color: var(--bg);
}

.state-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* A state set by itself (an item's Rented out): still clearly the current one. */
.state-btn:disabled[aria-pressed='true'] {
  opacity: 1;
}

.state-btn[data-state='approved'],
.state-btn[data-state='delivered'] {
  --state-color: var(--aqua);
}

.state-btn[data-state='ordered'],
.state-btn[data-state='rented_out'] {
  --state-color: var(--orange);
}

.state-btn[data-state='packed'],
.state-btn[data-state='not_found'] {
  --state-color: var(--violet);
}

.state-btn[data-state='done'],
.state-btn[data-state='available'] {
  --state-color: var(--green);
}

.state-btn[data-state='returned'] {
  --state-color: var(--accent);
}

.state-btn[data-state='issue'],
.state-btn[data-state='broken'] {
  --state-color: var(--danger);
}

.details-state-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}

.details-head {
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 4px solid var(--type-color);
}

.details-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.details-title {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
}

.details-fields {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
}

.details-fields dt {
  color: var(--muted);
}

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

.details-tasks h3 {
  margin: 18px 0 6px;
  font-size: 13px;
  font-weight: 600;
}

/* One card per task: header (number, time, duration), people, other fields folded away. */
.details-task {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* The selected task (see currentTask in details.js). */
.details-task.current {
  border-color: var(--magenta);
}

.details-task-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  background: var(--head);
  font-size: 13px;
}

.details-task-index {
  font-weight: 700;
  color: var(--magenta);
}

.details-task-time {
  flex: 1;
  font-weight: 600;
}

.details-task-duration {
  flex: none;
  font-size: 12px;
  color: var(--muted);
}

.details-people-title {
  padding: 8px 10px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* People of a task, one per line: name, role, and a button that takes them off the task. */
.details-people {
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
}

.details-person {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 6px 0 10px;
  font-size: 13px;
}

.details-person:hover {
  background: var(--hover);
}

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

.details-person-role {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.details-remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.details-remove:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.details-nobody {
  padding: 4px 10px 8px;
  font-size: 13px;
  color: var(--danger);
}

/* Folded fields (a task's other fields, a project's fields not in its form) behind a Material
   chevron (turned down while open) instead of the browser's marker. */
.details-more {
  border-top: 1px solid var(--line);
}

.details-more summary {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.details-more summary::-webkit-details-marker {
  display: none;
}

.details-more summary:hover {
  color: var(--fg);
}

.summary-icon {
  font-size: 16px;
  transition: transform 0.12s;
}

.details-more[open] .summary-icon {
  transform: rotate(90deg);
}

.details-more .details-fields {
  padding: 2px 10px 10px;
  font-size: 12px;
}

.details-empty {
  font-size: 13px;
  color: var(--muted);
}

/* ---- A project's form (see projectForm.js; fields as in the popovers below) ---- */

/* Name, exhibition, location and SharePoint | the team; one column when narrow. */
.project-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.project-form-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: start;
  gap: 12px 16px;
}

.project-form-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Search fields framed like the text fields. */
.project-form-combo .combo-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.project-form-combo .combo-input,
.project-form-combo .combo-ghost {
  height: 28px;
  font-size: 13px;
  line-height: 28px;
}

.project-form-combo .combo-input:focus {
  box-shadow: none;
}

.project-form-combo .combo-field:focus-within {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: -1px;
}

/* A field with a round button after it (SharePoint: open the link; an item: remove it). */
.project-link,
.artist-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-link > .popover-input,
.artist-item > .popover-input {
  flex: 1;
  min-width: 0;
}

.round-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
}

.round-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.round-btn.remove:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.round-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* The team: one member per line, then a search field adding one. */
.project-team {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.project-team .details-people {
  padding: 2px 0;
}

/* Narrow: the role gets shorter before the name does. */
.project-team .details-person-name {
  flex: 1 1 auto;
}

.project-team .details-person-role {
  flex: 0 100 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-team-empty {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.project-team-add .combo-field {
  border-width: 1px 0 0;
  border-radius: 0 0 6px 6px;
  background: none;
}

/* The artist's items: name, watts (unit inside the field), remove. */
.artist-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.watts {
  position: relative;
  flex: none;
  width: 96px;
}

.popover-input.watts-input {
  width: 100%;
  padding-right: 24px;
  appearance: textfield;
}

.watts-input::-webkit-inner-spin-button,
.watts-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.watts-unit {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.popover-btn.add-item {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  padding: 0 12px 0 8px;
}

.add-item .icon {
  font-size: 16px;
}

.project-form-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.project-form-status.error {
  color: var(--danger);
}

/* ---- Popovers (new team / shopping request, confirm delete) ---- */

/* Inside a gantt (placed by gantt.js), or .floating over the page in viewport coordinates. */
.popover {
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.18);
}

.popover.floating {
  position: fixed;
}

/* New rental request (see itemRequestPopover.js): the dropped item's picture and name. */
.item-request-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-request-item img {
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* New shopping request (see shoppingPopover.js): wider, for the page's picture and text. */
.shopping-popover {
  width: 340px;
}

.shop-more {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-image-box {
  display: grid;
  place-items: center;
  height: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff; /* product pictures are made for a white page */
  overflow: hidden;
}

.shop-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* A labelled field (label above), and fields side by side. */
.popover-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.popover-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.popover-row .popover-field {
  flex: 1;
}

.popover-text {
  font-size: 13px;
  font-weight: 600;
}

.popover-status,
.shop-facts {
  font-size: 12px;
  color: var(--muted);
}

.popover-input {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}

.popover-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: -1px;
}

.popover-input.popover-textarea {
  height: auto;
  min-height: 90px;
  padding: 6px 8px;
  line-height: 1.4;
  resize: vertical;
}

.popover-input.price-input {
  width: 100%;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.price-currency {
  flex: none;
  height: 30px;
  line-height: 30px;
  font-size: 12px;
  color: var(--muted);
}

/* Pieces: - input + */
.pieces {
  display: flex;
  gap: 4px;
}

/* As high as the pieces field. */
.popover-btn.pieces-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.pieces-input {
  width: 64px;
  text-align: center;
  appearance: textfield;
}

.pieces-input::-webkit-inner-spin-button,
.pieces-input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

/* A hint that is no error (e.g. the shop page could not be read; see shoppingPopover.js). */
.popover-notice {
  padding: 6px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--notice) 16%, var(--bg));
  color: var(--fg);
  font-size: 12px;
  line-height: 1.4;
}

.popover-error {
  font-size: 12px;
  color: var(--danger);
}

.popover-actions {
  display: flex;
  justify-content: space-between;
}

.popover-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
}

.popover-btn:hover:not(:disabled) {
  background: var(--hover);
}

.popover-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.popover-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.popover-btn.primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 85%, #000);
}

.popover-btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}

.popover-btn.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 85%, #000);
}

/* ---- Pages ---- */

/* Main page, Home view (the user's profile, later). */
.placeholder-page {
  flex: 1;
  overflow: auto;
  padding: 32px 24px;
}

.placeholder-card {
  max-width: 560px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.placeholder-card h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.placeholder-card p {
  margin: 0;
  color: var(--muted);
}

/* Table page: the level filter bar (only for request tables, see app.js), the table below. */
.table-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* A table cell's link (the Team view's mail addresses and phone numbers). */
.cell-link {
  color: var(--accent);
  text-decoration: none;
}

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