/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f8fafc;
  --surface: #ffffff;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-line: #a7f3d0;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 1px 3px rgb(15 23 42 / 0.08), 0 4px 12px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 20px 50px -12px rgb(15 23 42 / 0.25);
  --font:
    "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
main {
  flex: 1;
}
h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.25;
  margin: 1.5rem 0 0.5rem;
  letter-spacing: -0.015em;
}
h1 {
  font-size: 1.75rem;
  font-weight: 700;
}
h2 {
  font-size: 1.25rem;
  font-weight: 650;
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
}
p {
  margin: 0.5rem 0;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-600);
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid rgb(79 70 229 / 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 24px;
}
.page {
  padding-top: 8px;
  padding-bottom: 48px;
}
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.hint {
  color: var(--muted);
  font-weight: 400;
}
.center {
  text-align: center;
}
.empty {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover {
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff;
  font-size: 0.95rem;
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.nav a {
  color: var(--text);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav a:hover {
  background: #f1f5f9;
  color: var(--ink);
  text-decoration: none;
}
.nav a.active {
  background: var(--brand-50);
  color: var(--brand-600);
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* User menu (native <details>, no JavaScript) */
.user-menu {
  position: relative;
  margin-left: auto;
}
.user-menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.user-menu summary::-webkit-details-marker {
  display: none;
}
.user-menu summary:hover {
  border-color: var(--line-strong);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-600);
  font-weight: 700;
  font-size: 0.85rem;
}
.user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  max-width: 180px;
}
.user-name,
.user-tenant {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.875rem;
}
.user-tenant {
  color: var(--muted);
  font-size: 0.75rem;
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
}
.menu-head {
  padding: 8px 10px 10px;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.menu a,
.menu button.link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  text-decoration: none;
}
.menu a:hover,
.menu button.link:hover {
  background: #f1f5f9;
  color: var(--ink);
  text-decoration: none;
}
.menu form {
  margin: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
button,
a.button,
summary.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
button:hover,
a.button:hover,
summary.button:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  text-decoration: none;
}
button.secondary,
a.button.secondary,
summary.button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
button.secondary:hover,
a.button.secondary:hover,
summary.button.secondary:hover {
  background: #f1f5f9;
  color: var(--ink);
}
a.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
  box-shadow: none;
}
a.button.ghost:hover {
  background: #f1f5f9;
  color: var(--ink);
}
a.button.light {
  background: #fff;
  border-color: #fff;
  color: var(--brand-600);
}
a.button.light:hover {
  background: var(--brand-50);
  color: var(--brand-600);
}
.button.lg {
  padding: 12px 22px;
  font-size: 1rem;
}
.button.block {
  display: flex;
  width: 100%;
}
button.link {
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
  color: var(--brand);
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
}
button.link:hover {
  background: none;
  color: var(--brand-600);
  text-decoration: underline;
}
.inline {
  display: inline;
  margin: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */
form {
  margin-bottom: 1rem;
}
label {
  color: var(--ink);
  font-size: 0.875rem;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  padding: 9px 12px;
  margin: 4px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(79 70 229 / 0.18);
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 0;
  box-shadow: none;
  accent-color: var(--brand);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
  margin: 16px 0 0;
}
legend {
  font-weight: 600;
  color: var(--ink);
  padding: 0 6px;
}
.field-error,
.errors {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 2px 0 0;
}
.errors {
  padding-left: 1.1rem;
}

/* Card-style forms */
.form-card,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-card {
  max-width: 40rem;
  padding: 8px 28px 24px;
  margin: 16px 0 24px;
}
.form-card label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
}
.form-card label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 16px 6px 0;
  font-weight: 400;
}
.form-card button[type="submit"] {
  margin-top: 1.25rem;
}
.auth-card {
  width: 100%;
  max-width: 28rem;
  margin: 48px auto;
  padding: 12px 32px 28px;
}
.auth-card h1 {
  font-size: 1.5rem;
}
.auth-card label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
}
.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 1.5rem;
  padding: 11px 16px;
}
.auth-card form {
  margin-bottom: 8px;
}
.page-header,
.form {
  max-width: 28rem;
}
.field {
  margin-top: 1rem;
}
.choice-list {
  list-style: none;
  padding: 0;
}
.choice {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.choice:hover {
  background: var(--brand-50);
  border-color: var(--brand);
  color: var(--ink);
}

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flash,
.error,
.success {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  border: 1px solid;
}
.flash-error,
.flash.error,
.error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}
.flash-ok,
.success {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok);
}
.flash-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}
.flash .link {
  color: inherit;
  text-decoration: underline;
}

