:root {
  --bg: #f6efe4;
  --bg-deep: #f0e4d1;
  --panel: rgba(255, 250, 243, 0.84);
  --panel-border: rgba(71, 51, 24, 0.12);
  --text: #2d2418;
  --muted: #6e6151;
  --accent: #c25b2b;
  --accent-dark: #8f3f1a;
  --accent-soft: #f7d7c5;
  --shadow: 0 24px 60px rgba(72, 51, 23, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  overflow-x: hidden;
}

html.auth-pending body {
  overflow: hidden;
}

html.auth-pending main,
html.auth-pending .background-glow,
html.auth-pending .modal-shell {
  visibility: hidden;
}

html.auth-pending body::before {
  content: "Checking sign-in...";
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

p {
  margin: 0;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

a {
  font: inherit;
  text-decoration: none;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.shell-wide {
  align-items: start;
}

.panel {
  width: min(960px, 100%);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 480px;
  padding: 40px;
  animation: rise-in 500ms ease;
}

.portal-panel {
  padding: 32px;
  animation: rise-in 500ms ease;
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro {
  margin-top: 16px;
  color: var(--muted);
}

.login-form,
.app-form {
  display: grid;
  gap: 14px;
}

.login-form {
  margin-top: 28px;
}

label {
  font-weight: 600;
}

input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(71, 51, 24, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease;
}

select {
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

option {
  color: var(--text);
  background: #fffaf3;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  transform: translateY(-1px);
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

button,
.app-card a,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 16px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button {
  cursor: pointer;
}

.login-form button,
.app-form button,
.app-card a {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 14px 28px rgba(143, 63, 26, 0.22);
}

.login-form button:hover,
.app-form button:hover,
.app-card a:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
}

.helper-text,
.section-heading p,
.portal-header p,
.builder-section p,
.app-card p {
  color: var(--muted);
}

.portal-header,
.builder-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.builder-section {
  margin-top: 28px;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.52);
}

.status-box {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(71, 51, 24, 0.12);
}

.status-box span {
  color: var(--muted);
}

.app-form {
  grid-template-columns: minmax(160px, 1fr) minmax(240px, 1.4fr) auto;
  align-items: center;
  flex: 1;
}

.section-heading {
  margin: 32px 0 18px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.app-card {
  padding: 18px;
  border: 1px solid rgba(71, 51, 24, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
}

.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.app-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(194, 91, 43, 0.35));
}

.receipt-app-icon {
  display: grid;
  place-items: center;
}

.receipt-app-icon svg,
.viewer-app-icon svg {
  width: 30px;
  height: 30px;
}

.viewer-app-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(202, 228, 247, 0.9), rgba(84, 143, 186, 0.34));
}

.index-app-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(224, 231, 255, 0.92), rgba(110, 132, 196, 0.34));
}

.gymnastics-app-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(218, 245, 237, 0.94), rgba(55, 142, 122, 0.34));
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(194, 91, 43, 0.12);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-card h4 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.app-card p {
  margin-bottom: 16px;
  word-break: break-word;
}

.portal-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
  gap: 18px;
  margin-top: 32px;
}

.portal-app-card {
  width: min(320px, 100%);
  padding-bottom: 24px;
}

.secondary-button,
.icon-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-button {
  padding: 12px 16px;
  border: 1px solid rgba(71, 51, 24, 0.12);
}

.icon-button {
  padding: 9px 12px;
}

.hidden {
  display: none;
}

.background-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: rgba(194, 91, 43, 0.14);
  filter: blur(18px);
}

.background-glow-left {
  top: 60px;
  left: -80px;
}

.background-glow-right {
  right: -60px;
  bottom: 100px;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .auth-panel,
  .portal-panel {
    padding: 24px;
  }

  .portal-header,
  .builder-section,
  .app-form {
    grid-template-columns: 1fr;
    display: grid;
  }
}
