/* alwaysdata intranet — base stylesheet */

/*
 * Brand typefaces: Archivo for headings, Open Sans for body copy, as set out
 * in the alwaysdata identity. Both are variable fonts under the SIL Open Font
 * License; see fonts/README.md. The latin-ext face is only downloaded if a
 * character outside Latin-1 is actually rendered.
 */

@font-face {
  font-family: Archivo;
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/archivo-latin.cd56e2ec63d7.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Archivo;
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.c5e41aa17045.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/opensans-latin.dcf31ebe1074.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/opensans-latin-ext.062c1f2aaf2d.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* alwaysdata brand. #E9568E is the historical colour, reserved for the
     logo; #E21D69 is the UI colour and everything else derives from it. */
  --brand: #E21D69;
  --brand-dark: #B91855;
  --brand-darker: #8C1241;
  --brand-soft: #FFE4EE;
  --brand-text: #B91855;
  /* Text drawn on top of --brand, and the hover shade underneath it. */
  --brand-on: #ffffff;
  --brand-hover: #B91855;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c4cad2;

  --text: #16191d;
  --text-muted: #61686f;
  --text-faint: #8b929a;

  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;

  /* Timeline layers, from background band to foreground bar. */
  --planned: #d5dae1;
  --presence: #8fa3bc;
  --counted: var(--brand);
  /* Calendar events: a pale fill per calendar, ink dark enough to read on it,
     and a stronger edge for the left border and the initials badge. The
     default tone is the company calendar. */
  --event-bg: #eef1f6;
  --event-edge: #c3cddb;
  --event-ink: #3c4a5c;
  --event-stripe: rgba(16, 24, 40, .06);
  /* The brand pink belongs to the company calendar alone, and carries further
     than the pastels the accounts pick from. */
  --event-company-bg: #ffdcea;
  --event-company-edge: #e9568e;
  --event-company-ink: #a3164f;
  /* Emphasis chart: the highlighted part in the accent, the rest as context.
     Pair validated for colour-blind and normal vision in both themes. */
  --chart-part: var(--brand);
  --chart-rest: #9aa3ad;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);

  --font: 'Open Sans', system-ui, sans-serif;
  --font-title: Archivo, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #E9568E;
    --brand-dark: #E21D69;
    --brand-darker: #B91855;
    --brand-soft: #412a37;
    --brand-text: #F58BB4;
    --brand-on: #14171a;
    /* Lighter on hover here: on a dark ground, darker reads as disabled. */
    --brand-hover: #F58BB4;

    --bg: #14171a;
    --surface: #1c2024;
    --surface-alt: #23282d;
    --border: #2f353b;
    --border-strong: #454c54;

    --text: #e8eaed;
    --text-muted: #a2abb4;
    --text-faint: #79828b;

    --ok: #4ade80;
    --ok-soft: #14351f;
    --warn: #fbbf24;
    --warn-soft: #3a2c0c;
    --bad: #f87171;
    --bad-soft: #3d1717;

    --planned: #3d444c;
    --presence: #54687f;
    --event-bg: #262c33;
    --event-edge: #3f4a57;
    --event-ink: #c4cfda;
    --event-stripe: rgba(255, 255, 255, .06);
    --event-company-bg: #45262f;
    --event-company-edge: #e9568e;
    --event-company-ink: #f7b6ce;
    --chart-rest: #4b535c;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  margin: 0 0 .4em;
  font-family: var(--font-title);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.01em;
}
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* ---------- Layout ---------- */

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
}

.main { min-width: 0; }

.page {
  max-width: 1120px;
  padding: 1.75rem 1.5rem 4rem;
}

