:root {
  color-scheme: dark;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --bg: #0f172a;
  --bg-deep: #020617;
  --surface: rgba(30, 41, 59, 0.58);
  --border: #334155;
  --primary: #2563eb;
  --primary-hover: #3b82f6;
  --primary-light: #60a5fa;
  --cool-a: #90d4f5;
  --cool-b: #3f4a9e;
  --warm-a: #faaa35;
  --warm-b: #ed3558;
  --radius: 16px;
  --font-display: "Poppins", ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.64, 0, 0.78, 0);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, .card-name, .portal-copy p {
  font-family: var(--font-display);
}

a { color: var(--primary-light); text-decoration: none; }
::selection { background: var(--primary); color: #fff; }
*:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 3px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(37, 99, 235, 0.18), transparent 55%),
    linear-gradient(180deg, #0b1220 0%, var(--bg-deep) 55%, #020617 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 18s var(--ease-out) infinite alternate;
}

.orb-cool {
  width: min(52vw, 520px);
  height: min(52vw, 520px);
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, #90d4f5 0%, #2563eb 38%, transparent 70%);
}

.orb-warm {
  width: min(48vw, 460px);
  height: min(48vw, 460px);
  right: -8%;
  bottom: -12%;
  background: radial-gradient(circle, #faaa35 0%, #ed3558 40%, transparent 70%);
  animation-delay: -7s;
}

.grid-floor {
  position: absolute;
  inset: 42% 0 0;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent 95%);
  transform: perspective(500px) rotateX(62deg) scale(1.35);
  transform-origin: center top;
  opacity: 0.45;
}

.scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(2, 6, 23, 0.18) 3px 4px
  );
  opacity: 0.25;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem clamp(1.25rem, 4vw, 3.5rem) 4.5rem;
  max-width: 1416px;
  margin: 0 auto;
}

.top {
  position: absolute;
  top: 1.5rem;
  left: clamp(1.25rem, 4vw, 3.5rem);
  right: clamp(1.25rem, 4vw, 3.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 40;
}

main,
.suite-main {
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: transparent;
  transform: translateY(6px);
}

.brand h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}

.foot {
  position: absolute;
  bottom: 1.25rem;
  left: clamp(1.25rem, 4vw, 3.5rem);
  right: clamp(1.25rem, 4vw, 3.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.foot #clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-align: center;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.user-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 36px;
  padding: 0 0.5rem 0 0.75rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.user-avatar-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #cbd5e1;
  background: #334155;
}
.user-text {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  width: fit-content;
  flex-shrink: 0;
}
.user-role[data-role="superuser"] {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}
.user-role[data-role="admin"] {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
}
.user-burger {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.user-burger svg { width: 18px; height: 18px; display: block; }
.user-burger:hover { color: #94a3b8; background: rgba(148, 163, 184, 0.08); }
.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}
.user-dropdown[hidden] { display: none !important; }
.user-dropdown .nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.user-dropdown .nav-link:hover {
  background: #334155;
}
.user-dropdown .logout-link {
  color: #f87171;
}
.user-dropdown:has(#users-btn:not([hidden])) .logout-link {
  border-top: 1px solid #334155;
  margin-top: 4px;
}
.user-dropdown .logout-link:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.text-btn {
  appearance: none;
  background: none;
  border: 0;
  color: var(--primary-light);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.apps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  width: 100%;
}

.card {
  --accent: var(--primary-light);
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.02rem;
  width: 100%;
  min-height: 252px;
  padding: 1.5rem 1.44rem 1.38rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.55));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 40px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform-style: preserve-3d;
  transition:
    transform 0.35s var(--ease-out),
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
  position: relative;
  overflow: hidden;
  animation: card-in 0.7s var(--ease-out) backwards;
}
.card:nth-child(1) { animation-delay: 0.04s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.22s; }
.card:nth-child(5) { animation-delay: 0.28s; }
.card:nth-child(6) { animation-delay: 0.34s; }

