/*
 * The admin panel's only stylesheet, and no JavaScript anywhere. Phones first (390 px): a top bar with a menu button
 * that slides the sidebar in as a drawer. From 720 px lists are tables; from 960 px the sidebar is always there.
 */

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --hover: #f1f4f9;
  --text: #0f172a;
  --text-soft: #334155;
  --nav-text: #475569;
  --muted: #64748b;
  --line: #e6eaf1;
  --line-strong: #d6dce6;
  --input-line: #8590a3;
  --primary: #3b5bfd;
  --primary-dark: #2b48dd;
  --primary-soft: #eef2ff;
  --focus: #3b5bfd;
  --good: #146c43;
  --good-soft: #e8f7ef;
  --good-line: #b5e5cb;
  --warn: #93530a;
  --warn-soft: #fff5e5;
  --warn-line: #f6d7a6;
  --bad: #c0262d;
  --bad-dark: #a11d23;
  --bad-soft: #fdeded;
  --bad-line: #f6c4c6;
  --grey: #4b5565;
  --grey-soft: #eef1f5;
  --radius: 16px;
  --radius-small: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px -8px rgba(15, 23, 42, 0.08);
  --sidebar: 264px;
  --topbar: 60px;
  --speed: 0.25s;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Khmer", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
}

p {
  margin: 0;
}

a {
  color: var(--primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
}

/* The brand: a blue mark and the name */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-name {
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 14px -6px rgba(59, 91, 253, 0.7);
}

.brand-mark .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/*
 * The drawer, without script: a checkbox that stays focusable but unseen, and two labels for it (the menu button and
 * the dimmed backdrop). Checked, the sidebar slides in over the page. Closed, it is hidden, so Tab skips its links.
 */

.menu-toggle {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--topbar);
  padding: 0 12px 0 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.menu-button {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-small);
  color: var(--text);
  cursor: pointer;
}

.menu-button .icon {
  width: 24px;
  height: 24px;
}

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

.menu-toggle:focus-visible ~ .topbar .menu-button {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.topbar .brand {
  font-size: 16px;
}

.topbar .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.topbar .brand-mark .icon {
  width: 18px;
  height: 18px;
}

.topbar-you {
  margin-left: auto;
}

.topbar-you .avatar {
  width: 34px;
  height: 34px;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(288px, 86vw);
  padding: 16px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform var(--speed) ease, visibility 0s linear var(--speed);
}

.menu-toggle:checked ~ .sidebar {
  transform: none;
  visibility: visible;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  transition: transform var(--speed) ease;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition: opacity var(--speed) ease, visibility 0s linear var(--speed);
}

.menu-toggle:checked ~ .backdrop {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--speed) ease;
}

/* While the drawer is open, the page under it stays put. */
body:has(.menu-toggle:checked) {
  overflow: hidden;
}

.sidebar > .brand {
  margin: 0 8px 20px;
}

.nav ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a,
.you-links a,
.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--nav-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav a:hover,
.you-links a:hover,
.nav-button:hover {
  background: var(--hover);
  color: var(--text);
}

.nav a[aria-current="page"],
.you-links a[aria-current="page"] {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 8px 18px -10px rgba(59, 91, 253, 0.9);
}

.you {
  margin-top: auto;
  padding-top: 20px;
}

.you .person {
  margin: 0 0 8px;
  padding: 16px 8px 0;
  border-top: 1px solid var(--line);
}

.you .avatar {
  width: 40px;
  height: 40px;
}

.you-links form {
  margin: 0;
}

/* The page */

.main {
  min-width: 0;
  padding: 20px 16px 56px;
}

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

.page-head {
  margin-bottom: 20px;
}

.blocked-phones {
  margin-top: 32px;
}

.blocked-phones h2 {
  margin-bottom: 4px;
}

.blocked-phones .lead {
  margin-bottom: 16px;
  font-size: 15px;
}

.page-head .lead {
  margin-top: 4px;
  font-size: 15px;
}

.page-head.with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-head.with-action > div {
  flex: 1 1 260px;
  min-width: 0;
}

.person-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.person-head > div {
  min-width: 0;
}

.person-head .avatar {
  width: 56px;
  height: 56px;
  font-size: 19px;
}

