:root {
  --am-blue: #0b6bcb;
  --am-blue-deep: #0856a3;
  --am-lime: #7bc800;
  --am-ink: #142033;
  --am-muted: #5c6b7c;
  --am-card: rgba(255, 255, 255, 0.82);
  --am-line: rgba(11, 107, 203, 0.14);
  --icon-size: 96px; /* 1 inch at 96dpi */
  --tile-pad: 1.15rem;
  --radius: 22px;
  --font-display: "Outfit", sans-serif;
  --font-body: "Sora", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--am-ink);
  background: #eef6fc;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 900px 520px at 8% -8%, rgba(11, 107, 203, 0.28), transparent 58%),
    radial-gradient(ellipse 720px 480px at 96% 4%, rgba(123, 200, 0, 0.18), transparent 55%),
    radial-gradient(ellipse 640px 420px at 70% 110%, rgba(11, 107, 203, 0.12), transparent 58%),
    linear-gradient(180deg, #ffffff 0%, #f3f9fd 42%, #eef6f2 100%);
}

.atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(11, 107, 203, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 107, 203, 0.06) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 15%, transparent 75%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  width: min(42vw, 380px);
  height: min(42vw, 380px);
  border-radius: 50%;
  top: 12%;
  right: -4%;
  background: radial-gradient(circle, rgba(123, 200, 0, 0.2), transparent 68%);
  animation: drift 14s ease-in-out infinite;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-28px, 18px, 0) scale(1.06);
  }
}

.top {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.25rem 0 1.75rem;
  text-align: center;
  animation: rise 0.7s ease both;
}

.brand-logo {
  display: block;
  width: min(280px, 72vw);
  height: auto;
  margin: 0 auto 0.85rem;
  object-fit: contain;
}

h1 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--am-ink);
}

.lede {
  margin: 0 auto;
  max-width: 34rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--am-muted);
}

.grid {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto 2.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.tile {
  --accent: var(--am-blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: var(--tile-pad) 0.85rem 1.1rem;
  text-decoration: none;
  color: inherit;
  background: var(--am-card);
  border: 1px solid var(--am-line);
  border-radius: var(--radius);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 14px 34px rgba(11, 107, 203, 0.08);
  backdrop-filter: blur(12px);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  animation: rise 0.7s ease both;
}

.tile:nth-child(1) {
  --accent: #0b6bcb;
  animation-delay: 0.05s;
}
.tile:nth-child(2) {
  --accent: #1f8a5b;
  animation-delay: 0.1s;
}
.tile:nth-child(3) {
  --accent: #0b6bcb;
  animation-delay: 0.15s;
}
.tile:nth-child(4) {
  --accent: #2f7fd4;
  animation-delay: 0.2s;
}
.tile:nth-child(5) {
  --accent: #6aa60a;
  animation-delay: 0.25s;
}
.tile:nth-child(6) {
  --accent: #c45c12;
  animation-delay: 0.3s;
}
.tile:nth-child(7) {
  --accent: #0b6bcb;
  animation-delay: 0.35s;
}
.tile:nth-child(8) {
  --accent: #2a6fb8;
  animation-delay: 0.4s;
}
.tile:nth-child(9) {
  --accent: #6b4fd8;
  animation-delay: 0.45s;
}
.tile:nth-child(10) {
  --accent: #b45309;
  animation-delay: 0.5s;
}
.tile:nth-child(11) {
  --accent: #e47911;
  animation-delay: 0.55s;
}
.tile:nth-child(12) {
  --accent: #0d9488;
  animation-delay: 0.6s;
}
.tile:nth-child(13) {
  --accent: #1877f2;
  animation-delay: 0.65s;
}
.tile:nth-child(14) {
  --accent: #0b6bcb;
  animation-delay: 0.7s;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, white);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 20px 40px rgba(11, 107, 203, 0.14);
  outline: none;
}

.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: var(--accent);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(238, 246, 252, 0.9));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, white);
  box-shadow:
    0 10px 22px color-mix(in srgb, var(--accent) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.18s ease, color 0.18s ease;
}

.tile:hover .icon,
.tile:focus-visible .icon {
  transform: scale(1.04);
  color: var(--am-blue-deep);
}

.icon svg {
  width: 58px;
  height: 58px;
  display: block;
}

.label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1.2;
}