.card::after {
  content: "";
  position: absolute;
  inset: auto 1.2rem 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
  opacity: 0.9;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.icon svg {
  width: 29px;
  height: 29px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.launch {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease-out), color 0.3s ease, border-color 0.3s ease;
}

.launch svg {
  width: 14px;
  height: 14px;
}

.card-name {
  margin: 0;
  font-size: 1.46rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.card-domain {
  display: block;
  margin-top: 0.24rem;
  font-size: 0.94rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.card-blurb {
  margin: 0;
  margin-top: auto;
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--muted);
}

.card:hover,
.card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 22px 50px rgba(2, 6, 23, 0.5),
    0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
    0 12px 40px color-mix(in srgb, var(--accent) 16%, transparent);
}

.card:hover::after,
.card:focus-visible::after {
  transform: scaleX(1);
}

.card:hover .launch,
.card:focus-visible .launch {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translate(2px, -2px);
}

.card.launching {
  pointer-events: none;
  transform: scale(0.97) !important;
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 48px color-mix(in srgb, var(--accent) 40%, transparent);
}

.card.launching .icon {
  animation: icon-pulse 0.55s var(--ease-out);
}

.portal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}

.portal.active {
  pointer-events: auto;
}

#suite-return-cover {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #020617;
  pointer-events: none;
}

#suite-app-host {
  position: fixed;
  inset: 0;
  z-index: 2147482990;
  overflow: hidden;
  background: #020617;
}

html:not(.mobile-layout) #suite-app-host.suite-app-blue,
html:not(.mobile-layout).suite-app-blue #suite-app-host,
html:not(.mobile-layout).suite-app-blue #suite-app-clip {
  background: #0f172a;
}

#suite-app-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #020617;
}

#suite-app-scaler {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: top left;
}

html.suite-app-open #view-app {
  visibility: hidden;
  pointer-events: none;
}

#suite-app-frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  color-scheme: dark;
  background: #020617;
  transform: none;
  zoom: 1;
}

html.suite-app-open,
html.suite-app-open body {
  overflow: hidden !important;
  height: var(--app-h, 100dvh);
  overscroll-behavior: none;
}

.portal.active.holding {
  animation: suite-portal-hold 0.75s linear forwards;
}

.portal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-deep);
  opacity: 0;
}

.portal.active .portal-backdrop {
  animation: portal-backdrop-in 0.28s var(--ease-out) forwards;
}

.portal.active.closing .portal-backdrop {
  opacity: 1;
  animation: none;
}

.portal-disk {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.15);
  opacity: 0;
  background:
    radial-gradient(circle at 30% 30%, #fff, transparent 28%),
    radial-gradient(circle at 50% 50%, var(--cool-a), var(--primary) 42%, #0f172a 78%);
  box-shadow: 0 0 80px rgba(37, 99, 235, 0.55);
}

.portal.active .portal-disk {
  animation: portal-expand 0.72s var(--ease-out) forwards;
}

.portal.active.closing .portal-disk {
  animation: portal-veil-out 0.9s var(--ease-out) forwards;
}

.portal-copy {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: none;
}

.portal.active .portal-copy {
  animation: portal-copy-in 0.45s 0.28s var(--ease-out) forwards;
}

.portal.active.closing .portal-copy {
  animation: portal-copy-out 0.42s var(--ease-in) forwards;
}

.portal-mark {
  width: 88px;
  height: 88px;
  min-width: 88px;
  min-height: 88px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  justify-items: center;
  overflow: visible;
  background: rgba(15, 23, 42, 0.55);
  box-shadow: 0 12px 40px rgba(2, 6, 23, 0.45);
}

.portal.active .portal-mark {
  animation: suite-mark-breathe 2.6s var(--suite-breathe-delay, 0s) ease-in-out infinite;
}

.portal.active.closing .portal-mark,
.portal.active.closing .portal-mark img {
  animation: none;
}

.portal.active.closing .portal-mark img {
  transform: translateY(3px);
}

.portal-mark img {
  width: 76%;
  height: 76%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
  align-self: center;
  justify-self: center;
  transform: translateY(3px);
  transform-origin: center center;
}

.portal.active .portal-mark img {
  animation: suite-icon-breathe 2.6s calc(0.12s + var(--suite-breathe-delay, 0s)) ease-in-out infinite;
}

.portal-copy p {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.75);
  paint-order: stroke fill;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

html.suite-launching .portal,
html.suite-launching .portal-copy,
html.mobile-layout.suite-launching .portal-copy {
  zoom: 1;
  font-size: 18px;
}

html.suite-launching .portal-copy p,
html.mobile-layout.suite-launching .portal-copy p {
  font-size: 18px !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

html.suite-launching .portal-mark,
html.mobile-layout.suite-launching .portal-mark {
  width: 88px !important;
  height: 88px !important;
  min-width: 88px !important;
  min-height: 88px !important;
}

html.suite-launching .portal-mark img,
html.mobile-layout.suite-launching .portal-mark img {
  width: 76% !important;
  height: 76% !important;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, 3%, 0) scale(1.08); }
}

