/* Urbanist, served from this app (wwwroot/fonts) rather than Google Fonts, so a page view
   doesn't send the visitor's IP address to Google. The variable font covers every weight in two
   files: Latin, and Latin Extended for names like "Łódź" or "Şahin". Both from
   @fontsource-variable/urbanist 5.3.0; licence: wwwroot/fonts/Urbanist-OFL.txt (SIL OFL 1.1). */
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/urbanist-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/urbanist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * The one theme for this app's pages: Admin, the Company Portal and the Account pages. Nothing
 * else reads this file: the website has its own (Tailwind), the Prefab Hub keeps its own fork.
 *
 * Three layers (docs/design-system/audit.md):
 *   1. Brand foundations: a copy of klepon-marketing/src/styles/brand-tokens.css, the one source
 *      of brand values (workspace decision D-16). Never edit them here: change the source, then
 *      copy. Same values, same names.
 *   2. App tokens: this app's own roles and scales, built on the brand values. Components read
 *      these, not the brand values directly.
 *   3. Components: the rules below, grouped by component.
 */
:root {
  /* 1. Brand foundations. Copied from klepon-marketing/src/styles/brand-tokens.css; don't edit
     here. (Its --text-micro-xs/-sm and --spacing are Tailwind settings for the website, not
     needed here.) */
  --color-brand-bg: #f2f2f2;
  --color-brand-navy: #002e3a;
  --color-brand-navy-700: #0a3f4d;
  --color-brand-green: #11a46e;
  --color-brand-green-100: #e6f8ef;
  --color-brand-green-200: #c2eeda;
  --color-brand-green-300: #8fdfb9;
  --color-brand-green-400: #55cb92;
  --color-brand-green-500: #2bb87a;
  --color-brand-green-600: #11a46e;
  --color-brand-green-700: #0c7d55;
  --color-brand-green-800: #095e40;
  --color-brand-green-900: #06432d;
  --color-brand-slate: #30383d;
  --color-brand-teal: #40626c;
  --color-brand-orange: #d95527;
  --color-brand-amber: #d9a127;
  --color-surface: #e9e9ea;
  --font-brand: "Urbanist", system-ui, sans-serif;
  --text-micro: 11px;
  --text-label: 13px;
  --text-body: 15px;
  --text-bodyLarge: 18px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 7px;
  --radius-2xl: 16px;
  --radius-3xl: 22px;
  --radius-full: 9999px;
  --shadow-elev-sm: 0 1px 2px rgba(0, 46, 58, 0.10);
  --shadow-elev-md: 0 3px 10px rgba(0, 46, 58, 0.12);
  --shadow-elev-lg: 0 12px 32px rgba(0, 46, 58, 0.18);

  /* 2. App tokens. */

  /* Colour roles. Contrast on white, measured: text 13.2:1, muted text 6.0:1, control border
     3.6:1 (a field's edge needs 3:1), focus 5.2:1. */
  --color-bg: var(--color-brand-bg);
  --color-surface-raised: white;
  --color-text: var(--color-brand-navy);
  --color-text-muted: color-mix(in srgb, var(--color-text) 72%, white);
  --color-border: color-mix(in srgb, var(--color-brand-navy) 14%, transparent);
  --color-border-control: color-mix(in srgb, var(--color-brand-navy) 55%, white);
  --color-focus: var(--color-brand-green-700);
  --color-on-accent: white;

  /* The brand green under this app's name: the base, the light tint, and the dark steps used
     for text, buttons and their hover. */
  --color-accent: var(--color-brand-green);
  --color-accent-100: var(--color-brand-green-100);
  --color-accent-700: var(--color-brand-green-700);
  --color-accent-800: var(--color-brand-green-800);
  --color-accent-900: var(--color-brand-green-900);

  /* Status colours: -fg for text and icons on -bg, the plain name for solid fills. Warning and
     danger aren't brand colours: the website's DESIGN.md keeps its orange and amber as accents,
     not alarms. Every -fg reaches 4.5:1 on its -bg. */
  --color-success: var(--color-accent);
  --color-success-fg: var(--color-accent-700);
  --color-success-bg: var(--color-accent-100);
  --color-warning: #b45309;
  --color-warning-fg: #b45309;
  --color-warning-bg: #fef6e7;
  --color-danger: #dc2626;
  --color-danger-fg: #b91c1c;
  --color-danger-bg: #fdecec;
  --color-neutral-fg: var(--color-text);
  --color-neutral-bg: var(--color-surface);

  /* Type: one family, ten sizes. 13 and 15 are the brand's label and body. */
  --font-sans: var(--font-brand);
  --font-heading: var(--font-brand);
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-base: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 20px;
  --text-3xl: 24px;
  --text-4xl: 28px;

  /* Space: a 4px step. */
  --space-0-5: 2px;
  --space-1: 4px;
  --space-1-5: 6px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Corners: buttons stay pills, chips keep the brand's 16px; cards and tables are firmer than
     the website's 22px, to read as a work tool (decided 2026-10-15). */
  --radius-control: var(--radius-lg);
  --radius-chip: var(--radius-2xl);
  --radius-card: 12px;
  --radius-pill: var(--radius-full);

  /* Elevation. */
  --shadow-card: var(--shadow-elev-sm);
  --shadow-overlay: var(--shadow-elev-md);

  /* Controls line up: buttons, fields and selects share these heights. */
  --control-h-sm: 32px;
  --control-h-md: 40px;

}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