/* For a page whose content gains from the whole screen, such as the calendar. */
.page--wide { max-width: none; padding-bottom: 1.75rem; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.1rem .75rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  padding: .2rem .6rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.sidebar__nav { display: grid; gap: 2px; align-content: start; }

/* A panel of its own: the clock is information, not a menu entry. */
.clock {
  display: grid;
  padding: .55rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  line-height: 1.25;
}
.clock__time {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.clock__date { font-size: .8rem; color: var(--text-muted); }

.nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav-link__icon { width: 18px; height: 18px; flex: none; }
.nav-link__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Marks what only the staff sees, so they know it is not shown to everyone. */
.nav-link__restricted { display: inline-flex; flex: none; margin-left: auto; color: var(--text-faint); }
.nav-link__restricted svg { width: 16px; height: 16px; }
.nav-link.is-active .nav-link__restricted { color: var(--brand-text); }

/* Read out, never shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sidebar__foot { margin-top: auto; display: grid; gap: .75rem; }

.sidebar__user {
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: .1rem;
  font-size: .85rem;
}
.sidebar__name { padding: .2rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.sidebar__name:hover { background: var(--surface-alt); color: var(--brand-text); text-decoration: none; }
.sidebar__user .button--link { justify-self: start; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    max-height: none;
    flex-direction: row;
    align-items: center;
    gap: .75rem;
    padding: .55rem .9rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar__nav { grid-auto-flow: column; gap: .25rem; }
  .sidebar__group { grid-auto-flow: column; align-items: center; gap: .25rem; }
  .sidebar__heading { display: none; }
  .clock { padding: .2rem .5rem; }
  .clock__time { font-size: 1rem; }
  .clock__date { display: none; }
  .nav-link span { white-space: nowrap; }
  .sidebar__foot {
    margin-top: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
  }
  .sidebar__user {
    padding-top: 0;
    border-top: 0;
    display: flex;
    align-items: center;
  }
  .sidebar__name { display: none; }
  .page { padding: 1.25rem 1rem 3rem; }
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head p { margin: .15rem 0 0; color: var(--text-muted); font-size: .9rem; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card,
form + .card { margin-top: 1.25rem; }
.card__head {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card__head h2 { margin: 0; }
.card__body { padding: 1.1rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1040px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Buttons and forms ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
}
.button:hover { background: var(--surface-alt); text-decoration: none; }

/* Each variant restates its own background on hover: `.button:hover` is more
   specific than `.button--primary`, so without this the primary button would
   revert to the neutral surface and keep its light text — white on white. */
.button--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.button--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: var(--brand-on);
}

.button--link { border: 0; background: none; color: var(--text-muted); padding: .2rem .6rem; }
.button--link:hover { background: none; color: var(--text); text-decoration: underline; }

.button--block { width: 100%; justify-content: center; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }
.field input, .field select, .field textarea,
table.data input:not([type='checkbox']), table.data select, table.data textarea {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
.field input:focus, .field select:focus, .field textarea:focus,
table.data input:focus, table.data select:focus, table.data textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
.field .helptext { display: block; margin-top: .25rem; font-size: .8rem; color: var(--text-faint); }
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}
.field .errorlist { margin: .3rem 0 0; padding: 0; list-style: none; color: var(--bad); font-size: .82rem; }

.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.25rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  margin-bottom: -1px;
  padding: .5rem .85rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand-text); border-bottom-color: var(--brand); }

.preferences { max-width: 760px; }
.preferences__note { margin: 0 0 .8rem; font-size: .9rem; color: var(--text-muted); }

/* Each choice is drawn as the event it will produce. */
/* One colour per line, its holders beside it. The margin keeps the ring of the
   chosen one clear of the label above. */
.samples { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; }
.sample { display: flex; align-items: center; gap: .7rem; cursor: pointer; }
.sample__taken { font-size: .78rem; color: var(--text-faint); }
.sample input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sample__chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 9rem;
  padding: .45rem .8rem;
  border: 1px solid var(--event-edge);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--event-bg);
  color: var(--event-ink);
  font-size: .85rem;
  font-weight: 500;
  opacity: .75;
}
/* The tick has its slot from the start, so nothing moves when it appears. */
.sample__chip::before { content: ''; width: .8rem; font-weight: 700; }
.sample:hover .sample__chip { opacity: 1; }
.sample input:checked + .sample__chip {
  border-color: var(--event-ink);
  border-left-width: 6px;
  font-weight: 700;
  opacity: 1;
}
.sample input:checked + .sample__chip::before { content: '✓'; }
.sample input:focus-visible + .sample__chip { outline: 2px solid var(--brand); outline-offset: 2px; }

