/* Hallmark · design-system: HAIBAZO DESIGN.md (@haibazo/platform-react-ui 3.1.1) · designed-as-app
 * genre: modern-minimal · theme: custom "maroon glass, warm stone, calm chrome"
 * axes: light / geometric-sans / warm
 */

/*
 * The Directory's pages (login, applications, the Proteus picker) on the HAIBAZO design system.
 *
 * The kit ships React components and a Tailwind v4 tokens file, neither of which a
 * Spring static page can use, so the tokens below are copied by hand from
 * platform-react-ui 3.1.1 dist/tokens.css. When the kit's tokens change, copy them
 * again and bump the version above. Dark follows the reader's system setting.
 */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Azonix";
  src: url("/fonts/Azonix.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --background: oklch(0.972 0.003 70);
  --foreground: oklch(0.17 0.006 50);
  --card: oklch(0.995 0.002 70);
  --primary: #760000;
  --primary-hover: oklch(0.42 0.15 29);
  --primary-press: #5c0000;
  --primary-foreground: #ffffff;
  --primary-accent: #760000;
  /* The 10 % maroon tint DESIGN.md gives the active nav item, worn by every mark here. */
  --primary-tint: oklch(0.42 0.15 29 / 0.1);
  --primary-shadow: inset 0 1px 0 oklch(1 0 0 / 0.18), 0 1px 2px oklch(0.3 0.12 29 / 0.35);
  --muted-foreground: oklch(0.47 0.01 50);
  --accent: oklch(0.35 0.012 50 / 0.09);
  --border: oklch(0.3 0.01 50 / 0.12);
  --border-strong: oklch(0.28 0.015 50 / 0.56);
  --ring: #760000;
  --destructive-accent: #b91c1c;
  --paper-shadow: 0 0 0 1px oklch(0.3 0.01 50 / 0.08), 0 1px 2px oklch(0.3 0.02 40 / 0.05);
  --paper-lift: 0 12px 32px -16px oklch(0.3 0.02 40 / 0.2);
  --glass: oklch(0.975 0.004 70 / 0.72);
  --glass-solid: oklch(0.974 0.004 70);
  --glass-filter: blur(20px) saturate(170%);
  --popover: oklch(0.985 0.003 70 / 0.84);
  --popover-solid: oklch(0.978 0.003 70);
  --popover-filter: blur(24px) saturate(160%);
  --popover-shadow:
    inset 0 0 0 1px oklch(0.3 0.01 50 / 0.09), inset 0 1px 0 oklch(1 0 0 / 0.75),
    0 2px 6px oklch(0.3 0.02 40 / 0.08), 0 20px 48px -12px oklch(0.3 0.02 40 / 0.26);
  --canvas:
    radial-gradient(55% 50% at 0% 0%, oklch(0.9 0.045 25 / 0.55), transparent 70%),
    radial-gradient(50% 55% at 100% 0%, oklch(0.93 0.03 240 / 0.55), transparent 70%),
    linear-gradient(180deg, oklch(0.974 0.003 70), oklch(0.958 0.004 70));

  /* The Sandbox pill: amber, so it never reads as the maroon brand. */
  --sandbox-badge: oklch(0.88 0.11 82 / 0.6);
  --sandbox-badge-foreground: oklch(0.42 0.1 60);
  --sandbox-badge-ring: oklch(0.6 0.12 70 / 0.28);

  /* Microsoft's own mark, on the sign-in button only. */
  --ms-red: #f25022;
  --ms-green: #7fba00;
  --ms-blue: #00a4ef;
  --ms-yellow: #ffb900;
  --ms-chip: #ffffff;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-wordmark: "Azonix", sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-state: 150ms;
  --dur-press: 100ms;

  --radius-item: 8px;
  --radius-nav: 12px;
  --radius-surface: 14px;
  --radius-capsule: 9999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --text-caption: 12px;
  --text-body: 14px;
  --text-subheading: 18px;
  --text-title: 24px;

  --header-h: 56px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.175 0.007 30);
    --foreground: oklch(0.96 0.004 60);
    --card: oklch(0.215 0.007 30);
    --primary: oklch(0.55 0.19 25);
    --primary-hover: oklch(0.51 0.18 25);
    --primary-press: oklch(0.47 0.17 25);
    --primary-accent: #ef8275;
    --primary-tint: oklch(0.6 0.19 25 / 0.16);
    --primary-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16), 0 1px 2px oklch(0 0 0 / 0.4);
    --muted-foreground: oklch(0.73 0.01 50);
    --accent: oklch(1 0 0 / 0.1);
    --border: oklch(1 0 0 / 0.1);
    --border-strong: oklch(1 0 0 / 0.34);
    --ring: oklch(0.6 0.19 25);
    --destructive-accent: #ff8080;
    --sandbox-badge: oklch(0.75 0.12 78 / 0.18);
    --sandbox-badge-foreground: oklch(0.86 0.12 82);
    --sandbox-badge-ring: oklch(0.8 0.12 80 / 0.22);
    --paper-shadow: 0 0 0 1px oklch(1 0 0 / 0.07), 0 1px 2px oklch(0 0 0 / 0.25);
    --paper-lift: 0 12px 32px -16px oklch(0 0 0 / 0.5);
    --glass: oklch(0.255 0.008 30 / 0.6);
    --glass-solid: oklch(0.24 0.008 30);
    --glass-filter: blur(22px) saturate(150%);
    --popover: oklch(0.26 0.008 30 / 0.86);
    --popover-solid: oklch(0.245 0.008 30);
    --popover-filter: blur(26px) saturate(140%);
    --popover-shadow:
      inset 0 0 0 1px oklch(1 0 0 / 0.09), inset 0 1px 0 oklch(1 0 0 / 0.13),
      0 2px 8px oklch(0 0 0 / 0.35), 0 22px 52px -12px oklch(0 0 0 / 0.6);
    --canvas:
      radial-gradient(55% 50% at 0% 0%, oklch(0.36 0.09 28 / 0.42), transparent 70%),
      radial-gradient(50% 55% at 100% 0%, oklch(0.34 0.045 250 / 0.38), transparent 70%),
      linear-gradient(180deg, oklch(0.185 0.006 40), oklch(0.16 0.006 40));
  }
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

