/* Boss portal pages: login, account and administration. */
:root {
  --ink: #0b1533;
  --ink-2: #3a4566;
  --muted: #6b7591;
  --faint: #a3abc0;
  --line: #e6eaf2;
  --line-strong: #d6dce8;
  --canvas: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --blue: #2f6bff;
  --blue-ink: #1f4fe0;
  --blue-soft: #eaf0ff;
  --grad: linear-gradient(135deg, #14cbff 0%, #2f6bff 58%, #2a4bf0 100%);
  --green: #11906a;
  --green-soft: #e4f5ee;
  --red: #d92d20;
  --red-soft: #fdedeb;
  --amber: #b26a00;
  --amber-soft: #fff4dc;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 21, 51, .04), 0 8px 24px rgba(11, 21, 51, .05);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --num: "SF Pro Display", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid rgba(47, 107, 255, .55); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Controls ------------------------------------------------------------------ */
.input, .select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: #c3cbdb; }
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 107, 255, .14); }
.field { display: grid; gap: 6px; }
.field > span { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .2s var(--ease), transform .12s ease;
}
.btn:hover { border-color: #c3cbdb; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  border: 0;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .24);
}
.btn-primary:hover { background: var(--grad); box-shadow: 0 10px 24px rgba(47, 107, 255, .32); }
.btn-small { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--blue-ink); }
.btn-quiet:hover { background: var(--blue-soft); border-color: transparent; }
.btn-danger { border-color: transparent; background: transparent; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: transparent; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.alert::before { content: ""; width: 8px; height: 8px; flex: 0 0 8px; margin-top: 7px; border-radius: 50%; background: currentColor; }
.alert-error { background: var(--red-soft); color: #b42318; }
.alert-success { background: var(--green-soft); color: #0b6b4f; }
.alert-info { background: var(--blue-soft); color: var(--blue-ink); }

/* Login ----------------------------------------------------------------------- */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
/* A subset of Montserrat ExtraBold (SIL Open Font License) for the title only: it matches the
   geometric STOOOGES wordmark. */
@font-face { font-family: "Boss Montserrat"; src: url(/assets/fonts/montserrat-800-boss.woff2) format("woff2"); font-weight: 800; font-display: swap; }
.login-page {
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(180deg, #f6f9ff 0%, #eef3fd 100%);
}
/* Layers: drifting light, the thread ribbon (full-screen canvas), fine grain, then the content. */
.login-backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aura { position: absolute; border-radius: 50%; will-change: transform; }
.aura-1 { width: 72vmax; height: 72vmax; left: -26vmax; top: -34vmax; background: radial-gradient(circle, rgba(118, 214, 255, .5), rgba(118, 214, 255, 0) 62%); animation: aura-a 26s ease-in-out infinite alternate; }
.aura-2 { width: 66vmax; height: 66vmax; right: -26vmax; bottom: -34vmax; background: radial-gradient(circle, rgba(76, 120, 255, .34), rgba(76, 120, 255, 0) 62%); animation: aura-b 32s ease-in-out infinite alternate; }
.aura-3 { width: 48vmax; height: 48vmax; left: 18vw; top: 14vh; background: radial-gradient(circle, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 60%); animation: aura-c 22s ease-in-out infinite alternate; }
.login-flow {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.login-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.login-header { position: fixed; top: 28px; left: 40px; z-index: 3; animation: fade-in 1s var(--ease) .2s both; }
/* The official logo: the S a third taller than the wordmark, a third of its height away from it. */
.login-logo { display: flex; align-items: center; gap: 15px; }
.login-logo img { display: block; width: auto; }
.login-logo-mark { height: 46px; }
.login-logo-word { height: 35px; }
.login-layout {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  align-items: center;
  gap: clamp(40px, 8vw, 150px);
  width: min(1240px, calc(100% - 80px));
  margin: 0 auto;
  padding: 120px 0 100px;
}
/* On wide screens the content keeps to the middle, so the ribbon's two folds show on either side. */
@media (min-width: 1200px) { .login-layout { width: min(980px, calc(100% - 26vw)); } }
.login-hero { display: grid; justify-items: start; gap: 30px; will-change: transform; }
/* BOSS on its own, big, in the geometric face that matches the STOOOGES wordmark: deep ink that turns a
   little blue at the foot, and every so often a sheen runs across it like the light along the ribbon.
   A soft halo in the page colour keeps it clear of the threads. */
.login-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Boss Montserrat", var(--num);
  font-size: clamp(88px, calc(13vw - 30px), 150px);
  font-weight: 800;
  line-height: .75;
  letter-spacing: -.005em;
  color: var(--ink);
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, .72) 50%, rgba(255, 255, 255, 0) 58%) 160% 0 / 250% 100% no-repeat,
    linear-gradient(180deg, #0b1533 38%, #1f3f9e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(244, 248, 255, .95));
  font-synthesis: none;
  animation: title-in 1.1s var(--ease) .5s both, title-sheen 9s ease-in-out 3.4s infinite;
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(28px); filter: blur(10px) drop-shadow(0 0 22px rgba(244, 248, 255, .95)); }
  to { opacity: 1; transform: none; filter: blur(0) drop-shadow(0 0 22px rgba(244, 248, 255, .95)); }
}
@keyframes title-sheen { 0%, 72% { background-position: 160% 0, 0 0; } 100% { background-position: -60% 0, 0 0; } }
.login-card {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 36px 34px 32px;
  border: 1px solid transparent;
  border-radius: 28px;
  background: rgba(255, 255, 255, .58) padding-box;
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  backdrop-filter: blur(28px) saturate(1.7);
  box-shadow: 0 50px 100px rgba(31, 79, 224, .18), 0 2px 8px rgba(11, 21, 51, .05), inset 0 1px 0 rgba(255, 255, 255, .9);
  animation: card-in 1.1s var(--ease) .9s both;
}
/* The turning light on the edge, masked to the 1px ring so it never shows through the glass. */
.login-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(from var(--spin), rgba(255, 255, 255, .7), rgba(20, 203, 255, .85), rgba(47, 107, 255, .85), rgba(255, 255, 255, .7) 45%, rgba(255, 255, 255, .7));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 12s linear infinite;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity .35s ease;
}
.login-card:hover::before { opacity: 1; }
.login-card > * { position: relative; }
.login-card-head h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: .04em; }
.login-card-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.input-wrap { position: relative; display: block; }
.input-wrap .input { height: 50px; padding-left: 44px; border-color: rgba(214, 220, 232, .9); border-radius: 14px; background: rgba(255, 255, 255, .8); }
.input-wrap .input:focus { background: #fff; }
.input-icon { position: absolute; top: 15px; left: 14px; width: 20px; height: 20px; color: var(--faint); pointer-events: none; transition: color .16s ease; }
.input-wrap:focus-within .input-icon { color: var(--blue); }
.input-wrap .input#password { padding-right: 50px; }
.reveal {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.reveal:hover { background: var(--surface-2); color: var(--ink); }
.reveal[aria-pressed="true"] { color: var(--blue); }
.reveal svg { width: 18px; height: 18px; }
.login-submit { position: relative; height: 54px; margin-top: 8px; overflow: hidden; border-radius: 16px; font-size: 16px; letter-spacing: .12em; }
.login-submit svg { width: 18px; height: 18px; transition: transform .25s var(--ease); }
.login-submit:hover svg { transform: translateX(4px); }
.login-submit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .42) 50%, rgba(255, 255, 255, 0) 70%);
  transform: translateX(-100%);
  transition: transform .75s var(--ease);
}
.login-submit:hover::after { transform: translateX(100%); }
.login-submit.is-loading { pointer-events: none; }
.login-submit.is-loading span, .login-submit.is-loading svg { opacity: 0; }
.login-submit.is-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: turn .7s linear infinite;
}
.login-legal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 20px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 5px;
  margin: 0;
  color: rgba(58, 69, 102, .72);
  font-size: 12px;
  letter-spacing: .1em;
  text-align: center;
  animation: fade-in 1s var(--ease) 1.4s both;
}
.login-legal span:last-child { color: rgba(58, 69, 102, .52); font-size: 11px; letter-spacing: .24em; }
.login-card.shake { animation: card-in 1.1s var(--ease) .9s both, shake .5s ease 2s; }
/* After a failed attempt the page reloads: skip the entrance, just nudge the card. */
.returning .login-header, .returning .login-legal { animation: none; }
.returning .login-title { animation: title-sheen 9s ease-in-out 1s infinite; }
.returning .login-card { animation: none; }
.returning .login-card.shake { animation: shake .5s ease .05s; }
@keyframes word-in { from { opacity: 0; transform: translateY(28px); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(26px) scale(.97); filter: blur(8px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes aura-a { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes aura-b { to { transform: translate(-7vmax, -5vmax) scale(1.1); } }
@keyframes aura-c { to { transform: translate(6vmax, -4vmax) scale(.92); } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes spin { to { --spin: 360deg; } }
@media (max-width: 900px) {
  .login-header { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); }
  .login-logo { gap: 12px; }
  .login-logo-mark { height: 38px; }
  .login-logo-word { height: 29px; }
  .login-layout { grid-template-columns: 1fr; justify-items: center; gap: 24px; align-content: start; width: min(460px, calc(100% - 32px)); padding: 88px 0 76px; }
  .login-hero { justify-items: center; gap: 18px; text-align: center; }
  .login-title { font-size: clamp(48px, 15vw, 64px); }
  .login-card { width: 100%; padding: 28px 22px 24px; border-radius: 24px; }
  .login-legal { position: absolute; bottom: 14px; padding: 0 16px; }
}

/* Portal pages ------------------------------------------------------------------ */
.portal-main { width: min(1180px, 100%); padding: 32px 40px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: .02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-body { padding: 22px; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-group { display: grid; gap: 6px; }
.check-group + .check-group { margin-top: 10px; }
.check-group-name { color: var(--muted); font-size: 12px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: border-color .16s ease, background-color .16s ease;
}
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.check:has(input:disabled) { cursor: default; }
.check:has(input:checked) { border-color: rgba(47, 107, 255, .5); background: var(--blue-soft); color: var(--blue-ink); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.create-panel[hidden] { display: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 500; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover { background: #fafbfe; }
.person { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-weight: 600;
}
.avatar.admin { background: var(--grad); color: #fff; }
.person strong { display: block; font-weight: 600; }
.person span { color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; }
.pill.blue { background: var(--blue-soft); color: var(--blue-ink); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.gray { background: #eef1f6; color: var(--muted); }
.pill + .pill { margin-left: 4px; }
.muted { color: var(--muted); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions form { display: contents; }

.credential {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 24px;
  margin-bottom: 20px;
  padding: 20px 24px;
  overflow: hidden;
  border: 1px solid rgba(47, 107, 255, .22);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(20, 203, 255, .08), rgba(47, 107, 255, .1));
}
.credential h2 { margin: 0; font-size: 15px; font-weight: 600; }
.credential p { margin: 0; color: var(--ink-2); font-size: 13px; }
.credential code {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 600 22px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .06em;
  box-shadow: inset 0 0 0 1px var(--line);
}
.empty { padding: 56px 24px; color: var(--muted); text-align: center; }
.state-page { display: grid; place-items: center; min-height: calc(100vh - 120px); text-align: center; }
.state-page .glyph { width: 72px; height: 72px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 22px; background: var(--grad); box-shadow: 0 16px 36px rgba(47, 107, 255, .28); }
.state-page .glyph svg { width: 40px; height: 40px; }
.state-page h1 { margin: 0; font-size: 22px; font-weight: 600; }
.state-page p { margin: 10px 0 24px; color: var(--muted); }
.narrow { max-width: 520px; }
.portal-main > * { animation: page-rise .6s var(--ease) both; }
.portal-main > :nth-child(2) { animation-delay: .06s; }
.portal-main > :nth-child(3) { animation-delay: .12s; }
.portal-main > :nth-child(4) { animation-delay: .18s; }
@keyframes page-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.state-page .glyph.brand { background: var(--surface); box-shadow: 0 16px 36px rgba(47, 107, 255, .16), inset 0 0 0 1px var(--line); }
.state-page .glyph.brand img { width: 46px; height: 46px; }

@media (max-width: 960px) {
  .portal-main { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