.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset + .fieldset { margin-top: .25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
/* Floated, so the legend lays out like a heading instead of cutting the border. */
.fieldset legend {
  float: left;
  width: 100%;
  margin-bottom: .75rem;
  padding: 0;
  font-family: var(--font-title);
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.form-grid {
  clear: both;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 1rem;
}
.field--wide { grid-column: 1 / -1; }
/* A button closing a row of fields, level with their inputs. */
.form-grid__action { align-self: end; }

.messages { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .5rem; }
.messages li {
  padding: .6rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .9rem;
}
.messages li.success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.messages li.error { background: var(--bad-soft); border-color: transparent; color: var(--bad); }

/* ---------- Tables ---------- */

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

table.data {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  padding: .6rem .75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
}
table.data tbody tr:hover { background: var(--surface-alt); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
  background: var(--surface-alt);
}
td.strong, th.strong { font-weight: 650; color: var(--text); }
td.muted { color: var(--text-muted); }
.person { display: flex; flex-direction: column; }
.person__name { font-weight: 600; }
.person__login { font-size: .78rem; color: var(--text-faint); }

.balance { font-weight: 600; }
.balance--over { color: var(--ok); }
.balance--under { color: var(--bad); }
.balance--even { color: var(--text-muted); }

.meter {
  width: 80px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.meter__fill { height: 100%; background: var(--brand); }

/* ---------- Period navigation ---------- */

.range-nav { display: grid; gap: 1.1rem; }
.range-nav h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  margin-bottom: .4rem;
}
.range-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.range-nav a {
  display: block;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
}
.range-nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.range-nav a.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }

.range-steps { display: flex; align-items: center; gap: .35rem; }

/* ---------- Daily timeline ---------- */

.timeline { display: grid; gap: 2px; }

.timeline__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 76px;
  align-items: center;
  gap: .75rem;
  padding: .3rem .25rem;
  border-radius: var(--radius-sm);
}
.timeline__row:hover { background: var(--surface-alt); }
.timeline__row--weekend .timeline__day { color: var(--text-faint); }

.timeline__day { font-size: .85rem; color: var(--text-muted); }
.timeline__day b { color: var(--text); font-weight: 600; }

.timeline__track {
  position: relative;
  height: 22px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.timeline__bar { position: absolute; border-radius: 3px; }
.timeline__bar--planned { top: 3px; height: 16px; background: var(--planned); }
.timeline__bar--presence { top: 7px; height: 8px; background: var(--presence); }
.timeline__bar--counted { top: 7px; height: 8px; background: var(--counted); }

.timeline__total { text-align: right; font-size: .85rem; font-variant-numeric: tabular-nums; }

.timeline__axis {
  position: relative;
  height: 18px;
  margin: .35rem 0 0;
  grid-column: 2;
}
.timeline__tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: .7rem;
  color: var(--text-faint);
}

.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 18px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---------- Details ---------- */

details.periods { margin-top: .35rem; }
details.periods > summary {
  cursor: pointer;
  font-size: .82rem;
  color: var(--text-muted);
  padding: .2rem 0;
}
details.periods > summary:hover { color: var(--text); }
details.periods ul {
  margin: .4rem 0 .6rem;
  padding-left: 1.1rem;
  font-size: .82rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: .85rem 1rem; }
.stat__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.stat__value {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: .15rem;
}

.empty { color: var(--text-muted); font-size: .9rem; padding: 1.5rem 0; text-align: center; }

