:root {
  --nav-h: 56px;
  --chrome-pill-h: 40px;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #1a2433;
  --muted: #66788f;
  --line: #d5dee9;
  --accent: #0d9f90;
  --accent-ink: #0b8a7d;
  --accent-soft: rgba(13, 159, 144, 0.12);
  --danger: #d64550;
  --shadow: 0 10px 30px rgba(18, 38, 48, 0.06);
  --font: "DM Sans", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@property --hw-dock-scale {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

@property --hw-dock-shift {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 320px at 100% -10%, rgba(13, 159, 144, 0.16), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
}

button, input { font: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.boot[hidden],
.app[hidden],
.notice[hidden],
.page[hidden],
.dialog[hidden],
.field[hidden],
.hw-nav-notif-panel[hidden],
.hw-nav-user-menu[hidden] {
  display: none !important;
}

.boot, .gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
}

.gate {
  color: var(--ink);
}

.gate h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.gate p { margin: 0; color: var(--muted); }

.app { min-height: 100vh; padding-top: calc(var(--nav-h) + var(--safe-top)); }

.main {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.intro h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: -0.03em;
}

.intro p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 14px;
}

.search { flex: 1; }

.search input {
  width: min(420px, 100%);
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.search input:focus {
  outline: 2px solid rgba(13, 159, 144, 0.35);
  border-color: var(--accent);
}

.count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff4f2;
  color: var(--danger);
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(280px, 1.4fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}

.person h2, .person p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person h2 { font-size: 16px; }

.person p {
  color: var(--muted);
  font-size: 13px;
}

.grants {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.grant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfb;
  color: var(--ink);
  cursor: pointer;
}

.grant[aria-pressed="true"] {
  border-color: #9edfd4;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.grant:disabled { opacity: 0.55; cursor: progress; }

.grant small {
  color: var(--muted);
  font-size: 11px;
}

.switch {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #c5d0d8;
  position: relative;
}

.grant[aria-pressed="true"] .switch { background: var(--accent); }

.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s ease;
}

.grant[aria-pressed="true"] .switch i { transform: translateX(14px); }

.btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}

.btn-quiet:hover { border-color: #b7c6d1; }

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.btn-danger {
  border-color: #f0c9c6;
  background: #fff6f5;
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.35);
}

.sheet {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}

.sheet h2 { margin: 0; font-size: 20px; }

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-weight: 500;
}

.field input:focus {
  outline: 2px solid rgba(13, 159, 144, 0.35);
  border-color: var(--accent);
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.empty {
  padding: 28px 8px;
  color: var(--muted);
}

@media (max-width: 800px) {
  .toolbar { align-items: stretch; flex-direction: column; }
  .card { grid-template-columns: 1fr; }
  .grants { justify-content: flex-start; }
  .intro h1 { font-size: 26px; }
  .hw-brand .kicker { display: none; }
}

.hw-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  height: calc(var(--nav-h) + var(--safe-top));
  padding: var(--safe-top) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  background: transparent;
  pointer-events: none;
}

.hw-topnav:has(.hw-nav-dock.is-hovering) { z-index: 140; }

.hw-nav-start,
.hw-nav-end {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  pointer-events: none;
}

.hw-nav-start { justify-content: flex-start; }
.hw-nav-end { justify-content: flex-end; }

.hw-brand,
.hw-nav-dock,
.hw-nav-right { pointer-events: auto; }

.hw-brand,
.hw-brand:hover,
.hw-brand:focus,
.hw-brand:visited {
  text-decoration: none;
  color: inherit;
}

.hw-brand,
.hw-nav-right,
.hw-nav-dock {
  position: relative;
  isolation: isolate;
}

.hw-brand::before,
.hw-nav-right::before,
.hw-nav-dock::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 40%, rgba(255, 255, 255, 0.55) 0%, transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(226, 234, 244, 0.58) 100%);
  -webkit-backdrop-filter: blur(24px) saturate(1.9);
  backdrop-filter: blur(24px) saturate(1.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 0.5px rgba(15, 23, 42, 0.16),
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 8px 18px rgba(15, 23, 42, 0.1);
}

.hw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--chrome-pill-h);
  padding: 0 12px;
  border-radius: 14px;
}

.hw-brand .hw-brand-mark,
.hw-brand .kicker,
.hw-brand .hw-brand-title {
  position: relative;
  z-index: 1;
}

.hw-brand-mark {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.hw-brand .kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.hw-brand .hw-brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
}

.hw-nav-dock {
  --hw-dock-base: 34px;
  z-index: 3;
  justify-self: center;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: max-content;
  height: var(--chrome-pill-h);
  padding: 3px 8px 2px;
  border-radius: 16px;
  overflow: visible;
}

.hw-nav-dock.is-hovering::after,
.hw-nav-dock.is-settling::after {
  content: "";
  position: absolute;
  left: -36px;
  right: -36px;
  top: -10px;
  bottom: -40px;
  z-index: 0;
}