a {
  color: var(--color-accent-700);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-900);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in srgb, var(--color-accent) 30%, transparent);
}

/* Buttons — pill-shaped, always. .btn alone is the neutral/secondary action (a grey fill, not
   the website's outline: it reads better among table rows); .btn-primary is the one solid green
   action; .btn-danger confirms a destructive one. Hover and press always go darker. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  line-height: 1.2;
  min-height: var(--control-h-md);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: var(--space-2) var(--space-5);
  background: var(--color-surface);
  color: var(--color-text);
}

.btn:hover {
  background: color-mix(in srgb, var(--color-text) 10%, var(--color-surface));
  text-decoration: none;
}

/* Disabled controls don't need text contrast (WCAG exempts them); they just shouldn't look
   clickable. */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* A form that's been sent and is waiting for the answer (busy-forms.js). */
form[aria-busy="true"] .btn {
  cursor: progress;
}

/* White text on brand green-700, 5.2:1. The website keeps its brighter green (3.2:1, an
   accepted trade-off there for large type); this app's buttons are small and many, so they
   use the darker step of the same brand green (decided 2026-10-15). */
.btn-primary {
  background: var(--color-accent-700);
  border-color: var(--color-accent-700);
  color: var(--color-on-accent);
}

.btn-primary:hover {
  background: var(--color-accent-800);
  border-color: var(--color-accent-800);
  color: var(--color-on-accent);
}

.btn-primary:active {
  background: var(--color-accent-900);
  border-color: var(--color-accent-900);
}

.btn-sm {
  font-size: var(--text-md);
  min-height: var(--control-h-sm);
  padding: var(--space-1) var(--space-4);
}

.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-on-accent);
}

.btn-danger:hover {
  background: var(--color-danger-fg);
  border-color: var(--color-danger-fg);
  color: var(--color-on-accent);
}

/* Inputs */
label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1-5);
}

/* Text fields, number fields, text areas and selects: one look. The edge is 3.6:1 against
   white, so a field can be seen as a field. */
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  min-height: var(--control-h-md);
  padding: var(--space-2) var(--space-3);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-focus);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-accent-700);
  margin-right: var(--space-1-5);
}

/* Tables — rendered as a card in their own right: white surface, rounded, shadowed, no internal
   vertical rules, a tinted header row, and a hover highlight per row. border-collapse:separate
   (rather than the usual collapse) is what lets border-radius/overflow actually clip the header
   and last row's corners. */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

th, td {
  text-align: left;
  vertical-align: middle;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-md);
  line-height: 1.45;
}

th {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 60%, white);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--color-bg);
}