.badge {
  display: inline-block;
  padding: .05rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--muted { background: var(--surface-alt); color: var(--text-muted); }

/* ---------- Login ---------- */

.login {
  max-width: 340px;
  margin: 12vh auto;
  padding: 0 1.25rem;
}
.login h1 { font-size: 1.25rem; text-align: center; margin-bottom: 1.25rem; }

/* ---------- Brand marks ---------- */

.brand { display: flex; align-items: center; gap: .55rem; }
.brand__mark { width: 26px; height: auto; flex: none; }

.login__logo { display: block; width: 190px; height: auto; margin: 0 auto 1.25rem; }

/* ---------- Icon-only buttons ---------- */

.button--icon { padding: .4rem; }
.button__icon { width: 16px; height: 16px; flex: none; }

/* ---------- Sidebar groups ---------- */

.sidebar__group { display: grid; gap: .3rem; }

.sidebar__heading {
  margin: 0;
  padding: 0 .6rem;
  font-family: var(--font);
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
}


/* ---------- Team directory ---------- */

.team-group + .team-group { margin-top: 1.9rem; }
.team-group__title {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: 0 0 .6rem;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -.015em;
}
.team-group__count {
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.member {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.member__portrait { position: relative; flex: none; }

.member__photo,
.member__initials {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-alt);
}

.member__initials {
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.member__dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--text-faint);
}
.member__dot--online { background: var(--ok); }
.member__dot--dnd { background: var(--bad); }
.member__dot--away { background: var(--warn); }
.member__dot--offline { background: var(--border-strong); }

.member__body { min-width: 0; }
.member__name { margin: 0; font-size: 1rem; }
.member__handle,
.member__status,
.member__email { margin: .1rem 0 0; font-size: .82rem; color: var(--text-muted); }
.member__handle { font-family: var(--mono); color: var(--text-faint); }
.member__email a { overflow-wrap: anywhere; }

/* ---------- Impersonation ---------- */

.impersonation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--warn);
  font-size: .85rem;
}
.impersonation b { font-weight: 650; }
.impersonation form { margin: 0; }

.button--small { padding: .25rem .6rem; font-size: .8rem; }

/* Pushed to the far edge of the card, clear of the text. */
.member__impersonate { margin-left: auto; flex: none; }
.member__impersonate .button { color: var(--text-faint); }
.member__impersonate .button:hover { color: var(--brand-text); border-color: var(--brand); }

/* ---------- Tools ---------- */

.tool-list { list-style: none; margin: 0; padding: 0; }
.tool-list li + li { border-top: 1px solid var(--border); }
.tool-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .9rem 1.25rem;
}
.tool-item__name {
  font-family: var(--font-title);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.tool-item__name:hover {
  color: var(--brand-text);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
.tool-item__name:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.tool-item__desc {
  margin: .2rem 0 0;
  max-width: 62ch;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tool-item__date {
  flex: none;
  font-family: var(--font-title);
  font-size: .78rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  white-space: nowrap;
}

/* Outside its card, so a category reads as a section rather than a row. */
.tool-category + .tool-category { margin-top: 1.9rem; }
.tool-category__title {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: 0 0 .6rem;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -.015em;
}
.tool-category__count {
  font-size: .8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* ---------- Agenda ---------- */

.agenda { margin-bottom: 1.5rem; }
.agenda [hidden], .agenda-dialog [hidden] { display: none !important; }

.agenda .fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-alt);
  --fc-list-event-hover-bg-color: var(--surface-alt);
  --fc-today-bg-color: var(--surface-alt);
  --fc-now-indicator-color: var(--brand);
  --fc-button-text-color: var(--text);
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: var(--border-strong);
  --fc-button-hover-bg-color: var(--surface-alt);
  --fc-button-hover-border-color: var(--border-strong);
  --fc-button-active-bg-color: var(--brand-soft);
  --fc-button-active-border-color: var(--brand);
  font-size: .88rem;
}
.agenda .fc .fc-toolbar-title { font-family: var(--font-title); font-size: 1.15rem; font-weight: 600; }
.agenda .fc .fc-button { font-size: .82rem; }
.agenda .fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--brand-text); }
.agenda .fc .fc-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* Every event opens its details; FullCalendar only shows a pointer on some of them. */
.agenda .fc .fc-event { cursor: pointer; }

