:root {
  --auth-ink: #1a2332;
  --auth-primary: #1a4a7a;
  --auth-bg: #f2ede6;
  --auth-surface: #fffefb;
  --auth-amber: #FBBF24;
  --auth-border: #e2d9ce;
  --auth-muted: #625a52;
  --auth-error: #b91c1c;
}

.auth-page, .auth-page * { box-sizing: border-box; }
.auth-page *::before, .auth-page *::after { box-sizing: border-box; }

.auth-page {
  min-height: 100vh;
  margin: 0;
  padding: 1rem;
  display: grid;
  place-items: center;
  direction: rtl;
  background: var(--auth-bg);
  color: var(--auth-ink);
  font-family: "Heebo", sans-serif;
}

.auth-panel {
  width: min(100%, 28rem);
  min-width: 0;
  padding: clamp(1.5rem, 6vw, 2.25rem);
  border: 1px solid var(--auth-border);
  border-radius: 1rem;
  background: var(--auth-surface);
  box-shadow: 0 12px 36px rgba(26, 35, 50, .12);
  text-align: right;
}

.school-sign {
  width: 4.25rem;
  height: 4.25rem;
  margin-bottom: 1.25rem;
  display: grid;
  place-items: center;
  border: .35rem solid var(--auth-primary);
  border-radius: .9rem;
  background: var(--auth-amber);
  color: var(--auth-primary);
  font-size: 2rem;
  line-height: 1;
}

.auth-panel h1 {
  margin: 0 0 .45rem;
  color: var(--auth-ink);
  font-size: 1.75rem;
  line-height: 1.25;
}

.auth-panel p { margin: 0; color: var(--auth-muted); font-size: 1rem; line-height: 1.6; }
.auth-account { margin-top: 1rem !important; overflow-wrap: anywhere; }
.auth-account bdi { color: var(--auth-ink); font-weight: 600; }
.google-button { width: 100%; min-width: 0; min-height: 44px; margin-top: 1.5rem; }
.auth-status { min-height: 1.6rem; margin-top: .85rem !important; font-weight: 500; }
.auth-status.error, .auth-error { color: var(--auth-error); }

.auth-actions { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1.35rem; }
.auth-action {
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--auth-primary);
  border-radius: .65rem;
  background: var(--auth-primary);
  color: white;
  cursor: pointer;
  font: 600 .9rem "Heebo", sans-serif;
}
.auth-action.secondary { background: transparent; color: var(--auth-primary); }

.auth-identity {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  min-width: 0;
  flex-wrap: wrap;
}
.auth-email { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; font-size: .8rem; }
.auth-role { padding: .2rem .55rem; border-radius: 999px; background: var(--auth-amber); color: var(--auth-primary); font-weight: 700; font-size: .75rem; }
.auth-header-button { min-height: 44px; }

#access-state {
  position: relative;
  z-index: 12000;
  max-width: 42rem;
  margin: 0 auto 1rem;
  padding: .8rem 1rem;
  border: 1px solid #d6a000;
  border-radius: .75rem;
  background: #fff8dc;
  color: var(--auth-ink);
}
#access-state[data-kind="forbidden"], #access-state[data-kind="unauthenticated"] { border-color: var(--auth-error); background: #fff1f2; }
#access-state p { margin: 0 0 .6rem; }

.access-dialog[hidden] { display: none; }
.access-dialog {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 39, 68, .54);
}
.access-dialog-card {
  width: min(100%, 34rem);
  max-height: min(42rem, calc(100vh - 2rem));
  overflow: auto;
  padding: 1.35rem;
  border-radius: 1rem;
  background: var(--auth-surface);
  color: var(--auth-ink);
  box-shadow: 0 18px 55px rgba(15, 39, 68, .25);
}
.access-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.access-dialog-header h2 { margin: 0; font-size: 1.25rem; }
.access-close { min-width: 44px; min-height: 44px; color: var(--auth-primary); background: transparent; border-color: var(--auth-border); }
.access-form { display: grid; gap: .55rem; margin-top: 1.25rem; }
.access-form label { font-weight: 600; }
.access-form-row { display: flex; align-items: stretch; gap: .55rem; }
.access-form input {
  min-width: 0;
  flex: 1;
  min-height: 44px;
  padding: .6rem .75rem;
  border: 1px solid #b9afa4;
  border-radius: .6rem;
  color: var(--auth-ink);
  background: white;
  direction: ltr;
  font: 1rem "Heebo", sans-serif;
}
.access-list { margin: 1rem 0 0; padding: 0; list-style: none; }
.access-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--auth-border); }
.access-row bdi { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.access-remove { min-height: 44px; flex: 0 0 auto; border-color: #d7a6a6; background: transparent; color: var(--auth-error); }
.access-panel-status { min-height: 1.5rem; margin-top: .7rem; color: var(--auth-muted); }

:focus-visible { outline: 3px solid var(--auth-amber); outline-offset: 3px; }

@media (max-width: 480px) {
  .auth-page { padding: .75rem; }
  .auth-panel { padding: 1.35rem; }
  .auth-identity { width: 100%; justify-content: flex-start; }
  .access-form-row { flex-direction: column; }
  .access-row { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
