/* The portal's styles (loaded by index.html as app.css?v=<build>, see sw.js). */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --ink: #172325;
  --muted: #627271;
  --paper: #f4f0e6;
  --panel: rgba(255, 253, 246, 0.86);
  --panel-solid: #fdfbf4; /* the panel colour over the paper, for layers that cover the rows */
  --lime: #d5ef62;
  --lime-dark: #829e24;
  --coral: #ef765f;
  --teal: #5bb9b0;
  --sand: #e3b23c;
  --rose: #c1546b;
  --line: rgba(23, 35, 37, 0.15);
  /* The panes' outlines: --line as it looks on the paper, but solid, so it
     is the same grey on every pane whatever its fill (a see-through line
     takes on the colour of the pane under it). */
  --pane-line: #d3d1c9;
  /* Editing is slate blue (the drafting colour): the Edit pane / docked
     editor, and the selected days that it edits. */
  --edit-fill: #e7eef1;
  --edit-line: #b6c9d1;
  --select-tint: rgba(74, 122, 143, .14);
  --hover-tint: rgba(74, 122, 143, .06);
  --draft: #4a7a8f;
  --guide: #7d8986; /* rulers and measurement lines: a neutral ink grey */
  --ruler-size: 12px;
  /* settings: a panel sliding in over the page from the right */
  --drawer-width: min(320px, 85vw);
  --grid-cell: 32px;
  --slide-time: .28s;
  --slide: var(--slide-time) cubic-bezier(.3, 0, .2, 1);
  /* paper with a faint grid that fades out down the window (one window
     tall, drawn from the top-left corner of the window) */
  --page-grid:
    linear-gradient(to bottom, rgba(244, 240, 230, 0) 0, var(--paper) 90vh) 0 0 / 100% 100vh no-repeat,
    linear-gradient(rgba(23, 35, 37, .02) 1px, transparent 1px) 0 0 / var(--grid-cell) var(--grid-cell),
    linear-gradient(90deg, rgba(23, 35, 37, .02) 1px, transparent 1px) 0 0 / var(--grid-cell) var(--grid-cell),
    var(--paper);
}

/* The menu is a whole number of the paper grid's cells wide, so the grid looks
   the same when the page has slid by it: the grid stays put and only the page
   moves (moving the big grid layer made Firefox drop frames). */
@supports (width: round(down, 10px, 3px)) {
  :root {
    --drawer-width: round(down, min(320px, 85vw), var(--grid-cell));
  }
}

* {
  box-sizing: border-box;
}

/* `hidden` always wins over component display rules. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: 'Space Grotesk', sans-serif;
}

html {
  overflow-x: hidden;
}

/* Everything but settings. Settings slides in over the page from the right;
   nothing of the page moves (a moving page, rulers and grid are a lot of
   pixels to move on every frame). */
.page {
  --logo-top: calc(var(--ruler-size) + 4px);
  --logo-left: calc(var(--ruler-size) + 14px);
  --logo-height: 38px; /* a small, fixed header (28px / 24px on smaller screens) */
  --logo-bottom: 3px; /* under the logo: 57px in all on bigger screens */
  --topbar-height: calc(var(--logo-top) + var(--logo-height) + var(--logo-bottom));
  position: relative;
  z-index: 1;
  /* A column a window tall at least: header, the page (or the sign-in
     sheet), which takes the spare height, and the footer at the bottom. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: transform var(--slide);
}

/* The paper's grid: a fixed layer of its own (a background pinned to the
   window would make phones repaint the whole page on every frame of a
   scroll). It does not slide with the page: the menu is a whole number of its
   cells wide, so it looks the same. */
body::before {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  height: 100lvh; /* a full screen, so the address bar coming and going doesn't resize it */
  content: '';
  pointer-events: none;
  background: var(--page-grid);
}

/* The rulers belong to the drafting table, so they move with the page; the
   top one runs on across the menu. */
.ruler,
.ruler-corner {
  transition: transform var(--slide);
}

/* The panes, with room on their left for the week guides. */
.shell {
  position: relative;
  flex: 1 0 auto; /* takes the window's spare height, so the footer is at its bottom */
  width: min(1214px, calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0 96px 34px;
}

/* The top of the page is a slim header that stays while scrolling: the
   logo in the top-left corner, then the tabs; the menu button top right. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--topbar-height);
  padding: var(--logo-top) 20px var(--logo-bottom) var(--logo-left);
  border-bottom: 1px solid var(--line);
  /* the same grid, lined up: the header always sits at the window's top left */
  background: var(--page-grid);
}

/* The tabs' row: the whole header wide, under the logo and the menu button
   (the header's covers, below), so when the tabs don't fit between them they
   scroll sideways, going behind them. At rest they start after the logo
   and end before the menu button (fitHeader() sets its padding and the covers). */
.brand {
  position: absolute;
  inset: 0 0 -1px 0; /* down to the header's bottom line, where the current tab's line is */
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: var(--logo-top) var(--brand-right, 0px) calc(var(--logo-bottom) + 1px) var(--brand-left, 0px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.brand::-webkit-scrollbar {
  display: none;
}

/* Over the tabs' row, left and right: solid bars of the header's paper, with
   its bottom line, up to half a gap past the tabs' start and before the menu
   button; the logo and the menu button sit on top. A bar casts a shadow over
   the row while tabs are hidden behind it (.has-more-left / -right, set by
   showHiddenTabs()), so it shows there is more even when no tab is cut. */
.topbar::before,
.topbar::after {
  position: absolute;
  top: 0;
  bottom: -1px;
  z-index: 1;
  content: '';
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .2s ease;
  pointer-events: none;
}

.topbar::before {
  left: 0;
  width: var(--cover-left, 0px);
}

.topbar::after {
  right: 0;
  width: var(--cover-right, 0px);
}

.topbar.has-more-left::before {
  box-shadow: 7px 0 9px -6px rgba(23, 35, 37, .5);
}

.topbar.has-more-right::after {
  box-shadow: -7px 0 9px -6px rgba(23, 35, 37, .5);
}

.topbar > .settings-toggle,
.topbar-meta {
  position: relative;
  z-index: 2;
}

/* The logo leads the header, then the tabs; the menu
   button sits at the right. */
.topbar > .settings-toggle {
  margin-left: auto; /* the tabs' row is under the header, not in it: the button keeps to the right */
  margin-right: -6px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-button {
  display: block;
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.brand-button:hover,
.brand-button:active {
  background: none;
  transform: none;
  box-shadow: none;
}

/* Settings: a plain grey burger, no border, darker on hover. */
.settings-toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--muted);
}

.settings-toggle:hover,
.settings-toggle:active {
  background: none;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* While the menu is open the burger's outer lines fold into a chevron
   pointing right (the way the page is pushed) and the middle one goes: the arms
   are 6 x 6 units, meeting at 15,12. */
.burger path {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .2s ease, opacity .15s ease;
}

.settings-toggle[aria-expanded="true"] .burger-top {
  transform: translateY(2px) rotate(45deg) scaleX(.53);
}

.settings-toggle[aria-expanded="true"] .burger-middle {
  opacity: 0;
}

.settings-toggle[aria-expanded="true"] .burger-bottom {
  transform: translateY(-2px) rotate(-45deg) scaleX(.53);
}

/* The menu: the next section of the same sheet, to the right of the page.
   Opening it slides the page and its rulers left by the menu's width and the
   menu in from the right, together (the paper grid is the same after the slide,
   so it stays); the top ruler runs on across it. The menu is a still column; the sheet in it waits just off the right edge.
   Everything that moves does so by a transform, which the compositor does
   without repainting or laying anything out. */
.settings-open .page,
.settings-open .ruler,
.settings-open .ruler-corner {
  transform: translateX(calc(-1 * var(--drawer-width)));
}

.settings-panel {
  --logo-height: 38px; /* as the page's header (it follows the page's sizes) */
  --logo-bottom: 3px;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4; /* under the rulers, which run on across it */
  width: var(--drawer-width);
  visibility: hidden;
  transition: visibility 0s linear var(--slide-time); /* hidden only once the slide is done */
}

.settings-open .settings-panel {
  visibility: visible;
  transition: visibility 0s;
}

.settings-sheet {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line);
  background: #e8e3d6;
  font: .66rem/1.5 'DM Mono', monospace;
  transform: translateX(100%);
  will-change: transform;
  transition: transform var(--slide);
}

.settings-open .settings-sheet {
  transform: none;
}

.text-size {
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-size output {
  min-width: 5ch;
  color: var(--ink);
  text-align: center;
}

/* The top of the sheet: the full width of the menu, on the sheet's own paper
   with an ink line under it, with the title in the tabs' type and
   a close button (the panel covers the menu button). */
.settings-bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--ruler-size) + 4px + var(--logo-height) + var(--logo-bottom)); /* as tall as the page's header, its line on the same row */
  padding: calc(var(--ruler-size) + 4px) 22px var(--logo-bottom);
  border-bottom: 1px solid var(--ink);
  font: 500 .68rem 'DM Mono', monospace; /* the tabs' */
  letter-spacing: .13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.settings-title {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
}

.settings-close {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--ink); /* as the title */
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.settings-close:hover,
.settings-close:active {
  background: none;
  color: var(--coral);
  transform: none;
  box-shadow: none;
}

.settings-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 6px 20px 20px 14px;
}

.settings-group {
  padding: 10px 0;
}

.settings-group + .settings-group {
  border-top: 1px solid var(--line);
}

.settings-group h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font: 500 .6rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.settings-panel input {
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: rgba(91, 185, 176, .08);
  color: var(--ink);
  font: .7rem 'DM Mono', monospace;
}

.settings-panel input:focus {
  outline: 1px solid var(--draft);
  outline-offset: -1px;
}

.settings-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .58rem;
}

/* The signed-in member, as a drawing's title block. */
.title-block {
  margin: auto 0 0; /* at the bottom of the sheet */
  border: 1px solid var(--ink);
  background: var(--panel-solid);
}

.title-cell {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 10px;
}

.title-name {
  border-bottom: 1px solid var(--ink);
}