.hint {
  font-size: 0.78rem;
  color: var(--am-muted);
  text-align: center;
  line-height: 1.25;
  margin-top: -0.35rem;
}

.tile.is-pending {
  cursor: default;
  opacity: 0.92;
}

.tile.is-pending:hover {
  transform: none;
}

.foot {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  color: var(--am-muted);
  font-size: 0.82rem;
  animation: rise 0.8s ease both;
  animation-delay: 0.35s;
}

.foot .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--am-lime);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 640px) {
  .top {
    padding-top: 2.4rem;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }

  .icon {
    width: 84px;
    height: 84px;
    border-radius: 20px;
  }

  .icon svg {
    width: 50px;
    height: 50px;
  }
}

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

/* Auth + users */
.dash-bar {
  width: min(920px, calc(100% - 2rem));
  margin: -0.5rem auto 1.25rem;
}

.dash-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--am-line);
  border-radius: 14px;
  font-size: 0.88rem;
  color: var(--am-muted);
}

.dash-bar-inner nav {
  display: flex;
  gap: 0.85rem;
}

.dash-bar-inner a {
  color: var(--am-blue-deep);
  font-weight: 600;
  text-decoration: none;
}

.dash-bar-inner a:hover {
  text-decoration: underline;
}

.login-wrap,
.users-wrap,
.wrap-flash {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto 2.5rem;
}

.users-wrap {
  width: min(920px, calc(100% - 2rem));
  display: grid;
  gap: 1.25rem;
}

.login-card,
.users-panel {
  background: var(--am-card);
  border: 1px solid var(--am-line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: 0 14px 34px rgba(11, 107, 203, 0.08);
  backdrop-filter: blur(12px);
}

.login-card label,
.users-form label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--am-ink);
}

.login-card input,
.users-form input,
.users-form select,
.import-row input,
.import-row select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--am-line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.35rem;
  padding: 0.72rem 1.1rem;
  border: 0;
  border-radius: 12px;
  background: var(--am-blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: var(--am-blue-deep);
}

.btn.secondary {
  background: transparent;
  color: var(--am-blue-deep);
  border: 1px solid var(--am-line);
  margin-left: 0.35rem;
}

.btn.tiny {
  margin: 0;
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 9px;
}

.btn.danger {
  background: #b42318;
}

.flash {
  margin-bottom: 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.flash.ok {
  background: rgba(123, 200, 0, 0.16);
  color: #35580a;
}

.flash.bad {
  background: rgba(180, 35, 24, 0.12);
  color: #8a1c14;
}

.meta {
  color: var(--am-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.users-panel h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.table-scroll {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.users-table th,
.users-table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--am-line);
  vertical-align: middle;
}

.users-table .actions {
  white-space: nowrap;
}

.inline {
  display: inline-block;
  margin-right: 0.25rem;
}

.users-form {
  display: grid;
  gap: 0.15rem;
  max-width: 420px;
}

.import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.import-row input {
  width: 9.5rem;
}

.import-row select {
  width: auto;
}

.linkish {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--am-blue-deep);
  cursor: pointer;
}

.linkish:hover {
  text-decoration: underline;
}

.invite-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 51, 0.35);
  z-index: 40;
}

.invite-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(400px, 100vw);
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  border-left: 1px solid var(--am-line);
  box-shadow: -18px 0 40px rgba(11, 107, 203, 0.12);
  padding: 1.25rem 1.2rem 2rem;
  transform: translateX(105%);
  transition: transform 0.28s ease;
  overflow-y: auto;
}

.invite-panel.is-open {
  transform: translateX(0);
}

.invite-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.invite-panel-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.invite-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 10px;
  background: rgba(11, 107, 203, 0.08);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--am-ink);
}

.invite-form label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.invite-form input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--am-line);
  border-radius: 12px;
  font: inherit;
  margin-bottom: 0.75rem;
}

.invite-form .btn {
  width: 100%;
}

.invite-ok {
  color: #35580a;
}

.invite-err {
  color: #8a1c14;
}

.invite-recent {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--am-line);
}

.invite-recent h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.invite-recent ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.invite-recent li {
  display: grid;
  gap: 0.15rem;
  font-size: 0.84rem;
}

.invite-recent li span {
  color: var(--am-muted);
  font-size: 0.78rem;
}