/* Badges — small chips (the brand's 16px chip corner, not the button's pill), named by what
   they mean: success, warning, danger, neutral. */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-xs);
  border-radius: var(--radius-chip);
  border: none;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--color-neutral-fg); }

/* Utilization bar — seats in use vs total, for offering/stat cards. Fill color signals how close
   to capacity: brand green, amber warning, red once no seat is left at all. */
.util-bar {
  margin-top: var(--space-2);
  height: 8px;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.util-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
}

.util-bar-fill-ok { background: var(--color-success); }
.util-bar-fill-warn { background: var(--color-warning); }
.util-bar-fill-full { background: var(--color-danger); }

.error {
  color: var(--color-danger-fg);
  font-size: var(--text-md);
}

/* ============================================================
   App shell — sidebar + top bar chrome. This app's own addition
   (the marketing site has no dashboard to draw the pattern from);
   reads from the same tokens as everything else above.
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  background: var(--color-surface-raised);
  border-right: 1px solid var(--color-border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  margin-bottom: var(--space-8);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--color-text);
}

.app-brand:hover {
  color: var(--color-text);
  text-decoration: none;
}

.app-brand img {
  width: 24px;
  height: 24px;
}

/* Next to the logo in the sidebar: tells the internal Admin area and the customer-facing Portal
   apart at a glance. */
.wordmark-tag {
  font-family: var(--font-heading);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-accent-700);
  background: var(--color-accent-100);
  padding: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-chip);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text-muted);
}

.app-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}

.app-nav-item.active {
  background: var(--color-accent-100);
  color: var(--color-accent-700);
}

.app-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.app-nav-badge {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--color-on-accent);
  background: var(--color-accent-700);
  padding: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-pill);
}

.app-content {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}

.app-identity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-identity-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

/* Portal's identity menu — a native <details>/<summary> disclosure (identity-menu.js only
   handles closing it on outside click/Escape, since <details> doesn't do that natively). Needs
   its own positioning: .app-identity-dropdown is absolutely placed off the wrapping <details>,
   not inline in the topbar's flex flow, or it just falls into the page below the topbar as
   plain text — which is what it did before this rule existed. */
.app-identity-menu {
  position: relative;
}

.app-identity-menu summary {
  list-style: none;
  cursor: pointer;
}

.app-identity-menu summary::-webkit-details-marker {
  display: none;
}

.app-identity-dropdown {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  z-index: 20;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-raised);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-overlay);
}

.app-identity-dropdown-header {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.app-identity-dropdown-email {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text);
  word-break: break-all;
}

.app-identity-dropdown-role {
  margin-top: var(--space-0-5);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.app-identity-dropdown a {
  font-size: var(--text-md);
  font-weight: 600;
}

.app-identity-dropdown .app-logout {
  width: 100%;
}

/* Notification bell — same <details>/<summary> + .app-identity-dropdown pattern as the identity
   menu right next to it, just its own trigger icon and dropdown content. */
.app-notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  color: var(--color-text);
}

.app-notification-bell:hover,
.app-identity-menu[open] > summary.app-notification-bell {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
}

.app-notification-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  border: 1.5px solid var(--color-surface-raised);
}

.app-notification-dropdown {
  width: 320px;
  max-height: 380px;
  overflow-y: auto;
  padding: 0;
  gap: 0;
}

.app-notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.app-notification-header-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.app-notification-mark-read button {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent-700);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
}

.app-notification-empty {
  padding: var(--space-5) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.app-notification-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}

.app-notification-item:last-child {
  border-bottom: none;
}

.app-notification-item:hover {
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}

.app-notification-item.unread {
  background: var(--color-accent-100);
}

.app-notification-message {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-0-5);
}

.app-notification-time {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.app-logout {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent);
  background: transparent;
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  min-height: var(--control-h-sm);
}

.app-logout:hover {
  background: color-mix(in srgb, var(--color-text) 5%, transparent);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-8);
}

/* ============================================================
   Signed-out pages (_SignInLayout): /Portal/Login, /Account/*, /Admin/Login and
   /Admin/AccessDenied.
   ============================================================ */