.title-name b {
  font: 500 1.05rem 'Space Grotesk', sans-serif;
  overflow-wrap: anywhere;
}

.title-label {
  color: var(--muted);
  font-size: .54rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.title-row {
  display: flex;
}

.title-email {
  flex: 1;
  border-right: 1px solid var(--ink);
  overflow-wrap: anywhere;
}

.title-signout {
  align-self: stretch;
  min-height: 0;
  padding: 6px 10px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--coral);
  font: inherit;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Signing out is serious: it goes red under the pointer. */
.title-signout {
  transition: background-color .15s ease, color .15s ease;
}

.title-signout:hover,
.title-signout:active,
.title-signout:focus-visible {
  background: #c8372d;
  color: #fff;
  transform: none;
  box-shadow: none;
}

.rate-row {
  display: grid;
  grid-template-columns: 7ch minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.rate-row + .rate-row {
  margin-top: 4px;
}

.rate-row {
  margin: 0;
  font-size: .66rem;
}

.rate-row b {
  font-weight: 500;
  text-align: right;
}

.rate-project + .rate-project {
  margin-top: 10px;
}

.rate-project-name {
  margin: 0 0 4px;
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .08em;
}

.rate-project-name span {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}

#settingsTitle:focus {
  outline: none;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--draft);
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-transform: none;
}

.link-button:hover,
.link-button:active {
  background: none;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* The logo: the brand's one-line "argerus" (outlined, traced from the
   compact logo artwork) with "software consulting AB" under it, as an
   inline drafting sketch (drawn once, then gently alive): guides, a
   construction circle, the selected g, a construction curve and two
   dimensions. Units: a letter is 34.2 units tall. */
.logo {
  --logo-grey: #615d58;
  display: block;
  width: auto;
  height: var(--logo-height);
}

.logo .draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: logo-draw var(--dur, 1s) cubic-bezier(.22, .8, .3, 1) var(--delay, 0s) both; }
.logo .fade { animation: logo-fade .6s ease-out var(--delay, 0s) both; }
.logo .guide { stroke: var(--guide); stroke-width: .45; opacity: .5; }
.logo .guide.faint { opacity: .3; }
.logo .dashed { stroke-dasharray: 2 2; }
/* Outline only: the letters are drawn as lines and stay that way. */
.logo .ink { fill: none; stroke: var(--logo-grey); stroke-width: 1.2; stroke-linejoin: round; }
.logo .logo-tagline { fill: var(--logo-grey); }
.logo .dim { stroke: var(--guide); stroke-width: .45; }
.logo .label { fill: var(--guide); font: 500 6px 'DM Mono', monospace; letter-spacing: .02em; text-transform: none; }
/* Continuous motion once drawn: marching dashes, like a drawing still
   being worked on. */
.logo .march { animation: logo-march 14s linear infinite; }
.logo .march.slow { animation-duration: 40s; }

/* While anything scrolls, the decorative loops hold still, so a phone
   doesn't repaint them on every frame of a flick (body.is-scrolling) */
.is-scrolling .logo *,
.is-scrolling .status-dot {
  animation-play-state: paused;
}

@keyframes logo-draw { from { stroke-dashoffset: 1; } }
@keyframes logo-fade { from { opacity: 0; } }
@keyframes logo-march { to { stroke-dashoffset: -60; } }

@media (prefers-reduced-motion: reduce) {
  .logo *,
  .page,
  body::before,
  .ruler,
  .ruler-corner,
  .settings-panel,
  .settings-sheet {
    animation: none !important;
    transition: none !important;
  }
}

/* Drafting-table decoration: rulers along the viewport edges and live
   dimension lines around the panes (drawn by drawDrafting()). */
.ruler {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  color: var(--guide);
  background-color: rgba(244, 240, 230, .92);
  font: 500 .5rem 'DM Mono', monospace;
  letter-spacing: .02em;
}

.ruler-x {
  top: 0;
  left: 0;
  right: calc(-1 * var(--drawer-width)); /* runs on across the menu, right of the page */
  height: var(--ruler-size);
  border-bottom: 1px solid rgba(125, 137, 134, .35);
  background-image:
    linear-gradient(90deg, rgba(125, 137, 134, .55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 137, 134, .45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 137, 134, .35) 1px, transparent 1px);
  background-size: 100px 100%, 50px 6px, 10px 3px;
  background-position: 0 0, 0 100%, 0 100%;
  background-repeat: repeat-x;
}

.ruler-y {
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--ruler-size);
  border-right: 1px solid rgba(125, 137, 134, .35);
  background-image:
    linear-gradient(rgba(125, 137, 134, .55) 1px, transparent 1px),
    linear-gradient(rgba(125, 137, 134, .45) 1px, transparent 1px),
    linear-gradient(rgba(125, 137, 134, .35) 1px, transparent 1px);
  background-size: 100% 100px, 6px 50px, 3px 10px;
  background-position: 0 0, 100% 0, 100% 0;
  background-repeat: repeat-y;
}

.ruler-x span,
.ruler-y span {
  position: absolute;
  line-height: 1;
}

.ruler-x span {
  top: 1px;
  margin-left: 3px;
}

.ruler-y span {
  left: 1px;
  margin-top: 3px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.ruler-x::after,
.ruler-y::after {
  position: absolute;
  content: '';
  background: var(--coral);
}

/* The pointer's place on the rulers. */
.ruler-x::after {
  top: 0;
  bottom: 0;
  left: var(--pointer-x, -10px);
  width: 1px;
}

/* With the menu open the ruler has slid left by the menu's width. */
.settings-open .ruler-x::after {
  left: calc(var(--drawer-width) + var(--pointer-x, -10px));
}

.ruler-y::after {
  left: 0;
  right: 0;
  top: var(--pointer-y, -10px);
  height: 1px;
}

.ruler-corner {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  width: var(--ruler-size);
  height: var(--ruler-size);
  border-right: 1px solid rgba(125, 137, 134, .35);
  border-bottom: 1px solid rgba(125, 137, 134, .35);
  background: var(--paper);
  pointer-events: none;
}

.drafting {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.drafting .dim {
  stroke: var(--guide);
  stroke-width: .75;
  opacity: .7;
}

.drafting .ext {
  stroke: var(--guide);
  stroke-width: .5;
  opacity: .45;
}

.drafting .crop {
  stroke: var(--coral);
  stroke-width: .75;
  opacity: .8;
}

.drafting text {
  fill: var(--guide);
  font: 500 9px 'DM Mono', monospace;
  letter-spacing: .04em;
}


.drafting.is-intro .draw {
  stroke-dasharray: 1;
  animation: draft-draw .7s cubic-bezier(.65, 0, .35, 1) var(--delay, 0s) both;
}

.drafting.is-intro text {
  animation: draft-fade .5s ease-out var(--delay, 0s) both;
}

@keyframes draft-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes draft-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .drafting.is-intro .draw,
  .drafting.is-intro text {
    animation: none;
  }
}

/* Sections of the portal as tabs in the header (only Timesheet so far):
   coral caps, the current one underlined on the header's bottom line. */
.tabs {
  display: flex;
  align-self: stretch;
  gap: 22px;
}

/* The header row never shrinks its parts; when they don't fit, the tabs
   scroll (fitHeader()). */
.topbar-meta,
.tab {
  flex-shrink: 0;
}

.tab {
  white-space: nowrap;
}

/* The tab text sits on the logo letters' baseline: centred, then pushed
   down by twice the gap between the centre and that baseline (73.75% down
   the logo) less half the caps height (.735em). */
.tab {
  position: relative;
  display: flex;
  align-items: center;
  padding-top: calc(var(--logo-height) * .475 - .735em);
  color: var(--muted);
  font: 500 .68rem 'DM Mono', monospace;
  letter-spacing: .13em;
  text-decoration: none;
  text-transform: uppercase;
}

/* Bigger screens: the header a tenth larger (57px: the logo 38px, tabs
   and menu button a tenth larger). */
@media (min-width: 801px) {
  .tab,
  .settings-bar {
    font-size: .75rem;
  }

  .burger {
    width: 22px;
    height: 22px;
  }
}

.tab:hover,
.tab[aria-current="page"] {
  color: var(--coral);
}

.tab[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: calc(-1 * (var(--logo-bottom) + 1px)); /* its lower pixel on the header's bottom line: under the header's padding and border */
  left: 0;
  height: 2px;
  content: '';
  background: var(--coral);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #53b85a;
  box-shadow: 0 0 0 4px rgba(83, 184, 90, .16);
  animation: live-pulse 2.4s ease-in-out infinite;
  transition: background .2s ease;
}

/* Brief flash whenever a new line arrives in the log. */
.status-dot.is-flash {
  background: #8be08f;
  box-shadow: 0 0 0 5px rgba(83, 184, 90, .35);
}

@keyframes live-pulse {
  50% { box-shadow: 0 0 0 6px rgba(83, 184, 90, .04); }
}

.dock-head .status {
  margin-left: auto;
  margin-right: 12px;
  font-size: .58rem;
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

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

/* Panes: a thin grey border, like the log's. */
.board,
.panel,
.balance-pane {
  border: 1px solid var(--pane-line);
  background: var(--panel);
}

/* The timesheet has no border: a lighter sheet on the paper. Only its top
   (the summary on phones and the column names) is framed, in the same thin
   grey: the sides here, the top line below, and the lines already under
   each part (never two lines). */
.board {
  border: none;
}

/* The Balance tab (§23): the chart and the months in the main column,
   the figures and the latest transactions in a side column (380px, like
   the timesheet's); one column on narrow screens. */
.balance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
}

.balance-main,
.balance-side {
  display: grid;
  gap: 20px;
}

.balance-pane {
  padding: 16px 18px;
}

.balance-pane h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
  font: 500 .74rem 'DM Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.balance-pane h2 small,
.balance-pane h2 .link-button {
  color: var(--muted);
  font-size: .64rem;
  letter-spacing: .04em;
  text-transform: none;
}

.balance-pane h2 .link-button {
  color: var(--draft);
}

.balance-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.balance-big {
  margin: 0 0 10px;
  font: 700 1.9rem/1.1 'Space Grotesk', sans-serif;
  letter-spacing: -.02em;
}

.balance-chart {
  display: block;
  width: 100%;
  height: auto;
  font: 9.5px 'DM Mono', monospace;
  fill: var(--muted);
}

.balance-zero {
  stroke: var(--pane-line);
}

.balance-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
}