/* ==========================================================================
   Page layout pieces
   ========================================================================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 8px;
}
.page-head h1 {
  margin: 1rem 0 0.25rem;
}
.actions {
  display: flex;
  gap: 8px 16px;
  align-items: center;
  flex-wrap: wrap;
}
.actions p {
  margin: 0;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}
.filters input,
.filters select {
  margin: 0;
  width: auto;
}
.filters input {
  flex: 1;
  min-width: 14rem;
}
.pager {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}
ul.plain {
  list-style: none;
  padding: 0;
}
ul.plain li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 16px 0;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  color: var(--ink);
}
.pay-now {
  font-size: 1.15rem;
}
.badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.75rem;
  line-height: 1.5;
  background: #f1f5f9;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 1px 10px;
  font-weight: 600;
  letter-spacing: 0;
}

/* ==========================================================================
   Tables
   ========================================================================== */
table,
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: #fafbff;
}
td form {
  margin: 0;
}
.row-actions {
  white-space: nowrap;
  text-align: right;
}
.decide {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.decide input {
  margin: 0;
  min-width: 10rem;
  flex: 1;
}

/* ==========================================================================
   Dashboard tiles
   ========================================================================== */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
.tile:hover {
  border-color: var(--brand-100);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text);
}
.tile .icon {
  margin-bottom: 8px;
}
.tile-title {
  font-weight: 650;
  color: var(--ink);
  font-size: 1.05rem;
}
.icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-50);
  font-size: 1.3rem;
}

/* ==========================================================================
   Landing page
   ========================================================================== */
.page-bare > .section:first-child {
  padding-top: 48px;
}
.hero {
  background:
    radial-gradient(1000px 400px at 85% -10%, rgb(124 58 237 / 0.12), transparent 60%),
    radial-gradient(800px 400px at 0% 0%, rgb(79 70 229 / 0.1), transparent 60%), var(--surface);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 88px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.hero .lead {
  font-size: 1.15rem;
  max-width: 34rem;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 16px;
}
.mock {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.mock-bar {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.mock-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}
.mock-body {
  padding: 18px;
}
.mock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--ink);
}
.mock-pill {
  font-size: 0.75rem;
  background: var(--brand-50);
  color: var(--brand-600);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}
