:root {
  --ink: #111;
  --muted: #6b6866;
  --line: rgb(0 0 0 / 0.08);
  --glass: rgb(255 255 255 / 0.55);
  --glass-strong: rgb(255 255 255 / 0.78);
  --glass-edge: rgb(255 255 255 / 0.75);
  --danger: #b42318;
  --ok: #1f7a3a;
  --radius: 34px;
  font-family: "Montserrat", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

/* Cream that fades to warm grey at the bottom, with a fine film grain on top. */
html {
  min-height: 100%;
  background-color: #f9f5f0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #f9f5f0 0%, #f8f4ef 56%, #e9e5e1 66%, #cfcbc7 76%, #a9a5a2 88%, #6c6866 100%);
  background-attachment: fixed;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

/* --- Liquid glass card -------------------------------------------------------------------- */

.glass {
  position: relative;
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: linear-gradient(140deg, rgb(255 255 255 / 0.9) 0%, rgb(250 248 246 / 0.7) 45%, rgb(236 234 231 / 0.62) 100%);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),
    inset 0 -1px 0 rgb(0 0 0 / 0.04),
    0 1px 2px rgb(0 0 0 / 0.04),
    0 30px 80px rgb(40 30 20 / 0.14);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: linear-gradient(140deg, rgb(255 255 255 / 0.72) 0%, rgb(250 248 246 / 0.5) 45%, rgb(236 234 231 / 0.42) 100%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    backdrop-filter: blur(28px) saturate(160%);
  }
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; justify-self: start; }
.brand img { mix-blend-mode: multiply; }
.brand span { font-size: 1.12rem; font-weight: 600; }

.tabs { display: flex; gap: 32px; justify-self: center; }
.tabs a {
  position: relative; color: var(--muted); text-decoration: none; font-size: 0.86rem; padding: 10px 0;
  transition: color 0.2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -19px; height: 2px; border-radius: 2px; background: var(--ink);
}
.account { justify-self: end; }

.content { flex: 1; padding: 36px 40px 44px; display: flex; flex-direction: column; }
.center { margin: auto; text-align: center; max-width: 440px; width: 100%; }
.narrow { width: min(720px, 100%); margin: 0 auto; }

/* --- Menus (⋯ and account) ------------------------------------------------------------------ */

.menu { position: relative; }
.menu > summary {
  list-style: none; cursor: pointer; display: grid; place-items: center;
  border-radius: 999px; user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.account-menu > summary img, .initial { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9), 0 2px 8px rgb(0 0 0 / 0.12); }
.initial { display: grid; place-items: center; background: #151515; color: #fff; font-size: 0.85rem; font-weight: 600; }
.row-menu > summary { width: 34px; height: 34px; font-size: 1.2rem; color: var(--muted); }
.row-menu > summary:hover, .row-menu[open] > summary { background: rgb(0 0 0 / 0.05); color: var(--ink); }

.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 220px;
  display: grid; gap: 2px; padding: 10px;
  border-radius: 22px; border: 1px solid var(--glass-edge);
  background: rgb(252 250 248 / 0.92);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 18px 50px rgb(40 30 20 / 0.18);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .menu-panel { background: rgb(252 250 248 / 0.97); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
}
/* Keep a card with an open menu above its neighbours. */
.card:has(details[open]) { z-index: 5; transform: none; }
.account-menu .menu-panel { top: -8px; right: -8px; padding-top: 14px; min-width: 260px; }
.menu-title { margin: 0; padding: 8px 12px; font-weight: 600; display: grid; gap: 2px; }
.menu-title small { font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 8px; }
.menu-panel a, .menu-panel button {
  font: inherit; font-size: 0.92rem; text-align: left; color: var(--ink); text-decoration: none;
  background: none; border: 0; border-radius: 12px; padding: 10px 12px; cursor: pointer; width: 100%;
}
.menu-panel a:hover, .menu-panel button:hover { background: rgb(0 0 0 / 0.05); }
.menu-panel .danger { color: var(--danger); }

/* --- Type & forms ---------------------------------------------------------------------------- */

h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 700; letter-spacing: -0.01em; margin: 0 0 10px; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 16px; }
.grid h1 { margin-bottom: 24px; }
h2.spaced, .spaced { margin-top: 24px; }
.lede { color: var(--muted); margin: 0 0 28px; }
.muted { color: var(--muted); font-size: 0.85rem; }
.eyebrow { font-size: 0.9rem; color: #444; margin: 0 0 16px; }
.count { color: var(--muted); font-weight: 500; margin-left: 4px; }

.badge {
  width: 128px; height: 128px; margin: 0 auto 32px; border-radius: 50%;
  background: rgb(255 255 255 / 0.6); border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 #fff, 0 8px 24px rgb(0 0 0 / 0.06);
  display: grid; place-items: center; font-size: 2.4rem; color: #888;
}

form.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; text-align: left; min-width: 0; }
label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; font-size: 0.85rem; font-weight: 500; }
input, select {
  width: 100%; min-width: 0; font: inherit; font-size: 0.95rem; padding: 12px 16px;
  border: 1px solid rgb(0 0 0 / 0.08); border-radius: 14px;
  background: rgb(255 255 255 / 0.65);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.03);
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; background: #fff; }
input[type="file"] { padding: 10px 12px; }
input[type="checkbox"] { width: auto; }
.hint { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; font-size: 0.9rem; color: #fff; text-decoration: none;
  background: #000; border: 0; border-radius: 999px; padding: 15px 26px; cursor: pointer;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}
.button:hover { background: #222; }
.button.ghost { background: rgb(255 255 255 / 0.6); color: var(--ink); border: 1px solid rgb(0 0 0 / 0.08); box-shadow: inset 0 1px 0 #fff; }
.button.ghost:hover { background: #fff; }
.button.danger { background: var(--danger); }
.button.small { padding: 8px 16px; font-size: 0.8rem; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.alert { border-radius: 14px; padding: 12px 16px; font-size: 0.88rem; margin-bottom: 16px; text-align: left; }
.alert.error { background: rgb(253 236 234 / 0.85); color: var(--danger); }
.alert.ok { background: rgb(232 245 236 / 0.85); color: var(--ok); }
.alert code { background: rgb(0 0 0 / 0.06); padding: 1px 6px; border-radius: 6px; }

/* --- Dashboard ---------------------------------------------------------------------------------- */

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 36px; }
.grid > * { min-width: 0; }

.panel {
  border-radius: 26px; padding: 24px;
  background: rgb(255 255 255 / 0.45);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 10px 30px rgb(40 30 20 / 0.06);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }

.employee {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.employee:first-of-type { border-top: 0; padding-top: 0; }
.avatar { border-radius: 50%; object-fit: cover; background: rgb(0 0 0 / 0.05); box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9); }
.avatar.large { width: 64px; height: 64px; }
.who { display: grid; gap: 2px; min-width: 0; }
.who small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgb(0 0 0 / 0.05); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.pill.active { background: #e8f5ec; color: var(--ok); }
.pill.pending { background: #fff4e0; color: #8a5300; }
.pill.disabled { background: #fdecea; color: var(--danger); }

.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.85rem; margin-bottom: 18px; }
.back:hover { color: var(--ink); }
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.profile-head h1 { margin: 0 0 4px; }
.profile-head p { margin: 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li > div { display: grid; gap: 3px; min-width: 0; }
.rows small { color: var(--muted); font-size: 0.78rem; }

/* The custom email field only applies to manager roles. */
.manager-only { display: none; }
form:has(#role option[data-manager]:checked) .manager-only { display: grid; }
.email-field { display: flex; align-items: center; gap: 8px; }
.email-field input { flex: 1; min-width: 0; }
.email-field span { color: var(--muted); font-size: 0.9rem; font-weight: 400; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr auto; padding: 16px 20px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: start; gap: 24px; }
  .tabs a[aria-current="page"]::after { bottom: -9px; }
  .content { padding: 28px 20px 32px; }
  .employee { grid-template-columns: auto minmax(0, 1fr) auto; }
  .employee .pill { display: none; }
}

/* --- Hub-style page header, cards and modal --------------------------------------------------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lede { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }

.card {
  position: relative;
  border-radius: 24px;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.78), rgb(255 255 255 / 0.5));
  border: 1px solid rgb(255 255 255 / 0.85);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgb(0 0 0 / 0.04), 0 10px 30px rgb(40 30 20 / 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 2px 4px rgb(0 0 0 / 0.04), 0 16px 40px rgb(40 30 20 / 0.1); }

.person { display: grid; justify-items: center; text-align: center; gap: 3px; padding: 26px 18px 20px; }
.person strong { font-size: 1.02rem; margin-top: 10px; }
.person .role { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.person small { color: var(--muted); font-size: 0.74rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .pill { margin: 8px 0 4px; }
.person .seen { margin-top: 2px; }
.avatar.xl { width: 76px; height: 76px; }
.corner { position: absolute; top: 12px; right: 12px; }

.empty { text-align: center; padding: 60px 0; color: var(--muted); display: grid; justify-items: center; gap: 12px; }

/* Modal sheet (New account), like the hub's checkout. */
dialog.sheet {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  padding: 26px 28px 30px; border: 1px solid var(--glass-edge); border-radius: 30px; color: var(--ink);
  background: rgb(250 248 245 / 0.96);
  box-shadow: inset 0 1px 0 #fff, 0 40px 100px rgb(30 20 10 / 0.28);
  opacity: 1; transform: none;
  transition: opacity 0.25s ease, transform 0.25s ease, overlay 0.25s allow-discrete, display 0.25s allow-discrete;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  dialog.sheet { background: rgb(250 248 245 / 0.82); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); }
}
dialog.sheet:not([open]) { opacity: 0; transform: translateY(12px) scale(0.98); }
@starting-style { dialog.sheet[open] { opacity: 0; transform: translateY(12px) scale(0.98); } }
dialog.sheet::backdrop {
  background: rgb(60 55 50 / 0.35);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background 0.25s ease, overlay 0.25s allow-discrete, display 0.25s allow-discrete;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.close { font: inherit; background: rgb(0 0 0 / 0.05); border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; color: var(--muted); }
.close:hover { background: rgb(0 0 0 / 0.1); color: var(--ink); }

/* Pages slide in like the hub when switching tabs (browsers without view transitions just navigate). */
@view-transition { navigation: auto; }
.content { view-transition-name: content; }
.topbar { view-transition-name: topbar; }
::view-transition-old(content) { animation: 0.22s ease both slide-out; }
::view-transition-new(content) { animation: 0.32s ease both slide-in; }
@keyframes slide-out { to { opacity: 0; transform: translateX(-24px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(content), ::view-transition-new(content) { animation: none !important; transition: none !important; }
}

/* Shown in place of a picture that fails to load. */
.avatar-fallback { display: grid; place-items: center; border-radius: 50%; background: #151515; color: #fff; font-weight: 600; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9); }
.avatar-fallback.xl { width: 76px; height: 76px; font-size: 1.6rem; }
.avatar-fallback.large { width: 64px; height: 64px; font-size: 1.4rem; }
.account-menu summary .avatar-fallback { width: 36px; height: 36px; font-size: 0.85rem; }