.agenda .fc .fc-event {
  background: var(--event-bg);
  border: 1px solid var(--event-edge);
  border-left-width: 3px;
}
.agenda .fc .fc-event .fc-event-main { color: var(--event-ink); }
/* The company calendar wears the brand pink, and a heavier edge with it. */
.agenda .fc .agenda-event--company {
  --event-bg: var(--event-company-bg);
  --event-edge: var(--event-company-edge);
  --event-ink: var(--event-company-ink);
  border-left-width: 4px;
}
.agenda .fc .agenda-event--company .agenda-event__title { font-weight: 600; }

/* One hue per account, evenly spaced around the wheel. The pink band is left
   out: it belongs to the company calendar. */
[class*='agenda-tone-'] {
  --s: 62%;
  --event-bg: hsl(var(--h) var(--s) 93%);
  --event-edge: hsl(var(--h) var(--s) 66%);
  --event-ink: hsl(var(--h) var(--s) 29%);
}
@media (prefers-color-scheme: dark) {
  [class*='agenda-tone-'] {
    --event-bg: hsl(var(--h) calc(var(--s) / 2.5) 16%);
    --event-edge: hsl(var(--h) calc(var(--s) / 1.8) 36%);
    --event-ink: hsl(var(--h) var(--s) 76%);
  }
}
.agenda-tone-1 { --h: 15; }
.agenda-tone-2 { --h: 35; }
.agenda-tone-3 { --h: 55; }
.agenda-tone-4 { --h: 75; }
.agenda-tone-5 { --h: 100; }
.agenda-tone-6 { --h: 130; }
.agenda-tone-7 { --h: 155; }
.agenda-tone-8 { --h: 175; }
.agenda-tone-9 { --h: 195; }
.agenda-tone-10 { --h: 215; }
.agenda-tone-11 { --h: 235; }
.agenda-tone-12 { --h: 255; }
.agenda-tone-13 { --h: 275; }
.agenda-tone-14 { --h: 295; }
/* Nearly grey, for whoever would rather not carry a colour. */
.agenda-tone-15 { --h: 215; --s: 12%; }
/* Own events read first. */
.agenda .fc .agenda-event--mine .agenda-event__title { font-weight: 600; }
/* Days another application puts on the calendar: read-only, hence set apart. */
.agenda .fc .agenda-event--leave {
  --event-bg: var(--surface-alt);
  --event-edge: var(--border-strong);
  --event-ink: var(--text-muted);
  border-left-style: dashed;
}
.agenda .fc .agenda-event--private {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--event-stripe) 6px 12px);
}

