/* Aura theme: light, luminous, fluid. Glass surfaces floating over a slow drifting wash of colour. */
:root {
  color-scheme: light;

  /* ink */
  --text: #1d1a39;
  --muted: #5b5878;
  --faint: #8582a3;

  /* aura wash */
  --bg: #fbfaff;
  --aura-lilac: #dcd0ff;
  --aura-rose: #ffd9e8;
  --aura-peach: #ffe6d1;
  --aura-sky: #cfe6ff;
  --aura-mint: #d2f6ea;

  /* surfaces */
  --surface: rgba(255, 255, 255, .66);
  --surface-strong: rgba(255, 255, 255, .86);
  --surface-solid: #fff;
  --border: rgba(104, 86, 190, .16);
  --border-strong: rgba(104, 86, 190, .3);
  --hairline: rgba(104, 86, 190, .1);
  --glass-edge: rgba(255, 255, 255, .85);
  --blur: blur(22px) saturate(150%);

  /* accents */
  --accent: #5a3fd8;
  --accent-2: #7b52ea;
  --accent-soft: rgba(110, 82, 230, .1);
  --accent-text: #fff;
  --danger: #b3204d;
  --danger-soft: rgba(214, 60, 110, .09);
  --success: #0c6a50;
  --success-soft: rgba(40, 190, 150, .12);

  /* shape */
  --radius: 20px;
  --radius-sm: 12px;
  --pill: 999px;
  --shadow: 0 1px 0 var(--glass-edge) inset, 0 18px 48px -24px rgba(72, 52, 160, .35), 0 2px 6px -2px rgba(72, 52, 160, .08);
  --shadow-lift: 0 1px 0 var(--glass-edge) inset, 0 24px 56px -22px rgba(72, 52, 160, .45), 0 3px 8px -2px rgba(72, 52, 160, .12);
  --glow: 0 0 0 4px rgba(123, 82, 234, .18);

  /* motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: 160ms;
  --slow: 420ms;

  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

/* scroll-padding keeps a focused or invalid field clear of the fixed top bar */
html { background: var(--bg); scroll-padding-top: 5rem; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.55 var(--font);
  /* a long code, email or URL breaks rather than pushing the page sideways */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* The aura: a fixed, oversized wash of soft colour that drifts very slowly behind everything. */
body::before {
  content: "";
  position: fixed; inset: -25vmax; z-index: -1;
  background:
    radial-gradient(38vmax 34vmax at 22% 24%, var(--aura-lilac), transparent 70%),
    radial-gradient(36vmax 32vmax at 78% 18%, var(--aura-sky), transparent 70%),
    radial-gradient(40vmax 36vmax at 84% 76%, var(--aura-rose), transparent 70%),
    radial-gradient(38vmax 32vmax at 24% 84%, var(--aura-mint), transparent 70%),
    radial-gradient(30vmax 26vmax at 52% 50%, var(--aura-peach), transparent 72%);
  opacity: .85;
  animation: aura-drift 48s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes aura-drift {
  0%   { transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(3%, 2%, 0) rotate(8deg) scale(1.06); }
  100% { transform: translate3d(-2%, 4%, 0) rotate(-6deg) scale(1.02); }
}

a { color: var(--accent); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: .2em; }

h1 {
  font: 400 2.1rem/1.15 var(--display);
  letter-spacing: -.015em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 2rem 0 .85rem; font-weight: 650; letter-spacing: -.005em; }
.card h2, .card legend { margin-top: 0; }

/* shell: a fixed, full-width glass bar across the top; on small screens the sections move to bottom tabs */
body { padding-top: 64px; }
.sidebar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; height: 64px;
  display: flex; align-items: center; gap: 2rem;
  padding: 0 max(1.75rem, env(safe-area-inset-right)) 0 max(1.75rem, env(safe-area-inset-left));
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: 0 1px 0 var(--hairline), 0 14px 36px -26px rgba(72, 52, 160, .5);
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font: 500 1.3rem/1 var(--display); letter-spacing: -.01em; color: var(--text); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand::before {
  content: ""; width: 1.25rem; height: 1.25rem; border-radius: 50%; flex: none;
  background: conic-gradient(from 210deg, #8b6bff, #ff9ec4, #ffd3a3, #8fe3c8, #8fc4ff, #8b6bff);
  box-shadow: 0 0 14px rgba(139, 107, 255, .55), 0 0 0 3px rgba(255, 255, 255, .7) inset;
  animation: orb-spin 14s linear infinite;
}
@keyframes orb-spin { to { transform: rotate(1turn); } }

#nav { display: flex; align-items: stretch; flex: 1; min-width: 0; height: 100%; }
.nav-links, .nav-user { display: flex; align-items: center; }
.nav-links { gap: .25rem; align-items: stretch; }
.nav-user { margin-left: auto; gap: .25rem; }
#nav form { margin: 0; }
#nav a, #nav button.link {
  position: relative; display: inline-flex; align-items: center; gap: .5rem;
  padding: 0 .9rem; color: var(--muted); font-weight: 500; white-space: nowrap;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
#nav a:hover, #nav button.link:hover { color: var(--text); text-decoration: none; }
#nav svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-links svg.icon { display: none; }
/* The current section is marked by an iridescent underline that sits on the bar's bottom edge. */
.nav-links a::after {
  content: ""; position: absolute; left: .9rem; right: .9rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #7b52ea, #ff8fbd, #8fc4ff);
  transform: scaleX(0); transform-origin: center; opacity: 0;
  transition: transform var(--slow) var(--ease), opacity var(--fast) var(--ease);
}
.nav-links a:hover::after { transform: scaleX(.4); opacity: .5; }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav-links a[aria-current="page"]::after { transform: scaleX(1); opacity: 1; }
.nav-user a, .nav-user button.link { min-height: 40px; border-radius: var(--pill); }
.nav-user a:hover, .nav-user button.link:hover { background: var(--accent-soft); }
.nav-user a[aria-current="page"] { color: var(--accent); background: var(--surface-strong); box-shadow: 0 1px 0 #fff inset, 0 6px 16px -8px rgba(72, 52, 160, .45); }
#nav a.person { padding-left: .4rem; gap: .6rem; }
#nav a.bell { padding: 0 .6rem; }
.bell .dot {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: var(--pill);
  background: linear-gradient(135deg, #e0457b, #b3204d); color: #fff; font-size: .75rem; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
.person-name { overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.spacer { flex: 1; }

/* Between the tab-bar breakpoint and a roomy desktop, the bar tightens so its row always fits. */
@media (min-width: 901px) and (max-width: 1080px) {
  .sidebar { gap: 1rem; padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left)); }
  #nav a, #nav button.link { padding: 0 .65rem; }
  .person-name { display: none; }
  #nav a.person { padding: 0 .4rem; }
}

@media (max-width: 900px) {
  html { scroll-padding-top: 4.5rem; }
  body { padding-top: 56px; }
  .sidebar {
    height: 56px; gap: .5rem; padding: 0 max(.5rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
    /* no blur here: it would trap the fixed bottom tabs inside this bar */
    background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .brand { font-size: 1.2rem; }
  #nav { display: contents; }
  .nav-user { margin-left: auto; }
  .person-name { display: none; }
  #nav a.person { padding: 0 .4rem; }
  .nav-links {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; gap: 0;
    padding: .3rem max(.3rem, env(safe-area-inset-right)) calc(.3rem + env(safe-area-inset-bottom)) max(.3rem, env(safe-area-inset-left));
    background: var(--surface-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-top: 1px solid var(--glass-edge); box-shadow: 0 -14px 36px -26px rgba(72, 52, 160, .5);
  }
  .nav-links svg.icon { display: block; }
  #nav .nav-links a {
    flex: 1; flex-direction: column; justify-content: center; gap: .2rem; min-width: 0;
    min-height: 52px; padding: .3rem .1rem; font-size: .75rem; letter-spacing: -.01em; text-align: center;
  }
  #nav .nav-links a span.long { display: none; }
  .nav-links a::after { top: 0; bottom: auto; left: 28%; right: 28%; border-radius: 0 0 3px 3px; }
  .nav-links a[aria-current="page"] { color: var(--accent); }
  body:has(.nav-links) #content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}

/* On the narrowest phones five tab labels only fit a touch smaller. */
@media (max-width: 359px) { #nav .nav-links a { font-size: .6875rem; letter-spacing: -.02em; } }

/* A phone held sideways has little height to spare: both bars slim down. */
@media (max-width: 900px) and (max-height: 520px) {
  html { scroll-padding-top: 3.75rem; }
  body { padding-top: 44px; }
  .sidebar { height: 44px; }
  .brand { font-size: 1.1rem; }
  .nav-links { padding-top: .15rem; padding-bottom: calc(.15rem + env(safe-area-inset-bottom)); }
  #nav .nav-links a { flex-direction: row; gap: .4rem; min-height: 40px; font-size: .8rem; letter-spacing: 0; }
  body:has(.nav-links) #content { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
}

/* A thin shimmer along the top while a page is on its way. Only appears if the wait is noticeable. */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10;
  background: linear-gradient(90deg, transparent, #8b6bff, #ff9ec4, #8fc4ff, transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  opacity: 0; pointer-events: none; transition: opacity var(--fast) linear;
}
.is-loading .progress { opacity: 1; animation: progress-sweep 1.1s ease-in-out infinite; }
@keyframes progress-sweep { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.is-loading #content { opacity: .6; transition: opacity var(--slow) var(--ease); }

#content { max-width: 1148px; margin: 0 auto; padding: 2.5rem max(2rem, env(safe-area-inset-right)) 4rem max(2rem, env(safe-area-inset-left)); }
.narrow { max-width: 440px; margin-inline: auto; }

/* Page changes glide: each block of the new page rises into place, slightly staggered. */
#content > * { animation: rise var(--slow) var(--ease) both; }
#content > *:nth-child(2) { animation-delay: 40ms; }
#content > *:nth-child(3) { animation-delay: 80ms; }
#content > *:nth-child(n+4) { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head:has(h2) { margin-top: 2rem; margin-bottom: .85rem; }
.crumbs { color: var(--muted); margin: 0 0 .6rem; font-size: .9rem; }
.crumbs a { display: inline-block; padding: .35rem 0; }

/* surfaces */
.card, .table-wrap, .errors, .success, p.empty {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 1.5rem; margin: 0 0 1.25rem; }
fieldset.card { min-width: 0; }
/* Legends sit inside the card as a heading instead of straddling its border. */
legend { float: left; width: 100%; grid-column: 1 / -1; padding: 0; margin: 0 0 .25rem; font-weight: 650; font-size: 1.05rem; }
legend + * { clear: both; }

dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: .65rem 1rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.prose { margin: 0; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; margin-bottom: 1.25rem; }
.card .table-wrap { margin-bottom: 0; box-shadow: none; background: rgba(255, 255, 255, .5); border-color: var(--hairline); border-radius: 14px; -webkit-backdrop-filter: none; backdrop-filter: none; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .8rem 1.1rem; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
th {
  font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); background: rgba(255, 255, 255, .45); white-space: nowrap;
  padding-top: .9rem; padding-bottom: .9rem;
}
tbody tr { transition: background var(--fast) var(--ease); }
@media (hover: hover) { tbody tr:hover { background: rgba(255, 255, 255, .6); } }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .88em; white-space: nowrap; }
.brand-name { font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-top: .1rem; }
td > a:first-child { font-weight: 550; }

.actions { display: flex; gap: .6rem; align-items: center; justify-content: flex-end; white-space: nowrap; }
.actions form { margin: 0; }
/* Row actions stay real table cells so every row keeps one continuous rule. */
td.actions { display: table-cell; text-align: right; }
td.actions > * { display: inline-block; vertical-align: middle; margin-left: .25rem; }
td.actions a, td.actions button.link {
  padding: .4rem .8rem; border-radius: var(--pill); font-size: .9rem; font-weight: 550; line-height: 1.3;
  transition: background var(--fast) var(--ease);
}
td.actions a:hover { background: var(--accent-soft); text-decoration: none; }
td.actions button.link.danger:hover { background: var(--danger-soft); text-decoration: none; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--muted); font-size: .9rem; padding: 0 .35rem; }
.pagination a, .pagination span.muted { padding: .5rem .9rem; border-radius: var(--pill); }
.pagination a { background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); font-weight: 550; }
.pagination a:hover { text-decoration: none; background: var(--surface-strong); }
.pagination span.muted { color: var(--faint); }
.pagination .count:only-child { margin-inline: auto; }
.muted { color: var(--muted); }
.empty { color: var(--muted); }
p.empty { padding: 2.5rem 1.5rem; margin: 0 0 1.25rem; text-align: center; }
.card p.empty { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: .5rem 0; margin: 0; text-align: left; }
td.empty { text-align: center; padding: 1.75rem 1rem; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.stack.card { margin-bottom: 1.25rem; }
form.stack:not(.card) { gap: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 550; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .6rem; min-height: 40px; cursor: pointer; }
small { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  font: 400 15px/1.4 var(--font); color: inherit; width: 100%; min-height: 44px;
  padding: .6rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: 0 1px 2px rgba(72, 52, 160, .06) inset;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: rgba(104, 86, 190, .5); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); background: var(--surface-solid); box-shadow: var(--glow); }
input[type="search"] { border-radius: var(--pill); padding-inline: 1.15rem; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

button, .button {
  font: 550 15px/1.2 var(--font); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 1.25rem; border-radius: var(--pill);
  border: 1px solid var(--glass-edge); background: var(--surface-strong); color: var(--text);
  box-shadow: var(--shadow); white-space: nowrap;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.button:hover { text-decoration: none; }
/* the lift is for pointers that can hover; on touch it would stay stuck after a tap */
@media (hover: hover) { button:hover, .button:hover { background: var(--surface-solid); box-shadow: var(--shadow-lift); transform: translateY(-1px); } }
button:active, .button:active { transform: translateY(0) scale(.98); }
.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 60%, #8a5cf0 100%);
  border-color: transparent; color: var(--accent-text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 12px 28px -12px rgba(90, 63, 216, .75);
}
.primary:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 60%, #8a5cf0 100%);
  filter: brightness(1.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 18px 34px -12px rgba(90, 63, 216, .8);
}
button.danger { color: var(--danger); }
button.danger:hover { background: #fff5f8; }
button.danger.solid { background: var(--danger); border-color: transparent; color: #fff; box-shadow: 0 12px 28px -12px rgba(179, 32, 77, .7); }
button.danger.solid:hover { background: var(--danger); filter: brightness(1.1); }
button.link { border: 0; background: none; box-shadow: none; min-height: 0; padding: 0; color: var(--accent); font-weight: inherit; }
button.link:hover { text-decoration: underline; background: none; box-shadow: none; transform: none; }
button.link.danger { color: var(--danger); }

.form-actions { display: flex; align-items: center; gap: 1.25rem; }
/* plain links only: a link styled as a button keeps its own pill padding */
.form-actions a:not(.button) { padding: .6rem .25rem; }
.search { display: flex; gap: .6rem; margin-bottom: 1.25rem; max-width: 560px; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.inline-form label { flex: 1; min-width: 200px; }

.errors { margin: 0 0 1.25rem; padding: .9rem 1.25rem .9rem 2.4rem; background: #fff3f7; border-color: rgba(214, 60, 110, .28); color: var(--danger); }
.success { padding: .9rem 1.25rem; background: #effbf6; border-color: rgba(40, 170, 130, .3); color: var(--success); }

/* confirm dialog */
dialog.confirm {
  width: min(420px, calc(100vw - 2rem)); padding: 0; color: var(--text);
  border: 1px solid var(--glass-edge); border-radius: 24px;
  background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 40px 90px -30px rgba(52, 36, 130, .55);
}
dialog.confirm[open] { animation: dialog-in 260ms var(--ease); }
dialog.confirm::backdrop { background: rgba(60, 46, 130, .22); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: backdrop-in 220ms ease-out; }
dialog.confirm form { padding: 1.6rem; }
dialog.confirm p { margin: 0 0 1.4rem; font-size: 1.05rem; line-height: 1.45; }
dialog.confirm .actions { gap: .6rem; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes backdrop-in { from { opacity: 0; } }

/* people */
.avatar { border-radius: 50%; flex: none; display: block; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 4px 12px -4px rgba(72, 52, 160, .4); }
.person { display: inline-flex; align-items: center; gap: .65rem; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.profile-head strong { font: 500 1.25rem/1.2 var(--display); }

@media (max-width: 640px) {
  h1 { font-size: 1.7rem; }
  .grid { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; gap: 0; }
  dt { font-size: .82rem; }
  dd { margin-bottom: .75rem; }
  #content { padding: 1.5rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left)); }
  .card { padding: 1.15rem; }
  .search button { padding: 0 1rem; }
  .form-actions { flex-wrap: wrap; }
}

/* On phones either way up and tablets upright, tables become a stack of labelled rows,
   so nothing hides off the right edge. 960px takes in the largest phones held sideways. */
@media (max-width: 960px) {
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { padding: .85rem 1rem; border-bottom: 1px solid var(--hairline); }
  tbody tr:last-child { border-bottom: 0; }
  td { border: 0; padding: .15rem 0; }
  /* minmax(0, …) lets the value column shrink, so a long email wraps inside it */
  td[data-label] { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; align-items: baseline; }
  td[data-label]::before { content: attr(data-label); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  td.title { padding-bottom: .5rem; font-size: 1.02rem; }
  td.num { text-align: left; }
  td.mono { white-space: normal; }
  td.actions { display: flex; justify-content: flex-start; gap: .5rem; padding-top: .6rem; }
  td.actions > * { margin-left: 0; }
  td.actions a, td.actions button.link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1rem; background: var(--surface-strong); border: 1px solid var(--hairline); }
}

@media (pointer: coarse) {
  /* iOS zooms the page when a focused field's text is under 16px */
  input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="number"], select, textarea { font-size: 16px; }
  /* small text links grow to a comfortable 44px tap height */
  td.actions a, td.actions button.link { padding-block: .65rem; }
  button.link, .nav-user a, .nav-user button.link, .tabs a, label.check { min-height: 44px; }
  .crumbs { margin-top: -.4rem; margin-bottom: .2rem; }
  .crumbs a, .form-actions a:not(.button) { padding-block: .75rem; }
  .pagination a, .pagination span.muted { padding-block: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: rgba(255, 255, 255, .9); }
}

/* refinements */
td.title > a { display: inline-block; padding: .3rem 0; }

/* profile */
.profile { max-width: 920px; margin-inline: auto; }
.profile-head.card { display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.profile-head > div { min-width: 0; }
.profile-head h1 { margin: 0; font-size: 1.75rem; }
.profile-head .muted { font-size: .92rem; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.profile-grid .card { margin: 0; }
.profile-grid .form-actions { margin-top: .25rem; }
.name-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 720px) { .profile-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .name-row { grid-template-columns: 1fr; } }

/* nav polish */
@media (min-width: 961px) { td.title { min-width: 14rem; } }
.nav-user a[href="/login"][aria-current] { display: none; }

/* community */
.lede { color: var(--muted); margin: -.6rem 0 1.25rem; max-width: 62ch; }
.page-head .lede { margin: .35rem 0 0; }
.small { font-size: .85rem; }
.hint { margin: 0; font-size: .9rem; }
ul.plain, .request-list, .comments, .notification-list { list-style: none; margin: 0; padding: 0; }

.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tabs a {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 1rem; border-radius: var(--pill);
  color: var(--muted); font-weight: 550; transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.tabs a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.tabs a[aria-current] { background: var(--surface-strong); color: var(--accent); box-shadow: var(--shadow); }
.tabs .count { font-size: .78rem; font-weight: 650; padding: .1rem .5rem; border-radius: var(--pill); background: var(--accent-soft); color: inherit; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: var(--pill);
  font-size: .76rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge.open { background: var(--success-soft); color: var(--success); }
.badge.merged { background: var(--accent-soft); color: var(--accent); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.badge.withdrawn { background: rgba(91, 88, 120, .1); color: var(--muted); }

.request-list { display: grid; gap: .75rem; margin-bottom: 1.25rem; }
.request-list li { display: flex; align-items: flex-start; gap: 1rem; margin: 0; padding: 1.1rem 1.35rem; transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
@media (hover: hover) { .request-list li:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); } }
.request-list .badge { margin-top: .2rem; }
.request-main { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.request-title { font-weight: 650; font-size: 1.05rem; color: var(--text); }
.request-title:hover { color: var(--accent); }
.request-meta { display: grid; gap: .15rem; text-align: right; font-size: .85rem; white-space: nowrap; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state h2 { font: 400 1.5rem/1.2 var(--display); margin: 0 0 .5rem; }
.empty-state p { margin: 0 auto 1.25rem; max-width: 46ch; }
.empty-state p:last-child { margin-bottom: 0; }

.suggest { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.35rem; }
.suggest > div { display: grid; gap: .3rem; min-width: 0; }
.suggest ul li { display: flex; align-items: center; gap: .6rem; padding: .15rem 0; }

table.diff del, table.diff ins { text-decoration: none; padding: .15rem .5rem; border-radius: 8px; display: inline-block; overflow-wrap: anywhere; }
table.diff del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(179, 32, 77, .45); }
table.diff ins { background: var(--success-soft); color: var(--success); font-weight: 600; }
table.diff td.title { font-weight: 600; min-width: 0; }

.resolution.merged { border-color: rgba(110, 82, 230, .3); }
.resolution.rejected { border-color: rgba(214, 60, 110, .3); }
.resolution h2 { margin-bottom: .4rem; }
.resolution h2:only-child { margin-bottom: 0; }

.comments { display: grid; gap: .75rem; margin-bottom: 1rem; }
.comments li { display: flex; gap: .9rem; margin: 0; padding: 1rem 1.25rem; }
.comments li > div { min-width: 0; }
.comment-head { margin-bottom: .2rem; }
.review form + form { margin-top: 1rem; }
.review .hint { margin-bottom: 1rem; }

.notification-list { padding: .4rem; }
.notification-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .8rem 1rem; border-radius: 14px; }
.notification-list li + li { border-top: 1px solid var(--hairline); }
.notification-list li.unread { background: var(--accent-soft); border-top-color: transparent; }
.notification-list li.unread a { font-weight: 650; }
.notification-list a { color: var(--text); min-width: 0; }
.notification-list .small { white-space: nowrap; }
aside.stack { gap: 1.25rem; }
aside.stack .card { margin: 0; }

@media (max-width: 640px) {
  .request-list li { flex-wrap: wrap; }
  .request-meta { text-align: left; display: flex; gap: 1rem; width: 100%; }
  .notification-list li { flex-direction: column; gap: .2rem; }
}

/* hidden always wins over component display rules */
[hidden] { display: none !important; }
@media (max-width: 640px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -1rem; padding-inline: 1rem; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; }
}

/* sign-in screens carry the maker's mark at the foot of the window */
.powered { position: fixed; left: 0; right: 0; bottom: calc(1.25rem + env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: .85rem; letter-spacing: .04em; color: var(--muted); pointer-events: none; }
.powered strong { font: 500 1rem/1 var(--display); letter-spacing: 0; color: var(--text); }
@media (max-height: 520px) { .powered { position: static; margin-top: 2rem; } }
#nav .nav-user a[href="/login"][aria-current] { display: none; }

/* quiet, always-in-reach entry point on item pages, tucked under the account area */
.suggest-pin {
  position: fixed; top: calc(64px + .7rem); right: 1.75rem; z-index: 4;
  display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .85rem; border-radius: var(--pill);
  font-size: .85rem; color: var(--muted);
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); box-shadow: 0 6px 18px -12px rgba(72, 52, 160, .45);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.suggest-pin:hover, .suggest-pin:focus-visible { color: var(--accent); background: var(--surface-strong); text-decoration: none; box-shadow: var(--shadow); }
.suggest-pin .count { font-size: .74rem; font-weight: 650; padding: .05rem .45rem; border-radius: var(--pill); background: var(--success-soft); color: var(--success); }
/* on small screens it would sit over the page heading; the "Something set up wrong?" card carries the same link */
@media (max-width: 900px) { .suggest-pin { display: none; } }


/* segmented control: a soft track with one raised choice, for picking between a few views */
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--pill); background: rgba(104, 86, 190, .08); box-shadow: 0 1px 2px rgba(72, 52, 160, .08) inset; justify-self: start; }
.segmented button {
  min-height: 36px; padding: 0 1.1rem; border: 0; border-radius: var(--pill); background: none; box-shadow: none;
  color: var(--muted); font-weight: 550; font-size: .9rem;
}
.segmented button:hover { background: rgba(255, 255, 255, .5); color: var(--text); transform: none; box-shadow: none; }
.segmented button[aria-selected="true"] { background: var(--surface-solid); color: var(--accent); box-shadow: 0 1px 0 #fff inset, 0 6px 16px -8px rgba(72, 52, 160, .5); }

/* steps: numbered rows that share the look of the form fields */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.steps li {
  display: flex; align-items: center; gap: .9rem; min-height: 52px; padding: .65rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-strong);
  box-shadow: 0 1px 2px rgba(72, 52, 160, .05) inset; font-size: .93rem; line-height: 1.5;
}
.steps .n {
  flex: none; width: 1.5rem; text-align: center; font: 400 1.5rem/1 var(--display);
  background: linear-gradient(135deg, #5a3fd8, #c45fa8); -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* the name of something to click or look for in the browser's own interface */
.ui { font-weight: 600; white-space: nowrap; padding: .05rem .4rem; border-radius: 7px; background: var(--accent-soft); color: var(--text); }

.push-help { display: grid; gap: .85rem; }
.push-help .tip { margin: .6rem .15rem 0; }
@media (max-width: 420px) { .segmented { display: flex; } .segmented button { flex: 1; padding: 0 .5rem; } .ui { white-space: normal; } }
.form-actions:not(:has(> :not([hidden]))) { display: none; }

/* conversation: a live chat on each change request */
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.5rem .9rem; border-bottom: 1px solid var(--hairline); }
.chat-head h2 { margin: 0; }
.live-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .3rem; border-radius: 50%; background: #2bb58f; box-shadow: 0 0 0 0 rgba(43, 181, 143, .5); animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 7px rgba(43, 181, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 181, 143, 0); } }

.chat-list { list-style: none; margin: 0; padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; min-height: 9rem; max-height: min(58vh, 34rem); overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat-list .event { align-self: center; padding: .25rem .8rem; border-radius: var(--pill); background: rgba(104, 86, 190, .07); color: var(--muted); font-size: .8rem; text-align: center; }

.msg { display: flex; align-items: flex-end; gap: .6rem; max-width: min(78%, 40rem); animation: msg-in 320ms var(--ease) both; }
.msg.mine { align-self: flex-end; }
.msg .who { flex: none; width: 32px; }
.msg-body { display: grid; gap: .25rem; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: .5rem; padding: 0 .6rem; font-size: .8rem; color: var(--muted); }
.msg-meta strong { color: var(--text); font-weight: 600; }
.msg.mine .msg-meta { justify-content: flex-end; }
.bubble { padding: .6rem .95rem; border-radius: 20px 20px 20px 6px; background: var(--surface-solid); border: 1px solid var(--hairline); box-shadow: 0 6px 18px -12px rgba(72, 52, 160, .4); line-height: 1.5; overflow-wrap: anywhere; justify-self: start; }
.msg.mine .bubble { justify-self: end; border: 0; border-radius: 20px 20px 6px 20px; color: #fff; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 70%, #8a5cf0 100%); box-shadow: 0 10px 22px -12px rgba(90, 63, 216, .7); }
.bubble .proposal { list-style: none; margin: .6rem 0 .1rem; padding: .55rem 0 0; border-top: 1px solid var(--hairline); display: grid; gap: .3rem; font-size: .92rem; }
.bubble .proposal li { display: flex; flex-wrap: wrap; gap: .1rem .6rem; margin: 0; }
.msg.mine .bubble .proposal { border-top-color: rgba(255, 255, 255, .35); }
.msg-link { padding: 0 .6rem; }
.msg.mine .msg-link { justify-self: end; }
/* a run of messages from one person reads as one turn: name and avatar only on the first */
.msg.cont { margin-top: -.55rem; }
.msg.cont .msg-meta { display: none; }
.msg.cont .who > * { visibility: hidden; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.composer { display: flex; align-items: flex-end; gap: .6rem; padding: .85rem 1rem .4rem 1.25rem; border-top: 1px solid var(--hairline); }
.composer textarea { flex: 1; min-height: 44px; max-height: 10rem; resize: none; border-radius: 22px; padding: .62rem 1.1rem; line-height: 1.4; }
.composer .send { flex: none; width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.composer .send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.composer .send:disabled { opacity: .55; cursor: default; transform: none; }
.composer-hint { margin: 0; padding: 0 1.5rem .8rem; }
.composer-hint.error { color: var(--danger); }
@media (max-width: 640px) {
  .chat-list { padding: 1rem; max-height: 60vh; }
  .msg { max-width: 90%; }
  .composer { padding-left: .75rem; }
  .composer-hint { padding-inline: 1rem; }
}

/* panels */
.badge.phi { background: var(--danger-soft); color: var(--danger); }
.badge.stale { background: rgba(200, 130, 20, .14); color: #8a5300; }
.badge.shared { background: var(--success-soft); color: var(--success); }
td.title .badge { margin-left: .4rem; vertical-align: middle; }
.panel-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 0; }
.panel-badges:empty { display: none; }
.panel-card-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-card-head h2 { margin: 0; }
.panel-card-head .actions { margin-left: auto; }
.panel-card .hint { margin-bottom: .9rem; }
.panel-card .pagination { margin-top: .75rem; }
.panel-card-foot { margin: .9rem 0 0; }
.card > .prose + dl { margin-top: 1rem; }
/* Uploaded columns can be many and wide: let the table scroll sideways instead of crushing them. */
table.panel-rows td, table.panel-rows th { white-space: nowrap; }
table.panel-rows td { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; }
.key-list { white-space: normal; overflow-wrap: anywhere; margin: .75rem 0 0; }
.card > .inline-form:last-child { margin-bottom: 0; }
.card > .inline-form + .table-wrap { margin-top: 1.25rem; }
input[type="file"] { font: inherit; max-width: 100%; }
.success ul { margin: .5rem 0 0; padding-left: 1.25rem; }
@media (max-width: 900px) {
  table.panel-rows td, table.panel-rows th { white-space: normal; max-width: none; }
  /* Seven sections share the tab bar. */
  #nav .nav-links a { font-size: .6875rem; letter-spacing: -.02em; }
}