/* ---------- base ---------- */

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

html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  background-image: var(--canvas);
  background-attachment: fixed;
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.43;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }

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

.title { font-size: var(--text-title); line-height: 1.25; letter-spacing: -0.025em; font-weight: 600; }
.muted { color: var(--muted-foreground); }
.subheading { font-size: var(--text-subheading); line-height: 1.5; letter-spacing: -0.45px; font-weight: 600; }
.lede { color: var(--muted-foreground); }

/* ---------- brand ---------- */

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  font-family: var(--font-wordmark);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--foreground);
  white-space: nowrap;
}
.wordmark__product { color: var(--primary-accent); }

/* The HAIBAZO mark and every application mark share one shape and one material. */
.mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-nav);
  background: var(--primary-tint);
  color: var(--primary-accent);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.mark svg { width: 34%; height: 40%; }

/* "HAIBAZO" in ink, the product in maroon: the wordmark's two tones, set in Geist. */
.app-name__product { color: var(--primary-accent); }

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-capsule);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-state) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
/* A way in this deployment does not offer: still shown, plainly not usable. */
.btn:disabled { cursor: not-allowed; opacity: 0.55; }

.btn--primary {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-6);
  font-size: 15px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--primary-shadow);
}
.btn--primary:hover { background: var(--primary-hover); }
.btn--primary:active { background: var(--primary-press); }
.btn--primary:disabled:hover { background: var(--primary); }

/* The second way in, under the primary one: outlined, never maroon. */
.btn--secondary {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-6);
  font-size: 15px;
  background: transparent;
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.btn--secondary:hover { background: var(--accent); }
.btn--secondary:disabled:hover { background: transparent; }
.btn--secondary svg { flex: none; color: var(--muted-foreground); }

.or {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin: calc(-1 * var(--space-2)) 0;
  color: var(--muted-foreground);
  font-size: var(--text-caption);
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.ms-chip {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-capsule);
  background: var(--ms-chip);
}
/* Classes, not inline styles: the pages' CSP allows no inline style. */
.ms-red { fill: var(--ms-red); }
.ms-green { fill: var(--ms-green); }
.ms-blue { fill: var(--ms-blue); }
.ms-yellow { fill: var(--ms-yellow); }

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

/* ---------- login ---------- */

.center {
  flex: 1;
  display: grid;
  place-items: center;
  padding: var(--space-8) var(--gutter);
}

.login {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-10) var(--space-8) var(--space-8);
  text-align: center;
  background: var(--card);
  border-radius: var(--radius-surface);
  box-shadow: var(--paper-shadow), var(--paper-lift);
}
/* Who is asking: the account the person signs in to, above where it continues to. */
.login__wordmark { font-size: 16px; margin-bottom: var(--space-2); }
.login h1 { overflow-wrap: anywhere; }
.login .app-name { display: block; }

.sandbox-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-capsule);
  /* The translucent tint laid over the card, so the pill stays the same colour over a tile. */
  background: linear-gradient(var(--sandbox-badge), var(--sandbox-badge)), var(--card);
  color: var(--sandbox-badge-foreground);
  box-shadow: inset 0 0 0 1px var(--sandbox-badge-ring);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* Two nowrap capsule buttons outgrow a 288px card; without this the card widens past the gutter. */
@media (max-width: 359px) {
  .login { padding-left: var(--space-5); padding-right: var(--space-5); }
  .login .btn--primary, .login .btn--secondary { padding-left: var(--space-4); padding-right: var(--space-4); }
}