/* One line per event: the initials of its calendar, the time, then the title. */
.agenda-event { display: flex; align-items: baseline; gap: .3rem; min-width: 0; padding-left: .25rem; }
.agenda-event__badge {
  flex: none;
  align-self: center;
  padding: .1rem .3rem;
  border-radius: 4px;
  background: var(--event-edge);
  color: var(--event-ink);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .02em;
}
.agenda-event__avatar {
  flex: none;
  align-self: center;
  width: var(--avatar-size, 18px);
  height: var(--avatar-size, 18px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--event-edge);
}
/* The company's brand mark: whole, not cropped round like a face. */
.agenda-event__avatar--logo { border-radius: 0; object-fit: contain; background: none; }
/* The list view has room to spare. */
.agenda .fc-list-event .agenda-event__avatar { --avatar-size: 22px; }
.agenda-event__time { flex: none; font-size: .72rem; opacity: .8; font-variant-numeric: tabular-nums; }
.agenda-event__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.agenda-dialog {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.agenda-dialog::backdrop { background: rgba(16, 24, 40, .35); }
.agenda-dialog h2 { margin: 0 0 .75rem; }
.agenda-dialog__owner { margin: -.4rem 0 .75rem; font-size: .85rem; color: var(--text-muted); }
.agenda-dialog__errors { margin: 0 0 .75rem; padding-left: 1.1rem; color: var(--bad); font-size: .85rem; }

/* The dialog wears the colour of the calendar it is about. */
.agenda-dialog { border-top: 4px solid var(--event-edge); }
.agenda-dialog h2 { color: var(--event-ink); }
.agenda-dialog__owner {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
  background: var(--event-bg);
  color: var(--event-ink);
}
.agenda-dialog--company {
  --event-bg: var(--event-company-bg);
  --event-edge: var(--event-company-edge);
  --event-ink: var(--event-company-ink);
}
.agenda-dialog__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.agenda-dialog__check { display: flex; align-items: center; gap: .45rem; margin: 0 0 1rem; font-size: .9rem; }
.agenda-dialog__note { margin: -.5rem 0 1rem; font-size: .8rem; color: var(--text-faint); }
/* A tinted panel, so the reminders read apart from the event fields. */
.agenda-dialog__reminders {
  margin: 0 0 1rem;
  padding: .75rem .85rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.agenda-dialog__reminders legend {
  float: left;
  width: 100%;
  margin-bottom: .5rem;
  padding: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.agenda-dialog__reminders [data-reminders] { clear: both; }
.agenda-reminder {
  display: grid;
  gap: .4rem;
  margin-bottom: .6rem;
  padding: .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
/* Cancels the link buttons' own padding, whichever of them is shown first. */
.agenda-reminder__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-left: -.6rem; }
.agenda-reminder__line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.agenda-reminder textarea { resize: vertical; }
.agenda-reminder [data-send]:disabled { opacity: .5; }
.agenda-reminder__status { font-size: .8rem; color: var(--text-muted); }
.agenda-reminder select,
.agenda-reminder textarea {
  padding: .4rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
}
.agenda-dialog__delete { margin-left: auto; color: var(--bad); }
.agenda-dialog :disabled { cursor: default; }

@media (max-width: 520px) {
  .agenda-dialog__row { grid-template-columns: 1fr; }
}

/* ---------- Page actions and year navigation ---------- */

.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.year-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.year-nav a { padding: .3rem .6rem; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .85rem; }
.year-nav a:hover { background: var(--surface-alt); text-decoration: none; }
.year-nav a.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }

/* ---------- Column chart ---------- */

.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .5rem; font-size: .8rem; color: var(--text-muted); }
.chart-legend__key::before {
  content: '';
  display: inline-block;
  width: .7rem;
  height: .7rem;
  margin-right: .4rem;
  border-radius: 2px;
  vertical-align: -1px;
  background: var(--key);
}
.chart-legend__key--part { --key: var(--chart-part); }
.chart-legend__key--rest { --key: var(--chart-rest); }

.chart { position: relative; }
.chart__scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart__grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart__tick,
.chart__label { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__hit { fill: transparent; }
.chart__seg--part { fill: var(--chart-part); }
.chart__seg--rest { fill: var(--chart-rest); }
.chart__column { cursor: default; outline: none; }
.chart__column:hover .chart__hit,
.chart__column:focus-visible .chart__hit { fill: var(--surface-alt); }
.chart__column:focus-visible .chart__hit { stroke: var(--brand); stroke-width: 1.5; }

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 11rem;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.chart-tooltip p { margin: 0; }
.chart-tooltip__total { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tooltip__label { margin-bottom: .3rem !important; font-size: .8rem; color: var(--text-muted); }
.chart-tooltip__row { font-size: .82rem; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tooltip__row::before {
  content: '';
  display: inline-block;
  width: .8rem;
  height: 2px;
  margin-right: .45rem;
  vertical-align: middle;
  background: var(--key);
}
.chart-tooltip__row--part { --key: var(--chart-part); }
.chart-tooltip__row--rest { --key: var(--chart-rest); }

/* ---------- AI usage ---------- */

.aiusage-total__label { margin: 0; font-size: .85rem; color: var(--text-muted); }
.aiusage-total__value {
  margin: .1rem 0 0;
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.aiusage-total__mine { margin: .2rem 0 1.25rem; font-size: .9rem; color: var(--text-muted); }
.aiusage-total__value span { font-size: .9rem; font-weight: 500; color: var(--text-muted); }
.aiusage-hint { margin: 0 0 1rem; font-size: .8rem; color: var(--text-faint); }
.aiusage-entry__actions { text-align: right; }
.aiusage-entry__actions form { margin: 0; }
.aiusage-dialog {
  width: min(420px, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.aiusage-dialog::backdrop { background: rgba(16, 24, 40, .35); }
.aiusage-dialog h2 { margin: 0 0 .75rem; }
.aiusage-data { margin-top: 1rem; }
.aiusage-data > summary { cursor: pointer; font-size: .85rem; color: var(--text-muted); }
.aiusage-data > summary:hover { color: var(--text); }

/* ---------- Leave ---------- */

.leave-stats { margin-bottom: 1.25rem; }
.leave-stats__note { margin-top: .1rem; font-size: .8rem; color: var(--text-muted); }
.leave-inbox {
  margin: 0 0 1.25rem;
  padding: .6rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: .9rem;
}
.leave-inbox a { color: inherit; font-weight: 600; }
.leave-form { max-width: 560px; }
.leave-note { margin: 0 0 1rem; font-size: .9rem; color: var(--text-muted); }
.leave-actions { display: flex; align-items: center; justify-content: flex-end; gap: .1rem; }
.leave-actions form { margin: 0; }
.leave-actions .button--icon:hover { color: var(--brand-text); }
.leave-actions .leave-actions__cancel:hover { color: var(--bad); }
.leave-comment, .leave-reason { white-space: normal; font-size: .82rem; }
table.data td.leave-reason { max-width: 22rem; }
.leave-decision { display: flex; align-items: center; gap: .4rem; }
.leave-decision textarea {
  width: 12rem;
  padding: .3rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  resize: vertical;
}

/* ---------- Bug bounty ---------- */

.bounty-stats { margin-bottom: 1.25rem; }
.bounty-due { color: var(--warn); }
.bounty-stats__note { margin-top: .1rem; font-size: .8rem; color: var(--text-muted); }

.bounty-table td { vertical-align: top; }
/* The report column takes the room left by the others, sized to their content. */
table.data td.bounty-table__report { width: 100%; min-width: 20rem; white-space: normal; }
.bounty-table__title { font-weight: 600; color: var(--text); }
.bounty-table__title:hover { color: var(--brand-text); }
.bounty-table__meta { margin-top: .15rem; font-size: .8rem; color: var(--text-muted); }
.bounty-table__notes {
  margin-top: .4rem;
  padding-left: .6rem;
  border-left: 2px solid var(--border);
  font-size: .8rem;
  color: var(--text-faint);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.bounty-table__date { margin-top: .2rem; font-size: .78rem; color: var(--text-faint); }
.bounty-table .muted { color: var(--text-faint); }

.bounty-badge {
  display: inline-block;
  padding: .05rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.6;
}
.bounty-badge--paid { background: var(--ok-soft); color: var(--ok); }
.bounty-badge--due { background: var(--warn-soft); color: var(--warn); }
/* The payment waits on the hunter's name or customer account. */
.bounty-badge--missing {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .3rem;
  background: var(--bad);
  /* The page colour: white on the light theme's deep red, dark on the dark theme's pale one. */
  color: var(--surface);
  white-space: nowrap;
}
.bounty-badge__icon { width: 14px; height: 14px; }
table.data tbody tr.bounty-table__row--missing { background: var(--bad-soft); }
table.data tbody tr.bounty-table__row--missing td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.bounty-missing { color: var(--bad); }

.bounty-form { max-width: 760px; }
/* A shortcut filling the report fields, not a field of its own: set apart from the fieldsets. */
.field.bounty-shortcut {
  margin-bottom: 1.4rem;
  padding: .8rem 1rem .85rem;
  border: 1px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.bounty-shortcut label { color: var(--brand-text); }
.bounty-shortcut .helptext { color: var(--text-muted); }
.bounty-form .form-actions { padding-top: 1.1rem; border-top: 1px solid var(--border); }
.bounty-notice {
  margin: 0 0 1.1rem;
  padding: .6rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: .88rem;
}