.signin {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.signin-header {
  padding: var(--space-6) var(--space-4) 0;
  display: flex;
  justify-content: center;
}

.signin-logo {
  display: inline-flex;
  color: var(--color-text);
}

.signin-logo:hover {
  color: var(--color-text);
}

.klepon-logo {
  height: 28px;
  width: auto;
}

.signin-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-8) var(--space-4) var(--space-12);
}

.signin-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-8);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.signin-card h1 {
  margin: 0;
}

.signin-card p {
  margin: 0;
  line-height: 1.55;
}

.signin-lede {
  color: var(--color-text-muted);
}

.signin-small {
  font-size: var(--text-md);
  color: var(--color-text-muted);
}

.signin-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-base);
}

@media (max-width: 480px) {
  .signin-card {
    padding: var(--space-6) var(--space-5);
  }
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field-hint {
  margin: var(--space-1-5) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.input-readonly {
  background: var(--color-bg) !important;
}

.btn-block {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.next-steps {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}

/* Inline messages: an error (role="alert") or a confirmation (role="status"). */
.notice {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  font-size: var(--text-base);
}

.notice-error {
  background: var(--color-danger-bg);
  color: var(--color-danger-fg);
}

.notice-ok {
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}

.notice-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-fg);
}

/* Footer shared by the portal and the signed-out pages: back to the website, legal pages,
   support address. */
.site-footer {
  padding: var(--space-6) var(--space-4) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  color: var(--color-text-muted);
  text-align: center;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1-5) var(--space-5);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-block;
  padding: var(--space-1) 0;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--color-text);
}

/* ============================================================
   Company Portal and Admin layouts (_PortalLayout, _AdminLayout), on the app shell above.
   Both look the same; .admin (on Admin's body) holds the few things only Admin has. Laptop:
   the sidebar. Phone: one top bar with the logo, the bell (portal only), the account menu
   and a Menu button.
   ============================================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-raised);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-overlay);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.portal-brand .klepon-logo {
  height: 22px;
}

.app-identity:focus-visible,
.app-notification-bell:focus-visible,
.portal-menu-button:focus-visible {
  border-radius: var(--radius-pill);
}

/* Admin: a small label above the settings links in the nav. */
.app-nav-group {
  margin: var(--space-4) 0 var(--space-1);
  padding: 0 var(--space-3);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Admin's tables carry more columns than the portal's. */
.admin .app-main {
  max-width: 1240px;
}

/* A one-line message straight in the page flow: the stack's gap is its spacing. */
.admin .page-stack > p {
  margin: 0;
}

/* Admin › Orders: the actions on a paid order, stacked. */
.order-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.input-invoice-number {
  max-width: 10rem;
}

.cell-form {
  margin-top: var(--space-1-5);
}

.cell-nowrap {
  white-space: nowrap;
}

/* Newer / Older under a long list. */
.pager {
  display: flex;
  justify-content: space-between;
}

/* Admin home: "Needs action", one row per thing to do, its action on the right. On a narrow
   screen the action drops under the text. */
.card.card-flush {
  padding: 0;
  overflow: hidden;
}

.action-list {
  list-style: none;
  margin: 0;
}

.action-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.action-list > .action-row + .action-row {
  margin-top: 0;
}

.action-row:last-child {
  border-bottom: none;
}

.action-kind {
  justify-self: start;
}

.action-title {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.action-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-md);
  color: var(--color-text-muted);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.section-notice {
  margin-bottom: var(--space-4);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: var(--space-5);
  align-items: start;
}

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

  .action-buttons {
    align-items: flex-start;
  }
}

/* Admin: the search box at the left of the top bar. On a phone it gets a row of its own. */
.admin-search {
  flex: 1 1 auto;
  max-width: 30rem;
  margin-right: auto;
}

.admin .admin-search input {
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
}

/* A search result that lands on a row of a list: show which one. */
.admin tr:target td {
  background: var(--color-accent-100);
}

/* Search results: no badge column. */
.search-row {
  grid-template-columns: minmax(0, 1fr);
}

/* Admin › a company's licenses: extend, revoke or reactivate a group, and its keys. */
.group-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.admin select.select-narrow {
  width: auto;
}