.card {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card > h1 {
  margin-bottom: 10px;
  font-size: 21px;
}

.card > p + p,
.card > p + .warning {
  margin-top: 12px;
}

.confirm {
  max-width: 560px;
  margin-top: 0;
}

.confirm > p {
  color: var(--text-soft);
}

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

.name {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: 1px;
}

/* Avatars: initials on one of six soft colours */

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.avatar-0 { background: #e0e7ff; color: #3730a3; }
.avatar-1 { background: #ede9fe; color: #5b21b6; }
.avatar-2 { background: #fef3c7; color: #92400e; }
.avatar-3 { background: #dcfce7; color: #166534; }
.avatar-4 { background: #fce7f3; color: #9d174d; }
.avatar-5 { background: #ccfbf1; color: #115e59; }

.avatar .icon {
  width: 18px;
  height: 18px;
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.name-row {
  overflow-wrap: anywhere;
}

/* Pills: a state in words, on a tint, with a dot */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.pill::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-muted { background: var(--grey-soft); color: var(--grey); }
.pill-info { background: var(--primary-soft); color: var(--primary-dark); }

.status-detail {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-detail .status-text {
  display: block;
}

.status-detail .when {
  color: var(--muted);
}

/* Summary cards: a tint, a count, and an icon on a tile */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.stat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.stat-text {
  min-width: 0;
}

.stat-label {
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.stat-value {
  margin-top: 6px;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #ffffff;
}

.stat-icon .icon {
  width: 20px;
  height: 20px;
}

.stat-info { background: #eef3ff; border-color: #dfe7ff; }
.stat-info .stat-icon { background: #3b5bfd; }
.stat-good { background: #ebf8f1; border-color: #d4f0e1; }
.stat-good .stat-icon { background: #1e9e62; }
.stat-warn { background: #fff6e6; border-color: #fbe6c2; }
.stat-warn .stat-icon { background: #f29a0c; }
.stat-bad { background: #fdeeee; border-color: #f9dada; }
.stat-bad .stat-icon { background: #e5484d; }
/* A count that is neither good nor bad, in violet like the reference's fourth card. */
.stat-muted { background: #f4f0ff; border-color: #e7e0fd; }
.stat-muted .stat-icon { background: #7c5cfc; }

/* Messages */

.flash,
.alert,
.warning {
  padding: 12px 16px;
  border: 1px solid;
  border-radius: 12px;
  font-weight: 600;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--good-soft);
  border-color: var(--good-line);
  color: var(--good);
}

.flash .icon {
  margin-top: 2px;
}

.flash > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.flash.warning {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}

.alert {
  margin-bottom: 20px;
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: var(--bad);
}

.warning {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}

/* Forms */

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.field label {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

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

.field-error {
  margin-top: 2px;
  color: var(--bad);
  font-size: 14px;
  font-weight: 600;
}

.field input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 14px;
  border: 1px solid var(--input-line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.field input:hover {
  border-color: #6b768a;
}

.field input:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(59, 91, 253, 0.2);
}

.field.invalid input {
  padding: 9px 13px;
  border: 2px solid var(--bad);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-small);
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(59, 91, 253, 0.8);
}

.button .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

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

.button.wide {
  width: 100%;
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

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

.button.danger {
  background: var(--bad);
  border-color: var(--bad);
  box-shadow: none;
}

.button.danger:hover {
  background: var(--bad-dark);
  border-color: var(--bad-dark);
}

.button.danger-outline {
  background: var(--surface);
  border-color: var(--bad);
  color: var(--bad);
  box-shadow: none;
}

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

.button.small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 0;
}

.buttons .button {
  flex: 1 1 140px;
}

/* A lone button keeps its own width, like every other single button; only pairs share the row. */
.buttons .button:only-child {
  flex: 0 0 auto;
}

.card .buttons:first-child,
.card > .lead + .buttons {
  margin-top: 0;
}

.back {
  margin: -6px 0 10px;
}

.back a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.back a .icon {
  width: 18px;
  height: 18px;
  margin-left: -4px;
}

.back a:hover {
  color: var(--primary);
}

/* Pages and cards with forms: as wide as their fields, which fill them */

.narrow {
  max-width: 600px;
}

.card > h2 + .lead {
  margin: -8px 0 16px;
  font-size: 15px;
}

.card > .lead:last-child {
  margin-bottom: 0;
}

/* Numbered steps above a form, such as how to make a bot in BotFather */

.steps {
  margin: 0 0 20px;
  padding-left: 22px;
}

.steps li + li {
  margin-top: 6px;
}

.group-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.group-fields legend {
  float: left;
  width: 100%;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
}

.group-fields legend + .help {
  clear: both;
  margin-top: -16px;
}

.check-again {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.check-again .help {
  flex: 1 1 200px;
}

/* An operator's facts: each under its label */

.facts {
  margin: 0;
}

.facts > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.facts > div:first-child {
  padding-top: 0;
}

.facts > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

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

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

.card.needs-attention {
  border-color: var(--warn-line);
  box-shadow: 0 0 0 1px var(--warn-line), var(--shadow);
}

/*
 * Lists: a card each on phones, each cell under its label; a table from 720 px.
 */

.table,
.table tbody,
.table tr,
.table td {
  display: block;
}

.table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.table tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table td {
  grid-column: 1 / -1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.table td.who {
  grid-column: 1;
  grid-row: 1;
}

.table td.actions,
.table td.state {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

/* Without weight (:where), so the table below shows these cells again with a plain .table td. */
.table td:where(.blank, .actions:empty) {
  display: none;
}

.table td.labelled {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding-top: 10px;
  font-size: 15px;
}

.table td.who + td.labelled {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cell-label {
  color: var(--muted);
  font-size: 13px;
}

.cell-value {
  min-width: 0;
}

.table tr.needs-attention {
  border-color: var(--warn-line);
  box-shadow: 0 0 0 1px var(--warn-line), var(--shadow);
}

.table tr.left .name {
  color: var(--muted);
}

.table tr.left .avatar {
  opacity: 0.6;
}

.empty {
  padding: 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

/* The activity list: a timeline, each change by its actor's avatar */

.timeline {
  margin: 0;
  padding: 8px 16px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timeline li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
}

/* The line from one change down to the next. */
.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 54px;
  bottom: -10px;
  left: 18px;
  width: 2px;
  border-radius: 1px;
  background: var(--line);
}

.timeline .avatar {
  width: 38px;
  height: 38px;
}

.event {
  min-width: 0;
  padding-top: 1px;
}

.event p {
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.event time {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* The sign-in page, and pages shown without signing in */

.signin {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 16px;
  background: radial-gradient(1200px 480px at 50% -120px, #e3e9ff 0%, rgba(227, 233, 255, 0) 70%), var(--bg);
}

.signin-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 24px 48px -24px rgba(15, 23, 42, 0.18);
}

.signin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.signin-card > .lead {
  margin: 6px 0 24px;
  font-size: 15px;
}

.signin-card > .buttons {
  margin-top: 0;
}

.signin .stack .button {
  margin-top: 4px;
}

/* Wider phones and tablets: lists become tables */

@media (min-width: 720px) {
  .main {
    padding: 28px 24px 64px;
  }

  h1 {
    font-size: 28px;
  }

  .card {
    padding: 24px;
  }

  .card > h1 {
    font-size: 22px;
  }

  .buttons .button {
    flex: 0 0 auto;
  }

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

  .stat:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .stat {
    padding: 18px 20px;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
  }

  .stat-icon .icon {
    width: 22px;
    height: 22px;
  }

  .stat-value {
    font-size: 30px;
  }

  .signin {
    align-items: center;
    padding: 48px 24px;
  }

  .signin-card {
    padding: 40px 36px;
  }

  .table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* Never wider than the page: should a table not fit, it scrolls inside its card. */
    overflow-x: auto;
  }

  .table {
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table thead {
    display: table-header-group;
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .table tbody {
    display: table-row-group;
  }

  .table tr {
    display: table-row;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .table th,
  .table td,
  .table td.labelled {
    display: table-cell;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    text-align: left;
    vertical-align: middle;
  }

  .table td.who + td.labelled {
    margin-top: 0;
    padding-top: 14px;
    border-top: 0;
  }

  /* Short values (a date, a username, a count) stay on one line; names, phones and 5D's messages wrap. */
  .table td.labelled {
    overflow-wrap: break-word;
  }

  .table td.short {
    white-space: nowrap;
  }

  .table td.status {
    min-width: 170px;
  }

  .table td.who .person-text {
    min-width: 120px;
  }

  .table th {
    padding-top: 11px;
    padding-bottom: 11px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 20px;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 20px;
  }

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

  .table tbody tr:hover td {
    background: #fafbfd;
  }

  .table tr.needs-attention {
    box-shadow: none;
  }

  .table tr.needs-attention td,
  .table tbody tr.needs-attention:hover td {
    background: #fffbf3;
  }

  .table tr.needs-attention td:first-child {
    box-shadow: inset 3px 0 0 #f29a0c;
  }

  .cell-label {
    display: none;
  }

  .table td.actions,
  .table td.state {
    width: 1%;
    white-space: nowrap;
  }

  .table td.actions {
    text-align: right;
  }

  .timeline {
    padding: 8px 24px;
  }

  .timeline li {
    padding: 14px 0;
  }

  .timeline li:not(:last-child)::after {
    top: 56px;
    bottom: -12px;
  }
}

/* Wide enough that a phone's name fits on one line beside everything else */

@media (min-width: 1100px) {
  .table td.device {
    white-space: nowrap;
  }
}

/* Computers: the sidebar is always there, and the top bar, the menu and its backdrop are gone */

@media (min-width: 960px) {
  .menu-toggle,
  .topbar,
  .backdrop {
    display: none;
  }

  .sidebar,
  .menu-toggle:checked ~ .sidebar {
    width: var(--sidebar);
    padding: 24px 16px 20px;
    transform: none;
    visibility: visible;
    box-shadow: none;
    transition: none;
  }

  body:has(.menu-toggle:checked) {
    overflow: visible;
  }

  .main {
    max-width: calc(var(--sidebar) + 1200px);
    margin-left: 0;
    padding: 36px 40px 72px calc(var(--sidebar) + 40px);
  }

  .page-head {
    margin-bottom: 24px;
  }

  .stats {
    margin-bottom: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .menu-toggle:checked ~ .sidebar,
  .backdrop,
  .menu-toggle:checked ~ .backdrop {
    transition: none;
  }
}