@keyframes icon-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(0.9); }
  100% { transform: scale(1.08); }
}

@keyframes portal-expand {
  0% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(var(--portal-scale, 28));
  }
}

@keyframes portal-veil-out {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(var(--portal-scale, 28));
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(var(--portal-scale, 28));
  }
}

@keyframes portal-backdrop-out {
  to { opacity: 0; }
}

@keyframes portal-copy-in {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes portal-copy-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@keyframes suite-portal-hold {
  from, to { opacity: 1; }
}

@keyframes suite-mark-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes suite-icon-breathe {
  0%, 100% { transform: translateY(3px) scale(1); }
  50% { transform: translateY(3px) scale(1.05); }
}

@keyframes portal-backdrop-in {
  to { opacity: 1; }
}

@media (max-width: 980px) {
  .apps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { padding: 5.25rem 1rem 3.75rem; }
  .top, .foot { left: 1rem; right: 1rem; }
  .brand-mark { width: 46px; height: 46px; }
  .brand h1 { font-size: 1.15rem; }
  .apps { grid-template-columns: 1fr; }
  .card { min-height: 211px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .card, .launch, .portal-disk, .portal-copy, .portal-backdrop, .portal-mark, .portal-mark img, .portal.active.holding, .card.launching .icon {
    animation: none !important;
    transition: none !important;
  }
}

[hidden] {
  display: none !important;
}

.login-page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

.login-page-inner {
  width: 100%;
  max-width: 400px;
}

.login-card {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  user-select: none;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-brand img {
  height: 180px;
  width: auto;
  display: block;
  margin: 0 auto;
}
.login-card h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #e2e8f0;
  font-family: var(--font-display);
  text-align: center;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.user-form { display: flex; flex-direction: column; gap: 1rem; }
.login-fields { display: flex; flex-direction: column; gap: 1rem; }
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: inherit;
  color: inherit;
  font-weight: inherit;
}
.login-card label span {
  font-weight: 500;
  color: #cbd5e1;
}
.user-form label {
  display: flex; flex-direction: column; gap: 0.3rem; color: #cbd5e1; font-size: 0.92rem;
}
.login-card input, .user-form input, .users-table input {
  height: 40px; padding: 0 0.75rem; border: 1px solid #475569; border-radius: 12px;
  background: #0f172a; color: #e2e8f0; font: inherit;
}
.login-card input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.login-card input:focus {
  border-color: #60a5fa;
}
.user-form .select-wrap,
.users-table .select-wrap {
  display: inline-flex;
  align-items: stretch;
  height: 40px;
  min-height: 40px;
  border: 1px solid #475569;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.user-form .select-wrap {
  width: 100%;
}
.users-table .select-wrap {
  width: 154px;
  max-width: 154px;
  min-width: 154px;
  vertical-align: middle;
}
.user-form .select-wrap:hover,
.user-form .select-wrap:focus-within,
.users-table .select-wrap:hover,
.users-table .select-wrap:focus-within {
  border-color: #60a5fa;
}
.user-form .role-select,
.users-table .role-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: dark;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 2.25rem 0 0.75rem;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'><path d='M6 8l4 4 4-4' stroke='%2360a5fa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  color: #e2e8f0;
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
}
.role-select::-ms-expand {
  display: none;
}
.role-select:hover,
.role-select:focus {
  border-color: transparent;
}
.role-select:disabled {
  opacity: 0.7;
  cursor: default;
  color: #94a3b8;
}
.select-wrap:has(.role-select:disabled) {
  opacity: 0.7;
  cursor: default;
}
.role-select option {
  background: #1e293b;
  color: #e2e8f0;
}
.login-card button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 1rem;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}
.login-card button[type="submit"]:hover {
  background: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 6px 10px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.login-card button[type="submit"]:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.user-form button[type="submit"] {
  height: 40px; border: 0; border-radius: 8px; background: #2563eb; color: #fff;
  font: inherit; font-weight: 600; cursor: pointer;
}
.login-link {
  appearance: none; background: none; border: 0; color: var(--muted);
  cursor: pointer; font: inherit; font-size: 0.88rem;
  margin-top: 0.75rem;
}
.login-keep {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.15rem;
  cursor: pointer;
  user-select: none;
}
.login-keep span {
  font-weight: 500;
  color: #cbd5e1;
  font-size: 0.92rem;
}
.login-keep input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  padding: 0;
  accent-color: #2563eb;
  cursor: pointer;
}
.login-error {
  margin-top: 1rem;
  padding: 0.75rem; background: #7f1d1d; border: 1px solid #ef4444;
  border-radius: 12px; color: #fca5a5; font-size: 0.9rem;
}