.balance-line.is-preliminary {
  stroke-dasharray: 4 3;
}

.balance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .6rem;
}

.balance-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  vertical-align: -1px;
}

.balance-legend i.is-balance {
  height: 0;
  border-top: 1.6px solid var(--ink);
  vertical-align: 3px;
}

.balance-table,
.balance-figures {
  width: 100%;
  border-collapse: collapse;
}

.balance-table th {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .58rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
}

.balance-table td,
.balance-figures td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.balance-figures td {
  padding: 5px 2px;
}

.balance-table .balance-num,
.balance-figures .balance-num {
  text-align: right;
  white-space: nowrap;
}

.balance-num.is-earned {
  color: #2c6f69;
}

.balance-num.is-drawn {
  color: #b8432e;
}

.balance-muted,
.balance-empty {
  color: var(--muted);
}

.balance-month.is-open {
  background: var(--select-tint);
}

.balance-month.is-preliminary td {
  color: var(--muted);
  font-style: italic;
}

.balance-toggle {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  text-transform: none;
}

.balance-toggle:hover {
  background: none;
}

.balance-parts td {
  padding-left: 26px;
  color: var(--muted);
  font-size: .64rem;
  line-height: 1.7;
}

.balance-line-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.balance-line-item b {
  color: var(--ink);
  font-weight: 400;
}

/* The Expenses tab (§24): your expenses in the main column, the form for a
   new one in a side column (380px, like the timesheet's). */
.expenses {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
}

.expenses-pane {
  padding: 16px 18px;
  border: 1px solid var(--pane-line);
  background: var(--panel);
}

.expenses-pane h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
  font: 500 .74rem 'DM Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.expenses-pane h2 .link-button {
  color: var(--draft);
  font-size: .64rem;
  letter-spacing: .04em;
  text-transform: none;
}

.expenses-table {
  width: 100%;
  border-collapse: collapse;
}

.expenses-table th {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .58rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
}

.expenses-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.expenses-num {
  text-align: right;
  white-space: nowrap;
}

.expenses-muted,
.expenses-empty,
.expenses-hint,
.expenses-label {
  color: var(--muted);
}

.expenses-note {
  color: #b8432e;
  font-size: .62rem;
}

.expenses-status {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--pane-line);
  color: var(--muted);
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.expenses-status.is-submitted {
  border-color: var(--draft);
  color: var(--draft);
}

.expenses-status.is-approved {
  border-color: var(--teal);
  background: rgba(91, 185, 176, .14);
  color: #2c6f69;
}

.expenses-status.is-rejected {
  border-color: var(--coral);
  color: #b8432e;
}

.expenses-form {
  display: grid;
  gap: 10px;
}

.expenses-form h2 {
  margin-bottom: 2px;
}

.expenses-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: .62rem;
}

.expenses-form input:not([type="radio"]):not([type="file"]) {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--pane-line);
  background: #fff;
  color: var(--ink);
  font: .7rem 'DM Mono', monospace;
}

.expenses-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.expenses-label,
.expenses-hint,
.expenses-amount,
.expenses-message {
  margin: 0 0 3px;
  font-size: .62rem;
}

.expenses-amount {
  align-self: center;
  color: #2c6f69;
}

.expenses-message {
  min-height: 1.2em;
  color: #b8432e;
}

/* Segmented choices: the kind, what it was for, how it was paid. */
.expenses-seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--pane-line);
}

.expenses-seg label {
  display: block;
  color: var(--ink);
}

.expenses-seg input {
  position: absolute;
  opacity: 0;
}

.expenses-seg span,
.expenses-seg button {
  display: block;
  min-height: 0;
  padding: 5px 9px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font: .64rem 'DM Mono', monospace;
  text-transform: none;
  cursor: pointer;
}

.expenses-seg input:checked + span,
.expenses-seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--panel);
}

.expenses-seg input:focus-visible + span {
  outline: 2px solid var(--draft);
  outline-offset: -2px;
}

.expenses-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expenses-buttons .term-action {
  min-height: 32px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The footer, at every screen size: no logo (the header has it), the
   company and the portal, and the deployed version (from version.json). */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px 34px;
  color: var(--muted);
  font: .62rem/1.6 'DM Mono', monospace;
  letter-spacing: .04em;
  text-align: center;
}

.site-footer p {
  margin: 0;
}


/* The timesheet: the summary on top, then the days. The page scrolls as a
   whole (the table has no scroll of its own). Nothing is clipped, so the
   frame around its top can sit just outside it. */
.board {
  position: relative;
}

/* Sticks under the header: the month, the billable totals and the bar (or,
   while days are selected, the editor) and the column names. */
.board {
  --col-date: 132px;
  --col-select: 56px;
}

/* One line between the sections, never two: the totals (one column) are
   ruled off below, the legends below, and the column names below. */
.board-sticky {
  position: sticky;
  top: var(--topbar-height);
  z-index: 3;
  background: var(--panel-solid);
}

/* The column names, lined up with the table's columns; they stick right
   under the part above (--sticky-height is measured by the page). */
.sheet-columns {
  position: sticky;
  top: calc(var(--topbar-height) + var(--sticky-height, 0px));
  z-index: 2;
  background: var(--panel-solid);
  display: grid;
  grid-template-columns: var(--col-date) minmax(0, 1fr) var(--col-select);
  border-bottom: 1px solid var(--pane-line); /* the bottom of the frame */
  color: var(--muted);
  font: .62rem 'DM Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* The frame around the timesheet's top (see .board): drawn just outside
   it, so the top is exactly as wide as the rows. */
.board .board-sticky:has(.sheet-totals),
.board .sheet-details,
.board .sheet-columns {
  box-shadow: -1px 0 0 var(--pane-line), 1px 0 0 var(--pane-line);
}

/* The top line too is just outside: locked at the top, it lies on the
   header's own hairline (one line, not two). The side column's panes are
   raised by the same pixel (see .side). */
.board .board-sticky:has(.sheet-totals) {
  box-shadow: 0 -1px 0 var(--pane-line), -1px -1px 0 var(--pane-line), 1px -1px 0 var(--pane-line), -1px 0 0 var(--pane-line), 1px 0 0 var(--pane-line);
}


.sheet-columns span {
  padding: 10px 12px;
}

.col-date {
  width: var(--col-date);
}

.col-select {
  width: var(--col-select);
}

/* The month and Prev / Next: the first row of the timesheet's sticky
   header, above the billable hours. */
.board-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  padding: 12px 22px 0;
}

.sheet-column {
  min-width: 0;
}

.sheet-totals {
  padding: 14px 22px;
}

/* Scrolls away under the sticky part: the legends and hours per activity. */
.sheet-details {
  padding: 12px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-solid); /* its own, so it fills its width when it widens */
  container-type: inline-size;
}

.sheet-details .type-legend {
  margin-top: 10px;
}

