/* Door access proof of concept: shared styles for every page.
   The site runs under a strict Content-Security-Policy, so there are no
   inline styles anywhere. Looks are switched with classes, the hidden
   attribute and data-state / data-light attributes. */

/* ---------- Tokens and base ---------- */

:root {
  --page: #f3f3f3;
  --stage: #e6e7ea;
  --card: #ffffff;
  --text: #2d2d2d;
  --ink: #15181f;
  --muted: #4f545c;
  --label: #5a5a5a;
  --red: #cc2b43;
  --red-text: #b3213a;
  --red-dark: #8f1a2e;
  --pink: #fbe6ea;
  --navy: #17253e;
  --focus: #2459c9;
  --head: Barlow, Arial, sans-serif;
  --body: Inter, Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--red-text);
}

a:hover {
  color: var(--red-dark);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Headings that only receive focus from script when a screen changes. */
[tabindex="-1"]:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  display: block;
  flex-shrink: 0;
}

/* ---------- Shared pieces ---------- */

.page-title {
  font-family: var(--head);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.page-sub {
  font-size: 14px;
  color: var(--muted);
}

.pill {
  display: inline-block;
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  background: #ffffff;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--label);
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--head);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.btn-primary {
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--red-text);
}

.btn-primary:disabled {
  background: #e2e2e2;
  color: #4f4f4f;
}

.btn-outline {
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-outline:hover {
  background: var(--page);
}

.btn-outline:disabled {
  border-color: #b7bac0;
  background: #ffffff;
  color: #6b7078;
}

.notice {
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--pink);
  color: var(--red-dark);
  font-size: 13px;
  line-height: 1.4;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--red);
  cursor: pointer;
}

.check input:disabled {
  cursor: default;
}

.check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.check-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.check-sub {
  font-size: 13px;
  color: var(--muted);
}

.page-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Login ---------- */

.center-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form {
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.field-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid #8b919b;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
}

.field-input:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}

.login-pill {
  align-self: flex-start;
}

/* ---------- Hub ---------- */

.hub-page {
  min-height: 100vh;
  padding: 40px 20px;
  background: var(--stage);
}