.mock-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.mock-row b {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}
.mock-row small {
  color: var(--muted);
  font-size: 0.78rem;
}
.mock-row em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.mock-row em.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.mock-row em.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.dot {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.dot.a {
  background: #6366f1;
}
.dot.b {
  background: #0ea5e9;
}
.dot.c {
  background: #10b981;
}
.dot.d {
  background: #f59e0b;
}
.mock-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-50);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
}
.mock-btns {
  display: flex;
  gap: 6px;
}
.mock-btns i {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.mock-btns i.approve {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.section {
  padding: 80px 0;
}
.section-tint {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section-head {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto 40px;
}
.section-head h1,
.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.025em;
  margin: 0 0 12px;
}
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.feature h3 {
  margin: 16px 0 6px;
}
.feature p {
  color: var(--muted);
  margin: 0;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  counter-reset: none;
}
.steps li {
  text-align: center;
  padding: 0 12px;
}
.steps h3 {
  margin: 14px 0 6px;
}
.steps p {
  color: var(--muted);
  margin: 0;
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}
.cta {
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff;
}
.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 56px;
  padding-bottom: 56px;
}
.cta h2 {
  color: #fff;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin: 0;
}

/* ==========================================================================
   Pricing and billing
   ========================================================================== */
.pricing {
  padding: 40px 0 16px;
}
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 760px;
  margin: 24px auto;
}
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin: 0;
}
.plan h2,
.plan h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.plan .price {
  margin: 8px 0 12px;
  color: var(--muted);
}
.plan .price strong {
  font-size: 2.4rem;
  color: var(--ink);
  letter-spacing: -0.03em;
}
.plan > p:not(.price) {
  color: var(--muted);
  flex: 1;
}
.plan .button,
.plan button {
  margin-top: 16px;
}
.plan button {
  width: 100%;
}
.plan.featured,
.plan.selected {
  border-color: var(--brand);
  box-shadow:
    0 0 0 1px var(--brand),
    var(--shadow);
}
.plan-tag {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.included {
  list-style: none;
  padding: 0;
  max-width: 760px;
  margin: 32px auto 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 24px;
}
.included li::before {
  content: "✓";
  color: var(--ok);
  font-weight: 700;
  margin-right: 10px;
}
#billing-status {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 24px;
  padding-bottom: 24px;
}
.footer-inner strong {
  color: var(--ink);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a {
  color: var(--muted);
}

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 48px;
    padding-bottom: 56px;
  }
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 16px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  /* App navigation moves to its own scrollable row under the brand and user menu. */
  .nav:not(.nav-public) {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    margin: 0 -8px;
  }
}
@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }
  .container {
    padding-inline: 16px;
  }
  .section {
    padding: 56px 0;
  }
  .features,
  .steps {
    grid-template-columns: 1fr;
  }
  .nav-public {
    display: none;
  }
  .user-text {
    display: none;
  }
  .user-menu summary {
    padding: 3px;
  }
  .auth-card {
    margin: 24px auto;
    padding: 8px 20px 24px;
  }
  .form-card {
    padding: 4px 18px 20px;
  }
  /* Wide tables scroll sideways instead of squashing. */
  table,
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .facts dd {
    margin-bottom: 10px;
  }
  .mock-row small {
    display: none;
  }
}
.row-actions > * + * {
  margin-left: 14px;
}
.icon {
  color: var(--brand);
}
.i {
  display: block;
}

/* Page actions (Edit, Transfer, Archive…) look like buttons, not stray links. */
.actions > a,
.actions > p > a,
.actions > form > button.link,
.actions > form > button:not(.link) {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.actions > a:hover,
.actions > p > a:hover,
.actions > form > button:hover {
  background: #f1f5f9;
  color: var(--ink);
  text-decoration: none;
}
.actions > a.button.primary,
.actions > a.button:not(.secondary) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.actions form {
  margin: 0;
}

/* Buttons inside table rows: small and quiet so rows stay readable. */
td a.button,
td button,
td button.link {
  padding: 5px 11px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  vertical-align: middle;
}
td a.button:hover,
td button:hover,
td button.link:hover {
  background: #f1f5f9;
  color: var(--ink);
  text-decoration: none;
}
td > * + form.inline,
td > a.button + a.button {
  margin-left: 6px;
}
td p,
td ul {
  margin: 0;
}
td ul {
  padding-left: 1.1rem;
}
td .decide button:not(.secondary) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.form-card button[type="submit"] {
  display: flex;
  width: fit-content;
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 3px solid rgb(79 70 229 / 0.45);
  outline-offset: 2px;
}

/* Web address (subdomain) setup */
.auth-card.wide {
  max-width: 34rem;
}
.address-field {
  display: flex;
  align-items: stretch;
  margin: 4px 0 8px;
}
.address-field input {
  margin: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 0;
  flex: 1;
}
.address-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f1f5f9;
  color: var(--muted);
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avail {
  font-size: 0.875rem;
  margin: 4px 0;
}
.avail.ok {
  color: var(--ok);
}
.avail.bad {
  color: var(--danger);
}
.address {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  overflow-wrap: anywhere;
}
.setup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--brand-100);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.setup-banner strong {
  color: var(--ink);
}
.setup-banner p {
  margin: 2px 0 0;
}