@container (max-width: 340px) {
  .sheet-details .type-legend {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

/* The month: mono caps, tracked, like the tabs and labels; the Billable
   amount heading matches it. Larger on bigger displays. */
h1,
.panel h2 {
  margin: 0;
  font: 500 .84rem/1 'DM Mono', monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (min-width: 801px) {
  h1,
  .panel h2 {
    font-size: 1.05rem;
  }
}

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

/* Prev / Next are plain text links; they underline on hover. */
.month-nav .nav-link {
  min-height: 0;
  padding: 6px 2px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font: 500 .68rem 'DM Mono', monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: none;
}

.month-nav .nav-link:hover,
.month-nav .nav-link:active {
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: none;
  box-shadow: none;
}

/* The month title opens a month / year calendar; it underlines on hover. */
.month-heading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* A submitted month: a quiet lock and "SUBMITTED" after its title. */
.submitted-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font: 500 .58rem/1 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.submitted-badge[hidden] {
  display: none;
}

.month-title {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  transition: none;
}

/* No underline: a quiet colour change says it can be pressed. */
.month-title:hover,
.month-title:active,
.month-title[aria-expanded="true"] {
  background: none;
  color: var(--draft);
  text-decoration: none;
  transform: none;
  box-shadow: none;
}

.month-picker {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  width: 252px;
  padding: 12px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  font: .66rem 'DM Mono', monospace;
}

.picker-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font: 700 1rem 'Space Grotesk', sans-serif;
  letter-spacing: -.02em;
}

.picker-step {
  width: 30px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: none;
  box-shadow: none;
  font-size: .9rem;
}

.picker-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.picker-month {
  position: relative;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 253, 246, .9);
  box-shadow: none;
  color: var(--ink);
  font: 500 .64rem 'DM Mono', monospace;
  letter-spacing: .04em;
  text-transform: none;
  transition: none;
}

.picker-step:hover,
.picker-month:hover {
  background: rgba(91, 185, 176, .14);
  transform: none;
  box-shadow: none;
}

.picker-month.is-current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.picker-month.is-this-month:not(.is-current) {
  border-color: var(--ink);
}

/* A small check on months that have been submitted. */
.picker-month.is-submitted::after {
  position: absolute;
  top: 1px;
  right: 3px;
  content: '\2713';
  font-size: .55rem;
  opacity: .7;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .82rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The selection toggle: its own cell at the end of the row, a shade
   darker so it reads as a separate section. */
tbody td.select-cell {
  padding: 0;
}

/* One tick box per entry, on the entries' lines. */
.select-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 0;
}

.select-stack .select-toggle {
  min-height: 20px;
}

.select-toggle {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

/* Quiet until wanted: a grey box, ink on the row's hover. On weekends and
   red days it is fainter still. */
.select-toggle::before {
  width: 14px;
  height: 14px;
  content: '';
  border: 1.5px solid rgba(23, 35, 37, .25);
  background: #fff;
  transition: border-color .12s ease, opacity .12s ease;
}

tbody tr:hover .select-toggle::before,
tbody tr.is-selected .select-toggle::before,
.select-toggle:focus-visible::before {
  border-color: var(--ink);
}

tbody tr:is(.is-weekend, .is-redday):not(:hover, .is-selected, .is-partly-selected) .select-toggle[aria-checked="false"]:not(:focus-visible)::before {
  border-color: rgba(23, 35, 37, .12);
  background: transparent; /* the day off's paper shows through */
}

/* Locked days: a small grey lock instead of the box; ticked, it is ink on
   a light tint, in a frame. */
.select-toggle.is-lock::before {
  display: none;
}

.select-toggle.is-lock,
.row-lock {
  color: rgba(23, 35, 37, .4);
}

.row-lock {
  display: grid;
  place-items: center;
}

tbody tr:hover .select-toggle.is-lock {
  color: var(--ink);
}

.select-toggle.is-lock[aria-checked="true"] svg {
  padding: 2px;
  box-sizing: content-box;
  background: var(--select-tint);
  color: var(--ink);
  outline: 1.5px solid var(--ink);
}

.select-toggle[aria-checked="true"]::before {
  background: var(--ink);
  box-shadow: inset 0 0 0 2px #fff;
}

.select-toggle:hover,
.select-toggle:active {
  background: none;
  transform: none;
  box-shadow: none;
}

.select-toggle:hover::before {
  border-color: var(--teal-dark, var(--ink));
  background: rgba(91, 185, 176, .25);
}

.select-toggle[aria-checked="true"]:hover::before {
  background: var(--ink);
}

.select-toggle:focus-visible {
  outline: none;
}

.select-toggle:focus-visible::before {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

/* Days off (weekends and red days) blend into the page: the paper itself. */
tbody tr.is-weekend,
tbody tr.is-redday {
  background-color: var(--paper);
}

/* Preliminary days (entries, not done yet): fine, very light teal
   stripes, a quiet echo of the bar's and day edge's preliminary pattern. */
tbody tr.is-preliminary {
  background-image: repeating-linear-gradient(45deg, rgba(91, 185, 176, .1) 0 2px, transparent 2px 6px);
}

/* Today: the date number is inverted, like a wall calendar's today (no row
   tint, so it never competes with the lime "Mark done" or the selection). */
tbody tr.is-today td .day-num {
  margin-left: -4px;
  padding: 1px 4px;
  background: var(--ink);
  color: var(--paper);
}

tbody tr.is-today td .day-num.is-red {
  background: var(--coral);
  color: #fffdf6;
}

/* Keyboard focus: an ink outline (no size change). */
tbody tr:focus {
  outline: none;
}

/* Only while moving with the keyboard: a press (plain, ctrl- or
   shift-click) never outlines the row. */
.keyboard-nav tbody tr:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: -1.5px;
}

/* Done days: everything in ink. (Preliminary days are told apart by their
   striped background; their text is a readable ink-grey.) */
tbody tr.is-done .segment-label,
tbody tr.is-done .edited-value {
  color: var(--ink);
}

#dayRows:not(.is-locked) tr {
  cursor: pointer;
  user-select: none;
}

#dayRows:not(.is-locked) tr:not(.is-selected):hover {
  background-color: var(--hover-tint);
}

/* Selected days (ticked, or the day clicked): a slate tint, like the
   editor's; the row keeps its size. */
tbody tr.is-selected {
  background-color: var(--select-tint);
}

/* A day with several entries can be partly selected: the selected entries
   get the tint (and their own tick boxes). */
.segment-row.is-selected {
  background: var(--select-tint);
  box-shadow: 0 0 0 3px var(--select-tint);
}

tbody td.date-cell {
  position: relative;
}

/* Weeks: measurement lines outside the timesheet, left of the days, in
   the style of the page's dimension lines (renderWeekGuides places them). */
.week-guides {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 1;
}

.week-guide {
  position: absolute;
  display: grid;
  place-items: center;
  width: 16px;
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--guide);
  text-transform: none;
  transition: none;
}

/* the line */
.week-guide::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  content: '';
  border-left: .75px solid currentColor;
  opacity: .7;
}

/* slanted end ticks, like the dimension lines' */
.week-tick {
  position: absolute;
  left: calc(50% - 4px);
  width: 8px;
  border-top: .75px solid currentColor;
  transform: rotate(-45deg);
}

.week-tick.is-start {
  top: 0;
}

.week-tick.is-end {
  bottom: 0;
}

.week-label {
  position: relative;
  padding: 5px 0;
  background: var(--paper);
  font: 500 9px 'DM Mono', monospace;
  letter-spacing: .04em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

button.week-guide {
  cursor: pointer;
}

button.week-guide:hover,
button.week-guide:active,
button.week-guide:focus-visible {
  background: none;
  color: var(--coral);
  transform: none;
  box-shadow: none;
  outline: none;
}

/* The day's hours as a vertical bar in the left edge: one part per entry,
   in entry order, scaled so 8h fills the row (more than 8h fits the total).
   Solid when the day is done, checkered while preliminary; the faint track
   shows what's left of an 8h day. */
.activity-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 6px;
  background: rgba(23, 35, 37, .06);
}

.edge-part {
  flex: none;
  background: var(--segment-color);
}

/* The day rows' text is an eighth larger than the rest of the table. */
.day-num {
  font-family: 'DM Mono', monospace;
  font-size: .92rem;
  font-weight: 500;
}

.day-num.is-red {
  color: var(--coral);
}

.day-name {
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: .81rem;
  text-transform: uppercase;
}

.holiday-tag {
  display: block;
  margin-top: 2px;
  color: var(--coral);
  font: .65rem 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.hours-cell {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 12px;
  min-width: 190px;
}

.segments-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 24px;
  justify-content: center;
}

.segment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.edge-part.is-preview,
.bar-part.is-preview,
.swatch.is-preview {
  background-image: repeating-linear-gradient(45deg, color-mix(in srgb, var(--segment-color) 55%, white) 0 5px, white 5px 10px) !important;
}

.segment-label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted); /* like the help: the hours muted, the activity in ink */
  font: calc(.75rem * var(--row-text-scale, 1)) 'DM Mono', monospace; /* the entries, readable; the text size setting scales them */
  white-space: nowrap;
}

/* Changed from the day's default: full ink, a notch darker than the
   untouched defaults. */
.edited-value {
  color: var(--ink);
  font-weight: 400;
}

/* The activity name is a fixed-width column (room for "Parental leave"),
   so the hours start at the same place on every row. It still shrinks
   with an ellipsis when the cell is too narrow. */
.segment-activity {
  --activity-step-space: 0px;
  color: var(--ink);
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 1px;
  width: calc(16ch + 2 * var(--activity-step-space));
  min-width: 0;
}

.segment-activity > .activity-name,
.segment-activity > .activity-picker-trigger {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Locked days have no ‹ › around the activity: the same space instead. */
.segment-row.is-locked .segment-activity {
  padding-left: var(--activity-step-space);
}

/* Done (read-only) days have no ‹ › arrows, so they get the same space
   around the hours instead: their hours line up with editable days. */
.segment-hours {
  --step-space: 0px;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 1px;
}

.segment-row.is-locked .segment-hours {
  padding: 0 var(--step-space);
}

.segment-hours .hours-value {
  display: inline-block;
  min-width: 5ch;
  text-align: center;
}

/* ‹ › hour steppers: on hover (and on the selected row) where a pointer
   can hover; always on touch screens when the cell has room for them. */
.segments-list {
  container-type: inline-size;
}

.hours-step,
.activity-step {
  display: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font: 500 .8rem/1 'DM Mono', monospace;
  transition: none;
}

.hours-step.is-down::before,
.activity-step.is-down::before {
  content: '\2039';
}

.hours-step.is-up::before,
.activity-step.is-up::before {
  content: '\203A';
}

.hours-step:hover,
.activity-step:hover,
.hours-step:active,
.activity-step:active {
  border-color: var(--line);
  background: rgba(255, 253, 246, .8);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* Transparent rather than hidden, so a click that lands before the hover
   state updates still hits the arrow. */
@media (hover: hover) {
  .hours-step,
  .activity-step {
    display: inline-flex;
    opacity: 0;
  }

  .segment-hours {
    --step-space: 17px;
  }

  .segment-activity {
    --activity-step-space: 17px;
  }

  #dayRows:not(.is-locked) tr:hover .hours-step,
  #dayRows:not(.is-locked) tr:hover .activity-step,
  tbody tr.is-selected .hours-step,
  tbody tr.is-selected .activity-step,
  .hours-step:focus-visible,
  .activity-step:focus-visible {
    opacity: 1;
  }
}

@media (hover: none) {
  @container (min-width: 190px) {
    .hours-step {
      display: inline-flex;
      width: 26px;
      height: 26px;
    }

    .segment-hours {
      --step-space: 27px;
    }
  }

  /* the activity's arrows need more room; below that, only the hours' */
  @container (min-width: 300px) {
    .activity-step {
      display: inline-flex;
      width: 26px;
      height: 26px;
    }

    .segment-activity {
      --activity-step-space: 27px;
    }
  }
}

.activity-picker-trigger {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0;
  border: none;
  min-height: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: none;
  box-shadow: none;
}

.activity-picker-trigger:hover,
.activity-picker-trigger:active {
  background: none;
  color: var(--coral);
  transform: none;
  box-shadow: none;
}

.hours-edit-trigger {
  padding: 0;
  border: none;
  min-height: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
  box-shadow: none;
}

/* Fixed width (the font is monospaced), so the ‹ › arrows around it don't
   move when the value changes length, e.g. 8h → 7.5h. */
.segment-hours .hours-edit-trigger {
  min-width: 5ch;
  text-align: center;
}

.hours-edit-trigger:hover,
.hours-edit-trigger:active {
  background: none;
  color: var(--teal);
  transform: none;
  box-shadow: none;
}


.hours-empty {
  color: var(--muted);
  font: calc(.75rem * var(--row-text-scale, 1)) 'DM Mono', monospace;
}

.empty-segment {
  display: flex;
  align-items: center;
  min-height: 20px;
}

.panel {
  padding: 22px;
}

/* Two columns: the side column stays in view while the days scroll by,
   its top level with the timesheet's sticky header; when it is taller than
   the window it scrolls until its end is in view (--side-height is
   measured by the page). */
@media (min-width: 801px) {
  /* One pixel higher than the timesheet: its panes' top borders lie on
     the row of the timesheet's top line (drawn just outside it), and, stuck,
     on the header's hairline. */
  .side {
    position: sticky;
    top: min(calc(var(--topbar-height) - 1px), calc(100vh - var(--side-height, 0px) - 20px));
    margin-top: -1px;
  }
}

/* The Edit pane: laid out like the log (flat, a hairline border, a small
   caps title), but slate blue so it stands out. */
/* The editor takes the colour of the activity being edited (slate when
   none, or mixed; --edit-color is set by renderEditor): a wide bar in that
   colour on its left, with EDIT reading from bottom to top, and a light
   tint of it behind. */
.edit-pane,
.edit-bar {
  --edit-color: var(--draft);
  --edit-bar: var(--edit-color); /* mixed activities: bands of their colours (renderEditor) */
  --edit-tint: color-mix(in srgb, var(--edit-color) 11%, var(--panel-solid));
  --edit-rule: color-mix(in srgb, var(--edit-color) 50%, var(--pane-line));
  transition: background-color .2s ease, border-color .2s ease;
}

.edit-pane::before,
.edit-bar::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  content: 'Edit';
  background: var(--edit-bar);
  color: rgba(23, 35, 37, .78);
  font: 500 .58rem 'DM Mono', monospace;
  letter-spacing: .3em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: background-color .2s ease;
}

.edit-pane {
  position: relative;
  padding: 12px 14px 14px calc(22px + 14px);
  border: 1px solid var(--edit-rule);
  background: var(--edit-tint);
}

/* the bar says EDIT; the title stays for screen readers */
.edit-pane h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

#copyDay {
  flex: none;
}