.hub {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hub-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.hub-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hub-link {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 124px;
  height: 100%;
  padding: 22px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.hub-link:hover {
  border-color: var(--red);
  color: var(--text);
}

.hub-link-icon {
  color: var(--red);
}

.hub-link-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hub-link-title {
  font-family: var(--head);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0.03em;
  color: var(--red-text);
}

.hub-link-hint {
  font-size: 14px;
  line-height: 1.45;
}

.hub-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.hub-user {
  font-size: 14px;
  color: var(--muted);
}

.hub-user strong {
  color: var(--ink);
}

@media (max-width: 620px) {
  .hub-page {
    padding: 28px 16px;
  }

  .hub-links {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Phone: frame and layout ---------- */

.phone-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-frame {
  width: 372px;
  height: min(800px, calc(100vh - 48px));
  height: min(800px, calc(100dvh - 48px));
  border: 10px solid var(--ink);
  border-radius: 48px;
  background: var(--page);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 30px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tabbar-dock {
  flex-shrink: 0;
  padding: 0 12px 14px;
}

.tabbar {
  background: #ffffff;
  border-radius: 34px;
  padding: 6px;
  display: flex;
  gap: 4px;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tab[aria-current="page"] {
  background: var(--pink);
  color: var(--red-text);
}

.tab[aria-disabled="true"] {
  cursor: default;
}

/* A real phone, or a very low window: no drawn frame, the app fills the
   screen and the tab bar is fixed to the bottom edge. Never inside the
   stage iframe, where the frame is always drawn. */
@media (max-width: 600px), (max-height: 520px) {
  html:not(.is-embedded) .phone-page {
    display: block;
    padding: 0;
    background: var(--page);
  }

  html:not(.is-embedded) .phone-frame {
    width: auto;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  html:not(.is-embedded) .phone-screen {
    overflow: visible;
    padding: 30px 20px calc(108px + env(safe-area-inset-bottom, 0px));
  }

  html:not(.is-embedded) .tabbar-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--page);
  }
}

.is-embedded .phone-page {
  padding: 0;
}

.is-embedded .phone-frame {
  width: 100%;
  max-width: 372px;
  height: 100vh;
}

/* ---------- Phone: screens ---------- */

.back-btn {
  align-self: flex-start;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 12px 0 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--head);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.back-btn:disabled {
  opacity: 0.45;
}

.p-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.p-screen-tight {
  gap: 14px;
}

.p-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-title-xl,
.p-title {
  font-family: var(--head);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.p-title-xl {
  font-size: 34px;
}

.p-title {
  font-size: 30px;
}

.p-lead {
  font-size: 15px;
}

.p-text {
  font-size: 14px;
  line-height: 1.45;
}

.p-eyebrow {
  margin-top: 10px;
}

.p-section-title {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.p-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 18px;
}

.p-shortcut {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.p-shortcut-body {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-shortcut-title {
  font-family: var(--head);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: 0.03em;
  color: var(--red-text);
}

.p-status-text {
  font-size: 14px;
}

.p-link-btn {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--red-text);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.p-flat-card {
  background: #ffffff;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-card-name {
  font-family: var(--head);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.p-demo {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #c4c7cc;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p-demo-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.p-demo-athlete {
  font-size: 12px;
  color: var(--label);
}

.p-demo-check {
  align-items: center;
  font-size: 13px;
  color: var(--text);
}

.p-demo-check input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.p-center-card {
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.p-result-card {
  padding: 28px 20px;
  gap: 16px;
}

.p-card-title {
  font-family: var(--head);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.p-door-name {
  font-family: var(--head);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.p-place {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.p-key-pill {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.p-doors {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.p-door-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.p-door-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.p-door-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p-door-sub {
  font-size: 13px;
  color: var(--label);
}

.p-open-btn {
  min-height: 48px;
}

.p-empty-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.p-spinner-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-spinner {
  position: absolute;
  left: 0;
  top: 0;
  width: 128px;
  height: 128px;
  border: 8px solid var(--red);
  border-right-color: transparent;
  border-radius: 50%;
  animation: poc-spin 1s linear infinite;
}

@keyframes poc-spin {
  to {
    transform: rotate(360deg);
  }
}

.p-badge {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-badge-ok {
  background: var(--navy);
  color: #ffffff;
}

.p-badge-off {
  border: 6px solid var(--ink);
  color: var(--ink);
}

.p-badge-denied {
  border: 6px solid var(--red);
  color: var(--red);
}

.c-red {
  color: var(--red);
}

/* ---------- Door ---------- */

/* Every size in the scene is a multiple of --u, one design pixel scaled so
   that a 480 x 740 design area (scene plus status row) fits the viewport. */
.door-page {
  --u: min(100vw / 480, 100vh / 740);
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

@supports (height: 100dvh) {
  .door-page {
    --u: min(100vw / 480, 100dvh / 740);
    height: 100dvh;
  }
}

.d-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.d-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #cfd4db;
  transition: background-color 0.7s ease;
}

.d-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(76 * var(--u));
  background: #a9b0ba;
  transition: background-color 0.7s ease;
}

.d-light-label {
  position: absolute;
  left: calc(16 * var(--u));
  top: calc(16 * var(--u));
  padding: calc(6 * var(--u)) calc(12 * var(--u));
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: max(12px, calc(12 * var(--u)));
  font-weight: 600;
}

.d-lamp-cord {
  position: absolute;
  left: 50%;
  top: 0;
  width: max(2px, calc(2 * var(--u)));
  height: calc(46 * var(--u));
  background: var(--ink);
  transform: translateX(-50%);
}

.d-lamp-shade {
  position: absolute;
  left: 50%;
  top: calc(46 * var(--u));
  width: calc(84 * var(--u));
  height: calc(30 * var(--u));
  margin-left: calc(-42 * var(--u));
  border-radius: calc(42 * var(--u)) calc(42 * var(--u)) calc(6 * var(--u)) calc(6 * var(--u));
  background: var(--ink);
}

.d-lamp-bulb {
  position: absolute;
  left: 50%;
  top: calc(68 * var(--u));
  width: calc(28 * var(--u));
  height: calc(28 * var(--u));
  margin-left: calc(-14 * var(--u));
  border-radius: 50%;
  background: #8b919b;
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.d-frame {
  position: absolute;
  left: 50%;
  bottom: calc(76 * var(--u));
  width: calc(230 * var(--u));
  height: calc(410 * var(--u));
  margin-left: calc(-150 * var(--u));
  padding: calc(10 * var(--u)) calc(10 * var(--u)) 0;
  background: var(--ink);
}

/* The left padding is the strip the open leaf covers, so the greeting is
   centred in the part of the doorway that stays visible. */
.d-opening {
  position: relative;
  width: 100%;
  height: 100%;
  padding-left: calc(47 * var(--u));
  background: #ffe9a6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.d-welcome {
  font-family: var(--head);
  font-weight: 600;
  font-size: calc(20 * var(--u));
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* The leaf overlaps the frame by one pixel on every side, so no sliver of
   the lit room shows around a shut door at fractional sizes. */
.d-leaf {
  position: absolute;
  left: -1px;
  top: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  padding: calc(18 * var(--u)) calc(16 * var(--u));
  background: var(--red);
  display: flex;
  flex-direction: column;
  gap: calc(14 * var(--u));
  transform-origin: left center;
  transform: perspective(calc(900 * var(--u))) rotateY(0deg);
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.d-nameplate {
  align-self: center;
  max-width: 100%;
  padding: calc(4 * var(--u)) calc(10 * var(--u));
  border-radius: calc(4 * var(--u));
  background: #ffffff;
  color: var(--ink);
  font-family: var(--head);
  font-weight: 600;
  font-size: max(10px, calc(13 * var(--u)));
  letter-spacing: 0.05em;
  text-align: center;
  overflow-wrap: anywhere;
}

.d-nameplate:empty {
  visibility: hidden;
}

.d-panel {
  flex: 1 1 0;
  border: max(1px, calc(2 * var(--u))) solid rgba(255, 255, 255, 0.45);
  border-radius: calc(4 * var(--u));
}

.d-handle {
  position: absolute;
  right: calc(12 * var(--u));
  top: 50%;
  width: calc(10 * var(--u));
  height: calc(44 * var(--u));
  margin-top: calc(-22 * var(--u));
  border-radius: calc(5 * var(--u));
  background: #f3f3f3;
}

.d-reader {
  position: absolute;
  left: 50%;
  bottom: calc(236 * var(--u));
  width: calc(64 * var(--u));
  margin-left: calc(112 * var(--u));
  padding: calc(16 * var(--u)) 0;
  border-radius: calc(14 * var(--u));
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(10 * var(--u));
}

.d-led {
  width: calc(30 * var(--u));
  height: calc(30 * var(--u));
  border: calc(6 * var(--u)) solid #8b919b;
  border-radius: 50%;
  transition: border-color 0.3s ease;
}

.d-reader-bar {
  width: calc(22 * var(--u));
  height: calc(4 * var(--u));
  border-radius: calc(2 * var(--u));
  background: #5b616b;
}

.d-led-label {
  position: absolute;
  left: 50%;
  bottom: calc(202 * var(--u));
  width: calc(120 * var(--u));
  margin-left: calc(84 * var(--u));
  color: var(--ink);
  font-size: max(11px, calc(12 * var(--u)));
  font-weight: 700;
  text-align: center;
}

.d-status {
  flex-shrink: 0;
  min-height: max(56px, calc(96 * var(--u)));
  padding: max(8px, calc(12 * var(--u))) max(16px, calc(28 * var(--u)));
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: max(14px, calc(16 * var(--u)));
}

.d-badge {
  width: max(44px, calc(56 * var(--u)));
  height: max(44px, calc(56 * var(--u)));
  flex-shrink: 0;
  border-radius: 50%;
  background: #5b616b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.d-badge svg {
  width: 55%;
  height: 55%;
}

.d-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.d-status-title {
  font-size: max(18px, calc(26 * var(--u)));
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.d-status-sub {
  font-size: max(13px, calc(16 * var(--u)));
  line-height: 1.3;
  color: var(--muted);
}

/* Lock looks: locked is the default drawn above. */
.d-stage[data-state="reading"] .d-led {
  border-color: #5b9dff;
}

.d-stage[data-state="reading"] .d-badge {
  background: #2459c9;
}

.d-stage[data-state="open"] .d-led {
  border-color: #35c46f;
}

.d-stage[data-state="open"] .d-badge {
  background: #1b7a43;
}

.d-stage[data-state="open"] .d-leaf {
  transform: perspective(calc(900 * var(--u))) rotateY(74deg);
}

.d-stage[data-state="denied"] .d-led {
  border-color: var(--red);
}

.d-stage[data-state="denied"] .d-badge {
  background: var(--red);
}

/* Room light. */
.d-stage[data-light="on"] .d-scene {
  background: #fff6dc;
}

.d-stage[data-light="on"] .d-floor {
  background: #dccfae;
}

.d-stage[data-light="on"] .d-lamp-bulb {
  background: #ffd24a;
  box-shadow:
    0 0 0 calc(12 * var(--u)) rgba(255, 210, 74, 0.35),
    0 0 calc(70 * var(--u)) calc(36 * var(--u)) rgba(255, 210, 74, 0.5);
}

/* Inside the stage the door sits in a white card: design sizes for the
   status row and a rounded scene. */
.is-embedded .d-scene {
  border-radius: 12px;
}

.is-embedded .d-status {
  min-height: 56px;
  margin-top: 16px;
  padding: 0;
  gap: 14px;
}

.is-embedded .d-badge {
  width: 44px;
  height: 44px;
}

.is-embedded .d-status-title {
  font-size: 18px;
}

.is-embedded .d-status-sub {
  font-size: 13px;
}

/* ---------- Admin ---------- */

.admin-page {
  min-height: 100vh;
  padding: 16px 20px 32px;
  background: var(--stage);
}

.admin-wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.admin-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 900px) {
  .admin-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.a-eyebrow {
  margin-top: 4px;
}

.a-muted {
  font-size: 13px;
  color: var(--muted);
}

.a-athletes {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.a-athlete {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.a-athlete + .a-athlete {
  padding-top: 18px;
  border-top: 1px solid #dcdee2;
}

.a-athlete-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.a-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a-athlete-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.a-athlete-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.a-athlete-sport {
  font-size: 13px;
  color: var(--muted);
}

.a-key-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.a-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.a-key-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #8b919b;
}

.a-key-status[data-ready="true"] .a-key-dot {
  background: #1b7a43;
}

.a-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.a-door-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.a-door-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.a-door-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.a-door-name {
  font-family: var(--head);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.a-door-state {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #5b616b;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.a-door-state[data-state="reading"] {
  background: #2459c9;
}

.a-door-state[data-state="open"] {
  background: #1b7a43;
}

.a-door-state[data-state="denied"] {
  background: var(--red);
}

.a-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.log-card {
  min-width: 0;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-card .card-title {
  color: #ffffff;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-meta {
  font-size: 12px;
  color: #b9c2d3;
}

.log-text {
  font-size: 13px;
  line-height: 1.35;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.log-empty {
  font-size: 13px;
  color: #b9c2d3;
}

/* Inside the stage: no page padding, the controls scroll in the upper part
   and the log always keeps the rest of the column, as in the design. */
.is-embedded .admin-page {
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.is-embedded .standalone-only {
  display: none;
}

.is-embedded .admin-wrap {
  height: 100%;
  max-width: none;
}

.is-embedded .admin-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.is-embedded .admin-col {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 66%;
  overflow-y: auto;
  border-radius: 16px;
}

.is-embedded .log-card {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

/* ---------- Stage ---------- */

.stage-page {
  background: var(--stage);
}

.stage {
  height: 100vh;
  height: 100dvh;
  min-height: 700px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.stage-head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stage-head-side {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.stage-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.stage-nav-label {
  margin-right: 4px;
  color: var(--muted);
}

.stage-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-weight: 600;
}

.stage-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 28px;
}

.stage-phone {
  width: 372px;
  flex-shrink: 0;
}

.stage-door {
  flex: 1 1 0;
  min-width: 0;
  padding: 22px 24px;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stage-door-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.stage-door-hint {
  font-size: 13px;
  color: var(--muted);
}

.stage-admin {
  width: 336px;
  flex-shrink: 0;
}

.stage-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stage-door .stage-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

@media (max-width: 1320px) {
  .stage {
    padding: 24px;
  }

  .stage-row {
    gap: 20px;
  }

  .stage-door {
    padding: 18px;
  }
}

@media (max-width: 1120px) {
  .stage {
    height: auto;
    min-height: 0;
    padding: 20px 16px 32px;
  }

  .stage-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .stage-head-side {
    justify-content: flex-start;
  }

  .stage-row {
    flex: none;
    flex-direction: column;
    align-items: center;
  }

  .stage-phone {
    width: 100%;
    max-width: 372px;
    height: 760px;
  }

  .stage-door {
    flex: none;
    width: 100%;
    height: 640px;
  }

  .stage-admin {
    width: 100%;
    max-width: 560px;
    height: 860px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