/* Sign-up progress */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.steps-bar {
  list-style: none;
  display: flex;
  padding: 0;
  margin: 8px 0 24px;
}
.steps-bar li {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
/* The line joining each step to the previous one. */
.steps-bar li + li::before {
  content: "";
  position: absolute;
  top: 15px;
  right: calc(50% + 20px);
  left: calc(-50% + 20px);
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}
.steps-bar li.done::before,
.steps-bar li.current::before {
  background: var(--brand);
}
.step-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.steps-bar li.done .step-dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.steps-bar li.current .step-dot {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.steps-bar li.done,
.steps-bar li.current {
  color: var(--brand-600);
}
.setup-card {
  width: 100%;
  max-width: 40rem;
  margin: 40px auto;
}
.setup-card > .auth-card,
.setup-card > .card {
  margin: 0 auto;
  max-width: none;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 32px 28px;
}
.setup-steps {
  max-width: 34rem;
  margin: 24px auto 0;
}

/* "or" between the two ways to log in */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

/* A company in "Choose a company" that signs in at its own address */
a.choice {
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

/* ==========================================================================
   Form pages: centered, one card per section, fields side by side,
   and a save bar that stays in view while scrolling.
   ========================================================================== */
.form-page {
  max-width: 56rem;
  margin: 8px auto 0;
}
.form-page.narrow {
  max-width: 40rem;
}
.form-page-head {
  margin-bottom: 20px;
}
.form-page-head h1 {
  margin: 6px 0 4px;
}
.form-page-head .hint {
  margin: 0;
}
.back-link {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover {
  color: var(--brand);
}
.form-page form {
  margin: 0;
}
.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px 24px;
  margin-bottom: 16px;
}
.form-section-head h2 {
  font-size: 1rem;
  margin: 0 0 4px;
}
.form-section-head .hint {
  margin: 0 0 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}
.form-grid > .field {
  margin-top: 14px;
  min-width: 0;
}
.form-grid > .field.wide {
  grid-column: 1 / -1;
}
.form-grid label {
  display: block;
  font-weight: 600;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  margin-bottom: 0;
}
.form-grid .hint,
.form-grid .field-error {
  margin: 4px 0 0;
}
.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 4px;
}
fieldset.days {
  border: 0;
  padding: 0;
  margin: 14px 0 0;
}
fieldset.days legend {
  padding: 0;
  font-size: 0.875rem;
  margin-bottom: 6px;
}
.day-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.day {
  position: relative;
}
.day input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}
.day span {
  display: inline-block;
  min-width: 3.25rem;
  text-align: center;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  cursor: pointer;
}
.day input:checked + span {
  background: var(--brand-50);
  border-color: var(--brand);
  color: var(--brand-600);
  font-weight: 600;
}
.day input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 8px -12px 0;
  padding: 14px 12px;
  background: rgb(248 250 252 / 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.form-card {
  margin-inline: auto;
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-section {
    padding: 16px;
  }
  .form-actions {
    margin-inline: -16px;
    padding-inline: 16px;
  }
  .form-actions > * {
    flex: 1;
  }
}

/* Small forms on a page (pay change, emergency contact): a button that opens the form */
.inline-form {
  margin: 12px 0 8px;
}
.inline-form > summary {
  list-style: none;
}
.inline-form > summary::-webkit-details-marker {
  display: none;
}
.inline-form > summary .when-open,
.inline-form[open] > summary .when-closed {
  display: none;
}
.inline-form[open] > summary .when-open {
  display: inline;
}
.inline-form[open] > summary {
  margin-bottom: 12px;
}
.inline-form .form-section h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.inline-form-actions {
  margin-top: 16px;
}
.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 640px) {
  .form-grid.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Destructive actions (end employment) */
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}
button.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}
.request-form {
  max-width: 44rem;
}
.request-form h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

/* A form under a list on the same page (add a holiday, a leave type, adjust a balance) */
.compact-form {
  max-width: 44rem;
  margin-top: 20px;
}
.compact-form h2,
.compact-form h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.check-row label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}
.inline-form-actions {
  display: flex;
  gap: 10px;
}