.login-pin-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.login-pin-subtitle {
  min-height: 1.4rem;
  margin: 0 0 0.35rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  text-align: center;
}
.login-pin-prompt {
  margin: 0 0 0.75rem;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}
.login-pin-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  min-height: 1.25rem;
  margin-bottom: 0.35rem;
}
.login-pin-dots.shaking {
  animation: login-pin-shake 0.45s ease;
}
.login-pin-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid #64748b;
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.login-pin-dot.filled {
  background: #60a5fa;
  border-color: #60a5fa;
  transform: scale(1.12);
}
.login-pin-error {
  min-height: 1.25rem;
  margin-bottom: 0.55rem;
  color: #fca5a5;
  font-size: 0.8rem;
  text-align: center;
}
.login-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 16.5rem;
}
.login-pin-key {
  min-height: 44px;
  border: 1px solid #475569;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.login-pin-key:active:not(:disabled) {
  background: #1d4ed8;
  border-color: #60a5fa;
}
.login-pin-key:disabled { opacity: 0.4; }
.login-pin-key-action {
  font-size: 1.1rem;
  color: #cbd5e1;
}
.login-pin-key-spacer { min-height: 44px; }
.login-pin-footer {
  width: 100%;
  max-width: 16.5rem;
  margin-top: 0.75rem;
}
.login-pin-continue-slot { min-height: 40px; }
.login-pin-continue {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.login-pin-continue:disabled,
.login-pin-continue[disabled] {
  background: #334155;
  color: #64748b;
  cursor: default;
  box-shadow: none;
}
.login-pin-link-slot {
  min-height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.45rem;
}
.login-pin-link {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}
@keyframes login-pin-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.users-page { position: relative; z-index: 1; }
.users-shell { display: block; padding-top: 6rem; align-items: stretch; }
.users-main { width: min(1200px, 100%); margin: 0 auto; }
.user-form {
  background: rgba(30, 41, 59, 0.72); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
}
.user-form h2 { margin: 0; font-size: 1.1rem; }
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.form-hint { margin: 0; color: var(--faint); font-size: 0.82rem; }
.users-table-wrap { overflow: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.users-table th, .users-table td {
  text-align: left; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.users-table input { height: 40px; max-width: 220px; width: 100%; }
.users-table td:last-child {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  height: 40px;
  min-height: 40px;
}
.icon-btn {
  appearance: none;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  line-height: 1;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
.icon-btn:hover {
  background: #334155;
}
.icon-btn-save {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.icon-btn-save:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.icon-btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.users-table tbody tr.row-dirty {
  background: rgba(251, 191, 36, 0.22);
  box-shadow: inset 3px 0 0 #fbbf24;
}
.users-table tr.row-dirty td {
  background: rgba(251, 191, 36, 0.22);
}
.users-table tr.row-dirty input,
.users-table tr.row-dirty .select-wrap {
  background: rgba(120, 83, 16, 0.45);
  border-color: #fbbf24;
}

body.modal-open {
  overflow: hidden;
}
body.modal-open .users-page,
body.modal-open #view-app,
body.modal-open .login-page,
body.modal-open .atmosphere {
  filter: blur(4px);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  body.modal-open .users-page,
  body.modal-open #view-app,
  body.modal-open .login-page,
  body.modal-open .atmosphere {
    filter: none;
  }
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.confirm-modal[hidden] {
  display: none !important;
}
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.confirm-card {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.confirm-card h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: #e2e8f0;
}
.confirm-card p {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  color: #94a3b8;
  line-height: 1.5;
  white-space: pre-line;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.btn {
  appearance: none;
  background: #2563eb;
  color: #fff;
  border: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn:hover {
  background: #3b82f6;
}
.btn.secondary {
  background: #334155;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.btn.secondary:hover {
  background: #475569;
}
.btn.positive {
  background: #10b981;
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn.positive:hover {
  background: #34d399;
}
.btn.danger {
  background: #dc2626;
  box-shadow: 0 4px 6px rgba(220, 38, 38, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn.danger:hover {
  background: #ef4444;
}

@media (max-width: 640px) {
  .user-grid { grid-template-columns: 1fr; }
}