/* Lock / Unlock: set apart after a thin divider, in a firmer ink outline,
   with a lock (closed / open). */
.term-sep {
  flex: none;
  align-self: stretch;
  width: 1px;
  margin: 2px 0 2px auto; /* the divider and the lock sit at the right */
  background: rgba(23, 35, 37, .25);
}

/* only done days: nothing is left in the actions row (Unlock is in the strip) */
.edit-bar.is-done-only .term-actions {
  display: none;
}

.term-action[data-action="done"],
.term-action[data-action="reopen"] {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--ink);
}

.term-action[data-action="done"][hidden],
.term-action[data-action="reopen"][hidden] {
  display: none;
}

/* Another activity for the selected days: not an action on the current
   one, so a dashed line of its own under the chips. */
.add-activity {
  grid-area: add;
  min-height: 0;
  padding: 6px 8px;
  border: 1px dashed rgba(23, 35, 37, .35);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font: 500 .62rem 'DM Mono', monospace;
  letter-spacing: .06em;
  text-align: center;
  text-transform: uppercase;
}

.add-activity:hover,
.add-activity:active {
  border-color: var(--ink);
  background: rgba(255, 255, 255, .5);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.add-activity[hidden] {
  display: none;
}

/* Help (nothing selected): a quiet panel, no coloured EDIT bar. */
/* Help looks like the log: the same barely tinted pane and title, and
   its terminal-style mono text. */
.edit-pane.is-help {
  padding-left: 14px;
  border-color: var(--pane-line);
  background: rgba(91, 185, 176, .04);
}

.edit-pane.is-help::before {
  display: none;
}

/* Only days without entries: nothing to colour, so no EDIT bar either. */
.edit-pane.is-empty-only {
  padding-left: 14px;
}

.edit-pane.is-empty-only::before,
.edit-bar.is-empty-only::before {
  display: none;
}

.edit-bar.is-empty-only {
  padding-left: 22px;
}

.edit-pane.is-help h2 {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  margin: 0 0 10px;
  color: var(--muted);
  font: 500 .62rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}


/* not available (nothing copied, or no open day selected): greyed out */
.term-action:disabled,
.term-action:disabled:hover,
.term-action:disabled:active {
  border-color: var(--line);
  background: transparent;
  color: rgba(23, 35, 37, .35);
  cursor: default;
  transform: none;
}

.term-action:disabled::before,
.term-action:disabled::after {
  display: none;
}

#pasteDay {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A strip under the editor: Copy and Paste at the left, then a divider
   and Lock / Unlock at the right. One row: a long Paste label shortens
   (…) before the buttons would wrap. */
.clip-strip {
  grid-area: clip;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--edit-rule);
}

/* A new selection: the editor's background flashes a stronger slate and
   fades back (see callEditor). */
@keyframes edit-call {
  0% { background-color: color-mix(in srgb, var(--edit-color) 38%, var(--panel-solid)); }
  100% { background-color: var(--edit-tint); }
}

@keyframes edit-rise {
  from { transform: translateY(100%); }
}

.edit-pane.is-called,
.edit-bar.is-called {
  animation: edit-call .7s ease-out;
}

.edit-bar.is-called.is-rising {
  animation: edit-rise .25s ease-out, edit-call .7s ease-out .25s;
}

@media (prefers-reduced-motion: reduce) {
  .edit-pane.is-called,
  .edit-bar.is-called,
  .edit-bar.is-called.is-rising {
    animation: none;
  }
}

.edit-error {
  margin: 14px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  color: var(--coral);
  font: .66rem/1.5 'DM Mono', monospace;
}

.edit-error b {
  font-weight: 500;
}

.panel h2 {
  margin: 0 0 19px;
}

.metric {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.metric-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.metric-sub {
  margin-top: 7px;
  color: var(--muted);
  font: .62rem 'DM Mono', monospace;
  letter-spacing: .04em;
}

.bar {
  display: flex;
  height: 8px;
  border: 1px solid var(--ink);
  background: transparent;
  overflow: hidden;
}

.bar-part {
  position: relative;
  flex: none;
  height: 100%;
  background: var(--segment-color);
}

.bar-fill {
  display: flex;
  width: 100%;
  height: 100%;
}

/* One smooth sweep from left to right over the whole bar: only the front
   edge moves; the parts and their checkered pattern stay put. */
.bar.is-revealing .bar-fill {
  animation: bar-reveal var(--bar-reveal-duration, 1.1s) cubic-bezier(.45, 0, .25, 1) both;
}

/* Both ends are inset() so the browser can interpolate between them
   (inset → none would just jump halfway through). */
@keyframes bar-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .bar.is-revealing .bar-fill {
    animation: none;
  }
}

/* A complete month shows no month totals beside the done ones. */
.layout.is-complete .preliminary-value,
.layout.is-complete .legend-note,
.layout.is-complete .money-total-preliminary,
.layout.is-complete .money-compact-month {
  display: none;
}

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

.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
  color: var(--muted);
  font: .58rem 'DM Mono', monospace;
  letter-spacing: .03em;
}

.bar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* One legend entry per activity: swatch, name, done hours (month total). */
/* Billable activities in the first column, leave in the second. */
.type-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 4px 14px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font: .62rem 'DM Mono', monospace;
}

.type-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
}

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

.type-legend b {
  margin-left: auto;
  color: var(--ink);
  font-weight: 500;
}

/* What the billable hours are worth. */
.money {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font: .64rem 'DM Mono', monospace;
}

/* The total: a summary line under a heavier rule, in large type. */
/* Two columns: while the Billable amount pane is scrolled out of view, a
   one-line version of it sticks at the top of the side column. */
.money-compact-anchor {
  display: none;
}

@media (min-width: 801px) {
  .money-compact-anchor {
    position: sticky;
    top: calc(var(--topbar-height) - 1px); /* its border on the header's hairline */
    z-index: 4;
    display: block;
    height: 0;
    margin-bottom: -20px; /* takes no room: not even the column's gap */
  }
}

.money-compact {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--pane-line);
  background: var(--panel-solid);
  color: var(--muted);
  font: .6rem 'DM Mono', monospace;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.money-compact.is-shown {
  opacity: 1;
  transform: none;
}