/* Fields that sit next to small buttons take the small height too. */
.admin select.select-narrow,
.input-invoice-number {
  min-height: var(--control-h-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-md);
}

.key-list {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
}

.key-list summary {
  cursor: pointer;
  color: var(--color-accent-700);
}

.key-list ul {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
}

.portal-topbar-brand,
.portal-menu {
  display: none;
}

.portal-menu-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-2) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--color-text);
  min-height: var(--control-h-sm);
}

.portal-menu[open] > .portal-menu-button {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
}

.portal-menu-dropdown {
  gap: var(--space-0-5);
  padding: var(--space-2);
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    display: none;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: var(--space-3) var(--space-4);
  }

  .portal-topbar-brand {
    display: inline-flex;
    margin-right: auto;
    color: var(--color-text);
  }

  .admin .app-topbar {
    flex-wrap: wrap;
  }

  .admin-search {
    order: 10;
    flex-basis: 100%;
    max-width: none;
    margin-right: 0;
  }

  .portal-topbar-brand .klepon-logo {
    height: 20px;
  }

  .portal-menu {
    display: block;
  }

  /* Dropdowns span the screen under the bar instead of hanging off their button, which on a
     narrow screen pushed them past the left edge. */
  .app-identity-dropdown {
    position: fixed;
    top: 3.6rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    min-width: 0;
  }

  .app-main {
    padding: var(--space-6) var(--space-4) var(--space-8);
  }

  h1 {
    font-size: var(--text-3xl);
  }
}

/* Tables scroll sideways inside their own box on a narrow screen, never the whole page. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--color-surface-raised);
}

.table-wrap > table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* ============================================================
   Portal page parts: page header, next-step panel, tiles, cards, filters.
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.page-stack > section,
.page-stack > header {
  min-width: 0;
}

.page-header h1 {
  margin: 0;
}

.page-lede {
  margin: var(--space-1-5) 0 0;
  max-width: 62ch;
  color: var(--color-text-muted);
  line-height: 1.55;
}

h2 {
  font-size: var(--text-2xl);
  margin: 0;
}

p {
  line-height: 1.55;
}

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

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

/* Links in text are underlined: green-700 against navy text is 2.8:1, so colour alone wouldn't
   mark them. Not buttons, nav items, the logo or tiles. */
a:not(.btn):not(.app-nav-item):not(.app-brand):not(.portal-topbar-brand):not(.tile):not(.app-notification-item) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* A plain white content card (the website's .card). */
.card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

/* "Nothing here" in place of a list: quieter than a card with content. */
.empty-state {
  background: transparent;
  border-style: dashed;
  border-color: var(--color-border-control);
  box-shadow: none;
  color: var(--color-text-muted);
}

.card > * {
  margin-top: 0;
}

.card > * + * {
  margin-top: var(--space-3);
}

/* The one next step: a navy panel, the strongest thing on the page. */
.next-step {
  background: var(--color-brand-navy);
  color: var(--color-on-accent);
  border-radius: var(--radius-card);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.next-step h2 {
  color: var(--color-on-accent);
  font-size: var(--text-3xl);
}

.next-step p {
  margin: 0;
  max-width: 62ch;
  color: color-mix(in srgb, white 88%, var(--color-brand-navy));
}

.next-step .button-row {
  margin-top: var(--space-2);
}

.next-step-kicker {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-brand-green-300);
}

.btn-on-dark {
  background: transparent;
  border-color: color-mix(in srgb, white 45%, transparent);
  color: var(--color-on-accent);
}

.btn-on-dark:hover {
  background: color-mix(in srgb, white 12%, transparent);
  color: var(--color-on-accent);
}

.next-step :focus-visible {
  outline-color: white;
}

/* Setup steps on the next-step banner (_SetupSteps): Billing details, First license, Your team. */
.setup-steps {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  color: color-mix(in srgb, white 72%, var(--color-brand-navy));
}

.setup-steps li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.setup-step-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid color-mix(in srgb, white 45%, transparent);
  font-size: var(--text-xs);
  font-weight: 700;
}