.handoff { display: flex; align-items: center; gap: var(--space-3); }
/* In a Sandbox the chip hangs on the Application tile's lower edge, cut out of it by a ring of card. */
.handoff__app { position: relative; flex: none; display: grid; }
.handoff:has(.handoff__app) { margin-bottom: var(--space-2); }
.handoff__app .sandbox-badge {
  position: absolute;
  left: 50%;
  bottom: 0;
  /* Overlaps the tile by 4px only, so its rounded corners still read. */
  translate: -50% calc(100% - 4px);
  min-height: 18px;
  padding: 0 6px;
  font-size: 11px;
  box-shadow: inset 0 0 0 1px var(--sandbox-badge-ring), 0 0 0 2px var(--card);
}
.handoff__link { display: flex; align-items: center; gap: 5px; }
.handoff__link i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: var(--radius-capsule);
  background: var(--border-strong);
}

/* ---------- Proteus picker: the login card's header on a wider card ---------- */

/* Hung from the top: a centred card would move every time the search shortens the list. */
.center--top { place-items: start center; padding-top: clamp(var(--space-8), 12vh, 120px); }
.login--picker { width: min(100%, 560px); }
@media (max-width: 479px) {
  .login--picker { padding-left: var(--space-5); padding-right: var(--space-5); }
}

.login__title { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.login__title .lede { overflow-wrap: anywhere; }
/* The name sits on its own line under a heading; inside a sentence it stays inline. */
.login__title .lede .app-name { display: inline; white-space: nowrap; }

.picker { align-self: stretch; display: flex; flex-direction: column; gap: var(--space-3); text-align: left; }

.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted-foreground); pointer-events: none; }
.search input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4) 0 40px;
  border: 0;
  border-radius: var(--radius-nav);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--foreground);
  font: inherit;
  font-size: 16px;
}
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus-visible { outline-offset: 0; }

.count { min-height: 1lh; color: var(--muted-foreground); font-size: var(--text-caption); font-variant-numeric: tabular-nums; }

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52dvh, 460px);
  overflow-y: auto;
  border-radius: var(--radius-nav);
  box-shadow: inset 0 0 0 1px var(--border);
}
.people > li + li { border-top: 1px solid var(--border); }

.person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-state) var(--ease-out);
}
.person:hover { background: var(--accent); }
.person:focus-visible { outline-offset: -2px; }
.person:disabled { cursor: not-allowed; opacity: 0.55; }
.person:disabled:hover { background: none; }
.person__who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person__name { font-weight: 500; }
.person__role { font-size: 13px; overflow-wrap: anywhere; }
.person__meta { font-size: var(--text-caption); color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person__tags { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.person__tags:empty { display: none; }

/* Below the card's full width, tags move under the text instead of squeezing a third column. */
@media (max-width: 599px) {
  .person { grid-template-columns: auto minmax(0, 1fr); }
  .person__tags { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
}

.avatar.avatar--soft { width: 36px; height: 36px; background: var(--primary-tint); color: var(--primary-accent); font-size: var(--text-caption); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-capsule);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.tag--role { box-shadow: none; background: var(--primary-tint); color: var(--primary-accent); }

.empty-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-6);
  text-align: center;
}
.empty-result .btn { height: 36px; margin-top: var(--space-2); padding: 0 var(--space-4); background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.empty-result .btn:hover { background: var(--accent); }

/* ---------- top bar (chrome glass) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--gutter);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: 1px solid var(--border);
}

/* The account menu, drawn as TMS's UserMenu: an avatar and name that open the email and Log out. */
.account { position: relative; }
.account > summary { list-style: none; }
.account > summary::-webkit-details-marker { display: none; }
.account__trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-1);
  border-radius: var(--radius-capsule);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-state) var(--ease-out);
}
.account__trigger:hover, .account[open] .account__trigger { background: var(--accent); }
.account__name {
  display: none;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 640px) {
  .account__trigger { min-height: 0; padding-right: var(--space-2); }
  .account__name { display: inline; }
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-capsule);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 11px;
  font-weight: 600;
}
.avatar--md { width: 36px; height: 36px; font-size: var(--text-caption); }

.account__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  width: 256px;
  padding: var(--space-1);
  border-radius: var(--radius-surface);
  background: var(--popover);
  -webkit-backdrop-filter: var(--popover-filter);
  backdrop-filter: var(--popover-filter);
  box-shadow: var(--popover-shadow);
}
.account__who { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.account__identity { min-width: 0; }
.account__identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__identity span:first-child { font-weight: 500; }
.account__identity span:last-child { font-size: var(--text-caption); line-height: 1.5; color: var(--muted-foreground); }
.account__menu hr { height: 1px; margin: var(--space-1) 0; border: 0; background: var(--border); }
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-item);
  color: var(--destructive-accent);
  font-weight: 500;
}
.menu-item:hover { background: var(--accent); }

/* ---------- applications ---------- */

.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-8) var(--gutter) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-3);
}
.app-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--card);
  border-radius: var(--radius-surface);
  box-shadow: var(--paper-shadow);
  transition: background-color var(--dur-state) var(--ease-out);
}
.app-card:hover { background-image: linear-gradient(var(--accent), var(--accent)); }
.app-card .app-name { font-size: 15px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  border-radius: var(--radius-surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ---------- reader preferences ---------- */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: var(--glass-solid); }
  .account__menu { background: var(--popover-solid); }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .topbar { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .account__menu { background: var(--popover-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

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