.money-compact-label {
  margin-right: auto;
  color: var(--ink);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.money-compact b {
  color: var(--ink);
  font: 700 .95rem/1 'Space Grotesk', sans-serif;
  letter-spacing: -.02em;
}

.money-total {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1.5px solid var(--ink);
}

.money-total-label {
  color: var(--ink);
  font: 600 .7rem 'DM Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.money-total b {
  justify-self: end;
  color: var(--ink);
  font: 700 1.35rem/1.1 'Space Grotesk', sans-serif;
  letter-spacing: -.02em;
}

.money-total-preliminary {
  grid-column: 2;
  justify-self: end;
  color: var(--muted);
}

.money-line {
  display: grid;
  grid-template-columns: 7ch minmax(0, 1fr) auto;
  gap: 8px;
  color: var(--muted);
}

.money-line + .money-line {
  margin-top: 4px;
}

.money-line b {
  color: var(--ink);
  font-weight: 500;
}

.money-note {
  margin: 6px 0 0;
  color: var(--muted);
}

/* A project's heading in the billable amount: its code, then its name. */
.money-project {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.money-project span + span {
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.money-line + .money-project {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.swatch.is-neutral {
  --segment-color: #a3aaa8;
}

.swatch {
  --segment-color: var(--teal);
  display: inline-block;
  width: 14px;
  height: 7px;
  border: 1px solid var(--ink);
  background: var(--segment-color);
}

/* Submit and reset: under the billable amount. */
.controls {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

/* The shared editor (in the sticky part while days are selected), in the
   terminal style of the log: tabs that read like the row ("Work", "8h"; or
   "Activity" / "Hours" when the selected days differ), a one-line prompt
   that filters the activities as you type, the activities as chips, and
   Save / Add / Remove. */
/* One column: fixed to the bottom of the screen, full width, whether or not
   the timesheet is in view (the page gets room for it underneath). */
.edit-bar {
  position: fixed;
  right: 0;
  bottom: var(--keyboard-height, 0px); /* above the on-screen keyboard (see liftEditor) */
  left: 0;
  z-index: 20;
  border-top: 1px solid var(--edit-rule);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "tabs tabs" "panel actions" "chips chips" "add add" "clip clip";
  align-content: start;
  gap: 7px 12px;
  padding-top: 14px;
  padding-left: calc(22px + 22px); /* the EDIT bar, then the gutter */
  padding-right: 22px;
  /* the editor's tint, solid: it covers the rows */
  background: var(--edit-tint);
  color: var(--ink);
  font: .64rem/1.5 'DM Mono', monospace;
}

/* "3 days · 2–4 · done days are left as they are": one line that is cut
   short rather than wrapping, so the editor never changes height. */
.edit-scope {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-scope strong {
  color: var(--ink);
  font-weight: 500;
}

.edit-note::before {
  content: '\00b7  ';
}

/* Tabs read like the row ("Work", "6.5h") and look like links; the active one is dark. */
.term-tabs {
  grid-area: tabs;
  display: flex;
  align-items: baseline;
  gap: 14px;
  white-space: nowrap;
}

.term-tab {
  min-height: 0;
  padding: 0 0 1px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font: 500 .64rem 'DM Mono', monospace;
  letter-spacing: .02em;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-transform: none;
  transition: none;
}

.term-tab[aria-selected="true"],
.term-tab[aria-selected="true"]:hover {
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--draft);
}

.term-tab:hover,
.term-tab:active {
  background: none;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.term-panel {
  grid-area: panel;
  min-width: 0;
}

/* The activity side's field sits in the row; its chips get the full card
   width on the line below. */
.term-panel[data-panel="activity"]:not([hidden]) {
  display: contents;
}

.term-panel[data-panel="activity"] .term-command {
  grid-area: panel;
}

.term-panel[data-panel="hours"]:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* A field: a one-line command prompt in the log's style. */
.term-command {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: rgba(91, 185, 176, .08);
  overflow: hidden;
  cursor: text;
  font-size: .68rem;
  white-space: nowrap;
}

.term-command:focus-within {
  outline: 1px solid var(--draft);
  outline-offset: -1px;
}

.term-typed,
.term-suggest {
  white-space: pre;
}

.term-typed:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: .7;
}

.term-typed.is-selected {
  background: rgba(74, 122, 143, .25);
}

.term-suggest,
.term-unit {
  color: var(--muted);
  opacity: .7;
}

.term-unit {
  margin-left: 2px;
}

.term-cursor {
  display: inline-block;
  flex: none;
  width: .55em;
  height: 1em;
  background: var(--draft);
  animation: log-cursor 1.1s steps(1) infinite;
}

.term-command:not(:focus-within) .term-cursor {
  visibility: hidden;
}

.term-command .term-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px; /* keeps iOS from zooming in on focus */
  cursor: text;
}

/* Activities as chips that wrap: much shorter than a list. */
.term-options {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1px;
}

.term-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 246, .9);
  color: var(--ink);
  font-size: .6rem;
  white-space: nowrap;
  cursor: pointer;
}

.term-option:hover {
  border-color: rgba(74, 122, 143, .5);
}

.term-option.is-active {
  border-color: var(--draft);
  background: rgba(91, 185, 176, .18);
}

.term-swatch {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  background: var(--segment-color);
}

.term-empty {
  color: var(--coral);
  font-size: .6rem;
}

.term-key {
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 253, 246, .9);
  box-shadow: none;
  color: var(--ink);
  font: 500 .75rem/1 'DM Mono', monospace;
  transition: none;
}

.term-key:hover,
.term-key:active {
  background: rgba(91, 185, 176, .14);
  transform: none;
  box-shadow: none;
}

.term-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 24px;
}

/* Two columns: the editor in its own pane in the right column, under the
   summary, stacked in one column; help text while nothing is selected. */
.edit-pane .edit-bar {
  position: static;
  z-index: auto;
  border-top: none;
  box-shadow: none;
  padding: 0;
  background: none;
  transition: none;
}

/* in the pane, the pane draws the bar */
.edit-pane .edit-bar::before {
  display: none;
}

/* In the pane too, Remove and Save sit right of the prompt. */
.edit-pane .edit-bar {
  gap: 10px;
}

.edit-pane .term-actions {
  gap: 10px;
  height: auto;
}

.edit-help {
  color: var(--muted);
  font: .72rem/1.55 'DM Mono', monospace; /* the log's text, a size up */
}

.edit-help p {
  margin: 0 0 6px;
  color: var(--ink);
}

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

/* a slate prompt mark where the log has its times */
.edit-help li {
  position: relative;
  padding-left: 14px;
}

.edit-help li::before {
  position: absolute;
  left: 0;
  content: '\203A';
  color: var(--draft);
  opacity: .75;
}

.edit-help b {
  font-weight: 400;
  color: var(--ink);
}

@media not ((hover: hover) and (pointer: fine)) {
  .edit-help-keys {
    display: none;
  }
}

/* Drafting buttons: a hairline box with blueprint corner ticks (top left,
   bottom right); the main action (Save, Submit month) tinted teal. */
.term-action,
.reset-month,
#submitMonth {
  position: relative;
  min-height: 0;
  padding: 5px 10px 4px;
  border: 1px solid rgba(23, 35, 37, .2);
  background: var(--panel-solid);
  box-shadow: none;
  color: var(--ink);
  font: 500 .62rem/1 'DM Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color .12s ease, background .12s ease;
}

.term-action::before,
.term-action::after,
.reset-month::before,
.reset-month::after,
#submitMonth::before,
#submitMonth::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border: 0 solid var(--draft);
  pointer-events: none;
}

.term-action::before,
.reset-month::before,
#submitMonth::before {
  top: -3px;
  left: -3px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.term-action::after,
.reset-month::after,
#submitMonth::after {
  right: -3px;
  bottom: -3px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.term-action:hover,
.term-action:active,
.reset-month:hover,
.reset-month:active {
  background: var(--panel-solid);
  border-color: var(--draft);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.term-action[data-action="save"],
.term-action.is-main,
#submitMonth {
  border-color: var(--teal);
  background: rgba(91, 185, 176, .14);
  color: #2c6f69;
}

.term-action[data-action="save"]:hover,
.term-action.is-main:hover:not(:disabled),
#submitMonth:hover:not(:disabled) {
  background: rgba(91, 185, 176, .26);
  border-color: var(--teal);
  color: #2c6f69;
}

#submitMonth {
  min-height: 38px;
  font-size: .66rem;
}

#submitMonth:active {
  transform: none;
}

#submitMonth:disabled {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

#submitMonth:disabled::before,
#submitMonth:disabled::after {
  display: none;
}

/* Submitting (BEHAVIOR.md §11.1a): the button keeps its teal and shows a
   spinner beside "Submitting…"; the month's rows and the editor dim and can't
   be used until the account answers. */
#submitMonth.is-working,
#submitMonth.is-submitted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#submitMonth.is-working {
  pointer-events: none;
}

#submitMonth .submit-check {
  flex: none;
  width: 11px;
  height: 11px;
}

body.is-submitting #dayRows,
body.is-submitting #editBar {
  opacity: .55;
  pointer-events: none;
  transition: opacity .2s ease;
}

/* Just submitted: the button flashes teal and fades to its quiet "Month
   submitted"; the badge is stamped on beside the month. */
#submitMonth.is-just-submitted {
  animation: submit-confirm 1.6s ease-out;
}

@keyframes submit-confirm {
  0%, 30% {
    border-color: var(--teal);
    background: rgba(91, 185, 176, .32);
    color: #2c6f69;
  }
}

.submitted-badge.is-arriving {
  animation: badge-stamp .45s cubic-bezier(.2, .9, .3, 1.25);
}