.setup-steps .done .setup-step-mark {
  background: var(--color-brand-green-300);
  border-color: var(--color-brand-green-300);
  color: var(--color-brand-navy);
}

.setup-steps .current {
  color: white;
  font-weight: 700;
}

.setup-steps .current .setup-step-mark {
  background: white;
  border-color: white;
  color: var(--color-brand-navy);
}

.next-step-note {
  font-size: var(--text-sm);
}

/* A plain link on the dark next-step banner. */
.link-on-dark,
.link-on-dark:hover {
  color: white;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .setup-steps li:not(.current) .setup-step-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* At-a-glance numbers. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-4);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--color-text);
}

a.tile:hover {
  box-shadow: var(--shadow-overlay);
  color: var(--color-text);
}

.tile-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
}

.tile-value {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tile-value-text {
  font-size: var(--text-xl);
}

.tile-of {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-muted);
}

.tile-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Label/value pairs, e.g. the company's billing details. */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4) var(--space-6);
  margin: 0;
}

.facts dt {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
}

.facts dd {
  margin: var(--space-0-5) 0 0;
  overflow-wrap: anywhere;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.package-card h3 {
  margin: 0;
}

.package-numbers {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.package-expiry {
  font-size: var(--text-md);
}

/* Filter and sort controls above a table: a GET form. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
}

.filter-bar > div {
  min-width: 0;
  flex: 1 1 180px;
  max-width: 20rem;
}

/* The small Apply/Filter button lines up with the fields beside it. */
.filter-bar .btn {
  min-height: var(--control-h-md);
}

.filter-bar .filter-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.filter-count {
  margin: 0 0 var(--space-3);
  font-size: var(--text-md);
}

.cell-note {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.cell-action {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .next-step {
    padding: var(--space-6);
  }

  .next-step h2 {
    font-size: var(--text-2xl);
  }

  th, td {
    padding: var(--space-3) var(--space-3);
  }
}

/* Tables that turn into labelled blocks on a phone: each cell shows its column name
   (data-label) next to its value, one row per block. */
@media (max-width: 600px) {
  .stack-table thead {
    display: none;
  }

  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td {
    display: block;
    width: 100%;
  }

  .stack-table tr {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
  }

  .stack-table tbody tr:last-child {
    border-bottom: none;
  }

  .stack-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-1) 0;
    border: none;
    text-align: right;
  }

  .stack-table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text-muted);
    text-align: left;
  }

  .stack-table td.cell-action {
    justify-content: flex-end;
    padding-top: var(--space-2);
  }

  .stack-table td.cell-action:not(:has(*)) {
    display: none;
  }

  .stack-table tbody tr:hover td {
    background: none;
  }
}

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

.session-list li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.session-list li:last-child {
  border-bottom: none;
}

/* A destructive action behind a second click: the <summary> is the first button (click it
   again to back out), the confirm button sits inside. No script needed. */
.confirm > summary {
  list-style: none;
}

.confirm > summary::-webkit-details-marker {
  display: none;
}

.confirm[open] > summary {
  margin-bottom: var(--space-3);
}

.confirm-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: var(--color-danger-bg);
}

.confirm-body p {
  margin: 0;
}

.input-narrow {
  max-width: 7rem;
}

.checkbox-group {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.checkbox-group legend {
  padding: 0;
  margin-bottom: var(--space-1-5);
  font-weight: 700;
  font-size: var(--text-sm);
}

label.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-0-5);
  margin-right: var(--space-5);
  font-weight: 500;
  font-size: var(--text-base);
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-3);
}

.field-postcode {
  flex: 0 0 8rem;
}

.field-grow {
  flex: 1 1 12rem;
  min-width: 0;
}

/* A form card with a side note: side by side on a wide screen, stacked below. */
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 32rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

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

.form-aside h2 {
  font-size: var(--text-lg);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  max-width: 64rem;
  align-items: start;
  gap: var(--space-5);
}

.choice-grid h3 {
  margin: 0;
}

.section-intro {
  margin: calc(-1 * var(--space-1-5)) 0 var(--space-4);
}