.hw-nav-link {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: var(--hw-dock-base);
  height: calc(var(--hw-dock-base) + 8px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  transform: translate3d(var(--hw-dock-shift, 0px), 0, 0);
  overflow: visible;
}

.hw-nav-dock .hw-nav-link::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: calc(var(--hw-dock-base) * var(--hw-dock-scale, 1));
  height: calc(var(--hw-dock-base) * var(--hw-dock-scale, 1) + 14px);
  transform: translateX(-50%);
  z-index: 2;
}

.hw-nav-link.is-hot { z-index: 48; }

.hw-nav-dock.is-settling .hw-nav-link {
  transition: --hw-dock-shift 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-nav-dock-icon {
  display: block;
  width: var(--hw-dock-base);
  height: var(--hw-dock-base);
  transform: scale3d(var(--hw-dock-scale, 1), var(--hw-dock-scale, 1), 1);
  transform-origin: 50% 0%;
  pointer-events: none;
}

.hw-nav-dock.is-settling .hw-nav-dock-icon {
  transition: --hw-dock-scale 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-nav-dock-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, #7eb6ff, #1d6fe8);
  filter:
    drop-shadow(0 1px 1px rgba(15, 35, 70, 0.1))
    drop-shadow(0 4px 8px rgba(15, 35, 70, 0.16));
}

.hw-nav-dock-glyph[data-id="access"] {
  background: linear-gradient(160deg, #7eb6ff, #1d6fe8);
}

.hw-nav-dock-glyph[data-id="users"] {
  background: linear-gradient(160deg, #5fe0c8, #0b8f80);
}

.hw-nav-dock-glyph svg {
  display: block;
  width: 18px;
  height: 18px;
}

.hw-nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(-1.2px - (var(--hw-dock-scale, 1) - 1) * var(--hw-dock-base));
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #1d2430;
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.55);
  z-index: 3;
  pointer-events: none;
}

.hw-nav-dock-tip {
  position: absolute;
  left: 50%;
  top: calc(max(var(--chrome-pill-h), var(--hw-dock-base) * var(--hw-dock-scale, 1)) + 8px);
  transform: translate3d(-50%, 0, 0);
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(28, 32, 40, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 6;
  box-shadow: 0 8px 18px rgba(15, 35, 70, 0.2);
}

.hw-nav-dock-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: inherit;
  transform: rotate(45deg);
}

.hw-nav-link.is-hot .hw-nav-dock-tip,
.hw-nav-link:focus-visible .hw-nav-dock-tip,
.hw-nav-link:hover .hw-nav-dock-tip {
  opacity: 1;
}

.hw-nav-right {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--chrome-pill-h);
  padding: 0 4px;
  border-radius: 14px;
}

.hw-nav-notif,
.hw-nav-user {
  appearance: none;
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.hw-nav-notif {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  color: var(--ink);
}

.hw-nav-notif::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  background: transparent;
  z-index: 0;
}

.hw-nav-notif:hover::before,
.hw-nav-notif.is-open::before {
  background: rgba(13, 159, 144, 0.14);
}

.hw-nav-notif:hover,
.hw-nav-notif.is-open { color: var(--accent-ink); }

.hw-nav-notif-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
}

.hw-nav-notif-icon svg { display: block; }

.hw-nav-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 14px;
  color: var(--muted);
}

.hw-nav-user:hover,
.hw-nav-user.is-open {
  background: rgba(255, 255, 255, 0.28);
  color: var(--ink);
}

.hw-nav-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d7efec;
  color: #0b7a70;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.8),
    0 2px 6px rgba(15, 35, 70, 0.16);
}

.hw-nav-user-initials {
  line-height: 1;
  user-select: none;
}

.hw-nav-user strong {
  color: var(--ink);
  font-weight: 650;
  font-size: 13px;
}

.hw-nav-user-menu,
.hw-nav-notif-panel {
  position: fixed;
  z-index: 400;
}

.hw-nav-user-menu.hw-account-menu {
  width: 220px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(26, 36, 51, 0.12);
}

.hw-account-item {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #243044;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.hw-account-item:hover { background: #f4f7fb; }
.hw-account-item.is-danger { color: #e15b64; }

.hw-nav-notif-panel {
  width: 320px;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 32px rgba(26, 36, 51, 0.16);
  overflow: hidden;
}

.hw-nav-notif-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.hw-nav-notif-head strong {
  font-size: 14px;
  color: var(--ink);
}

.hw-nav-notif-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1280px) {
  :root { --chrome-pill-h: 36px; }
  .hw-nav-dock {
    --hw-dock-base: 30px;
    padding: 2px 6px 1px;
    gap: 4px;
  }
  .hw-brand-mark,
  .hw-nav-user-icon { width: 24px; height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .hw-nav-dock-icon,
  .hw-nav-link { transform: none !important; transition: none !important; }
}