@keyframes badge-stamp {
  from {
    opacity: 0;
    transform: scale(1.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  #submitMonth.is-just-submitted,
  .submitted-badge.is-arriving {
    animation: none;
  }
}

.term-action[data-action="remove"]:hover,
.reset-month:hover {
  color: var(--coral);
  border-color: var(--coral);
}

/* Only done days: what they hold and how to change them, where the prompt
   would be. */
.edit-done-info {
  display: none;
  grid-area: panel;
  margin: 0;
  color: var(--ink);
  font: .66rem/1.5 'DM Mono', monospace;
}

/* Only empty days: an invitation above the prompt. */
.edit-empty-info {
  grid-area: info;
  margin: 0;
  color: var(--ink);
  font: .66rem/1.5 'DM Mono', monospace;
}

.edit-empty-info[hidden] {
  display: none;
}

/* Only empty days: no edit controls but Add (and the text). */
.edit-bar.is-empty-only .term-tab,
.edit-bar.is-empty-only .term-command,
.edit-bar.is-empty-only .term-panel[data-panel="hours"],
.edit-bar.is-empty-only .term-options,
.edit-bar.is-empty-only .clip-strip,
.edit-bar.is-empty-only .term-action {
  display: none !important;
}

/* its row, only while it shows (so the editor is no taller otherwise) */
.edit-bar.is-empty-only {
  grid-template-areas: "tabs tabs" "info info" "panel actions" "chips chips" "add add" "clip clip";
}

.edit-bar.is-done-only .edit-done-info {
  display: block;
}

/* Only done days selected: no tabs, prompt or chips, just Reopen. */
.edit-bar.is-done-only .term-tab,
.edit-bar.is-done-only .term-panel,
.edit-bar.is-done-only .term-options {
  display: none !important;
}

/* Touch screens: everything a little larger to press (not much). */
@media (hover: none) {
  .term-command,
  .term-actions {
    height: 38px;
  }

  .term-tab {
    padding: 8px 2px 6px;
  }

  .term-key {
    width: 38px;
    height: 38px;
  }

  .term-option {
    padding: 7px 11px;
    font-size: .68rem;
  }

  .term-action,
  .reset-month {
    min-height: 36px;
    padding: 8px 14px 7px;
    font-size: .66rem;
  }

  #submitMonth {
    min-height: 44px;
  }

  .edit-clear,
  .month-nav .nav-link {
    padding: 8px 6px;
  }

  .select-toggle::before {
    width: 17px;
    height: 17px;
  }

  .select-stack .select-toggle {
    min-height: 26px;
  }

  .dock-head {
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .term-cursor {
    animation: none;
  }
}


button {
  cursor: pointer;
  min-height: 45px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: var(--lime);
  font: 500 .72rem 'DM Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

button:disabled {
  cursor: default;
}

button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

button.secondary {
  background: transparent;
}

/* Hover only shifts the color. :where() keeps these as weak as the base
   button rules, so component-specific hover styles still win. */
button:where(:hover:not(:disabled)) {
  background: #e4fa81;
}

button.secondary:where(:hover:not(:disabled)) {
  background: rgba(91, 185, 176, .16);
}

/* Docked side panes (log, quick keys): flat, tinted, collapsible. */
.dock {
  padding: 12px 14px 14px;
  border: 1px solid var(--pane-line);
  background: rgba(91, 185, 176, .04); /* barely off the paper */
}

.dock-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  margin-bottom: 10px;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font: 500 .62rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.dock-head:hover,
.dock-head:active {
  background: none;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.dock-toggle::before {
  content: '\2013';
  font-size: .8rem;
}

/* The log can be expanded: many more lines, still scrolling if needed. */
.dock.is-expanded .log-lines {
  height: min(calc(20 * 1.55em), 55vh);
}

.log-expand {
  display: block;
  margin: 8px 0 0 auto;
  color: var(--muted);
  font: .58rem 'DM Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dock.is-collapsed .log-expand {
  display: none;
}

.dock.is-collapsed {
  padding-bottom: 12px;
}

.dock.is-collapsed .dock-head {
  margin-bottom: 0;
}

.dock.is-collapsed .dock-toggle::before {
  content: '+';
}

.dock.is-collapsed .dock-body {
  display: none;
}

/* Summary, log and quick keys stack with the same fixed gap as the rest of
   the layout, whatever the window height. */
.side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Terminal-style log: newest line first, fixed height (it scrolls instead of growing). */
.log-lines {
  height: calc(5 * 1.55em);
  transition: height .2s ease;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font: .64rem/1.55 'DM Mono', monospace;
  color: var(--muted);
}

.log-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.log-line time {
  color: var(--draft);
  opacity: .75;
}

.log-title {
  color: var(--ink);
}

@keyframes log-cursor {
  50% { opacity: 0; }
}

.log-line.is-error time,
.log-line.is-error .log-title {
  color: var(--coral);
  opacity: 1;
}

.dock.is-collapsed .log-lines {
  height: auto;
  overflow: hidden;
  margin-top: 8px;
}

.dock.is-collapsed .log-line:not(:first-child) {
  display: none;
}

.dock.is-collapsed .log-message {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.breakdown-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font: .67rem 'DM Mono', monospace;
}

.breakdown-line+.breakdown-line {
  margin-top: 7px;
}

.breakdown-line b {
  color: var(--ink);
  font-weight: 500;
}

.reset-month {
  width: 100%;
  min-height: 32px;
}


@media (max-width: 800px) {
  .board {
    --col-date: 96px;
    --col-select: 48px;
  }

  /* the footer's version without the build's date and time */
  .version-stamp {
    display: none;
  }

  .ruler-y,
  .ruler-corner,
  .drafting {
    display: none;
  }

  /* One column: the panes are centred; the week guides sit in the left
     margin (at the screen's edge when it is narrow). */
  .shell {
    width: min(100% - 32px, 600px);
    padding-left: 0;
    padding-bottom: 42px;
  }

  /* Locked at the top, the header (the month, the bar, the legends while
     they show, and the column names) widens to the full width of the
     screen, its grey frame moving to the screen's edges. The month, the bar
     and the legends use the new room; the column names stay over their
     columns. --view-width is the page's width without
     a scrollbar, measured by the page (100vw would count it). */
  .board-sticky,
  .sheet-details,
  .sheet-columns {
    transition: margin .2s ease, padding .2s ease;
  }

  .board.is-stuck .board-sticky,
  .board.is-stuck .sheet-details,
  .board.is-stuck .sheet-columns {
    margin-inline: calc(50% - var(--view-width, 100vw) / 2);
    box-shadow: inset 1px 0 0 var(--pane-line), inset -1px 0 0 var(--pane-line);
  }

  .board.is-stuck .board-sticky {
    box-shadow: 0 -1px 0 var(--pane-line), inset 1px 0 0 var(--pane-line), inset -1px 0 0 var(--pane-line);
  }

  .board.is-stuck .sheet-columns {
    padding-inline: calc(var(--view-width, 100vw) / 2 - 50%);
  }


  .page {
    --logo-left: 12px;
  }

  .page,
  .settings-panel {
    --logo-height: 28px; /* a bit smaller on smaller screens (24px on phones) */
    --logo-bottom: 6px;
  }

  .topbar {
    padding-right: 12px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  /* one column: no sticking, but still the place its guides are drawn from */
  .side {
    position: relative;
  }
}

@media (max-width: 480px) {
  /* phones: the lock alone (its title says "Submitted") */
  .badge-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .page,
  .settings-panel {
    --logo-height: 24px;
  }


  /* The header row must fit 375px: tighter gaps. */
  .topbar,
  .brand {
    gap: 10px;
  }

  .tab {
    letter-spacing: .07em;
  }

  .topbar-meta {
    gap: 10px;
  }

  .board {
    --col-date: 72px; /* the day and its weekday ("01 TUE") */
  }

  .sheet-columns span,
  tbody td {
    padding-left: 8px;
    padding-right: 8px;
  }

  .edit-bar {
    padding-top: 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* room under the page for the fixed editor, so the last days can scroll
     above it (measured by the page; 0 while it is hidden) */
  body {
    padding-bottom: var(--edit-bar-height, 0px);
  }

  /* One line of chips that scrolls sideways, so the editor stays short. */
  .term-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  /* Room is short: the count stays, the list of days goes (the rows show it). */
  #editDays {
    display: none;
  }

  .holiday-tag {
    display: none;
  }

  .hours-cell {
    min-width: 0;
    gap: 8px;
  }


  .board-head {
    column-gap: 12px;
  }

  .sheet-totals {
    padding: 12px 14px;
  }

  .board-head {
    padding: 12px 14px 0;
  }

  .sheet-details {
    padding-left: 14px;
    padding-right: 14px;
  }

  .edit-bar {
    padding-left: calc(22px + 14px);
    padding-right: 14px;
  }

  .edit-bar.is-empty-only {
    padding-left: 14px;
  }

  h1,
  .panel h2 {
    font-size: .76rem;
  }

  .month-nav {
    gap: 8px;
  }

  .month-nav .nav-link {
    font-size: .6rem;
  }
}

/* Signed out (BEHAVIOR.md §20): no header (the pane has the logo and the
   portal's name), and the sign-in sheet takes the timesheet's place: one
   pane in the middle of the page, the logo drawn over the form; the full
   width on narrow screens. */
body.is-signed-out .topbar,
body.is-signed-out .shell {
  display: none;
}

/* The pane is the logo and the form, one over the other, each with its
   outline and fill; the sheet itself only centres them. */
.signin {
  display: grid;
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
  align-content: center;
  position: relative;
  flex: 1 0 auto; /* the window's height less the footer's: nothing to scroll */
  padding-top: calc(var(--ruler-size) + 20px); /* padding: a margin would push the whole page down */
}

.signin[hidden] {
  display: none;
}

.signin-brand,
.signin-form {
  border: 1px solid var(--pane-line);
  background: var(--panel);
}

.signin-brand {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 40px 26px;
}

.signin-brand .logo {
  display: block;
  width: 100%;
  height: auto;
}

/* Signed out, the header's tabs are the pane's tagline: the portal's
   parts in plain grey words, not links yet. */
.signin-brand .tabs {
  flex-wrap: wrap;
  gap: 4px 1.6em;
}

.signin-brand .tab,
.signin-brand .tab[aria-current="page"] {
  padding-top: 0;
  color: var(--muted);
  font-size: .66rem;
  letter-spacing: .1em;
}

.signin-brand .tab[aria-current="page"]::after {
  display: none;
}

/* Admin is only for admins: never on the sign-in page. */
.signin-brand .tab[data-view="admin"] {
  display: none;
}

.signin-kicker {
  margin: 0;
  color: var(--muted);
  font: 500 .66rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.signin-form {
  --form-top: 32px;
  display: flex;
  flex-direction: column;
  padding: var(--form-top) 40px 28px;
  border-top: none;
  font-family: 'DM Mono', monospace;
}

.signin-title {
  margin: 0 0 18px;
  font: 500 .84rem 'DM Mono', monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.signin .signin-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  margin: 0 0 10px;
  font-size: .64rem;
}

.signin-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.signin-or::before,
.signin-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.signin-email label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: .62rem;
}

.signin-email input {
  box-sizing: border-box;
  width: 100%;
  height: 36px;
  margin: 0 0 10px;
  padding: 0 10px;
  border: 1px solid var(--pane-line);
  background: #fff;
  color: var(--ink);
  font: .74rem 'DM Mono', monospace;
}

.signin-email input:focus {
  outline: 1px solid var(--draft);
  outline-offset: -1px;
}

.signin-email .signin-code {
  height: 44px;
  font-size: 1.2rem;
  letter-spacing: .5em;
  text-align: center;
}

.signin-text,
.signin-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .64rem;
  line-height: 1.55;
}

.signin-text b {
  color: var(--ink);
  font-weight: 500;
}

.signin-note {
  margin: 4px 0 0;
}

.signin-message {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: #b8432e;
  font-size: .66rem;
  line-height: 1.5;
}

.signin-message.is-info {
  color: var(--muted);
}

/* Signing in with Google or GitHub: what is happening, one line each (BEHAVIOR.md §20.8). */
.signin-progress {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.signin-progress li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: .66rem;
  line-height: 1.45;
}

.signin-progress li.is-active,
.signin-progress li.is-done {
  color: var(--ink);
}

.signin-progress li.is-failed {
  color: #b8432e;
}

.signin-progress svg {
  display: block;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.signin-progress .progress-pending {
  width: 5px;
  height: 5px;
  margin: 6px 0 0 4px;
  border: 1px solid var(--guide);
  border-radius: 50%;
}

.signin-spinner .arc {
  transform-origin: 7px 7px;
  animation: signin-spin .9s linear infinite;
}

@keyframes signin-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .signin-spinner .arc {
    animation: none;
  }
}

/* Signed in (BEHAVIOR.md §20.5): the pane turns into the header
   (arriveFromSignIn()). The form slides up under the logo's part, which
   is lifted over it; then a frame goes from that part to the header bar
   while the logo and tabs move into the header themselves. Until then the
   header shows only them, and the page is not shown. */
.signin.is-arriving .signin-brand {
  position: relative;
  z-index: 1;
  background: var(--panel-solid);
}

.arrival-frame {
  position: fixed;
  z-index: -1; /* in the header: over its background, under the logo and tabs */
  box-sizing: border-box;
  border: 1px solid var(--pane-line);
  background: var(--panel-solid);
  pointer-events: none;
}

body.is-arriving .topbar {
  background: none;
  border-bottom-color: transparent;
}

body.is-arriving .topbar::before,
body.is-arriving .topbar::after {
  opacity: 0;
}

body.is-arriving .settings-toggle,
body.is-arriving .shell {
  opacity: 0;
}

/* Waiting on the account: the step can't be used, and is dimmed, all but
   the button that is working (it says what it is doing, with a spinner). */
.signin.is-busy .signin-step {
  pointer-events: none;
}

.signin.is-busy .signin-step :is(h1, p, label, input, button):not(.is-working):not(:has(.is-working)) {
  opacity: .55;
}

.is-working .signin-spinner {
  flex: none;
  width: 13px;
  height: 13px;
}

/* A button at work (showWorking()): its spinner beside its words, and not pressed twice. */
.term-action.is-working {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

/* The ways besides the code by email. Their box reaches up to the logo's
   part of the pane (and a little to the sides, for the buttons' corner
   ticks), so that, shrunk to nothing while a code is sent, they slide up
   under it (slideChoices()). */
.signin-choices {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin: calc(-1 * var(--form-top)) -4px 0;
  padding: var(--form-top) 4px 0;
}

.signin-choices.is-sliding {
  overflow: hidden;
}

/* Send code, while the code is being sent: it fills with the Sign in
   button's tint, left to right, then becomes that button (sendingCode()). */
.signin .signin-button.is-filling {
  background-image: linear-gradient(rgba(91, 185, 176, .14), rgba(91, 185, 176, .14));
  background-repeat: no-repeat;
  background-size: 0% 100%;
}

.signin .link-button.is-working {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

/* The pane keeps its width, centred, while the window has room for it;
   narrower, it goes from side to side and shrinks with the window (its
   column is minmax(0, 420px)), with less space inside. The logo always
   spans the buttons' width. */
@media (max-width: 460px) {
  .signin-brand {
    gap: 10px;
    padding: 24px 20px 20px;
  }

  .signin-form {
    --form-top: 24px;
    padding: var(--form-top) 20px 28px;
  }
}

/* The form while it grows or shrinks to a new height (resizingPane()). */
.signin-form.is-resizing {
  overflow: hidden;
}

/* Passkeys in settings: one line each, with when it was added and used. */
.passkey-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.passkey-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: .66rem;
}

.passkey-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.passkey-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: .58rem;
}

.passkey-list .link-button {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-size: .6rem;
}

#addPasskey {
  margin: 2px 0 0;
}

/* Dialogs (add a passkey, hours from before signing in): a plain pane. */
.portal-dialog {
  max-width: min(360px, calc(100vw - 32px));
  padding: 18px 20px;
  border: 1px solid var(--pane-line);
  background: var(--panel-solid);
  color: var(--ink);
  font-family: 'DM Mono', monospace;
}

.portal-dialog::backdrop {
  background: rgba(23, 35, 37, .28);
}

.portal-dialog h2 {
  margin: 0 0 10px;
  font: 500 .72rem 'DM Mono', monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.portal-dialog p {
  margin: 0 0 16px;
  font-size: .7rem;
  line-height: 1.55;
}

.portal-dialog-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.portal-dialog .term-action {
  min-height: 32px;
}

.portal-dialog .link-button {
  font-size: .66rem;
}

/* The log's light: green online, blue while syncing, grey offline, coral
   when syncing failed. */
.status-dot.is-syncing {
  background: var(--draft);
  box-shadow: 0 0 0 4px rgba(74, 122, 143, .18);
}

.status-dot.is-offline {
  background: var(--guide);
  box-shadow: none;
  animation: none;
}

.status-dot.is-error {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(239, 118, 95, .2);
  animation: none;
}

/* The Admin tab (§22): people and projects on the left, the chosen one's
   page on the right; one column on narrow screens. */
.admin-view {
  padding: 0;
}

.admin-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.admin {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  font-family: 'DM Mono', monospace;
  font-size: .7rem;
}

.admin-lists,
.admin-detail {
  padding: 16px 18px;
  border: 1px solid var(--pane-line);
  background: var(--panel);
}

.admin-detail {
  min-height: 360px;
}

.admin-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 8px;
}

.admin-list-head + .admin-list + .admin-list-head {
  margin-top: 22px;
}

.admin h2,
.admin h3 {
  margin: 0;
  font: 500 .74rem 'DM Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.admin h3 {
  margin: 18px 0 10px;
  font-size: .66rem;
}

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

.admin-item {
  display: grid;
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-transform: none;
}

.admin-item:hover,
.admin-item.is-selected {
  background: var(--select-tint);
  transform: none;
}

.admin-item-detail,
.admin-empty,
.admin-hint,
.admin-head p {
  color: var(--muted);
  font-size: .64rem;
}

.admin-empty {
  padding: 6px 10px;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
}

.admin-head h2 {
  font-size: .84rem;
}

.admin-head p {
  margin: 0;
}

.admin-tabs {
  display: flex;
  gap: 18px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.admin-tabs button {
  min-height: 0;
  padding: 0 0 7px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font: 500 .62rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.admin-tabs button:hover {
  background: none;
  color: var(--ink);
}

.admin-tabs button[aria-current="page"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .58rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
}

.admin-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.admin-table .admin-num {
  text-align: right;
}

.admin-status {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--pane-line);
  color: var(--muted);
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-status.is-submitted {
  border-color: var(--teal);
  background: rgba(91, 185, 176, .14);
  color: #2c6f69;
}

.admin-form {
  display: grid;
  gap: 8px;
  max-width: 560px;
}

.admin-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: .62rem;
}

.admin-form textarea {
  padding: 6px 8px;
  border: 1px solid var(--pane-line);
  background: #fff;
  color: var(--ink);
  font: .7rem 'DM Mono', monospace;
  resize: vertical;
}

.admin-form input:not([type="checkbox"]):not([type="radio"]),
.admin-form select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--pane-line);
  background: #fff;
  color: var(--ink);
  font: .7rem 'DM Mono', monospace;
}

.admin-form input:disabled {
  background: transparent;
  color: var(--muted);
}

.admin-form .admin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.admin-form .admin-hint {
  margin: -4px 0 4px;
}

/* What an import came to, under its button (Admin → Payroll → Tax tables). */
.admin-result {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  font: 500 .66rem/1.3 'DM Mono', monospace;
}

.admin-result[hidden] {
  display: none;
}

.admin-result svg {
  flex: none;
  width: 11px;
  height: 11px;
}

.admin-result.is-done {
  color: #2c6f69;
}

.admin-result.is-failed {
  color: #b8432e;
}

.admin-form > .term-action,
.admin-detail > .term-action,
.admin-tab-body > .term-action {
  justify-self: start;
  min-height: 32px;
  margin-top: 6px;
}

.admin-form + .admin-form {
  margin-top: 18px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.admin-terms-row {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.admin-rates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* A project's overtime (OT1, OT2): ticks side by side, a note under them. */
.admin-overtime {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-overtime legend {
  margin-bottom: 3px;
  padding: 0;
  color: var(--muted);
  font-size: .62rem;
}

.admin-overtime .admin-hint {
  flex-basis: 100%;
  margin: 0;
}

.admin-own {
  margin: 0;
  color: #2c6f69;
  font-size: .62rem;
}

.admin-terms-row .link-button,
.admin-form > .link-button {
  justify-self: start;
  font-size: .62rem;
}

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

.admin-people li {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.admin-people span {
  color: var(--muted);
}

.admin-legend {
  padding: 0 4px;
  color: var(--ink);
  font: 500 .62rem 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.admin-salary {
  max-width: 560px;
}

.admin-salary .admin-strong td {
  border-top: 1px solid var(--ink);
  font-weight: 500;
}

.admin-buttons {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.admin-buttons .term-action {
  min-height: 32px;
}

/* Expenses to approve: one card each, oldest first. */
.admin-expenses {
  display: grid;
  gap: 10px;
  max-width: 640px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-expenses li {
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.admin-expenses p {
  margin: 4px 0;
}

.admin-expense-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.admin-expense-head .admin-num {
  margin-left: auto;
}

/* Expenses to invoice: a batch per person, each expense ticked. */
.admin-batch .admin-expenses li {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.admin-batch .admin-check {
  flex: 1;
  flex-wrap: wrap;
  column-gap: 12px;
}

.admin-batch .admin-check .admin-num {
  margin-left: auto;
}

.admin-batch .admin-strong {
  display: flex;
  max-width: 640px;
  margin: 0;
  font-weight: 600;
}

.admin-batch .admin-strong .admin-num {
  margin-left: auto;
}

.admin-expenses .admin-buttons input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--pane-line);
  background: #fff;
  font: .66rem 'DM Mono', monospace;
}

.admin-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #b8432e;
  font-size: .66rem;
}

.admin-vouchers { display: grid; gap: 14px; margin: 18px 0; }
.admin-voucher { padding: 14px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
.admin-voucher h3 { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: .78rem; }
.admin-voucher ul { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: .72rem; }
.admin-voucher li { display: flex; justify-content: space-between; gap: 12px; }
.admin-voucher code { font-family: var(--mono); }

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

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

/* The Balance tab in one column: the figures first. */
@media (max-width: 800px) {
  .balance {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .balance-side {
    order: -1;
  }
}