.invoiced-to {
  margin: 0;
  font-size: var(--text-base);
}

/* One field and its button on one row (the invite form), stacking on a phone. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.notice p {
  margin: 0;
}

.notice p + p {
  margin-top: var(--space-1-5);
}

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.confirm-inline {
  display: inline-block;
  text-align: left;
  white-space: normal;
}

.confirm-inline[open] .confirm-body {
  max-width: 22rem;
}

.section-note {
  margin: var(--space-4) 0 0;
  max-width: 70ch;
  font-size: var(--text-md);
}

.package-card-title {
  font-size: var(--text-xl);
}

/* Account settings: the password form beside a column of smaller cards. */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 28rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.settings-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

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

/* The card for an irreversible action: a red edge, not a red fill. */
.danger-card {
  box-shadow: var(--shadow-card), inset 0 0 0 1px color-mix(in srgb, var(--color-danger) 45%, transparent);
}

.form-card {
  max-width: 32rem;
}

.consequences {
  margin: var(--space-3) 0 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}

label.checkbox-top {
  align-items: flex-start;
  gap: var(--space-2);
  margin-right: 0;
}

label.checkbox-top input {
  margin-top: var(--space-0-5);
  flex-shrink: 0;
}

/* Online checkout. */
.notice-test {
  background: var(--color-warning-bg);
  color: var(--color-warning-fg);
}

.price-lines {
  margin: var(--space-1) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.price-lines > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.price-lines dd {
  margin: 0;
  white-space: nowrap;
}

.price-lines .price-total {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xl);
  font-weight: 800;
}

.price-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-variant-numeric: tabular-nums;
}

.price-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-1-5) 0;
  border-bottom: 1px solid var(--color-border);
}

.price-list li:last-child {
  border-bottom: none;
}

.invoice-to {
  font-size: var(--text-md);
}

.next-step .next-step-title {
  color: var(--color-on-accent);
  font-size: var(--text-3xl);
  margin: 0;
}

/* ============================================================
   Admin invoice preview: a sample invoice on a white sheet, printable.
   ============================================================ */
.invoice-sheet {
  position: relative;
  overflow: hidden;
  max-width: 820px;
  margin-top: var(--space-6);
  padding: var(--space-10);
  background: var(--color-surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  font-size: var(--text-base);
  line-height: 1.5;
}

.invoice-watermark {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font-size: 8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: color-mix(in srgb, var(--color-danger) 10%, transparent);
  pointer-events: none;
}

.invoice-title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-3xl);
}

.invoice-sample {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-danger-fg);
}

.invoice-meta, .invoice-totals {
  margin: 0;
}

.invoice-meta > div, .invoice-totals > div {
  display: flex;
  gap: var(--space-4);
}

.invoice-meta dt {
  min-width: 9rem;
  font-weight: 700;
}

.invoice-meta dd, .invoice-totals dd {
  margin: 0;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  margin: var(--space-8) 0;
}

.invoice-parties h3 {
  margin: 0 0 var(--space-1-5);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-parties p {
  margin: 0;
}

.invoice-missing {
  color: var(--color-danger-fg);
  font-weight: 600;
}

table.invoice-lines {
  box-shadow: none;
  border-radius: 0;
}

.invoice-lines th, .invoice-lines td {
  background: none;
  padding: var(--space-2) var(--space-1-5);
}

.invoice-lines .num, .invoice-totals dd {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.invoice-small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.invoice-totals {
  margin: var(--space-4) 0 0 auto;
  max-width: 26rem;
}

.invoice-totals > div {
  justify-content: space-between;
  padding: var(--space-1) 0;
}

.invoice-totals .invoice-total {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 2px solid var(--color-text);
  font-weight: 800;
  font-size: var(--text-xl);
}

.invoice-note {
  margin: var(--space-4) 0 0;
}

@media print {
  .app-sidebar, .app-topbar, .invoice-tools {
    display: none !important;
  }

  .app-main {
    padding: 0;
  }

  .invoice-sheet {
    box-shadow: none;
    margin: 0;
    max-width: none;
  }
}
